export const __rspack_esm_id="28245";export const __rspack_esm_ids=["28245"];export const __webpack_modules__={55881(t,i,e){e.d(i,{AQ:()=>u,Z0:()=>o,Zs:()=>h,hW:()=>d,jW:()=>c,pc:()=>l});var s=e(48927),n=e(22675),a=e(59241),o=function(t){return t[t.OPEN=1]="OPEN",t}({});function c(t){return"jammed"===t.state}function r(t){return["opening","unlocking","locking"].includes(t.state)}function l(t){if(t.state===n.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return"open"===t.state}(t)&&!r(t)}function u(t){if(t.state===n.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return"locked"===t.state}(t)&&!r(t)}function h(t){if(t.state===n.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return"unlocked"===t.state}(t)&&!r(t)}const d=async(t,i,e,n)=>{let o;const c=await(0,a.v)(i,e.entity_id).catch(()=>{}),r=c?.options?.lock?.default_code;if(e.attributes.code_format&&!r){const a=await(0,s.H)(t,{codeFormat:"text",codePattern:e.attributes.code_format,title:i.localize(`ui.card.lock.${n}`),submitText:i.localize(`ui.card.lock.${n}`)});if(null==a)throw new Error("Code dialog closed");o=a}await i.callService("lock",n,{entity_id:e.entity_id,code:o})}},48927(t,i,e){e.d(i,{H:()=>n});var s=e(1087);const n=(t,i)=>new Promise(n=>{const a=i.cancel,o=i.submit;(0,s.r)(t,"show-dialog",{dialogTag:"dialog-enter-code",dialogImport:()=>Promise.all([e.e("44533"),e.e("93785"),e.e("12036"),e.e("29130")]).then(e.bind(e,24561)),dialogParams:{...i,cancel:()=>{n(null),a&&a()},submit:t=>{n(t),o&&o(t)}}})})},49748(t,i,e){e.a(t,async function(t,s){try{e.r(i);var n=e(62826),a=e(96196),o=e(44457),c=e(18350),r=e(22675),l=e(55881),u=e(99936),h=e(784),d=e(79757),f=e(85979),g=t([c,d]);[c,d]=g.then?(await g)():g;class _ extends a.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}shouldUpdate(t){return(0,h.LX)(this,t)}render(){if(!this._config||!this.hass)return a.s6;const t=this.hass.states[this._config.entity];return t?a.qy` <hui-generic-entity-row .hass="${this.hass}" .config="${this._config}"> <ha-button appearance="plain" size="small" @click="${this._callService}" .disabled="${(0,r.g0)(t.state)}" class="text-content"> ${"locked"===t.state?this.hass.localize("ui.card.lock.unlock"):this.hass.localize("ui.card.lock.lock")} </ha-button> </hui-generic-entity-row> `:a.qy` <hui-warning .hass="${this.hass}"> ${(0,f.j)(this.hass,this._config.entity)} </hui-warning> `}async _callService(t){t.stopPropagation();const i=this.hass.states[this._config.entity],e="locked"===i.state?"unlock":"lock";this._config?.confirmation&&!await(0,u.f)(this,this.hass,this._config.confirmation,this.hass.localize(`ui.card.lock.${e}`))||(0,l.hW)(this,this.hass,i,e)}}_.styles=a.AH`ha-button{margin-right:-.57em;margin-inline-end:-.57em;margin-inline-start:initial}`,(0,n.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,n.Cg)([(0,o.wk)()],_.prototype,"_config",void 0),_=(0,n.Cg)([(0,o.EM)("hui-lock-entity-row")],_),s()}catch(t){s(t)}})}};
//# sourceMappingURL=28245.2debc251ead5c046.js.map