export const id=7108;export const ids=[7108];export const modules={57108:(e,t,r)=>{r.r(t),r.d(t,{HaQrCode:()=>c});var a=r(36312),i=r(14562),o=r(19867),s=(r(16891),r(66360)),d=r(29818),n=r(50240),l=(r(77477),r(28310));let c=(0,a.A)([(0,d.EM)("ha-qr-code")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,d.MZ)()],key:"data",value:void 0},{kind:"field",decorators:[(0,d.MZ)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value:()=>"medium"},{kind:"field",decorators:[(0,d.MZ)({type:Number})],key:"width",value:()=>4},{kind:"field",decorators:[(0,d.MZ)({type:Number})],key:"scale",value:()=>4},{kind:"field",decorators:[(0,d.MZ)({type:Number})],key:"margin",value:()=>4},{kind:"field",decorators:[(0,d.MZ)({type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,d.MZ)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,d.wk)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,d.P)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,i.A)((0,o.A)(r.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){const 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"))){const e=getComputedStyle(this),r=e.getPropertyValue("--rgb-primary-text-color"),a=e.getPropertyValue("--rgb-card-background-color"),i=(0,l.v2)(r.split(",").map((e=>parseInt(e,10)))),o=(0,l.v2)(a.split(",").map((e=>parseInt(e,10))));if(n.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:o,dark:i}}).catch((e=>{this._error=e.message})),this.centerImage){const e=this._canvas.getContext("2d"),r=new Image;r.src=this.centerImage,r.onload=()=>{e?.drawImage(r,.375*t.width,.375*t.height,t.width/4,t.height/4)}}}}},{kind:"method",key:"render",value:function(){return this.data?this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.qy`<canvas></canvas>`:s.s6}},{kind:"field",static:!0,key:"styles",value:()=>s.AH`:host{display:block}`}]}}),s.WF)}};
//# sourceMappingURL=7108.imiTShC-DZo.js.map