export const __rspack_esm_id="82158";export const __rspack_esm_ids=["82158"];export const __webpack_modules__={5981(t,e,a){a.a(t,async function(t,o){try{a.r(e);a(18111),a(61701);var s=a(62826),i=a(96196),n=a(97735),l=a(1087),h=a(82286),r=a(18350),c=(a(48374),a(93444),a(26300)),d=(a(28732),a(606)),_=(a(75709),a(72554)),u=a(46049),p=a(14503),v=t([r,c,d,_]);[r,c,d,_]=v.then?(await v)():v;const b="M8,5.14V19.14L19,12.14L8,5.14Z",g="M18,18H6V6H18V18Z";class m extends i.WF{showDialog({stateObj:t}){this._stateObj=t,this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._open=!1,this._stateObj=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._stateObj)return i.s6;const t=(0,h.$)(this._stateObj,u.n.TONES)&&this._stateObj.attributes.available_tones,e=(0,h.$)(this._stateObj,u.n.VOLUME_SET),a=(0,h.$)(this._stateObj,u.n.DURATION);return i.qy` <ha-dialog .open="${this._open}" .hass="${this.hass}" header-title="${this.hass.localize("ui.components.siren.advanced_controls")}" @closed="${this._dialogClosed}"> <div> <div class="options"> ${t?i.qy` <ha-select .label="${this.hass.localize("ui.components.siren.tone")}" @selected="${this._handleToneChange}" .value="${this._tone}" .options="${Object.entries(this._stateObj.attributes.available_tones).map(([t,e])=>({value:Array.isArray(this._stateObj.attributes.available_tones)?e:t,label:e}))}"> </ha-select> `:i.s6} ${e?i.qy` <ha-textfield type="number" .label="${this.hass.localize("ui.components.siren.volume")}" .suffix="${"%"}" .value="${this._volume?100*this._volume:void 0}" @change="${this._handleVolumeChange}" .min="${0}" .max="${100}" .step="${1}"></ha-textfield> `:i.s6} ${a?i.qy` <ha-textfield type="number" .label="${this.hass.localize("ui.components.siren.duration")}" .value="${this._duration}" suffix="s" @change="${this._handleDurationChange}"></ha-textfield> `:i.s6} </div> <div class="controls"> <ha-control-button .label="${this.hass.localize("ui.card.common.turn_on")}" @click="${this._turnOn}"> <ha-svg-icon .path="${b}"></ha-svg-icon> </ha-control-button> <ha-control-button .label="${this.hass.localize("ui.card.common.turn_off")}" @click="${this._turnOff}"> <ha-svg-icon .path="${g}"></ha-svg-icon> </ha-control-button> </div> </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}"> ${this.hass.localize("ui.common.close")} </ha-button> </ha-dialog-footer> </ha-dialog> `}_handleToneChange(t){this._tone=t.detail.value}_handleVolumeChange(t){this._volume=parseFloat(t.target.value)/100,isNaN(this._volume)&&(this._volume=void 0)}_handleDurationChange(t){this._duration=parseInt(t.target.value),isNaN(this._duration)&&(this._duration=void 0)}async _turnOn(){await this.hass.callService("siren","turn_on",{entity_id:this._stateObj.entity_id,tone:this._tone,volume_level:this._volume,duration:this._duration})}async _turnOff(){await this.hass.callService("siren","turn_off",{entity_id:this._stateObj.entity_id})}static get styles(){return[p.RF,i.AH`.options{display:flex;flex-direction:column;gap:var(--ha-space-4)}.controls{display:flex;flex-direction:row;justify-content:center;gap:var(--ha-space-4);margin-top:var(--ha-space-4)}ha-control-button{--control-button-border-radius:var(--ha-border-radius-xl);--mdc-icon-size:24px;width:64px;height:64px}`]}constructor(...t){super(...t),this._open=!1}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,s.Cg)([(0,n.wk)()],m.prototype,"_stateObj",void 0),(0,s.Cg)([(0,n.wk)()],m.prototype,"_open",void 0),(0,s.Cg)([(0,n.wk)()],m.prototype,"_tone",void 0),(0,s.Cg)([(0,n.wk)()],m.prototype,"_volume",void 0),(0,s.Cg)([(0,n.wk)()],m.prototype,"_duration",void 0),m=(0,s.Cg)([(0,n.EM)("ha-more-info-siren-advanced-controls")],m),o()}catch(t){o(t)}})}};
//# sourceMappingURL=82158.0e8ed335aff249e9.js.map