iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 17.4 kB
JavaScript
/*! For license information please see 38461.e4f471fb8042fe28.js.LICENSE.txt */
;(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[38461],{35370:function(t,e,o){var i=o(26198);t.exports=function(t,e,o){for(var r=0,a=arguments.length>2?o:i(e),n=new t(a);a>r;)n[r]=e[r++];return n}},29344:function(t,e,o){o.a(t,async function(t,i){try{o.d(e,{A:function(){return T}});o(27495),o(62953);var r=o(5124),a=o(67576),n=o(6412),s=o(63672),l=o(34514),h=o(40991),c=o(92070),d=o(41268),p=o(9395),u=o(62676),b=o(15477),v=o(31896),w=o(17060),f=o(19978),m=t([w]);w=(m.then?(await m)():m)[0];let C,A,E,O=t=>t;var g=Object.defineProperty,y=Object.getOwnPropertyDescriptor,k=(t,e,o,i)=>{for(var r,a=i>1?void 0:i?y(e,o):e,n=t.length-1;n>=0;n--)(r=t[n])&&(a=(i?r(e,o,a):r(a))||a);return i&&a&&g(e,o,a),a};let T=class extends u.q{static get validators(){return[...super.validators,(0,d.i)()]}get value(){var t;return null!==(t=this._value)&&void 0!==t?t:"on"}set value(t){this._value=t}handleSizeChange(){(0,h.b)(this.localName,this.size)}get checked(){var t;return this.valueHasChanged?Boolean(this._checked):null!==(t=this._checked)&&void 0!==t?t:this.defaultChecked}set checked(t){this._checked=Boolean(t),this.valueHasChanged=!0}handleClick(){this.hasInteracted=!0,this.checked=!this.checked,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})}handleKeyDown(t){const e="rtl"===this.localize.dir();"ArrowLeft"===t.key&&(t.preventDefault(),this.checked=e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))})),"ArrowRight"===t.key&&(t.preventDefault(),this.checked=!e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}))}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("checked")||t.has("defaultChecked"))&&this.handleValueOrCheckedChange()}handleValueOrCheckedChange(){this.setValue(this.checked?this.value:null,this._value),this.updateValidity()}handleStateChange(){this.hasUpdated&&(this.input.checked=this.checked),this.customStates.set("checked",this.checked),this.updateValidity()}handleDisabledChange(){this.updateValidity()}click(){this.input.click()}focus(t){this.input.focus(t)}blur(){this.input.blur()}setValue(t,e){this.checked?this.internals.setFormValue(null!=t?t:"on",e):this.internals.setFormValue(null,null)}formResetCallback(){this._checked=null,super.formResetCallback(),this.handleValueOrCheckedChange()}render(){const t=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,e=!!this.hint||!!t;return(0,r.qy)(C||(C=O` <label part="base" class="${0}"> <input class="input" type="checkbox" title="${0}" name="${0}" value="${0}" .checked="${0}" .disabled="${0}" .required="${0}" role="switch" aria-checked="${0}" aria-describedby="hint" @click="${0}" @keydown="${0}"> <span part="control" class="switch"> <span part="thumb" class="thumb"></span> </span> <slot part="label" class="label"></slot> </label> <slot id="hint" name="hint" part="hint" class="${0}" aria-hidden="${0}">${0}</slot> `),(0,n.H)({checked:this.checked,disabled:this.disabled}),this.title,(0,s.J)(this.name),(0,s.J)(this.value),(0,l.V)(this.checked),this.disabled,this.required,this.checked?"true":"false",this.handleClick,this.handleKeyDown,(0,n.H)({"has-slotted":e}),e?"false":"true",this.hint)}constructor(){var t;super(...arguments),this.hasSlotController=new c.X(this,"hint"),this.localize=new w.c(this),this.title="",this.name=null,this._value=null!==(t=this.getAttribute("value"))&&void 0!==t?t:null,this.size="m",this.disabled=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint="",this.withHint=!1}};T.shadowRootOptions=Object.assign(Object.assign({},u.q.shadowRootOptions),{},{delegatesFocus:!0}),T.css=[b.A,v.A,f.A],k([(0,a.P)('input[type="checkbox"]')],T.prototype,"input",2),k([(0,a.MZ)()],T.prototype,"title",2),k([(0,a.MZ)({reflect:!0})],T.prototype,"name",2),k([(0,a.MZ)({reflect:!0})],T.prototype,"value",1),k([(0,a.MZ)({reflect:!0})],T.prototype,"size",2),k([(0,p.w)("size")],T.prototype,"handleSizeChange",1),k([(0,a.MZ)({type:Boolean})],T.prototype,"disabled",2),k([(0,a.MZ)({type:Boolean,attribute:!1})],T.prototype,"checked",1),k([(0,a.MZ)({type:Boolean,attribute:"checked",reflect:!0})],T.prototype,"defaultChecked",2),k([(0,a.MZ)({type:Boolean,reflect:!0})],T.prototype,"required",2),k([(0,a.MZ)({attribute:"hint"})],T.prototype,"hint",2),k([(0,a.MZ)({attribute:"with-hint",type:Boolean})],T.prototype,"withHint",2),k([(0,p.w)(["checked","defaultChecked"])],T.prototype,"handleStateChange",1),k([(0,p.w)("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1),T=k([(0,a.EM)("wa-switch")],T),null===(A=(E=T).disableWarning)||void 0===A||A.call(E,"change-in-update"),i()}catch(C){i(C)}})},19978:function(t,e,o){o.d(e,{A:function(){return r}});let i;var r=(0,o(5124).AH)(i||(i=(t=>t)`:host{--height:var(--wa-form-control-toggle-size);--width:calc(var(--height) * 1.75);--thumb-size:0.75em;display:inline-flex;line-height:var(--wa-form-control-value-line-height)}label{position:relative;display:flex;align-items:center;font:inherit;color:var(--wa-form-control-value-color);vertical-align:middle;cursor:pointer}.switch{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:center;width:var(--width);height:var(--height);background-color:var(--wa-form-control-background-color);border-color:var(--wa-form-control-border-color);border-radius:var(--height);border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);transition-property:translate,background,border-color,box-shadow;transition-duration:var(--wa-transition-normal);transition-timing-function:var(--wa-transition-easing)}.switch .thumb{aspect-ratio:1/1;width:var(--thumb-size);height:var(--thumb-size);background-color:var(--wa-form-control-border-color);border-radius:50%;translate:calc((var(--width) - var(--height))/ -2);transition:inherit}.switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ 2)}.input{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}.checked .switch{background-color:var(--wa-form-control-activated-color);border-color:var(--wa-form-control-activated-color)}.checked .switch .thumb{background-color:var(--wa-color-surface-default);translate:calc((var(--width) - var(--height))/ 2)}.checked .switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ -2)}label:has(> :disabled){opacity:.5;cursor:not-allowed}[part~=label]{display:inline-block;line-height:var(--height);margin-inline-start:.5em;user-select:none;-webkit-user-select:none}:host([required]) [part~=label]::after{content:var(--wa-form-control-required-content);color:var(--wa-form-control-required-content-color);margin-inline-start:var(--wa-form-control-required-content-offset)}@media (forced-colors:active){:checked+.switch .thumb,:checked:enabled+.switch:hover .thumb{background-color:ButtonText}}`))},52630:function(t,e,o){o.a(t,async function(t,i){try{o.d(e,{A:function(){return O}});o(74423),o(44114),o(18111),o(22489),o(3362),o(27495),o(62953);var r=o(5124),a=o(67576),n=o(6412),s=o(17051),l=o(42462),h=o(28438),c=o(98779),d=o(27259),p=o(25877),u=o(984),b=o(95010),v=o(9395),w=o(717),f=o(40158),m=o(51920),g=t([f]);f=(g.then?(await g)():g)[0];let A,E=t=>t;var y=Object.defineProperty,k=Object.getOwnPropertyDescriptor,C=(t,e,o,i)=>{for(var r,a=i>1?void 0:i?k(e,o):e,n=t.length-1;n>=0;n--)(r=t[n])&&(a=(i?r(e,o,a):r(a))||a);return i&&a&&y(e,o,a),a};let O=class extends w.A{connectedCallback(){super.connectedCallback(),this.eventController.signal.aborted&&(this.eventController=new AbortController),this.addEventListener("mouseout",this.handleMouseOut),this.open&&(this.open=!1,this.updateComplete.then(()=>{this.open=!0})),this.id||(this.id=(0,b.N)("wa-tooltip-")),this.for&&this.anchor?(this.anchor=null,this.handleForChange()):this.for&&this.handleForChange()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleDocumentKeyDown),(0,p.Fw)(this),this.eventController.abort(),this.anchor&&this.removeFromAriaLabelledBy(this.anchor,this.id)}firstUpdated(){this.body.hidden=!this.open,this.open&&(this.popup.active=!0,this.popup.reposition())}hasTrigger(t){return this.trigger.split(" ").includes(t)}addToAriaLabelledBy(t,e){const o=(t.getAttribute("aria-labelledby")||"").split(/\s+/).filter(Boolean);o.includes(e)||(o.push(e),t.setAttribute("aria-labelledby",o.join(" ")))}removeFromAriaLabelledBy(t,e){const o=(t.getAttribute("aria-labelledby")||"").split(/\s+/).filter(Boolean).filter(t=>t!==e);o.length>0?t.setAttribute("aria-labelledby",o.join(" ")):t.removeAttribute("aria-labelledby")}async handleOpenChange(){if(this.open){if(this.disabled)return;const t=new c.k;if(this.dispatchEvent(t),t.defaultPrevented)return void(this.open=!1);document.addEventListener("keydown",this.handleDocumentKeyDown,{signal:this.eventController.signal}),(0,p.AZ)(this),this.body.hidden=!1,this.popup.active=!0,await(0,d.Ud)(this.popup.popup,"show-with-scale"),this.popup.reposition(),this.dispatchEvent(new l.q)}else{const t=new h.L;if(this.dispatchEvent(t),t.defaultPrevented)return void(this.open=!1);document.removeEventListener("keydown",this.handleDocumentKeyDown),(0,p.Fw)(this),await(0,d.Ud)(this.popup.popup,"hide-with-scale"),this.popup.active=!1,this.body.hidden=!0,this.dispatchEvent(new s.Z)}}handleForChange(){const t=this.getRootNode();if(!t)return;const e=this.for?t.getElementById(this.for):null,o=this.anchor;if(e===o)return;const{signal:i}=this.eventController;e&&(this.addToAriaLabelledBy(e,this.id),e.addEventListener("blur",this.handleBlur,{capture:!0,signal:i}),e.addEventListener("focus",this.handleFocus,{capture:!0,signal:i}),e.addEventListener("click",this.handleClick,{signal:i}),e.addEventListener("mouseover",this.handleMouseOver,{signal:i}),e.addEventListener("mouseout",this.handleMouseOut,{signal:i})),o&&(this.removeFromAriaLabelledBy(o,this.id),o.removeEventListener("blur",this.handleBlur,{capture:!0}),o.removeEventListener("focus",this.handleFocus,{capture:!0}),o.removeEventListener("click",this.handleClick),o.removeEventListener("mouseover",this.handleMouseOver),o.removeEventListener("mouseout",this.handleMouseOut)),this.anchor=e}async handleOptionsChange(){this.hasUpdated&&(await this.updateComplete,this.popup.reposition())}handleDisabledChange(){this.disabled&&this.open&&this.hide()}async show(){if(!this.open)return this.open=!0,(0,u.l)(this,"wa-after-show")}async hide(){if(this.open)return this.open=!1,(0,u.l)(this,"wa-after-hide")}render(){return(0,r.qy)(A||(A=E` <wa-popup part="base" exportparts="
popup:base__popup,
arrow:base__arrow
" class="${0}" placement="${0}" distance="${0}" skidding="${0}" flip shift ?arrow="${0}" hover-bridge .anchor="${0}"> <div part="body" class="body"> <slot></slot> </div> </wa-popup> `),(0,n.H)({tooltip:!0,"tooltip-open":this.open}),this.placement,this.distance,this.skidding,!this.withoutArrow,this.anchor)}constructor(){super(...arguments),this.placement="top",this.disabled=!1,this.distance=8,this.open=!1,this.skidding=0,this.showDelay=150,this.hideDelay=0,this.trigger="hover focus",this.withoutArrow=!1,this.for=null,this.anchor=null,this.eventController=new AbortController,this.handleBlur=()=>{this.hasTrigger("focus")&&this.hide()},this.handleClick=()=>{this.hasTrigger("click")&&(this.open?this.hide():this.show())},this.handleFocus=()=>{this.hasTrigger("focus")&&this.show()},this.handleDocumentKeyDown=t=>{"Escape"===t.key&&this.open&&(0,p.a0)(this)&&(t.preventDefault(),t.stopPropagation(),this.hide())},this.handleMouseOver=()=>{this.hasTrigger("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout(()=>this.show(),this.showDelay))},this.handleMouseOut=()=>{if(this.hasTrigger("hover")){var t;const e=Boolean(null===(t=this.anchor)||void 0===t?void 0:t.matches(":hover")),o=this.matches(":hover");if(e||o)return;clearTimeout(this.hoverTimeout),e||o||(this.hoverTimeout=window.setTimeout(()=>{this.hide()},this.hideDelay))}}}};O.css=m.A,O.dependencies={"wa-popup":f.A},C([(0,a.P)("slot:not([name])")],O.prototype,"defaultSlot",2),C([(0,a.P)(".body")],O.prototype,"body",2),C([(0,a.P)("wa-popup")],O.prototype,"popup",2),C([(0,a.MZ)()],O.prototype,"placement",2),C([(0,a.MZ)({type:Boolean,reflect:!0})],O.prototype,"disabled",2),C([(0,a.MZ)({type:Number})],O.prototype,"distance",2),C([(0,a.MZ)({type:Boolean,reflect:!0})],O.prototype,"open",2),C([(0,a.MZ)({type:Number})],O.prototype,"skidding",2),C([(0,a.MZ)({attribute:"show-delay",type:Number})],O.prototype,"showDelay",2),C([(0,a.MZ)({attribute:"hide-delay",type:Number})],O.prototype,"hideDelay",2),C([(0,a.MZ)()],O.prototype,"trigger",2),C([(0,a.MZ)({attribute:"without-arrow",type:Boolean,reflect:!0})],O.prototype,"withoutArrow",2),C([(0,a.MZ)()],O.prototype,"for",2),C([(0,a.wk)()],O.prototype,"anchor",2),C([(0,v.w)("open",{waitUntilFirstUpdate:!0})],O.prototype,"handleOpenChange",1),C([(0,v.w)("for")],O.prototype,"handleForChange",1),C([(0,v.w)(["distance","placement","skidding"])],O.prototype,"handleOptionsChange",1),C([(0,v.w)("disabled")],O.prototype,"handleDisabledChange",1),O=C([(0,a.EM)("wa-tooltip")],O),i()}catch(A){i(A)}})},51920:function(t,e,o){o.d(e,{A:function(){return r}});let i;var r=(0,o(5124).AH)(i||(i=(t=>t)`:host{--max-width:30ch;display:inline-block;position:absolute;color:var(--wa-tooltip-content-color);font-size:var(--wa-tooltip-font-size);line-height:var(--wa-tooltip-line-height);text-align:start;white-space:normal}.tooltip{--arrow-size:var(--wa-tooltip-arrow-size);--arrow-color:var(--wa-tooltip-background-color)}.tooltip::part(popup){z-index:1000}.tooltip[placement^=top]::part(popup){transform-origin:bottom}.tooltip[placement^=bottom]::part(popup){transform-origin:top}.tooltip[placement^=left]::part(popup){transform-origin:right}.tooltip[placement^=right]::part(popup){transform-origin:left}.body{display:block;width:max-content;max-width:var(--max-width);border-radius:var(--wa-tooltip-border-radius);background-color:var(--wa-tooltip-background-color);border:var(--wa-tooltip-border-width) var(--wa-tooltip-border-style) var(--wa-tooltip-border-color);padding:.25em .5em;user-select:none;-webkit-user-select:none}.tooltip{--popup-border-width:var(--wa-tooltip-border-width)}.tooltip::part(arrow){border-bottom:var(--wa-tooltip-border-width) var(--wa-tooltip-border-style) var(--wa-tooltip-border-color);border-right:var(--wa-tooltip-border-width) var(--wa-tooltip-border-style) var(--wa-tooltip-border-color)}`))},984:function(t,e,o){o.d(e,{l:function(){return i}});o(3362);function i(t,e){return new Promise(o=>{t.addEventListener(e,function i(r){r.target===t&&(t.removeEventListener(e,i),o())})})}},95010:function(t,e,o){o.d(e,{q:function(){return r},N:function(){return a}});o(54743),o(11745),o(16573),o(78100),o(77936),o(21489),o(48140),o(75044),o(21903),o(91134),o(28845),o(373),o(37467),o(44732),o(79577),o(16632),o(34226),o(9486),o(20456);let i=(t=21)=>{let e="",o=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&o[t]];return e};function r(t,e,o){const i=t=>Object.is(t,-0)?0:t;return i(t<e?e:t>o?o:t)}function a(t=""){return`${t}${i()}`}},15477:function(t,e,o){o.d(e,{A:function(){return r}});let i;var r=(0,o(5124).AH)(i||(i=(t=>t)`:host{display:flex;flex-direction:column}[part~=form-control]{display:contents}:is([part~=form-control-label],[part~=label]).has-label,:is([part~=form-control-label],[part~=label]):has(:not(:empty)){display:inline-flex;color:var(--wa-form-control-label-color);font-weight:var(--wa-form-control-label-font-weight);line-height:var(--wa-form-control-label-line-height);margin-block-end:0.5em}:host([required]) :is([part~=form-control-label],[part~=label])::after{content:var(--wa-form-control-required-content);margin-inline-start:var(--wa-form-control-required-content-offset);color:var(--wa-form-control-required-content-color)}[part~=hint]{display:block;color:var(--wa-form-control-hint-color);font-weight:var(--wa-form-control-hint-font-weight);line-height:var(--wa-form-control-hint-line-height);margin-block-start:0.5em;font-size:var(--wa-font-size-smaller)}[part~=hint]:not(.has-slotted,.has-hint){display:none}`))},34514:function(t,e,o){o.d(e,{V:function(){return n}});o(16280),o(62953);var i=o(5055),r=o(42017),a=o(63937);const n=(0,r.u$)(class extends r.WL{render(t){return t}update(t,[e]){if(e===i.c0||e===i.s6)return e;const o=t.element,n=t.name;if(t.type===r.OA.PROPERTY){if(e===o[n])return i.c0}else if(t.type===r.OA.BOOLEAN_ATTRIBUTE){if(!!e===o.hasAttribute(n))return i.c0}else if(t.type===r.OA.ATTRIBUTE&&o.getAttribute(n)===e+"")return i.c0;return(0,a.mY)(t),e}constructor(t){if(super(t),t.type!==r.OA.PROPERTY&&t.type!==r.OA.ATTRIBUTE&&t.type!==r.OA.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!(0,a.Rt)(t))throw Error("`live` bindings can only contain a single expression")}})}}]);