iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 3.24 kB
JavaScript
;(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[44722],{58548:function(t,o,i){i.d(o,{A:function(){return r}});i(16280),i(27495),i(25440);const e=t=>{const o=parseFloat(t);if(isNaN(o))throw new Error(`${t} is not a number`);return o};function r(t){if(!t)return null;try{if(t.endsWith("%"))return{w:100,h:e(t.slice(0,-1))};const o=t.replace(":","x").split("x");return 0===o.length?null:1===o.length?{w:e(o[0]),h:1}:{w:e(o[0]),h:e(o[1])}}catch(o){}return null}},56393:function(t,o,i){i.a(t,async function(t,e){try{i.r(o),i.d(o,{HuiIframeCard:function(){return m}});i(16280),i(3362),i(27495),i(25440),i(62953),i(3296),i(27208),i(48408),i(14603),i(47566),i(98721);var r=i(40445),n=i(5124),a=i(67576),s=i(6412),l=i(63672),c=i(89784),h=i(58548),u=i(38962),d=(i(76776),i(47222)),f=t([u]);u=(f.then?(await f)():f)[0];let p,g,_,w=t=>t;class m extends n.WF{static async getConfigElement(){return await i.e(21833).then(i.bind(i,976)),document.createElement("hui-iframe-card-editor")}static getStubConfig(){return{type:"iframe",url:"https://www.home-assistant.io",aspect_ratio:"50%"}}getCardSize(){if(!this._config)return 5;return 1+(this._config.aspect_ratio?Number(this._config.aspect_ratio.replace("%","")):50)/25}setConfig(t){if(!t.url)throw new Error("URL required");this._config=t}render(){var t;if(!this._config||!this.hass)return n.s6;let o="";if(!("panel"===this.layout||"grid"===this.layout))if(this._config.aspect_ratio){const t=(0,h.A)(this._config.aspect_ratio);t&&t.w>0&&t.h>0&&(o=`${(100*t.h/t.w).toFixed(2)}%`)}else o="50%";const i=new URL(this._config.url,location.toString()).protocol;if("https:"===location.protocol&&"https:"!==i)return(0,n.qy)(p||(p=w` <ha-alert alert-type="error"> ${0} </ha-alert> `),this.hass.localize("ui.panel.lovelace.cards.iframe.error_secure_context",{target_protocol:i,context_protocol:location.protocol}));let e="";this._config.allow_open_top_navigation&&(e+="allow-top-navigation-by-user-activation");const r=this._config.disable_sandbox?void 0:`${e} ${d.D}`;return(0,n.qy)(g||(g=w` <ha-card class="${0}" .header="${0}"> <div id="root" style="${0}"> <iframe title="${0}" src="${0}" sandbox="${0}" allow="${0}"></iframe> </div> </ha-card> `),(0,s.H)({"hide-background":this._config.hide_background}),this._config.title,(0,c.W)({"padding-top":o}),(0,l.J)(this._config.title),this._config.url,(0,l.J)(r),null!==(t=this._config.allow)&&void 0!==t?t:"fullscreen")}getGridOptions(){return{columns:"full",rows:4,min_columns:3,min_rows:2}}}m.styles=(0,n.AH)(_||(_=w`ha-card{overflow:hidden;width:100%;height:100%;display:flex;flex-direction:column}ha-card.hide-background{background:0 0;box-shadow:none;border:none}#root{width:100%;height:100%;position:relative}iframe{position:absolute;border:none;width:100%;height:100%;top:0;left:0}`)),(0,r.Cg)([(0,a.MZ)({attribute:!1})],m.prototype,"layout",void 0),(0,r.Cg)([(0,a.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,r.Cg)([(0,a.wk)()],m.prototype,"_config",void 0),m=(0,r.Cg)([(0,a.EM)("hui-iframe-card")],m),e()}catch(p){e(p)}})},47222:function(t,o,i){i.d(o,{D:function(){return e}});const e="allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts allow-modals allow-downloads"}}]);