"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([[7108],{57108:function(e,r,t){t.r(r),t.d(r,{HaQrCode:function(){return g}});var a,n,i,o=t(64599),s=t(35806),d=t(71008),c=t(62193),h=t(2816),l=t(27927),u=t(14562),v=t(19867),k=(t(81027),t(97741),t(29193),t(22871),t(16891),t(66360)),f=t(29818),m=t(50240),y=(t(77477),t(28310)),g=(0,l.A)([(0,f.EM)("ha-qr-code")],(function(e,r){var t=function(r){function t(){var r;(0,d.A)(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=(0,c.A)(this,t,[].concat(n)),e(r),r}return(0,h.A)(t,r),(0,s.A)(t)}(r);return{F:t,d:[{kind:"field",decorators:[(0,f.MZ)()],key:"data",value:void 0},{kind:"field",decorators:[(0,f.MZ)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value:function(){return"medium"}},{kind:"field",decorators:[(0,f.MZ)({type:Number})],key:"width",value:function(){return 4}},{kind:"field",decorators:[(0,f.MZ)({type:Number})],key:"scale",value:function(){return 4}},{kind:"field",decorators:[(0,f.MZ)({type:Number})],key:"margin",value:function(){return 4}},{kind:"field",decorators:[(0,f.MZ)({type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,f.MZ)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,f.wk)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,f.P)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,u.A)((0,v.A)(t.prototype),"willUpdate",this).call(this,e),(e.has("data")||e.has("scale")||e.has("width")||e.has("margin")||e.has("maskPattern")||e.has("errorCorrectionLevel"))&&this._error&&(this._error=void 0)}},{kind:"method",key:"updated",value:function(e){var r=this,t=this._canvas;if(t&&this.data&&(e.has("data")||e.has("scale")||e.has("width")||e.has("margin")||e.has("maskPattern")||e.has("errorCorrectionLevel")||e.has("centerImage"))){var a=getComputedStyle(this),n=a.getPropertyValue("--rgb-primary-text-color"),i=a.getPropertyValue("--rgb-card-background-color"),o=(0,y.v2)(n.split(",").map((function(e){return parseInt(e,10)}))),s=(0,y.v2)(i.split(",").map((function(e){return parseInt(e,10)})));if(m.toCanvas(t,this.data,{errorCorrectionLevel:this.errorCorrectionLevel||(this.centerImage?"Q":"M"),width:this.width,scale:this.scale,margin:this.margin,maskPattern:this.maskPattern,color:{light:s,dark:o}}).catch((function(e){r._error=e.message})),this.centerImage){var d=this._canvas.getContext("2d"),c=new Image;c.src=this.centerImage,c.onload=function(){null==d||d.drawImage(c,.375*t.width,.375*t.height,t.width/4,t.height/4)}}}}},{kind:"method",key:"render",value:function(){return this.data?this._error?(0,k.qy)(a||(a=(0,o.A)(['<ha-alert alert-type="error">',"</ha-alert>"])),this._error):(0,k.qy)(n||(n=(0,o.A)(["<canvas></canvas>"]))):k.s6}},{kind:"field",static:!0,key:"styles",value:function(){return(0,k.AH)(i||(i=(0,o.A)([":host{display:block}"])))}}]}}),k.WF)}}]);
//# sourceMappingURL=7108.kFeraJe4fq4.js.map