"use strict";(self.webpackChunkknx_frontend=self.webpackChunkknx_frontend||[]).push([[3599],{83599:function(e,r,t){t.r(r),t.d(r,{HaQrCode:function(){return y}});var a,n,i,o=t(6238),s=t(36683),d=t(89231),c=t(29864),l=t(83647),h=t(8364),u=t(27526),k=(t(77052),t(36724),t(650),t(43618),t(98168),t(98597)),v=t(196),f=t(28345),m=(t(91074),t(26709)),y=(0,h.A)([(0,v.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,l.A)(t,r),(0,s.A)(t)}(r);return{F:t,d:[{kind:"field",decorators:[(0,v.MZ)()],key:"data",value:void 0},{kind:"field",decorators:[(0,v.MZ)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value:function(){return"medium"}},{kind:"field",decorators:[(0,v.MZ)({type:Number})],key:"width",value:function(){return 4}},{kind:"field",decorators:[(0,v.MZ)({type:Number})],key:"scale",value:function(){return 4}},{kind:"field",decorators:[(0,v.MZ)({type:Number})],key:"margin",value:function(){return 4}},{kind:"field",decorators:[(0,v.MZ)({type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,v.MZ)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,v.wk)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,v.P)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,u.A)(t,"willUpdate",this,3)([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,m.v2)(n.split(",").map((function(e){return parseInt(e,10)}))),s=(0,m.v2)(i.split(",").map((function(e){return parseInt(e,10)})));if(f.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)(["\n    :host {\n      display: block;\n    }\n  "])))}}]}}),k.WF)}}]);