export const __rspack_esm_id="10405";export const __rspack_esm_ids=["10405"];export const __webpack_modules__={44688(t,a,s){s.d(a,{Oc:()=>o,gk:()=>i,oS:()=>n});var e=s(50816);const n=!1,i=n?e._:"A078F6B0",o="urn:x-cast:com.nabucasa.hast"},50816(t,a,s){s.d(a,{I:()=>n,_:()=>e});const e="5FE44367",n="http://192.168.1.234:8123"},40461(t,a,s){s.d(a,{oK:()=>i,tb:()=>o,xV:()=>c});var e=s(44688),n=s(50816);const i=(t,a)=>t.sendMessage({type:"connect",refreshToken:a.data.refresh_token,clientId:a.data.clientId,hassUrl:e.oS?n.I:a.data.hassUrl}),o=(t,a,s,i)=>t.sendMessage({type:"show_lovelace_view",viewPath:s,urlPath:i||null,hassUrl:e.oS?n.I:a}),c=(t,a)=>{if(!t.castConnectedToOurHass)return new Promise(s=>{const e=t.addEventListener("connection-changed",()=>{t.castConnectedToOurHass&&(e(),s())});i(t,a)})}},96612(t,a,s){s.a(t,async function(t,e){try{s.r(a);var n=s(62826),i=s(96196),o=s(44457),c=s(94333),r=s(40461),h=s(18350),l=(s(88945),t([h]));h=(l.then?(await l)():l)[0];class d extends i.WF{setConfig(t){this._config={icon:"mdi:television",name:"Home Assistant Cast",view:0,...t}}shouldUpdate(t){return!(1===t.size&&t.has("hass"))}render(){if(!this._config)return i.s6;const t=this._castManager&&this._castManager.status&&this._config.view===this._castManager.status.lovelacePath&&this._config.dashboard===this._castManager.status.urlPath;return i.qy` <ha-icon .icon="${this._config.icon}"></ha-icon> <div class="flex"> <div class="name">${this._config.name}</div> ${this._noHTTPS?i.qy` Cast requires HTTPS `:void 0===this._castManager?i.s6:null===this._castManager?i.qy` Cast API unavailable `:"NO_DEVICES_AVAILABLE"===this._castManager.castState?i.qy` No devices found `:i.qy` <div class="controls"> <google-cast-launcher></google-cast-launcher> <ha-button @click="${this._sendLovelace}" class="${(0,c.H)({inactive:!t})}" appearance="plain" size="small" .disabled="${!this._castManager.status}"> SHOW </ha-button> </div> `} </div> `}firstUpdated(t){super.firstUpdated(t),"http:"===location.protocol&&"localhost"!==location.hostname&&(this._noHTTPS=!0),s.e("80444").then(s.bind(s,51671)).then(({getCastManager:t})=>t(this.hass.auth).then(t=>{this._castManager=t,t.addEventListener("connection-changed",()=>{this.requestUpdate()}),t.addEventListener("state-changed",()=>{this.requestUpdate()})},()=>{this._castManager=null}))}updated(t){super.updated(t),this._config&&this._config.hide_if_unavailable&&(this.style.display=this._castManager&&"NO_DEVICES_AVAILABLE"!==this._castManager.castState?"":"none")}async _sendLovelace(){await(0,r.xV)(this._castManager,this.hass.auth),(0,r.tb)(this._castManager,this.hass.auth.data.hassUrl,this._config.view,this._config.dashboard)}constructor(...t){super(...t),this._noHTTPS=!1}}d.styles=i.AH`:host{display:flex;align-items:center}ha-icon{padding:8px;color:var(--state-icon-color)}.flex{flex:1;margin-left:16px;margin-inline-start:16px;margin-inline-end:initial;display:flex;justify-content:space-between;align-items:center}.name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.controls{display:flex;align-items:center}google-cast-launcher{margin-right:.57em;margin-inline-end:-.57em;margin-inline-start:initial;cursor:pointer;display:inline-block;height:24px;width:24px}.inactive{padding:0 4px}`,(0,n.Cg)([(0,o.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],d.prototype,"_config",void 0),(0,n.Cg)([(0,o.wk)()],d.prototype,"_castManager",void 0),(0,n.Cg)([(0,o.wk)()],d.prototype,"_noHTTPS",void 0),d=(0,n.Cg)([(0,o.EM)("hui-cast-row")],d),e()}catch(t){e(t)}})}};
//# sourceMappingURL=10405.070875fa8adc6104.js.map