UNPKG

iobroker.lovelace

Version:

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

48 lines 21.4 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[28501],{62371:function(t,e,n){n.d(e,{E:function(){return i},T:function(){return a}});n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698),n(62953);const a=(t,e,n=true)=>{var i;if(!t||t===document.body)return null;if((t=null!==(i=t.assignedSlot)&&void 0!==i?i:t).parentElement)t=t.parentElement;else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return(n?Object.prototype.hasOwnProperty.call(t,e):t&&e in t)?t:a(t,e,n)},i=(t,e,n=true)=>{const i=new Set;for(;t;)i.add(t),t=a(t,e,n);return i}},50248:function(t,e,n){n.d(e,{n:function(){return a}});const a=(t=document)=>{var e;return null!==(e=t.activeElement)&&void 0!==e&&null!==(e=e.shadowRoot)&&void 0!==e&&e.activeElement?a(t.activeElement.shadowRoot):t.activeElement}},37981:function(t,e,n){n.d(e,{xn:function(){return o},T:function(){return r},Kh:function(){return l}});n(18111),n(22489),n(61701),n(42762),n(62953);var a=n(22786);n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698);var i=n(28978);const o=t=>{var e;return null===(e=t.name_by_user||t.name)||void 0===e?void 0:e.trim()},r=(t,e,n,a)=>o(t)||a&&s(n,a)||e("ui.panel.config.devices.unnamed_device",{type:e(`ui.panel.config.devices.type.${t.entry_type||"device"}`)}),s=(t,e)=>{for(const n of e||[]){const e=t["string"==typeof n?n:n.entity_id];if(e)return(0,i.u)(e)}},l=(0,a.A)(t=>function(t){const e=new Set,n=new Set;for(const a of t)n.has(a)?e.add(a):n.add(a);return e}(Object.values(t).map(t=>o(t)).filter(t=>void 0!==t)))},91926:function(t,e,n){n.d(e,{OE:function(){return c},Te:function(){return r},oo:function(){return l}});n(3362),n(27495),n(25440);var a=n(96126),i=n(1087),o=n(63091);const r=t=>{o.G.history.replaceState(Object.assign(Object.assign({},o.G.history.state),{},{refreshUrl:t}),"")},s=async t=>{var e;const{history:n}=o.G;if(null===(e=n.state)||void 0===e||!e.dialog||Date.now()-t>=500)return!0;return await(0,a.Jh)()?(await new Promise(t=>{setTimeout(t)}),s(t)):(console.warn("Navigation blocked, because dialog refused to close"),!1)},l=async(t,e)=>{if(!(await s(Date.now())))return!1;const n=(null==e?void 0:e.replace)||!1;var a,r,l;return n?o.G.history.replaceState(null!==(a=o.G.history.state)&&void 0!==a&&a.root?{root:!0}:null!==(r=null==e?void 0:e.data)&&void 0!==r?r:null,"",t):o.G.history.pushState(null!==(l=null==e?void 0:e.data)&&void 0!==l?l:null,"",t),(0,i.r)(o.G,"location-changed",{replace:n}),!0},c=async t=>{if(!(await s(Date.now())))return;const{history:e}=o.G;if(e.length>1)return void e.back();l(t||"/",{replace:!0})}},12587:function(t,e,n){n.d(e,{E:function(){return i},m:function(){return a}});n(3362);const a=t=>{requestAnimationFrame(()=>setTimeout(t,0))},i=()=>new Promise(t=>{a(t)})},60353:function(t,e,n){n.d(e,{u:function(){return a}});class a{start(t){const e=Date.now();this._startY=t,this._startTime=e,this._lastY=t,this._lastTime=e,this._delta=0}move(t){const e=Date.now();return this._delta=this._startY-t,this._lastY=t,this._lastTime=e,this._delta}end(){const t=this.getVelocity(),e=Math.abs(t)>this._velocityThreshold;return{velocity:t,delta:this._delta,isSwipe:e,isDownwardSwipe:t>0}}getDelta(){return this._delta}getVelocity(){if(Date.now()-this._lastTime>=this._movementTimeThreshold)return 0;const t=this._lastTime-this._startTime;return t>0?(this._lastY-this._startY)/t:0}reset(){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0}constructor(t={}){var e,n;this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=null!==(e=t.velocitySwipeThreshold)&&void 0!==e?e:.5,this._movementTimeThreshold=null!==(n=t.movementTimeThreshold)&&void 0!==n?n:100}}},54276:function(t,e,n){n(62953);var a=n(40445),i=n(76482),o=n(91382),r=n(96245),s=n(5124),l=n(67576);let c;class d extends o.n{attach(t){super.attach(t),this.attachableTouchController.attach(t)}disconnectedCallback(){super.disconnectedCallback(),this.hovered=!1,this.pressed=!1}detach(){super.detach(),this.attachableTouchController.detach()}_onTouchControlChange(t,e){null==t||t.removeEventListener("touchend",this._handleTouchEnd),null==e||e.addEventListener("touchend",this._handleTouchEnd)}constructor(...t){super(...t),this.attachableTouchController=new i.i(this,this._onTouchControlChange.bind(this)),this._handleTouchEnd=()=>{this.disabled||super.endPressAnimation()}}}d.styles=[r.R,(0,s.AH)(c||(c=(t=>t)`:host{--md-ripple-hover-opacity:var(--ha-ripple-hover-opacity, 0.08);--md-ripple-pressed-opacity:var(--ha-ripple-pressed-opacity, 0.12);--md-ripple-hover-color:var( --ha-ripple-hover-color, var(--ha-ripple-color, var(--secondary-text-color)) );--md-ripple-pressed-color:var( --ha-ripple-pressed-color, var(--ha-ripple-color, var(--secondary-text-color)) )}`))],d=(0,a.Cg)([(0,l.EM)("ha-ripple")],d)},34127:function(t,e,n){n.a(t,async function(t,e){try{n(62953);var a=n(40445),i=n(52630),o=n(5124),r=n(67576),s=t([i]);i=(s.then?(await s)():s)[0];let l,c=t=>t;class d extends i.A{static get styles(){return[i.A.styles,(0,o.AH)(l||(l=c`:host{--wa-tooltip-background-color:var( --ha-tooltip-background-color, var(--ha-color-surface-default) );--wa-tooltip-content-color:var( --ha-tooltip-text-color, var(--primary-text-color) );--wa-tooltip-font-family:var( --ha-tooltip-font-family, var(--ha-font-family-body) );--wa-tooltip-font-size:var( --ha-tooltip-font-size, var(--ha-font-size-m) );--wa-tooltip-font-weight:var( --ha-tooltip-font-weight, var(--ha-font-weight-medium) );--wa-tooltip-line-height:var( --ha-tooltip-line-height, var(--ha-line-height-condensed) );--wa-tooltip-padding:var(--ha-tooltip-padding, var(--ha-space-2));--wa-tooltip-border-radius:var( --ha-tooltip-border-radius, var(--ha-border-radius-md) );--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 0px);--wa-tooltip-border-width:0px;--wa-z-index-tooltip:1000}.tooltip::part(popup){animation-duration:var(--ha-tooltip-animation-duration, 0)}.body{box-shadow:var(--ha-tooltip-box-shadow,var(--ha-box-shadow-m))}`))]}constructor(...t){super(...t),this.showDelay=350,this.hideDelay=150}}(0,a.Cg)([(0,r.MZ)({attribute:"show-delay",type:Number})],d.prototype,"showDelay",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"hide-delay",type:Number})],d.prototype,"hideDelay",void 0),d=(0,a.Cg)([(0,r.EM)("ha-tooltip")],d),e()}catch(l){e(l)}})},77423:function(t,e,n){n.d(e,{A:function(){return i},Cm:function(){return o},Fs:function(){return v},JW:function(){return m},TC:function(){return l},VN:function(){return c},Vx:function(){return d},XQ:function(){return f},eM:function(){return u},iH:function(){return h},k3:function(){return p},m4:function(){return r},qf:function(){return s},t0:function(){return a},yv:function(){return g}});n(44114),n(18111),n(22489),n(20116),n(7588),n(61701),n(62953);const a=(t,e)=>t.callWS({type:"config_entries/subentries/list",entry_id:e}),i=(t,e,n,a)=>t.callWS(Object.assign({type:"config_entries/subentries/update",entry_id:e,subentry_id:n},a)),o=(t,e,n)=>t.callWS({type:"config_entries/subentries/delete",entry_id:e,subentry_id:n}),r=66649!=n.j?["migration_error","setup_error","setup_retry"]:null,s=66649!=n.j?["not_loaded","loaded","setup_error","setup_retry"]:null,l=(t,e,n)=>{const a={type:"config_entries/subscribe"};return n&&n.type&&(a.type_filter=n.type),t.connection.subscribeMessage(t=>{e(t)},a)},c=(t,e)=>{const n={};return e&&(e.type&&(n.type_filter=e.type),e.domain&&(n.domain=e.domain)),t.callWS(Object.assign({type:"config_entries/get"},n))},d=(t,e)=>t.callWS({type:"config_entries/get_single",entry_id:e}),h=(t,e,n)=>t.callWS(Object.assign({type:"config_entries/update",entry_id:e},n)),u=(t,e)=>t.callApi("DELETE",`config/config_entries/entry/${e}`),g=(t,e)=>t.callApi("POST",`config/config_entries/entry/${e}/reload`),f=(t,e)=>t.callWS({type:"config_entries/disable",entry_id:e,disabled_by:"user"}),p=(t,e)=>t.callWS({type:"config_entries/disable",entry_id:e,disabled_by:null}),m=(t,e)=>{if(!e)return t;const n=t.find(t=>t.entry_id===e);if(!n)return t;return[n,...t.filter(t=>t.entry_id!==e)]};class v{processMessage(t){return t.forEach(t=>{if(null!==t.type&&"added"!==t.type)if("removed"!==t.type){if("updated"===t.type){const e=t.entry;this._entries=this._entries.map(t=>t.entry_id===e.entry_id?e:t)}}else this._entries=this._entries.filter(e=>e.entry_id!==t.entry.entry_id);else this._entries.push(t.entry)}),this._entries}constructor(){this._entries=[]}}},59241:function(t,e,n){n.d(e,{BM:function(){return O},Bz:function(){return E},DW:function(){return p},Er:function(){return f},G3:function(){return y},G_:function(){return _},Ox:function(){return k},P9:function(){return z},RP:function(){return x},bg:function(){return w},fs:function(){return h},jh:function(){return m},n4:function(){return S},oY:function(){return d},v:function(){return v},z0:function(){return u}});n(74423),n(26910),n(18111),n(22489),n(20116),n(62953);var a=n(90889),i=n(22786),o=n(71727),r=n(28978),s=n(52220),l=n(9899);const c=66649!=n.j?["light","cover","valve"]:null,d=t=>c.includes(t),h=t=>null==t||t.length>0,u=t=>null!=t,g=["sensor","binary_sensor"],f=(t,e)=>{const n=e.filter(e=>t.states[e.entity_id]&&"battery"===t.states[e.entity_id].attributes.device_class&&g.includes((0,o.m)(e.entity_id))).sort((t,e)=>g.indexOf((0,o.m)(t.entity_id))-g.indexOf((0,o.m)(e.entity_id)));if(n.length>0)return n[0]},p=(t,e)=>e.find(e=>t.states[e.entity_id]&&"battery_charging"===t.states[e.entity_id].attributes.device_class),m=(t,e)=>{if(e.name)return e.name;const n=t.states[e.entity_id];return n?(0,r.u)(n):e.original_name?e.original_name:e.entity_id},v=(t,e)=>t.callWS({type:"config/entity_registry/get",entity_id:e}),y=(t,e)=>t.callWS({type:"config/entity_registry/get_entries",entity_ids:e}),_=(t,e,n)=>t.callWS(Object.assign({type:"config/entity_registry/update",entity_id:e},n)),w=(t,e)=>t.callWS({type:"config/entity_registry/remove",entity_id:e}),b=t=>t.sendMessagePromise({type:"config/entity_registry/list"}),x=t=>t.sendMessagePromise({type:"config/entity_registry/list_for_display"}),T=(t,e)=>t.subscribeEvents((0,l.s)(()=>b(t).then(t=>e.setState(t,!0)),500,!0),"entity_registry_updated"),E=(t,e)=>(0,a.N)("_entityRegistry",b,T,t,e),S=(t,e)=>t.sort((t,n)=>(0,s.SH)(t.name||"",n.name||"",e)),k=(0,i.A)(t=>{const e={};for(const n of t)e[n.entity_id]=n;return e}),z=(0,i.A)(t=>{const e={};for(const n of t)e[n.id]=n;return e}),O=(t,e)=>t.callWS({type:"config/entity_registry/get_automatic_entity_ids",entity_ids:e})},65063:function(t,e,n){n.d(e,{an:function(){return l},dk:function(){return s},showAlertDialog:function(){return r}});n(3362),n(62953);var a=n(1087);const i=()=>Promise.all([n.e(72850),n.e(39763),n.e(32450),n.e(29962),n.e(62574),n.e(960)]).then(n.bind(n,26683)),o=(t,e,n)=>new Promise(o=>{const r=e.cancel,s=e.confirm;(0,a.r)(t,"show-dialog",{dialogTag:"dialog-box",dialogImport:i,dialogParams:Object.assign(Object.assign(Object.assign({},e),n),{},{cancel:()=>{o(!(null==n||!n.prompt)&&null),r&&r()},confirm:t=>{o(null==n||!n.prompt||t),s&&s(t)}})})}),r=(t,e)=>o(t,e),s=(t,e)=>o(t,e,{confirmation:!0}),l=(t,e)=>o(t,e,{prompt:!0})},96126:function(t,e,n){n.d(e,{Jh:function(){return g},oO:function(){return p},t3:function(){return u},ui:function(){return d},zU:function(){return h}});n(16280),n(44114),n(3362),n(62953);var a=n(62371);if(66649!=n.j)var i=n(50248);var o=n(63091),r=n(12587);const s={},l=[],c=Symbol.for("HA focus target"),d=async(t,e,n,r,h,u=!0,g)=>{if(!(e in s)){if(!r)return!1;s[e]={element:r().then(()=>{const n=document.createElement(e);return"showDialog"in n&&t.provideHass(n),n.addEventListener("dialog-closed",f),n.addEventListener("dialog-closed",m),n})}}if(u){var p,v;const{history:a}=o.G;if(null!==(p=a.state)&&void 0!==p&&p.dialog&&!l.length)return await new Promise(t=>{setTimeout(t)}),d(t,e,n,r,h,u,g);const i=l.findIndex(t=>t.dialogTag===e);-1!==i&&l.splice(i,1),l.push({element:t,dialogTag:e,dialogParams:n,dialogImport:r,addHistory:u});const s={dialog:e};null!==(v=a.state)&&void 0!==v&&v.dialog?a.replaceState(s,""):(a.replaceState(Object.assign(Object.assign({},a.state),{},{opensDialog:!0}),""),a.pushState(s,""))}let y;if(s[e].closedFocusTargets=(0,a.E)((0,i.n)(),c),s[e]&&null===s[e].element?(y=document.createElement(e),y.addEventListener("dialog-closed",f),y.addEventListener("dialog-closed",m),s[e].element=Promise.resolve(y)):y=await s[e].element,"dialogNext"in y&&y.dialogNext)y.dialogAnchor=g,y.params=n;else{if(!("showDialog"in y))throw new Error("Unknown dialog type loaded");y.dialogAnchor=g,y.showDialog(n)}const _=(h||t).shadowRoot;return y.parentNode!==_&&_.appendChild(y),!0},h=async(t,e)=>{if(!(t in s))return!0;const n=await s[t].element;return!n||!n.closeDialog||!1!==n.closeDialog(e)},u=async t=>{if(l.length){var e;const n=l.pop(),a=await h(n.dialogTag,t);return a?l.length&&null!==(e=o.G.history.state)&&void 0!==e&&e.opensDialog&&o.G.history.pushState({dialog:l[l.length-1].dialogTag},""):l.push(n),a}return!0},g=async()=>{for(let t=l.length-1;t>=0;t--){if(!(!l[t]||await h(l[t].dialogTag)))return!1}return!0},f=t=>{var e;const n=l.findIndex(e=>e.dialogTag===t.detail.dialog);if(-1!==n&&l.splice(n,1),(null===(e=o.G.history.state)||void 0===e?void 0:e.dialog)===t.detail.dialog&&(l.length?o.G.history.replaceState({dialog:l[l.length-1].dialogTag},""):-1!==n&&o.G.history.back()),t.currentTarget&&"params"in t.currentTarget){const e=t.currentTarget;e.removeEventListener("dialog-closed",f),e.removeEventListener("dialog-closed",m),s[t.detail.dialog].element=null}},p=t=>{t.addEventListener("show-dialog",e=>{const{dialogTag:n,dialogImport:a,dialogParams:i,dialogAnchor:o,addHistory:r,parentElement:s}=e.detail;d(t,n,i,a,s,r,o)})},m=async t=>{if(!s[t.detail.dialog])return;const e=s[t.detail.dialog].closedFocusTargets;if(delete s[t.detail.dialog].closedFocusTargets,!e)return;let n=(0,i.n)();n instanceof HTMLElement&&n.blur(),await(0,r.E)();for(const a of e)if(a instanceof HTMLElement&&(a.focus(),n=(0,i.n)(),n&&n!==document.body))return}},69235:function(t,e,n){n.a(t,async function(t,e){try{n(3362),n(62953);"function"!=typeof window.ResizeObserver&&(window.ResizeObserver=(await n.e(71055).then(n.bind(n,52370))).default),e()}catch(a){e(a)}},1)},14503:function(t,e,n){n.d(e,{RF:function(){return u},dp:function(){return p},kO:function(){return f},nA:function(){return g},og:function(){return h}});var a=n(5124);let i,o,r,s,l,c,d=t=>t;const h=(0,a.AH)(i||(i=d`button.link{background:0 0;color:inherit;border:none;padding:0;font:inherit;text-align:left;text-decoration:underline;cursor:pointer;outline:0}`)),u=(0,a.AH)(o||(o=d`:host{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}app-header div[sticky]{height:48px}app-toolbar [main-title]{margin-left:20px;margin-inline-start:20px;margin-inline-end:initial}.header{transition:box-shadow .2s linear,width var(--ha-animation-duration-normal) ease,padding-left var(--ha-animation-duration-normal) ease,padding-right var(--ha-animation-duration-normal) ease}@media (prefers-reduced-motion:reduce){.header{transition:box-shadow .2s linear}}h1{font-family:var(--ha-font-family-heading);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}h2{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-normal)}h3{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal)}a{color:var(--primary-color)}.secondary{color:var(--secondary-text-color)}.error{color:var(--error-color)}.warning{color:var(--error-color)}${0} .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}`),h),g=(0,a.AH)(r||(r=d`ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:400px;--mdc-dialog-max-width:600px;--mdc-dialog-max-width:min(600px, 95vw);--justify-action-buttons:space-between;--dialog-container-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--dialog-surface-padding:0px}ha-adaptive-dialog .form,ha-dialog .form{color:var(--primary-text-color)}a{color:var(--primary-color)}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--mdc-dialog-min-width:100vw;--mdc-dialog-max-width:100vw;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--dialog-container-padding:0px;--dialog-surface-padding:var(--safe-area-inset-top, 0) var(--safe-area-inset-right, 0) var(--safe-area-inset-bottom, 0) var(--safe-area-inset-left, 0);--vertical-align-dialog:flex-end}ha-dialog{--ha-dialog-border-radius:var(--ha-border-radius-square)}}.error{color:var(--error-color)}`)),f=(0,a.AH)(s||(s=d`ha-adaptive-dialog,ha-dialog{--vertical-align-dialog:flex-start;--dialog-surface-margin-top:var(--ha-space-10);--mdc-dialog-max-height:calc( 100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--mdc-dialog-max-height:calc( 100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--ha-dialog-max-height:calc( 100vh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) );--ha-dialog-max-height:calc( 100svh - var(--dialog-surface-margin-top) - var(--ha-space-2) - var( --safe-area-inset-y, 0px ) )}@media all and (max-width:450px),all and (max-height:500px){ha-adaptive-dialog,ha-dialog{--dialog-surface-margin-top:0px;--mdc-dialog-min-height:100vh;--mdc-dialog-min-height:100svh;--mdc-dialog-max-height:100vh;--mdc-dialog-max-height:100svh;--ha-dialog-max-height:100vh;--ha-dialog-max-height:100svh}}`)),p=(0,a.AH)(l||(l=d`.ha-scrollbar::-webkit-scrollbar{width:.4rem;height:.4rem}.ha-scrollbar::-webkit-scrollbar-thumb{border-radius:var(--ha-border-radius-sm);background:var(--scrollbar-thumb-color)}.ha-scrollbar{overflow-y:auto;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin}`));(0,a.AH)(c||(c=d`body{background-color:var(--primary-background-color);color:var(--primary-text-color);height:calc(100vh - 32px);width:100vw}`))},44144:function(t,e,n){n.d(e,{Cv:function(){return l},MR:function(){return u},QR:function(){return g},_c:function(){return h},a_:function(){return p},bg:function(){return m},yM:function(){return f}});n(18111),n(22489),n(3362),n(62953),n(3296),n(27208),n(48408),n(14603),n(47566),n(98721);var a=n(8129);let i,o;const r=66649!=n.j?18e5:null,s=66649!=n.j?[0,500,1e3,2e3,5e3,1e4,15e3]:null,l=async t=>{const e=i;for(const o of s){o&&await(0,a.l)(o);try{return await c(t),d(t),i!==e}catch(n){}}return!1},c=async t=>{const e=await t.callWS({type:"brands/access_token"});i=e.token},d=t=>{h(),o=setInterval(()=>{c(t).catch(()=>{})},r)},h=()=>{o&&(clearInterval(o),o=void 0)},u=(t,e)=>{if(!i)return"";e=null!=e?e:location.origin;const n=`/api/brands/integration/${t.domain}/${t.darkOptimized?"dark_":""}${t.type}.png`,a=new URL(n,e);return a.searchParams.set("token",i),a.toString()},g=(t,e)=>{if(!i)return"";e=null!=e?e:location.origin;const n=`/api/brands/hardware/${t.category}/${t.darkOptimized?"dark_":""}${t.manufacturer}${t.model?`_${t.model}`:""}.png`,a=new URL(n,e);return a.searchParams.set("token",i),a.toString()},f=(t,e)=>{let n;e=null!=e?e:location.origin;try{n=new URL(t,e)}catch(a){return t}return n.pathname.startsWith("/api/brands/")?i?(n.searchParams.set("token",i),n.toString()):"":t},p=t=>{var e;const n=new URL(t,location.origin);if(n.pathname.startsWith("/api/brands/"))return n.pathname.split("/")[4];const a=n.pathname.split("/").filter(t=>t.length>0),i=a.indexOf("_");return-1!==i&&i+1<a.length?a[i+1]:null!==(e=a[1])&&void 0!==e?e:""},m=t=>{try{return new URL(t,location.origin).pathname.startsWith("/api/brands/")||t.startsWith("https://brands.home-assistant.io/")}catch(e){return!1}}}}]);