export const __rspack_esm_id="65742";export const __rspack_esm_ids=["65742"];export const __webpack_modules__={16349(t,a,e){e.a(t,async function(t,s){try{e.r(a);e(14603),e(47566),e(98721);var o=e(62826),i=e(96196),n=e(44457),r=e(80880),c=e(89300),d=(e(55148),e(22675)),h=e(30039),l=e(81619),p=t([c]);c=(p.then?(await p)():p)[0];class _ extends i.WF{connectedCallback(){super.connectedCallback(),this._attached=!0}disconnectedCallback(){super.disconnectedCallback(),this._attached=!1}render(){return this._attached&&this.stateObj?i.qy` <ha-camera-stream .hass="${this.hass}" .stateObj="${this.stateObj}" allow-exoplayer controls></ha-camera-stream> <div class="actions"> <ha-progress-button @click="${this._downloadSnapshot}" .progress="${this._waiting}" .disabled="${this.stateObj.state===d.Hh}" appearance="filled"> ${this.hass.localize("ui.dialogs.more_info_control.camera.download_snapshot")} </ha-progress-button> </div> `:i.s6}async _downloadSnapshot(t){const a=t.currentTarget;this._waiting=!0;try{const t=await this.hass.callApiRaw("GET",`camera_proxy/${this.stateObj.entity_id}`);if(!t)throw new Error("No response from API");const a="image/png"===t.headers.get("content-type")?"png":"jpg",e=(new Date).toLocaleString(),s=`snapshot_${(0,r.Y)(this.stateObj.entity_id)}_${e}.${a}`,o=await t.blob(),i=window.URL.createObjectURL(o);(0,h.R)(i,s)}catch(t){return this._waiting=!1,a.actionError(),void(0,l.P)(this,{message:this.hass.localize("ui.dialogs.more_info_control.camera.failed_to_download")})}this._waiting=!1,a.actionSuccess()}constructor(...t){super(...t),this._attached=!1,this._waiting=!1}}_.styles=i.AH`:host{display:block}.actions{width:100%;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end;box-sizing:border-box;padding:var(--ha-space-4);z-index:1;gap:var(--ha-space-2)}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"stateObj",void 0),(0,o.Cg)([(0,n.wk)()],_.prototype,"_attached",void 0),(0,o.Cg)([(0,n.wk)()],_.prototype,"_waiting",void 0),_=(0,o.Cg)([(0,n.EM)("more-info-camera")],_),s()}catch(t){s(t)}})},30039(t,a,e){e.d(a,{R:()=>o,h:()=>i});var s=e(22348);const o=(t,a="")=>{const e=document.createElement("a");e.target="_blank",e.href=t,e.download=a,e.style.display="none",document.body.appendChild(e),e.dispatchEvent(new MouseEvent("click")),document.body.removeChild(e)},i=t=>!(0,s.V)(t)||!!t.auth.external?.config.downloadFileSupported},22348(t,a,e){e.d(a,{V:()=>o});var s=e(37177);const o=t=>!!t.auth.external&&s.n},37177(t,a,e){e.d(a,{n:()=>s});const s=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}};
//# sourceMappingURL=65742.650d525547581b48.js.map