"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["33495"],{25995:function(e,t,n){n.d(t,{Vw:function(){return o},kG:function(){return i},y6:function(){return a}});n(26099),n(3362);var r=function(e,t,n){return new Promise(function(r,a){var i=document.createElement(e),o="src",s="body";switch(i.onload=function(){return r(t)},i.onerror=function(){return a(t)},e){case"script":i.async=!0,n&&(i.type=n);break;case"link":i.type="text/css",i.rel="stylesheet",o="href",s="head"}i[o]=t,document[s].appendChild(i)})},a=function(e){return r("link",e)},i=function(e){return r("script",e)},o=function(e){return r("script",e,"module")}},6378:function(e,t,n){n.r(t),n.d(t,{HaPanelCustom:function(){return _}});var r=n(31432),a=n(44734),i=n(43080),o=n(69683),s=n(6454),l=n(25460),c=(n(28706),n(74423),n(23792),n(26099),n(42762),n(62953),n(40445)),u=n(96196),h=n(77845),p=n(91926),f=n(19459),m=(n(3362),n(25995)),d={},v=function(e){return e.html_url?{type:"html",url:e.html_url}:e.module_url&&e.js_url?{type:"js",url:e.js_url}:e.module_url?{type:"module",url:e.module_url}:{type:"js",url:e.js_url}},y=(n(18111),n(7588),n(79432),n(23500),function(e,t){"setProperties"in e?e.setProperties(t):Object.keys(t).forEach(function(n){e[n]=t[n]})}),_=function(e){function t(){var e;(0,a.A)(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=(0,o.A)(this,t,[].concat(r))).narrow=!1,e.navigate=function(e,t){return(0,p.o)(e,t)},e}return(0,s.A)(t,e),(0,i.A)(t,[{key:"createRenderRoot",value:function(){return this}},{key:"registerIframe",value:function(e,t){e(this.panel,{hass:this.hass,narrow:this.narrow,route:this.route}),this._setProperties=t}},{key:"disconnectedCallback",value:function(){(0,l.A)(t,"disconnectedCallback",this,3)([]),this._cleanupPanel()}},{key:"update",value:function(e){if((0,l.A)(t,"update",this,3)([e]),e.has("panel")){var n=e.get("panel");if(!(0,f.b)(n,this.panel))return n&&this._cleanupPanel(),void this._createPanel(this.panel)}if(this._setProperties){var a,i={},o=(0,r.A)(e.keys());try{for(o.s();!(a=o.n()).done;){var s=a.value;i[s]=this[s]}}catch(c){o.e(c)}finally{o.f()}this._setProperties(i)}}},{key:"_cleanupPanel",value:function(){for(delete window.customPanel,this._setProperties=void 0;this.lastChild;)this.removeChild(this.lastChild)}},{key:"_createPanel",value:function(e){var t=this,n=e.config._panel_custom,r=v(n),a=document.createElement("a");if(a.href=r.url,n.trust_external||["localhost","127.0.0.1",location.hostname].includes(a.hostname)||confirm("".concat(this.hass.localize("ui.panel.custom.external_panel.question_trust",{name:n.name,link:a.href}),"\n\n           ").concat(this.hass.localize("ui.panel.custom.external_panel.complete_access"),"\n\n           (").concat(this.hass.localize("ui.panel.custom.external_panel.hide_message"),")")))if(n.embed_iframe){var i,o;window.customPanel=this;var s=this.panel.title?'title="'.concat(this.panel.title,'"'):"";this.innerHTML="\n      <style>\n        iframe {\n          border: 0;\n          width: calc(100% - var(--safe-area-inset-right, 0px));\n          height: calc(100% - var(--safe-area-inset-top, 0px) - var(--safe-area-inset-bottom, 0px));\n          display: block;\n          background-color: var(--primary-background-color);\n          margin-top: var(--safe-area-inset-top);\n          margin-bottom: var(--safe-area-inset-bottom);\n          margin-right: var(--safe-area-inset-right);\n        }\n        @media (max-width: 870px) {\n          iframe {\n            width: calc(100% - var(--safe-area-inset-left, 0px) - var(--safe-area-inset-right, 0px));\n            margin-left: var(--safe-area-inset-left);\n          }\n        }\n      </style>\n      <iframe ".concat(s,"></iframe>").trim();var l=this.querySelector("iframe").contentWindow.document;l.open(),l.write("<!doctype html><script src='".concat(window.customPanelJS,"'><\/script>")),l.close()}else(i=n,o=v(i),"js"===o.type?(o.url in d||(d[o.url]=(0,m.kG)(o.url)),d[o.url]):"module"===o.type?(0,m.Vw)(o.url):Promise.reject("No valid url found in panel config.")).then(function(){var r=function(e){var t="html_url"in e?"ha-panel-".concat(e.name):e.name;return document.createElement(t)}(n);t._setProperties=function(e){return y(r,e)},y(r,{panel:e,hass:t.hass,narrow:t.narrow,route:t.route}),t.appendChild(r)},function(){alert("Unable to load custom panel from ".concat(a.href))})}}])}(u.mN);(0,c.Cg)([(0,h.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,c.Cg)([(0,h.MZ)({type:Boolean})],_.prototype,"narrow",void 0),(0,c.Cg)([(0,h.MZ)({attribute:!1})],_.prototype,"route",void 0),(0,c.Cg)([(0,h.MZ)({attribute:!1})],_.prototype,"panel",void 0),_=(0,c.Cg)([(0,h.EM)("ha-panel-custom")],_)}}]);
//# sourceMappingURL=33495.3a07cd83338efb05.js.map