"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["706"],{69273:function(e,t,r){r.r(t),r.d(t,{HaQrCode:function(){return l}});r(35748),r(65315),r(37089),r(62928),r(95013);var a=r(69868),o=r(84922),s=r(11991),i=r(11936),h=(r(94124),r(83510));let n,c,d,p=e=>e;class l extends o.WF{willUpdate(e){super.willUpdate(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)}updated(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"),o=(0,h.v2)(r.split(",").map(e=>parseInt(e,10))),s=(0,h.v2)(a.split(",").map(e=>parseInt(e,10)));if(i.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(e=>{this._error=e.message}),this.centerImage){const e=this._canvas.getContext("2d"),r=new Image;r.src=this.centerImage,r.onload=()=>{null==e||e.drawImage(r,.375*t.width,.375*t.height,t.width/4,t.height/4)}}}}render(){return this.data?this._error?(0,o.qy)(n||(n=p`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,o.qy)(c||(c=p`<canvas></canvas>`)):o.s6}constructor(...e){super(...e),this.errorCorrectionLevel="medium",this.width=4,this.scale=4,this.margin=4}}l.styles=(0,o.AH)(d||(d=p`:host{display:block}`)),(0,a.__decorate)([(0,s.MZ)()],l.prototype,"data",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:"error-correction-level"})],l.prototype,"errorCorrectionLevel",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],l.prototype,"width",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],l.prototype,"scale",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],l.prototype,"margin",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:!1,type:Number})],l.prototype,"maskPattern",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:"center-image"})],l.prototype,"centerImage",void 0),(0,a.__decorate)([(0,s.wk)()],l.prototype,"_error",void 0),(0,a.__decorate)([(0,s.P)("canvas")],l.prototype,"_canvas",void 0),l=(0,a.__decorate)([(0,s.EM)("ha-qr-code")],l)}}]);
//# sourceMappingURL=706.5a2fb1d480a42db3.js.map