iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 7.88 kB
JavaScript
export const __rspack_esm_id=62740;export const __rspack_esm_ids=[62740];export const __webpack_modules__={93421(t,e,r){r.d(e,{IW:()=>h,dH:()=>l,fI:()=>c});r(44114);var o=r(35211),i=r(22792),s=r(32172);const a=(t,e)=>{let r=t;for(const t of e){if(null==r)return;r=r[t]}return r},n=(t,e,r)=>{const i=(0,s.p)({transformer:function(t){return r.call(this,t)},watch:e?[e]:[]}),a=(0,o.Fg)({context:t,subscribe:!0});return(t,e)=>{i(t,e),a(t,e)}},c=t=>n(i.iN,t.entityIdPath[0],function(e){const r=a(this,t.entityIdPath);return"string"==typeof r?e?.[r]:void 0}),l=t=>n(i.X1,t.entityIdPath[0],function(e){const r=a(this,t.entityIdPath);return"string"==typeof r?e?.[r]:void 0}),h=()=>n(i.D5,void 0,({localize:t})=>t)},32172(t,e,r){r.d(e,{p:()=>o});r(18111),r(7588),r(45367),r(92731),r(17642),r(58004),r(33853),r(45876),r(32475),r(15024),r(31698);function o(t){return(e,r)=>{if("object"==typeof r)throw new Error("This decorator does not support this compilation type.");const o=String(r),i=e;if(i._transformers){if(!i.hasOwnProperty("_transformers")){const t=i._transformers;i._transformers=new Map,t.forEach((t,e)=>i._transformers.set(e,t))}}else{i._transformers=new Map,i._watching=new Map;const t=i.willUpdate;i.willUpdate=function(e){t.call(this,e);const r=new Set;e.forEach((t,e)=>{const o=this._watching.get(e);void 0!==o&&o.forEach(t=>r.add(t))}),r.forEach(t=>{this[t]=this[`__original_${String(t)}`]})}}i._transformers.set(r,t.transformer),t.watch&&t.watch.forEach(t=>{let e=i._watching.get(t);e||(e=new Set,i._watching.set(t,e)),e.add(r)});const s=Object.getOwnPropertyDescriptor(e,r);let a;if(void 0===s)a={get(){return this[`__transform_${o}`]},set(t){const e=this[`__transform_${o}`],r=this._transformers.get(o);this[`__transform_${o}`]=r?r.call(this,t):t,this[`__original_${o}`]=t,this.requestUpdate(o,e)},configurable:!0,enumerable:!0};else{const t=s.set;a={...s,set(e){const r=this[`__transform_${o}`],i=this._transformers.get(o);this[`__transform_${o}`]=i?i.call(this,e):e,this[`__original_${o}`]=e,this.requestUpdate(o,r),t?.call(this,e)}}}Object.defineProperty(e,r,a)}}},38962(t,e,r){r.a(t,async function(t,o){try{r.r(e);var i=r(62826),s=r(5124),a=r(22441),n=r(6412),c=r(93421),l=r(1087),h=r(26300),d=(r(67094),t([h]));h=(d.then?(await d)():d)[0];const p="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",g={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};class m extends s.WF{render(){return s.qy` <div class="issue-type ${(0,n.H)({[this.alertType]:!0})}" role="alert"> <div class="icon ${this.title?"":"no-title"}"> <slot name="icon"> <ha-svg-icon .path="${g[this.alertType]}"></ha-svg-icon> </slot> </div> <div class="${(0,n.H)({content:!0,narrow:this.narrow})}"> <div class="main-content"> ${this.title?s.qy`<div class="title">${this.title}</div>`:s.s6} <slot></slot> </div> <div class="action"> <slot name="action"> ${this.dismissable?s.qy`<ha-icon-button ="${this._dismissClicked}" .label="${this._localize?.("ui.common.dismiss_alert")}" .path="${p}"></ha-icon-button>`:s.s6} </slot> </div> </div> </div> `}_dismissClicked(){(0,l.r)(this,"alert-dismissed-clicked")}constructor(...t){super(...t),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}m.styles=s.AH`.issue-type{position:relative;padding:8px;display:flex}.icon{height:var(--ha-alert-icon-size,24px);width:var(--ha-alert-icon-size,24px)}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-border-radius-sm)}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;line-height:normal;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:8px}.title{margin-top:2px;font-weight:var(--ha-font-weight-bold)}.action ha-icon-button{--mdc-theme-primary:var(--primary-text-color);--ha-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`,(0,i.Cg)([(0,a.MZ)()],m.prototype,"title",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"alert-type"})],m.prototype,"alertType",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean})],m.prototype,"dismissable",void 0),(0,i.Cg)([(0,a.wk)(),(0,c.IW)()],m.prototype,"_localize",void 0),(0,i.Cg)([(0,a.MZ)({type:Boolean})],m.prototype,"narrow",void 0),m=(0,i.Cg)([(0,a.EM)("ha-alert")],m),o()}catch(t){o(t)}})},60543(t,e,r){r.a(t,async function(t,o){try{r.r(e),r.d(e,{HaQrCode:()=>d});r(18111),r(61701);var i=r(62826),s=r(5124),a=r(22441),n=r(81298),c=r(38962),l=r(79468),h=t([c]);c=(h.then?(await h)():h)[0];class d extends s.WF{willUpdate(t){super.willUpdate(t),(t.has("data")||t.has("scale")||t.has("width")||t.has("margin")||t.has("maskPattern")||t.has("errorCorrectionLevel"))&&this._error&&(this._error=void 0)}updated(t){const e=this._canvas;if(e&&this.data&&(t.has("data")||t.has("scale")||t.has("width")||t.has("margin")||t.has("maskPattern")||t.has("errorCorrectionLevel")||t.has("centerImage"))){const t=getComputedStyle(this),r=t.getPropertyValue("--rgb-primary-text-color"),o=t.getPropertyValue("--rgb-card-background-color"),i=(0,l.v2)(r.split(",").map(t=>parseInt(t,10))),s=(0,l.v2)(o.split(",").map(t=>parseInt(t,10)));if(n.toCanvas(e,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:i}}).catch(t=>{this._error=t.message}),this.centerImage){const t=this._canvas.getContext("2d"),r=new Image;r.src=this.centerImage,r.onload=()=>{t?.drawImage(r,.375*e.width,.375*e.height,e.width/4,e.height/4)}}}}render(){return this.data?this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.qy`<canvas></canvas>`:s.s6}constructor(...t){super(...t),this.errorCorrectionLevel="medium",this.width=4,this.scale=4,this.margin=4}}d.styles=s.AH`:host{display:block}`,(0,i.Cg)([(0,a.MZ)()],d.prototype,"data",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"error-correction-level"})],d.prototype,"errorCorrectionLevel",void 0),(0,i.Cg)([(0,a.MZ)({type:Number})],d.prototype,"width",void 0),(0,i.Cg)([(0,a.MZ)({type:Number})],d.prototype,"scale",void 0),(0,i.Cg)([(0,a.MZ)({type:Number})],d.prototype,"margin",void 0),(0,i.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"maskPattern",void 0),(0,i.Cg)([(0,a.MZ)({attribute:"center-image"})],d.prototype,"centerImage",void 0),(0,i.Cg)([(0,a.wk)()],d.prototype,"_error",void 0),(0,i.Cg)([(0,a.P)("canvas")],d.prototype,"_canvas",void 0),d=(0,i.Cg)([(0,a.EM)("ha-qr-code")],d),o()}catch(t){o(t)}})}};