export const __rspack_esm_id="89691";export const __rspack_esm_ids=["89691"];export const __webpack_modules__={17022(t,i,e){e.d(i,{A1:()=>o,CY:()=>n,Fn:()=>s,Jz:()=>r,St:()=>c,VA:()=>_,WI:()=>d,iY:()=>h,xw:()=>a});const o=(t,i)=>t.callWS({type:"media_source/resolve_media",media_content_id:i}),s=(t,i)=>t.callWS({type:"media_source/browse_media",media_content_id:i}),a="__MANUAL_ENTRY__",n=t=>t.startsWith(a),c=t=>t.startsWith("media-source://"),r=t=>t.startsWith("media-source://media_source"),h=t=>t.startsWith("media-source://image_upload"),_=async(t,i,e)=>{const o=new FormData;o.append("media_content_id",i),o.append("file",e);const s=await t.fetchWithAuth("/api/media_source/local_source/upload",{method:"POST",body:o});if(413===s.status)throw new Error(`Uploaded file is too large (${e.name})`);if(200!==s.status)throw new Error("Unknown error");return s.json()},d=async(t,i)=>t.callWS({type:"media_source/local_source/remove",media_content_id:i})},86063(t,i,e){e.a(t,async function(t,o){try{e.r(i),e.d(i,{STUB_IMAGE:()=>b});var s=e(62826),a=e(96196),n=e(44457),c=e(94333),r=e(32288),h=e(42372),_=e(71727),d=(e(76776),e(67013)),g=e(19037),m=e(37642),f=e(13632),l=e(37544),u=e(97176),p=e(784),y=e(57914),w=e(85979),v=t([y]);y=(v.then?(await v)():v)[0];const b="https://demo.home-assistant.io/stub_config/bedroom.png";class $ extends a.WF{static async getConfigElement(){return await e.e("76999").then(e.bind(e,98458)),document.createElement("hui-picture-entity-card-editor")}static getStubConfig(t,i,e){return{type:"picture-entity",entity:(0,f.B)(t,1,i,e,["light","switch"])[0]||"",image:b}}getCardSize(){return 3}setConfig(t){if(!t||!t.entity)throw new Error("Entity must be specified");if(!(["camera","image","person"].includes((0,_.m)(t.entity))||t.image||t.state_image||t.camera_image))throw new Error("No image source configured");this._config={show_name:!0,show_state:!0,tap_action:{action:"more-info"},...t}}shouldUpdate(t){return(0,p.LX)(this,t)}updated(t){if(super.updated(t),!this._config||!this.hass)return;const i=t.get("hass"),e=t.get("_config");i&&e&&i.themes===this.hass.themes&&e.theme===this._config.theme||(0,h.Q)(this,this.hass.themes,this._config.theme)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];if(!t)return a.qy` <hui-warning .hass="${this.hass}"> ${(0,w.j)(this.hass,this._config.entity)} </hui-warning> `;const i=(0,m.v)(this.hass,t,this._config.name),e=this.hass.formatEntityState(t);let o="";this._config.show_name&&this._config.show_state?o=a.qy` <div class="footer both"> <div>${i}</div> <div>${e}</div> </div> `:this._config.show_name?o=a.qy`<div class="footer single">${i}</div>`:this._config.show_state&&(o=a.qy`<div class="footer single">${e}</div>`);const s=(0,_.m)(this._config.entity);let n="object"==typeof this._config?.image&&this._config.image.media_content_id||this._config.image;if(!n)switch(s){case"image":n=(0,d.e)(t);break;case"person":t.attributes.entity_picture&&(n=t.attributes.entity_picture)}const h="grid"===this.layout&&"number"==typeof this._config.grid_options?.rows,f=(0,u.h)(this._config.tap_action)||Boolean(!this._config.tap_action&&this._config.entity);return a.qy` <ha-card> <div class="image-container ${(0,c.H)({clickable:f})}" @action="${this._handleAction}" .actionHandler="${(0,g.T)({hasHold:(0,u.h)(this._config.hold_action),hasDoubleClick:(0,u.h)(this._config.double_tap_action)})}" tabindex="${(0,r.J)(f?"0":void 0)}" role="${(0,r.J)(f?"0":void 0)}"> <hui-image .hass="${this.hass}" .image="${n}" .stateImage="${this._config.state_image}" .stateFilter="${this._config.state_filter}" .cameraImage="${"camera"===s?this._config.entity:this._config.camera_image}" .cameraView="${this._config.camera_view}" .entity="${this._config.entity}" .aspectRatio="${h?void 0:this._config.aspect_ratio}" .fitMode="${this._config.fit_mode}"></hui-image> </div> ${o} </ha-card> `}_handleAction(t){(0,l.$)(this,this.hass,this._config,t.detail.action)}}$.styles=a.AH`ha-card{min-height:75px;overflow:hidden;position:relative;height:100%;box-sizing:border-box}.image-container{height:100%}.image-container.clickable{cursor:pointer}hui-image{pointer-events:none;height:100%}.footer{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:absolute;left:0;right:0;bottom:0;background-color:var(--ha-picture-card-background-color,rgba(0,0,0,.3));padding:16px;font-size:var(--ha-font-size-l);line-height:16px;color:var(--ha-picture-card-text-color,#fff);pointer-events:none}.both{display:flex;justify-content:space-between}.single{text-align:center}`,(0,s.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"layout",void 0),(0,s.Cg)([(0,n.wk)()],$.prototype,"_config",void 0),$=(0,s.Cg)([(0,n.EM)("hui-picture-entity-card")],$),o()}catch(t){o(t)}})}};
//# sourceMappingURL=89691.ecf20393433fec29.js.map