iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
6 lines • 31 kB
JavaScript
export const __webpack_ids__=["42214"];export const __webpack_modules__={49976:function(e,t,o){o.d(t,{U:()=>a});const a=e=>e.stopPropagation()},87865:function(e,t,o){o.d(t,{v:()=>a});const a=async(e,t)=>{if(navigator.clipboard)try{return void await navigator.clipboard.writeText(e)}catch{}const o=t??document.body,a=document.createElement("textarea");a.value=e,o.appendChild(a),a.select(),document.execCommand("copy"),o.removeChild(a)}},22381:function(e,t,o){o.d(t,{D:()=>a});const a=(e,t,o=!1)=>{let a;const r=(...r)=>{const i=o&&!a;clearTimeout(a),a=window.setTimeout((()=>{a=void 0,e(...r)}),t),i&&e(...r)};return r.cancel=()=>{clearTimeout(a)},r}},37394:function(e,t,o){o.d(t,{n:()=>r});class a extends Error{constructor(e,...t){super(...t),this.timeout=void 0,Error.captureStackTrace&&Error.captureStackTrace(this,a),this.name="TimeoutError",this.timeout=e,this.message=`Timed out in ${e} ms.`}}const r=(e,t)=>{const o=new Promise(((t,o)=>{setTimeout((()=>{o(new a(e))}),e)}));return Promise.race([t,o])}},59826:function(e,t,o){var a=o(44249),r=o(31622),i=o(57243),n=o(15093),d=o(22344);(0,a.Z)([(0,n.Mo)("ha-button")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"styles",value:()=>[d.W,i.iv`::slotted([slot=icon]){margin-inline-start:0px;margin-inline-end:8px;direction:var(--direction);display:block}.mdc-button{height:var(--button-height,36px)}.trailing-icon{display:flex}.slot-container{overflow:var(--button-slot-container-overflow,visible)}:host([destructive]){--mdc-theme-primary:var(--error-color)}`]}]}}),r.Button)},68325:function(e,t,o){var a=o(44249),r=o(72621),i=(o(92745),o(9359),o(70104),o(57243)),n=o(15093),d=o(27486),s=o(36522),l=o(49976);o(65981);const c={key:"Mod-s",run:e=>((0,s.B)(e.dom,"editor-save"),!0)},h=e=>{const t=document.createElement("ha-icon");return t.icon=e.label,t};(0,a.Z)([(0,n.Mo)("ha-code-editor")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",key:"codemirror",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"mode",value:()=>"yaml"},{kind:"field",key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"autofocus",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({attribute:"read-only",type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"linewrap",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"autocomplete-entities"})],key:"autocompleteEntities",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"autocomplete-icons"})],key:"autocompleteIcons",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"error",value:()=>!1},{kind:"field",decorators:[(0,n.SB)()],key:"_value",value:()=>""},{kind:"field",key:"_loadedCodeMirror",value:void 0},{kind:"field",key:"_iconList",value:void 0},{kind:"set",key:"value",value:function(e){this._value=e}},{kind:"get",key:"value",value:function(){return this.codemirror?this.codemirror.state.doc.toString():this._value}},{kind:"get",key:"hasComments",value:function(){if(!this.codemirror||!this._loadedCodeMirror)return!1;const e=this._loadedCodeMirror.highlightingFor(this.codemirror.state,[this._loadedCodeMirror.tags.comment]);return!!this.renderRoot.querySelector(`span.${e}`)}},{kind:"method",key:"connectedCallback",value:function(){(0,r.Z)(a,"connectedCallback",this,3)([]),this.hasUpdated&&this.requestUpdate(),this.addEventListener("keydown",l.U),this.codemirror&&!1!==this.autofocus&&this.codemirror.focus()}},{kind:"method",key:"disconnectedCallback",value:function(){(0,r.Z)(a,"disconnectedCallback",this,3)([]),this.removeEventListener("keydown",l.U),this.updateComplete.then((()=>{this.codemirror.destroy(),delete this.codemirror}))}},{kind:"method",key:"scheduleUpdate",value:async function(){this._loadedCodeMirror??=await Promise.all([o.e("83895"),o.e("93505"),o.e("51403"),o.e("84729")]).then(o.bind(o,2765)),(0,r.Z)(a,"scheduleUpdate",this,3)([])}},{kind:"method",key:"update",value:function(e){if((0,r.Z)(a,"update",this,3)([e]),!this.codemirror)return void this._createCodeMirror();const t=[];e.has("mode")&&t.push({effects:[this._loadedCodeMirror.langCompartment.reconfigure(this._mode),this._loadedCodeMirror.foldingCompartment.reconfigure(this._getFoldingExtensions())]}),e.has("readOnly")&&t.push({effects:this._loadedCodeMirror.readonlyCompartment.reconfigure(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly))}),e.has("linewrap")&&t.push({effects:this._loadedCodeMirror.linewrapCompartment.reconfigure(this.linewrap?this._loadedCodeMirror.EditorView.lineWrapping:[])}),e.has("_value")&&this._value!==this.value&&t.push({changes:{from:0,to:this.codemirror.state.doc.length,insert:this._value}}),t.length>0&&this.codemirror.dispatch(...t),e.has("error")&&this.classList.toggle("error-state",this.error)}},{kind:"get",key:"_mode",value:function(){return this._loadedCodeMirror.langs[this.mode]}},{kind:"method",key:"_createCodeMirror",value:function(){if(!this._loadedCodeMirror)throw new Error("Cannot create editor before CodeMirror is loaded");const e=[this._loadedCodeMirror.lineNumbers(),this._loadedCodeMirror.history(),this._loadedCodeMirror.drawSelection(),this._loadedCodeMirror.EditorState.allowMultipleSelections.of(!0),this._loadedCodeMirror.rectangularSelection(),this._loadedCodeMirror.crosshairCursor(),this._loadedCodeMirror.highlightSelectionMatches(),this._loadedCodeMirror.highlightActiveLine(),this._loadedCodeMirror.indentationMarkers({thickness:0,activeThickness:1,colors:{activeLight:"var(--secondary-text-color)",activeDark:"var(--secondary-text-color)"}}),this._loadedCodeMirror.keymap.of([...this._loadedCodeMirror.defaultKeymap,...this._loadedCodeMirror.searchKeymap,...this._loadedCodeMirror.historyKeymap,...this._loadedCodeMirror.tabKeyBindings,c]),this._loadedCodeMirror.langCompartment.of(this._mode),this._loadedCodeMirror.haTheme,this._loadedCodeMirror.haSyntaxHighlighting,this._loadedCodeMirror.readonlyCompartment.of(this._loadedCodeMirror.EditorView.editable.of(!this.readOnly)),this._loadedCodeMirror.linewrapCompartment.of(this.linewrap?this._loadedCodeMirror.EditorView.lineWrapping:[]),this._loadedCodeMirror.EditorView.updateListener.of(this._onUpdate),this._loadedCodeMirror.foldingCompartment.of(this._getFoldingExtensions())];if(!this.readOnly){const t=[];this.autocompleteEntities&&this.hass&&t.push(this._entityCompletions.bind(this)),this.autocompleteIcons&&t.push(this._mdiCompletions.bind(this)),t.length>0&&e.push(this._loadedCodeMirror.autocompletion({override:t,maxRenderedOptions:10}))}this.codemirror=new this._loadedCodeMirror.EditorView({state:this._loadedCodeMirror.EditorState.create({doc:this._value,extensions:e}),parent:this.renderRoot})}},{kind:"field",key:"_getStates",value:()=>(0,d.Z)((e=>{if(!e)return[];return Object.keys(e).map((t=>({type:"variable",label:t,detail:e[t].attributes.friendly_name,info:`State: ${e[t].state}`})))}))},{kind:"method",key:"_entityCompletions",value:function(e){const t=e.matchBefore(/[a-z_]{3,}\.\w*/);if(!t||t.from===t.to&&!e.explicit)return null;const o=this._getStates(this.hass.states);return o&&o.length?{from:Number(t.from),options:o,validFor:/^[a-z_]{3,}\.\w*$/}:null}},{kind:"field",key:"_getIconItems",value(){return async()=>{if(!this._iconList){let e;e=(await o.e("25016").then(o.t.bind(o,58134,19))).default,this._iconList=e.map((e=>({type:"variable",label:`mdi:${e.name}`,detail:e.keywords.join(", "),info:h})))}return this._iconList}}},{kind:"method",key:"_mdiCompletions",value:async function(e){const t=e.matchBefore(/mdi:\S*/);if(!t||t.from===t.to&&!e.explicit)return null;const o=await this._getIconItems();return{from:Number(t.from),options:o,validFor:/^mdi:\S*$/}}},{kind:"field",key:"_onUpdate",value(){return e=>{e.docChanged&&(this._value=e.state.doc.toString(),(0,s.B)(this,"value-changed",{value:this._value}))}}},{kind:"field",key:"_getFoldingExtensions",value(){return()=>"yaml"===this.mode?[this._loadedCodeMirror.foldGutter(),this._loadedCodeMirror.foldingOnIndent]:[]}},{kind:"field",static:!0,key:"styles",value:()=>i.iv`:host(.error-state) .cm-gutters{border-color:var(--error-state-color,red)}`}]}}),i.fl)},65981:function(e,t,o){o.r(t),o.d(t,{HaIcon:()=>_});var a=o(44249),r=o(72621),i=o(57243),n=o(15093),d=o(36522),s=o(22381),l=o(80654),c=(o(92745),o(9359),o(31526),o(27608)),h=o(27486),f=o(37394);const u=JSON.parse('{"version":"7.4.47","parts":[{"file":"7a7139d465f1f41cb26ab851a17caa21a9331234"},{"start":"account-supervisor-circle-","file":"9561286c4c1021d46b9006596812178190a7cc1c"},{"start":"alpha-r-c","file":"eb466b7087fb2b4d23376ea9bc86693c45c500fa"},{"start":"arrow-decision-o","file":"4b3c01b7e0723b702940c5ac46fb9e555646972b"},{"start":"baby-f","file":"2611401d85450b95ab448ad1d02c1a432b409ed2"},{"start":"battery-hi","file":"89bcd31855b34cd9d31ac693fb073277e74f1f6a"},{"start":"blur-r","file":"373709cd5d7e688c2addc9a6c5d26c2d57c02c48"},{"start":"briefcase-account-","file":"a75956cf812ee90ee4f656274426aafac81e1053"},{"start":"calendar-question-","file":"3253f2529b5ebdd110b411917bacfacb5b7063e6"},{"start":"car-lig","file":"74566af3501ad6ae58ad13a8b6921b3cc2ef879d"},{"start":"cellphone-co","file":"7677f1cfb2dd4f5562a2aa6d3ae43a2e6997b21a"},{"start":"circle-slice-2","file":"70d08c50ec4522dd75d11338db57846588263ee2"},{"start":"cloud-co","file":"141d2bfa55ca4c83f4bae2812a5da59a84fec4ff"},{"start":"cog-s","file":"5a640365f8e47c609005d5e098e0e8104286d120"},{"start":"cookie-l","file":"dd85b8eb8581b176d3acf75d1bd82e61ca1ba2fc"},{"start":"currency-eur-","file":"15362279f4ebfc3620ae55f79d2830ad86d5213e"},{"start":"delete-o","file":"239434ab8df61237277d7599ebe066c55806c274"},{"start":"draw-","file":"5605918a592070803ba2ad05a5aba06263da0d70"},{"start":"emoticon-po","file":"a838cfcec34323946237a9f18e66945f55260f78"},{"start":"fan","file":"effd56103b37a8c7f332e22de8e4d67a69b70db7"},{"start":"file-question-","file":"b2424b50bd465ae192593f1c3d086c5eec893af8"},{"start":"flask-off-","file":"3b76295cde006a18f0301dd98eed8c57e1d5a425"},{"start":"food-s","file":"1c6941474cbeb1755faaaf5771440577f4f1f9c6"},{"start":"gamepad-u","file":"c6efe18db6bc9654ae3540c7dee83218a5450263"},{"start":"google-f","file":"df341afe6ad4437457cf188499cb8d2df8ac7b9e"},{"start":"head-c","file":"282121c9e45ed67f033edcc1eafd279334c00f46"},{"start":"home-pl","file":"27e8e38fc7adcacf2a210802f27d841b49c8c508"},{"start":"inbox-","file":"0f0316ec7b1b7f7ce3eaabce26c9ef619b5a1694"},{"start":"key-v","file":"ea33462be7b953ff1eafc5dac2d166b210685a60"},{"start":"leaf-circle-","file":"33db9bbd66ce48a2db3e987fdbd37fb0482145a4"},{"start":"lock-p","file":"b89e27ed39e9d10c44259362a4b57f3c579d3ec8"},{"start":"message-s","file":"7b5ab5a5cadbe06e3113ec148f044aa701eac53a"},{"start":"moti","file":"01024d78c248d36805b565e343dd98033cc3bcaf"},{"start":"newspaper-variant-o","file":"22a6ec4a4fdd0a7c0acaf805f6127b38723c9189"},{"start":"on","file":"c73d55b412f394e64632e2011a59aa05e5a1f50d"},{"start":"paw-ou","file":"3f669bf26d16752dc4a9ea349492df93a13dcfbf"},{"start":"pigg","file":"0c24edb27eb1c90b6e33fc05f34ef3118fa94256"},{"start":"printer-pos-sy","file":"41a55cda866f90b99a64395c3bb18c14983dcf0a"},{"start":"read","file":"c7ed91552a3a64c9be88c85e807404cf705b7edf"},{"start":"robot-vacuum-variant-o","file":"917d2a35d7268c0ea9ad9ecab2778060e19d90e0"},{"start":"sees","file":"6e82d9861d8fac30102bafa212021b819f303bdb"},{"start":"shoe-f","file":"e2fe7ce02b5472301418cc90a0e631f187b9f238"},{"start":"snowflake-m","file":"a28ba9f5309090c8b49a27ca20ff582a944f6e71"},{"start":"st","file":"7e92d03f095ec27e137b708b879dfd273bd735ab"},{"start":"su","file":"61c74913720f9de59a379bdca37f1d2f0dc1f9db"},{"start":"tag-plus-","file":"8f3184156a4f38549cf4c4fffba73a6a941166ae"},{"start":"timer-a","file":"baab470d11cfb3a3cd3b063ee6503a77d12a80d0"},{"start":"transit-d","file":"8561c0d9b1ac03fab360fd8fe9729c96e8693239"},{"start":"vector-arrange-b","file":"c9a3439257d4bab33d3355f1f2e11842e8171141"},{"start":"water-ou","file":"02dbccfb8ca35f39b99f5a085b095fc1275005a0"},{"start":"webc","file":"57bafd4b97341f4f2ac20a609d023719f23a619c"},{"start":"zip","file":"65ae094e8263236fa50486584a08c03497a38d93"}]}'),p=(0,h.Z)((async()=>{const e=(0,c.MT)("hass-icon-db","mdi-icon-store");{const t=await(0,c.U2)("_version",e);t?t!==u.version&&(await(0,c.ZH)(e),(0,c.t8)("_version",u.version,e)):(0,c.t8)("_version",u.version,e)}return e})),v=["mdi","hass","hassio","hademo"];let b=[];o(37583);const m={},y={},g=(0,s.D)((()=>(async e=>{const t=Object.keys(e),o=await Promise.all(Object.values(e));(await p())("readwrite",(a=>{o.forEach(((o,r)=>{Object.entries(o).forEach((([e,t])=>{a.put(t,e)})),delete e[t[r]]}))}))})(y)),2e3),k={};let _=(0,a.Z)([(0,n.Mo)("ha-icon")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",decorators:[(0,n.Cb)()],key:"icon",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_path",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_secondaryPath",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_viewBox",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_legacy",value:()=>!1},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(a,"willUpdate",this,3)([e]),e.has("icon")&&(this._path=void 0,this._secondaryPath=void 0,this._viewBox=void 0,this._loadIcon())}},{kind:"method",key:"render",value:function(){return this.icon?this._legacy?i.dy` <iron-icon .icon="${this.icon}"></iron-icon>`:i.dy`<ha-svg-icon .path="${this._path}" .secondaryPath="${this._secondaryPath}" .viewBox="${this._viewBox}"></ha-svg-icon>`:i.Ld}},{kind:"method",key:"_loadIcon",value:async function(){if(!this.icon)return;const e=this.icon,[t,a]=this.icon.split(":",2);let r,i=a;if(!t||!i)return;if(!v.includes(t)){const o=l.g[t];return o?void(o&&"function"==typeof o.getIcon&&this._setCustomPath(o.getIcon(i),e)):void(this._legacy=!0)}if(this._legacy=!1,i in m){const e=m[i];let o;e.newName?(o=`Icon ${t}:${i} was renamed to ${t}:${e.newName}, please change your config, it will be removed in version ${e.removeIn}.`,i=e.newName):o=`Icon ${t}:${i} was removed from MDI, please replace this icon with an other icon in your config, it will be removed in version ${e.removeIn}.`,console.warn(o),(0,d.B)(this,"write_log",{level:"warning",message:o})}if(i in k)return void(this._path=k[i]);if("home-assistant"===i){const t=(await o.e("48348").then(o.bind(o,30511))).mdiHomeAssistant;return this.icon===e&&(this._path=t),void(k[i]=t)}try{r=await(e=>new Promise(((t,o)=>{if(b.push([e,t,o]),b.length>1)return;const a=p();(0,f.n)(1e3,(async()=>{(await a)("readonly",(e=>{for(const[t,o,a]of b)(0,c.RV)(e.get(t)).then((e=>o(e))).catch((e=>a(e)));b=[]}))})()).catch((e=>{for(const[,,t]of b)t(e);b=[]}))})))(i)}catch(e){r=void 0}if(r)return this.icon===e&&(this._path=r),void(k[i]=r);const n=(e=>{let t;for(const o of u.parts){if(void 0!==o.start&&e<o.start)break;t=o}return t.file})(i);if(n in y)return void this._setPath(y[n],i,e);const s=fetch(`/static/mdi/${n}.json`).then((e=>e.json()));y[n]=s,this._setPath(s,i,e),g()}},{kind:"method",key:"_setCustomPath",value:async function(e,t){const o=await e;this.icon===t&&(this._path=o.path,this._secondaryPath=o.secondaryPath,this._viewBox=o.viewBox)}},{kind:"method",key:"_setPath",value:async function(e,t,o){const a=await e;this.icon===o&&(this._path=a[t]),k[t]=a[t]}},{kind:"field",static:!0,key:"styles",value:()=>i.iv`:host{fill:currentcolor}`}]}}),i.oi)},34363:function(e,t,o){var a=o(44249),r=o(57243),i=o(15093);(0,a.Z)([(0,i.Mo)("ha-input-helper-text")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"render",value:function(){return r.dy`<slot></slot>`}},{kind:"field",static:!0,key:"styles",value:()=>r.iv`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:.75rem;padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px}`}]}}),r.oi)},11530:function(e,t,o){o.r(t),o.d(t,{HaObjectSelector:()=>s});var a=o(44249),r=o(72621),i=o(57243),n=o(15093),d=o(36522);o(64889),o(34363);let s=(0,a.Z)([(0,n.Mo)("ha-selector-object")],(function(e,t){class o extends t{constructor(...t){super(...t),e(this)}}return{F:o,d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"required",value:()=>!0},{kind:"field",decorators:[(0,n.IO)("ha-yaml-editor",!0)],key:"_yamlEditor",value:void 0},{kind:"field",key:"_valueChangedFromChild",value:()=>!1},{kind:"method",key:"render",value:function(){return i.dy`<ha-yaml-editor .hass="${this.hass}" .readonly="${this.disabled}" .label="${this.label}" .required="${this.required}" .placeholder="${this.placeholder}" .defaultValue="${this.value}" -changed="${this._handleChange}"></ha-yaml-editor> ${this.helper?i.dy`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`:""} `}},{kind:"method",key:"updated",value:function(e){(0,r.Z)(o,"updated",this,3)([e]),e.has("value")&&!this._valueChangedFromChild&&this._yamlEditor.setValue(this.value),this._valueChangedFromChild=!1}},{kind:"method",key:"_handleChange",value:function(e){this._valueChangedFromChild=!0;const t=e.target.value;e.target.isValid&&this.value!==t&&(0,d.B)(this,"value-changed",{value:t})}}]}}),i.oi)},64889:function(e,t,o){var a=o(44249),r=o(72621),i=o(76848),n=o(57243),d=o(15093),s=o(36522),l=o(28008),c=(o(68325),o(72473)),h=o(87865);o(59826);(0,a.Z)([(0,d.Mo)("ha-yaml-editor")],(function(e,t){class o extends t{constructor(...t){super(...t),e(this)}}return{F:o,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"yamlSchema",value:()=>i.DEFAULT_SCHEMA},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"defaultValue",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"is-valid",type:Boolean})],key:"isValid",value:()=>!0},{kind:"field",decorators:[(0,d.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"auto-update",type:Boolean})],key:"autoUpdate",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"read-only",type:Boolean})],key:"readOnly",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({type:Boolean})],key:"required",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"copy-clipboard",type:Boolean})],key:"copyClipboard",value:()=>!1},{kind:"field",decorators:[(0,d.Cb)({attribute:"has-extra-actions",type:Boolean})],key:"hasExtraActions",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_yaml",value:()=>""},{kind:"field",decorators:[(0,d.IO)("ha-code-editor")],key:"_codeEditor",value:void 0},{kind:"method",key:"setValue",value:function(e){try{this._yaml=(e=>{if("object"!=typeof e||null===e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0})(e)?"":(0,i.dump)(e,{schema:this.yamlSchema,quotingType:'"',noRefs:!0})}catch(t){console.error(t,e),alert(`There was an error converting to YAML: ${t}`)}}},{kind:"method",key:"firstUpdated",value:function(){void 0!==this.defaultValue&&this.setValue(this.defaultValue)}},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(o,"willUpdate",this,3)([e]),this.autoUpdate&&e.has("value")&&this.setValue(this.value)}},{kind:"method",key:"focus",value:function(){this._codeEditor?.codemirror&&this._codeEditor?.codemirror.focus()}},{kind:"method",key:"render",value:function(){return void 0===this._yaml?n.Ld:n.dy` ${this.label?n.dy`<p>${this.label}${this.required?" *":""}</p>`:n.Ld} <ha-code-editor .hass="${this.hass}" .value="${this._yaml}" .readOnly="${this.readOnly}" mode="yaml" autocomplete-entities autocomplete-icons .error="${!1===this.isValid}" -changed="${this._onChange}" dir="ltr"></ha-code-editor> ${this.copyClipboard||this.hasExtraActions?n.dy` <div class="card-actions"> ${this.copyClipboard?n.dy` <ha-button ="${this._copyYaml}"> ${this.hass.localize("ui.components.yaml-editor.copy_to_clipboard")} </ha-button> `:n.Ld} <slot name="extra-actions"></slot> </div> `:n.Ld} `}},{kind:"method",key:"_onChange",value:function(e){let t;e.stopPropagation(),this._yaml=e.detail.value;let o,a=!0;if(this._yaml)try{t=(0,i.load)(this._yaml,{schema:this.yamlSchema})}catch(e){a=!1,o=`${this.hass.localize("ui.components.yaml-editor.error",{reason:e.reason})}${e.mark?` (${this.hass.localize("ui.components.yaml-editor.error_location",{line:e.mark.line+1,column:e.mark.column+1})})`:""}`}else t={};this.value=t,this.isValid=a,(0,s.B)(this,"value-changed",{value:t,isValid:a,errorMsg:o})}},{kind:"get",key:"yaml",value:function(){return this._yaml}},{kind:"method",key:"_copyYaml",value:async function(){this.yaml&&(await(0,h.v)(this.yaml),(0,c.C)(this,{message:this.hass.localize("ui.common.copied_clipboard")}))}},{kind:"get",static:!0,key:"styles",value:function(){return[l.Qx,n.iv`.card-actions{border-radius:var(--actions-border-radius,0px 0px var(--ha-card-border-radius,12px) var(--ha-card-border-radius,12px));border:1px solid var(--divider-color);padding:5px 16px}ha-code-editor{flex-grow:1}`]}}]}}),n.oi)},80654:function(e,t,o){o.d(t,{g:()=>n});const a=window;"customIconsets"in a||(a.customIconsets={});const r=a.customIconsets,i=window;"customIcons"in i||(i.customIcons={});const n=new Proxy(i.customIcons,{get:(e,t)=>e[t]??(r[t]?{getIcon:r[t]}:void 0)})},28008:function(e,t,o){o.d(t,{$c:()=>d,Qx:()=>i,k1:()=>r,yu:()=>n});var a=o(57243);const r=a.iv`button.link{background:0 0;color:inherit;border:none;padding:0;font:inherit;text-align:left;text-decoration:underline;cursor:pointer;outline:0}`,i=a.iv`:host{font-family:var(--paper-font-body1_-_font-family);-webkit-font-smoothing:var(--paper-font-body1_-_-webkit-font-smoothing);font-size:var(--paper-font-body1_-_font-size);font-weight:var(--paper-font-body1_-_font-weight);line-height:var(--paper-font-body1_-_line-height)}app-header div[sticky]{height:48px}app-toolbar [main-title]{margin-left:20px;margin-inline-start:20px;margin-inline-end:initial}h1{font-family:var(--paper-font-headline_-_font-family);-webkit-font-smoothing:var(--paper-font-headline_-_-webkit-font-smoothing);white-space:var(--paper-font-headline_-_white-space);overflow:var(--paper-font-headline_-_overflow);text-overflow:var(--paper-font-headline_-_text-overflow);font-size:var(--paper-font-headline_-_font-size);font-weight:var(--paper-font-headline_-_font-weight);line-height:var(--paper-font-headline_-_line-height)}h2{font-family:var(--paper-font-title_-_font-family);-webkit-font-smoothing:var(--paper-font-title_-_-webkit-font-smoothing);white-space:var(--paper-font-title_-_white-space);overflow:var(--paper-font-title_-_overflow);text-overflow:var(--paper-font-title_-_text-overflow);font-size:var(--paper-font-title_-_font-size);font-weight:var(--paper-font-title_-_font-weight);line-height:var(--paper-font-title_-_line-height)}h3{font-family:var(--paper-font-subhead_-_font-family);-webkit-font-smoothing:var(--paper-font-subhead_-_-webkit-font-smoothing);white-space:var(--paper-font-subhead_-_white-space);overflow:var(--paper-font-subhead_-_overflow);text-overflow:var(--paper-font-subhead_-_text-overflow);font-size:var(--paper-font-subhead_-_font-size);font-weight:var(--paper-font-subhead_-_font-weight);line-height:var(--paper-font-subhead_-_line-height)}a{color:var(--primary-color)}.secondary{color:var(--secondary-text-color)}.error{color:var(--error-color)}.warning{color:var(--error-color)}ha-button.warning,mwc-button.warning{--mdc-theme-primary:var(--error-color)}${r} .card-actions a{text-decoration:none}.card-actions .warning{--mdc-theme-primary:var(--error-color)}.layout.horizontal,.layout.vertical{display:flex}.layout.inline{display:inline-flex}.layout.horizontal{flex-direction:row}.layout.vertical{flex-direction:column}.layout.wrap{flex-wrap:wrap}.layout.no-wrap{flex-wrap:nowrap}.layout.center,.layout.center-center{align-items:center}.layout.bottom{align-items:flex-end}.layout.center-center,.layout.center-justified{justify-content:center}.flex{flex:1;flex-basis:0.000000001px}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.layout.justified{justify-content:space-between}`,n=a.iv`ha-dialog{--mdc-dialog-min-width:400px;--mdc-dialog-max-width:600px;--mdc-dialog-max-width:min(600px, 95vw);--justify-action-buttons:space-between}ha-dialog .form{color:var(--primary-text-color)}a{color:var(--primary-color)} all and (max-width:450px),all and (max-height:500px){ha-dialog{--mdc-dialog-min-width:calc(
100vw - env(safe-area-inset-right) - env(safe-area-inset-left)
);--mdc-dialog-max-width:calc(
100vw - env(safe-area-inset-right) - env(safe-area-inset-left)
);--mdc-dialog-min-height:100%;--mdc-dialog-max-height:100%;--vertical-align-dialog:flex-end;--ha-dialog-border-radius:0}}ha-button.warning,mwc-button.warning{--mdc-theme-primary:var(--error-color)}.error{color:var(--error-color)}`,d=a.iv`.ha-scrollbar::-webkit-scrollbar{width:.4rem;height:.4rem}.ha-scrollbar::-webkit-scrollbar-thumb{-webkit-border-radius:4px;border-radius:4px;background:var(--scrollbar-thumb-color)}.ha-scrollbar{overflow-y:auto;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin}`;a.iv`body{background-color:var(--primary-background-color);color:var(--primary-text-color);height:calc(100vh - 32px);width:100vw}`},78344:function(e){var t=TypeError;e.exports=function(e){if("string"==typeof e)return e;throw new t("Argument is not a string")}},87265:function(e,t,o){var a=o(61896),r=String,i=TypeError;e.exports=function(e){if(void 0===e||a(e))return e;throw new i(r(e)+" is not an object or undefined")}},87038:function(e,t,o){var a=o(59069),r=TypeError;e.exports=function(e){if("Uint8Array"===a(e))return e;throw new r("Argument is not an Uint8Array")}},17743:function(e,t,o){var a=o(13053);e.exports=function(e,t,o){for(var r=0,i=arguments.length>2?o:a(t),n=new e(i);i>r;)n[r]=t[r++];return n}},15419:function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=t+"+/",a=t+"-_",r=function(e){for(var t={},o=0;o<64;o++)t[e.charAt(o)]=o;return t};e.exports={i2c:o,c2i:r(o),i2cUrl:a,c2iUrl:r(a)}},93474:function(e){var t=TypeError;e.exports=function(e){var o=e&&e.alphabet;if(void 0===o||"base64"===o||"base64url"===o)return o||"base64";throw new t("Incorrect `alphabet` option")}},47057:function(e,t,o){var a=o(1569),r=o(72878),i=o(87265),n=o(78344),d=o(39129),s=o(15419),l=o(93474),c=o(38511),h=s.c2i,f=s.c2iUrl,u=a.SyntaxError,p=a.TypeError,v=r("".charAt),b=function(e,t){for(var o=e.length;t<o;t++){var a=v(e,t);if(" "!==a&&"\t"!==a&&"\n"!==a&&"\f"!==a&&"\r"!==a)break}return t},m=function(e,t,o){var a=e.length;a<4&&(e+=2===a?"AA":"A");var r=(t[v(e,0)]<<18)+(t[v(e,1)]<<12)+(t[v(e,2)]<<6)+t[v(e,3)],i=[r>>16&255,r>>8&255,255&r];if(2===a){if(o&&0!==i[1])throw new u("Extra bits");return[i[0]]}if(3===a){if(o&&0!==i[2])throw new u("Extra bits");return[i[0],i[1]]}return i},y=function(e,t,o){for(var a=t.length,r=0;r<a;r++)e[o+r]=t[r];return o+a};e.exports=function(e,t,o,a){n(e),i(t);var r="base64"===l(t)?h:f,s=t?t.lastChunkHandling:void 0;if(void 0===s&&(s="loose"),"loose"!==s&&"strict"!==s&&"stop-before-partial"!==s)throw new p("Incorrect `lastChunkHandling` option");o&&c(o.buffer);var g=o||[],k=0,_=0,w="",x=0;if(a)for(;;){if((x=b(e,x))===e.length){if(w.length>0){if("stop-before-partial"===s)break;if("loose"!==s)throw new u("Missing padding");if(1===w.length)throw new u("Malformed padding: exactly one additional character");k=y(g,m(w,r,!1),k)}_=e.length;break}var C=v(e,x);if(++x,"="===C){if(w.length<2)throw new u("Padding is too early");if(x=b(e,x),2===w.length){if(x===e.length){if("stop-before-partial"===s)break;throw new u("Malformed padding: only one =")}"="===v(e,x)&&(++x,x=b(e,x))}if(x<e.length)throw new u("Unexpected character after padding");k=y(g,m(w,r,"strict"===s),k),_=e.length;break}if(!d(r,C))throw new u("Unexpected character");var M=a-k;if(1===M&&2===w.length||2===M&&3===w.length)break;if(4===(w+=C).length&&(k=y(g,m(w,r,!1),k),w="",_=x,k===a))break}return{bytes:g,read:_,written:k}}},35303:function(e,t,o){var a=o(1569),r=o(72878),i=a.Uint8Array,n=a.SyntaxError,d=a.parseInt,s=Math.min,l=/[^\da-f]/i,c=r(l.exec),h=r("".slice);e.exports=function(e,t){var o=e.length;if(o%2!=0)throw new n("String should be an even number of characters");for(var a=t?s(t.length,o/2):o/2,r=t||new i(a),f=0,u=0;u<a;){var p=h(e,f,f+=2);if(c(l,p))throw new n("String should only contain hex characters");r[u++]=d(p,16)}return{bytes:r,read:f}}},21917:function(e,t,o){var a=o(40810),r=o(1569),i=o(47057),n=o(87038);r.Uint8Array&&a({target:"Uint8Array",proto:!0},{setFromBase64:function(e){n(this);var t=i(e,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:t.read,written:t.written}}})},56193:function(e,t,o){var a=o(40810),r=o(1569),i=o(78344),n=o(87038),d=o(38511),s=o(35303);r.Uint8Array&&a({target:"Uint8Array",proto:!0},{setFromHex:function(e){n(this),i(e),d(this.buffer);var t=s(e,this).read;return{read:t,written:t/2}}})},25020:function(e,t,o){var a=o(40810),r=o(1569),i=o(72878),n=o(87265),d=o(87038),s=o(38511),l=o(15419),c=o(93474),h=l.i2c,f=l.i2cUrl,u=i("".charAt);r.Uint8Array&&a({target:"Uint8Array",proto:!0},{toBase64:function(){var e=d(this),t=arguments.length?n(arguments[0]):void 0,o="base64"===c(t)?h:f,a=!!t&&!!t.omitPadding;s(this.buffer);for(var r,i="",l=0,p=e.length,v=function(e){return u(o,r>>6*e&63)};l+2<p;l+=3)r=(e[l]<<16)+(e[l+1]<<8)+e[l+2],i+=v(3)+v(2)+v(1)+v(0);return l+2===p?(r=(e[l]<<16)+(e[l+1]<<8),i+=v(3)+v(2)+v(1)+(a?"":"=")):l+1===p&&(r=e[l]<<16,i+=v(3)+v(2)+(a?"":"==")),i}})},86913:function(e,t,o){var a=o(40810),r=o(1569),i=o(72878),n=o(87038),d=o(38511),s=i(1..toString);r.Uint8Array&&a({target:"Uint8Array",proto:!0},{toHex:function(){n(this),d(this.buffer);for(var e="",t=0,o=this.length;t<o;t++){var a=s(this[t],16);e+=1===a.length?"0"+a:a}return e}})},27608:function(e,t,o){o.d(t,{MT:()=>r,RV:()=>a,U2:()=>d,ZH:()=>l,t8:()=>s});o(92745),o(9359),o(31526),o(70104);function a(e){return new Promise(((t,o)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>o(e.error)}))}function r(e,t){const o=indexedDB.open(e);o.onupgradeneeded=()=>o.result.createObjectStore(t);const r=a(o);return(e,o)=>r.then((a=>o(a.transaction(t,e).objectStore(t))))}let i;function n(){return i||(i=r("keyval-store","keyval")),i}function d(e,t=n()){return t("readonly",(t=>a(t.get(e))))}function s(e,t,o=n()){return o("readwrite",(o=>(o.put(t,e),a(o.transaction))))}function l(e=n()){return e("readwrite",(e=>(e.clear(),a(e.transaction))))}}};
//# sourceMappingURL=42214.58d03397b8acad15.js.map