UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 12.7 kB
/*! For license information please see 54028.39700149f3bef5b3.js.LICENSE.txt */ export const __rspack_esm_id=54028;export const __rspack_esm_ids=[54028];export const __webpack_modules__={35370(e,t,r){var n=r(26198);e.exports=function(e,t,r){for(var a=0,i=arguments.length>2?r:n(t),o=new e(i);i>a;)o[a]=t[a++];return o}},29344(e,t,r){r.a(e,async function(e,n){try{r.d(t,{A:()=>E});var a=r(5124),i=r(22441),o=r(6412),s=r(63672),l=r(34514),c=r(40991),h=r(92070),d=r(41268),u=r(9395),p=r(62676),f=r(15477),b=r(31896),m=r(17060),g=r(19978),v=e([m]);m=(v.then?(await v)():v)[0];var w=Object.defineProperty,y=Object.getOwnPropertyDescriptor,k=(e,t,r,n)=>{for(var a,i=n>1?void 0:n?y(t,r):t,o=e.length-1;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&w(t,r,i),i};let E=class extends p.q{static get validators(){return[...super.validators,(0,d.i)()]}get value(){return this._value??"on"}set value(e){this._value=e}handleSizeChange(){(0,c.b)(this.localName,this.size)}get checked(){return this.valueHasChanged?Boolean(this._checked):this._checked??this.defaultChecked}set checked(e){this._checked=Boolean(e),this.valueHasChanged=!0}handleClick(){this.hasInteracted=!0,this.checked=!this.checked,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})}handleKeyDown(e){const t="rtl"===this.localize.dir();"ArrowLeft"===e.key&&(e.preventDefault(),this.checked=t,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))})),"ArrowRight"===e.key&&(e.preventDefault(),this.checked=!t,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}))}willUpdate(e){super.willUpdate(e),(e.has("value")||e.has("checked")||e.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(e){this.input.focus(e)}blur(){this.input.blur()}setValue(e,t){this.checked?this.internals.setFormValue(e??"on",t):this.internals.setFormValue(null,null)}formResetCallback(){this._checked=null,super.formResetCallback(),this.handleValueOrCheckedChange()}render(){const e=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,t=!!this.hint||!!e;return a.qy` <label part="base" class="${(0,o.H)({checked:this.checked,disabled:this.disabled})}"> <input class="input" type="checkbox" title="${this.title}" name="${(0,s.J)(this.name)}" value="${(0,s.J)(this.value)}" .checked="${(0,l.V)(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" role="switch" aria-checked="${this.checked?"true":"false"}" aria-describedby="hint" @click="${this.handleClick}" @keydown="${this.handleKeyDown}"> <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,o.H)({"has-slotted":t})}" aria-hidden="${t?"false":"true"}">${this.hint}</slot> `}constructor(){super(...arguments),this.hasSlotController=new h.X(this,"hint"),this.localize=new m.c(this),this.title="",this.name=null,this._value=this.getAttribute("value")??null,this.size="m",this.disabled=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint="",this.withHint=!1}};E.shadowRootOptions={...p.q.shadowRootOptions,delegatesFocus:!0},E.css=[f.A,b.A,g.A],k([(0,i.P)('input[type="checkbox"]')],E.prototype,"input",2),k([(0,i.MZ)()],E.prototype,"title",2),k([(0,i.MZ)({reflect:!0})],E.prototype,"name",2),k([(0,i.MZ)({reflect:!0})],E.prototype,"value",1),k([(0,i.MZ)({reflect:!0})],E.prototype,"size",2),k([(0,u.w)("size")],E.prototype,"handleSizeChange",1),k([(0,i.MZ)({type:Boolean})],E.prototype,"disabled",2),k([(0,i.MZ)({type:Boolean,attribute:!1})],E.prototype,"checked",1),k([(0,i.MZ)({type:Boolean,attribute:"checked",reflect:!0})],E.prototype,"defaultChecked",2),k([(0,i.MZ)({type:Boolean,reflect:!0})],E.prototype,"required",2),k([(0,i.MZ)({attribute:"hint"})],E.prototype,"hint",2),k([(0,i.MZ)({attribute:"with-hint",type:Boolean})],E.prototype,"withHint",2),k([(0,u.w)(["checked","defaultChecked"])],E.prototype,"handleStateChange",1),k([(0,u.w)("disabled",{waitUntilFirstUpdate:!0})],E.prototype,"handleDisabledChange",1),E=k([(0,i.EM)("wa-switch")],E),E.disableWarning?.("change-in-update"),n()}catch(e){n(e)}})},19978(e,t,r){r.d(t,{A:()=>n});var n=r(5124).AH`: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}}`},15477(e,t,r){r.d(t,{A:()=>n});var n=r(5124).AH`: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}`},2209(e,t,r){r.d(t,{LV:()=>u});r(18111),r(61701),r(18237),r(45367),r(92731),r(88454),r(29452);const n=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),i=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),s=Symbol("Comlink.thrown"),l=e=>"object"==typeof e&&null!==e||"function"==typeof e,c=new Map([["proxy",{canHandle:e=>l(e)&&e[n],serialize(e){const{port1:t,port2:r}=new MessageChannel;return h(e,t),[r,[r]]},deserialize:e=>(e.start(),u(e))}],["throw",{canHandle:e=>l(e)&&s in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function h(e,t=globalThis,r=["*"]){t.addEventListener("message",function a(i){if(!i||!i.data)return;if(!function(e,t){for(const r of e){if(t===r||"*"===r)return!0;if(r instanceof RegExp&&r.test(t))return!0}return!1}(r,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:l,type:c,path:u}=Object.assign({path:[]},i.data),p=(i.data.argumentList||[]).map(k);let f;try{const t=u.slice(0,-1).reduce((e,t)=>e[t],e),r=u.reduce((e,t)=>e[t],e);switch(c){case"GET":f=r;break;case"SET":t[u.slice(-1)[0]]=k(i.data.value),f=!0;break;case"APPLY":f=r.apply(t,p);break;case"CONSTRUCT":f=function(e){return Object.assign(e,{[n]:!0})}(new r(...p));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;h(e,r),f=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":f=void 0;break;default:return}}catch(e){f={value:e,[s]:0}}Promise.resolve(f).catch(e=>({value:e,[s]:0})).then(r=>{const[n,i]=y(r);t.postMessage(Object.assign(Object.assign({},n),{id:l}),i),"RELEASE"===c&&(t.removeEventListener("message",a),d(t),o in e&&"function"==typeof e[o]&&e[o]())}).catch(e=>{const[r,n]=y({value:new TypeError("Unserializable return value"),[s]:0});t.postMessage(Object.assign(Object.assign({},r),{id:l}),n)})}),t.start&&t.start()}function d(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e,t){const r=new Map;return e.addEventListener("message",function(e){const{data:t}=e;if(!t||!t.id)return;const n=r.get(t.id);if(n)try{n(t)}finally{r.delete(t.id)}}),g(e,r,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function f(e){return E(e,new Map,{type:"RELEASE"}).then(()=>{d(e)})}const b=new WeakMap,m="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(b.get(e)||0)-1;b.set(e,t),0===t&&f(e)});function g(e,t,r=[],n=function(){}){let o=!1;const s=new Proxy(n,{get(n,a){if(p(o),a===i)return()=>{!function(e){m&&m.unregister(e)}(s),f(e),t.clear(),o=!0};if("then"===a){if(0===r.length)return{then:()=>s};const n=E(e,t,{type:"GET",path:r.map(e=>e.toString())}).then(k);return n.then.bind(n)}return g(e,t,[...r,a])},set(n,a,i){p(o);const[s,l]=y(i);return E(e,t,{type:"SET",path:[...r,a].map(e=>e.toString()),value:s},l).then(k)},apply(n,i,s){p(o);const l=r[r.length-1];if(l===a)return E(e,t,{type:"ENDPOINT"}).then(k);if("bind"===l)return g(e,t,r.slice(0,-1));const[c,h]=v(s);return E(e,t,{type:"APPLY",path:r.map(e=>e.toString()),argumentList:c},h).then(k)},construct(n,a){p(o);const[i,s]=v(a);return E(e,t,{type:"CONSTRUCT",path:r.map(e=>e.toString()),argumentList:i},s).then(k)}});return function(e,t){const r=(b.get(t)||0)+1;b.set(t,r),m&&m.register(e,t,e)}(s,e),s}function v(e){const t=e.map(y);return[t.map(e=>e[0]),(r=t.map(e=>e[1]),Array.prototype.concat.apply([],r))];var r}const w=new WeakMap;function y(e){for(const[t,r]of c)if(r.canHandle(e)){const[n,a]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},a]}return[{type:"RAW",value:e},w.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return c.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,r,n){return new Promise(a=>{const i=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(i,a),e.start&&e.start(),e.postMessage(Object.assign({id:i},r),n)})}},34514(e,t,r){r.d(t,{V:()=>o});var n=r(5055),a=r(42017),i=r(63937);const o=(0,a.u$)(class extends a.WL{render(e){return e}update(e,[t]){if(t===n.c0||t===n.s6)return t;const r=e.element,o=e.name;if(e.type===a.OA.PROPERTY){if(t===r[o])return n.c0}else if(e.type===a.OA.BOOLEAN_ATTRIBUTE){if(!!t===r.hasAttribute(o))return n.c0}else if(e.type===a.OA.ATTRIBUTE&&r.getAttribute(o)===t+"")return n.c0;return(0,i.mY)(e),t}constructor(e){if(super(e),e.type!==a.OA.PROPERTY&&e.type!==a.OA.ATTRIBUTE&&e.type!==a.OA.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!(0,i.Rt)(e))throw Error("`live` bindings can only contain a single expression")}})}};