export const __rspack_esm_id="44722";export const __rspack_esm_ids=["44722"];export const __webpack_modules__={58548(t,o,i){i.d(o,{A:()=>r});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(t){}return null}},56393(t,o,i){i.a(t,async function(t,e){try{i.r(o),i.d(o,{HuiIframeCard:()=>f});i(14603),i(47566),i(98721);var r=i(62826),a=i(96196),n=i(97735),s=i(94333),l=i(32288),c=i(29485),h=i(58548),d=i(38962),u=(i(76776),i(47222)),p=t([d]);d=(p.then?(await p)():p)[0];class f extends a.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(){if(!this._config||!this.hass)return a.s6;let t="";if(!("panel"===this.layout||"grid"===this.layout))if(this._config.aspect_ratio){const o=(0,h.A)(this._config.aspect_ratio);o&&o.w>0&&o.h>0&&(t=`${(100*o.h/o.w).toFixed(2)}%`)}else t="50%";const o=new URL(this._config.url,location.toString()).protocol;if("https:"===location.protocol&&"https:"!==o)return a.qy` <ha-alert alert-type="error"> ${this.hass.localize("ui.panel.lovelace.cards.iframe.error_secure_context",{target_protocol:o,context_protocol:location.protocol})} </ha-alert> `;let i="";this._config.allow_open_top_navigation&&(i+="allow-top-navigation-by-user-activation");const e=this._config.disable_sandbox?void 0:`${i} ${u.D}`;return a.qy` <ha-card class="${(0,s.H)({"hide-background":this._config.hide_background})}" .header="${this._config.title}"> <div id="root" style="${(0,c.W)({"padding-top":t})}"> <iframe title="${(0,l.J)(this._config.title)}" src="${this._config.url}" sandbox="${(0,l.J)(e)}" allow="${this._config.allow??"fullscreen"}"></iframe> </div> </ha-card> `}getGridOptions(){return{columns:"full",rows:4,min_columns:3,min_rows:2}}}f.styles=a.AH`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,n.MZ)({attribute:!1})],f.prototype,"layout",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,r.Cg)([(0,n.wk)()],f.prototype,"_config",void 0),f=(0,r.Cg)([(0,n.EM)("hui-iframe-card")],f),e()}catch(t){e(t)}})},47222(t,o,i){i.d(o,{D:()=>e});const e="allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts allow-modals allow-downloads"}};
//# sourceMappingURL=44722.2a6eef838df21736.js.map