2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["7615"],{81036:function(e,t,n){n.d(t,{U:function(){return i}});const i=e=>e.stopPropagation()},74064:function(e,t,n){var i=n(73577),o=n(72621),a=(n(71695),n(47021),n(65703)),r=n(46289),s=n(57243),l=n(50778);let d,c,u,p=e=>e;(0,i.Z)([(0,l.Mo)("ha-list-item")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"method",key:"renderRipple",value:function(){return this.noninteractive?"":(0,o.Z)(n,"renderRipple",this,3)([])}},{kind:"get",static:!0,key:"styles",value:function(){return[r.W,(0,s.iv)(d||(d=p`:host{padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-inline-start:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));padding-inline-end:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px))}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:48px}span.material-icons:first-of-type{margin-inline-start:0px!important;margin-inline-end:var(--mdc-list-item-graphic-margin,16px)!important;direction:var(--direction)!important}span.material-icons:last-of-type{margin-inline-start:auto!important;margin-inline-end:0px!important;direction:var(--direction)!important}.mdc-deprecated-list-item__meta{display:var(--mdc-list-item-meta-display);align-items:center;flex-shrink:0}:host([graphic=icon]:not([twoline])) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,20px)!important}:host([multiline-secondary]){height:auto}:host([multiline-secondary]) .mdc-deprecated-list-item__text{padding:8px 0}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text{text-overflow:initial;white-space:normal;overflow:auto;display:inline-block;margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text{margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text::before{display:none}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text::before{display:none}:host([disabled]){color:var(--disabled-text-color)}:host([noninteractive]){pointer-events:unset}`)),"rtl"===document.dir?(0,s.iv)(c||(c=p`span.material-icons:first-of-type,span.material-icons:last-of-type{direction:rtl!important;--direction:rtl}`)):(0,s.iv)(u||(u=p``))]}}]}}),a.K)},58130:function(e,t,n){var i=n(73577),o=n(72621),a=(n(71695),n(40251),n(47021),n(60930)),r=n(9714),s=n(57243),l=n(50778),d=n(56587),c=n(30137);n(59897);let u,p,h,m,g=e=>e;(0,i.Z)([(0,l.Mo)("ha-select")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,reflect:!0})],key:"clearable",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({attribute:"inline-arrow",type:Boolean})],key:"inlineArrow",value(){return!1}},{kind:"method",key:"render",value:function(){return(0,s.dy)(u||(u=g` ${0} ${0} `),(0,o.Z)(n,"render",this,3)([]),this.clearable&&!this.required&&!this.disabled&&this.value?(0,s.dy)(p||(p=g`<ha-icon-button label="clear" @click="${0}" .path="${0}"></ha-icon-button>`),this._clearValue,"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"):s.Ld)}},{kind:"method",key:"renderLeadingIcon",value:function(){return this.icon?(0,s.dy)(h||(h=g`<span class="mdc-select__icon"><slot name="icon"></slot></span>`)):s.Ld}},{kind:"method",key:"connectedCallback",value:function(){(0,o.Z)(n,"connectedCallback",this,3)([]),window.addEventListener("translations-updated",this._translationsUpdated)}},{kind:"method",key:"firstUpdated",value:async function(){var e;((0,o.Z)(n,"firstUpdated",this,3)([]),this.inlineArrow)&&(null===(e=this.shadowRoot)||void 0===e||null===(e=e.querySelector(".mdc-select__selected-text-container"))||void 0===e||e.classList.add("inline-arrow"))}},{kind:"method",key:"updated",value:function(e){if((0,o.Z)(n,"updated",this,3)([e]),e.has("inlineArrow")){var t;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".mdc-select__selected-text-container");this.inlineArrow?null==e||e.classList.add("inline-arrow"):null==e||e.classList.remove("inline-arrow")}}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(n,"disconnectedCallback",this,3)([]),window.removeEventListener("translations-updated",this._translationsUpdated)}},{kind:"method",key:"_clearValue",value:function(){!this.disabled&&this.value&&(this.valueSetDirectly=!0,this.select(-1),this.mdcFoundation.handleChange())}},{kind:"field",key:"_translationsUpdated",value(){return(0,d.D)((async()=>{await(0,c.y)(),this.layoutOptions()}),500)}},{kind:"field",static:!0,key:"styles",value(){return[r.W,(0,s.iv)(m||(m=g`:host([clearable]){position:relative}.mdc-select:not(.mdc-select--disabled) .mdc-select__icon{color:var(--secondary-text-color)}.mdc-select__anchor{width:var(--ha-select-min-width,200px)}.mdc-select--filled .mdc-select__anchor{height:var(--ha-select-height,56px)}.mdc-select--filled .mdc-floating-label{inset-inline-start:12px;inset-inline-end:initial;direction:var(--direction)}.mdc-select--filled.mdc-select--with-leading-icon .mdc-floating-label{inset-inline-start:48px;inset-inline-end:initial;direction:var(--direction)}.mdc-select .mdc-select__anchor{padding-inline-start:12px;padding-inline-end:0px;direction:var(--direction)}.mdc-select__anchor .mdc-floating-label--float-above{transform-origin:var(--float-start)}.mdc-select__selected-text-container{padding-inline-end:var(--select-selected-text-padding-end,0px)}:host([clearable]) .mdc-select__selected-text-container{padding-inline-end:var(--select-selected-text-padding-end,12px)}ha-icon-button{position:absolute;top:10px;right:28px;--mdc-icon-button-size:36px;--mdc-icon-size:20px;color:var(--secondary-text-color);inset-inline-start:initial;inset-inline-end:28px;direction:var(--direction)}.inline-arrow{flex-grow:0}`))]}}]}}),a.K)},19778:function(e,t,n){n.r(t),n.d(t,{HaConversationAgentSelector:()=>Z});var i=n("73577"),o=(n("71695"),n("47021"),n("57243")),a=n("50778"),r=n("72621"),s=(n("19083"),n("40251"),n("61006"),n("39527"),n("67670"),n("13334"),n("11297")),l=n("81036"),d=n("56587"),c=n("87055"),u=n("31762"),p=n("1275");n("19423");const h=(e,t)=>{var n;return e.callApi("POST","config/config_entries/options/flow",{handler:t,show_advanced_options:Boolean(null===(n=e.userData)||void 0===n?void 0:n.showAdvanced)})},m=(e,t)=>e.callApi("GET",`config/config_entries/options/flow/${t}`),g=(e,t,n)=>e.callApi("POST",`config/config_entries/options/flow/${t}`,n),v=(e,t)=>e.callApi("DELETE",`config/config_entries/options/flow/${t}`);var f=n("43373");let _,y,k,b,w,$,x=e=>e;n("74064"),n("58130");var C=n("60498");let L,S,F,z,E,A=e=>e;const B="__NONE_OPTION__";(0,i.Z)([(0,a.Mo)("ha-conversation-agent-picker")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,a.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"language",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Boolean,reflect:!0})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,a.SB)()],key:"_agents",value:void 0},{kind:"field",decorators:[(0,a.SB)()],key:"_configEntry",value:void 0},{kind:"method",key:"render",value:function(){var e;if(!this._agents)return o.Ld;let t=this.value;if(!t&&this.required){for(const e of this._agents)if("conversation.home_assistant"===e.id&&e.supported_languages.includes(this.language)){t=e.id;break}if(!t)for(const e of this._agents)if("*"===e.supported_languages&&e.supported_languages.includes(this.language)){t=e.id;break}}return t||(t=B),(0,o.dy)(L||(L=A` <ha-select .label="${0}" .value="${0}" .required="${0}" .disabled="${0}" @selected="${0}" @closed="${0}" fixedMenuPosition naturalMenuWidth> ${0} ${0}</ha-select>${0} `),this.label||this.hass.localize("ui.components.coversation-agent-picker.conversation_agent"),t,this.required,this.disabled,this._changed,l.U,this.required?o.Ld:(0,o.dy)(S||(S=A`<ha-list-item .value="${0}"> ${0} </ha-list-item>`),B,this.hass.localize("ui.components.coversation-agent-picker.none")),this._agents.map((e=>(0,o.dy)(F||(F=A`<ha-list-item .value="${0}" .disabled="${0}"> ${0} </ha-list-item>`),e.id,"*"!==e.supported_languages&&0===e.supported_languages.length,e.name))),null!==(e=this._configEntry)&&void 0!==e&&e.supports_options?(0,o.dy)(z||(z=A`<ha-icon-button .path="${0}" @click="${0}"></ha-icon-button>`),"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",this._openOptionsFlow):"")}},{kind:"method",key:"willUpdate",value:function(e){(0,r.Z)(n,"willUpdate",this,3)([e]),this.hasUpdated?e.has("language")&&this._debouncedUpdateAgents():this._updateAgents(),e.has("value")&&this._maybeFetchConfigEntry()}},{kind:"method",key:"_maybeFetchConfigEntry",value:async function(){if(this.value&&this.value in this.hass.entities)try{const e=await(0,C.L3)(this.hass,this.value);if(!e.config_entry_id)return void(this._configEntry=void 0);this._configEntry=(await(0,c.RQ)(this.hass,e.config_entry_id)).config_entry}catch(e){this._configEntry=void 0}else this._configEntry=void 0}},{kind:"field",key:"_debouncedUpdateAgents",value(){return(0,d.D)((()=>this._updateAgents()),500)}},{kind:"method",key:"_updateAgents",value:async function(){const{agents:e}=await(0,u.rM)(this.hass,this.language,this.hass.config.country||void 0);if(this._agents=e,!this.value)return;const t=e.find((e=>e.id===this.value));(0,s.B)(this,"supported-languages-changed",{value:null==t?void 0:t.supported_languages}),(!t||"*"!==t.supported_languages&&0===t.supported_languages.length)&&(this.value=void 0,(0,s.B)(this,"value-changed",{value:this.value}))}},{kind:"method",key:"_openOptionsFlow",value:async function(){var e,t,n;this._configEntry&&(e=this,t=this._configEntry,n={manifest:await(0,p.t4)(this.hass,this._configEntry.domain)},(0,f.w)(e,Object.assign({startFlowHandler:t.entry_id,domain:t.domain},n),{flowType:"options_flow",showDevices:!1,createFlow:async(e,n)=>{const[i]=await Promise.all([h(e,n),e.loadFragmentTranslation("config"),e.loadBackendTranslation("options",t.domain),e.loadBackendTranslation("selector",t.domain)]);return i},fetchFlow:async(e,n)=>{const[i]=await Promise.all([m(e,n),e.loadFragmentTranslation("config"),e.loadBackendTranslation("options",t.domain),e.loadBackendTranslation("selector",t.domain)]);return i},handleFlowStep:g,deleteFlow:v,renderAbortDescription(e,n){const i=e.localize(`component.${n.translation_domain||t.domain}.options.abort.${n.reason}`,n.description_placeholders);return i?(0,o.dy)(_||(_=x` <ha-markdown breaks allow-svg .content="${0}"></ha-markdown> `),i):n.reason},renderShowFormStepHeader(e,n){return e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.title`,n.description_placeholders)||e.localize("ui.dialogs.options_flow.form.header")},renderShowFormStepDescription(e,n){const i=e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.description`,n.description_placeholders);return i?(0,o.dy)(y||(y=x` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),i):""},renderShowFormStepFieldLabel(e,n,i,o){var a;if("expandable"===i.type)return e.localize(`component.${t.domain}.options.step.${n.step_id}.sections.${i.name}.name`);const r=null!=o&&null!==(a=o.path)&&void 0!==a&&a[0]?`sections.${o.path[0]}.`:"";return e.localize(`component.${t.domain}.options.step.${n.step_id}.${r}data.${i.name}`)||i.name},renderShowFormStepFieldHelper(e,n,i,a){var r;if("expandable"===i.type)return e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.sections.${i.name}.description`);const s=null!=a&&null!==(r=a.path)&&void 0!==r&&r[0]?`sections.${a.path[0]}.`:"",l=e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.${s}data_description.${i.name}`,n.description_placeholders);return l?(0,o.dy)(k||(k=x`<ha-markdown breaks .content="${0}"></ha-markdown>`),l):""},renderShowFormStepFieldError(e,n,i){return e.localize(`component.${n.translation_domain||t.domain}.options.error.${i}`,n.description_placeholders)||i},renderShowFormStepFieldLocalizeValue(e,n,i){return e.localize(`component.${t.domain}.selector.${i}`)},renderShowFormStepSubmitButton(e,n){return e.localize(`component.${t.domain}.options.step.${n.step_id}.submit`)||e.localize("ui.panel.config.integrations.config_flow."+(!1===n.last_step?"next":"submit"))},renderExternalStepHeader(e,t){return""},renderExternalStepDescription(e,t){return""},renderCreateEntryDescription(e,t){return(0,o.dy)(b||(b=x` <p>${0}</p> `),e.localize("ui.dialogs.options_flow.success.description"))},renderShowFormProgressHeader(e,n){return e.localize(`component.${t.domain}.options.step.${n.step_id}.title`)||e.localize(`component.${t.domain}.title`)},renderShowFormProgressDescription(e,n){const i=e.localize(`component.${n.translation_domain||t.domain}.options.progress.${n.progress_action}`,n.description_placeholders);return i?(0,o.dy)(w||(w=x` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),i):""},renderMenuHeader(e,n){return e.localize(`component.${t.domain}.options.step.${n.step_id}.title`)||e.localize(`component.${t.domain}.title`)},renderMenuDescription(e,n){const i=e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.description`,n.description_placeholders);return i?(0,o.dy)($||($=x` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),i):""},renderMenuOption(e,n,i){return e.localize(`component.${n.translation_domain||t.domain}.options.step.${n.step_id}.menu_options.${i}`,n.description_placeholders)},renderLoadingDescription(e,n){return e.localize(`component.${t.domain}.options.loading`)||("loading_flow"===n||"loading_step"===n?e.localize(`ui.dialogs.options_flow.loading.${n}`,{integration:(0,p.Lh)(e.localize,t.domain)}):"")}}))}},{kind:"get",static:!0,key:"styles",value:function(){return(0,o.iv)(E||(E=A`:host{display:flex;align-items:center}ha-select{width:100%}ha-icon-button{color:var(--secondary-text-color)}`))}},{kind:"method",key:"_changed",value:function(e){var t;const n=e.target;!this.hass||""===n.value||n.value===this.value||void 0===this.value&&n.value===B||(this.value=n.value===B?void 0:n.value,(0,s.B)(this,"value-changed",{value:this.value}),(0,s.B)(this,"supported-languages-changed",{value:null===(t=this._agents.find((e=>e.id===this.value)))||void 0===t?void 0:t.supported_languages}))}}]}}),o.oi);let O,M,T=e=>e,Z=(0,i.Z)([(0,a.Mo)("ha-selector-conversation_agent")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"selector",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,a.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,a.Cb)({type:Boolean})],key:"required",value(){return!0}},{kind:"field",decorators:[(0,a.Cb)({attribute:!1})],key:"context",value:void 0},{kind:"method",key:"render",value:function(){var e,t;return(0,o.dy)(O||(O=T`<ha-conversation-agent-picker .hass="${0}" .value="${0}" .language="${0}" .label="${0}" .helper="${0}" .disabled="${0}" .required="${0}"></ha-conversation-agent-picker>`),this.hass,this.value,(null===(e=this.selector.conversation_agent)||void 0===e?void 0:e.language)||(null===(t=this.context)||void 0===t?void 0:t.language),this.label,this.helper,this.disabled,this.required)}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(M||(M=T`ha-conversation-agent-picker{width:100%}`))}}]}}),o.oi)},31762:function(e,t,n){n.d(t,{rM:function(){return o},zt:function(){return i}});let i=function(e){return e[e.CONTROL=1]="CONTROL",e}({});const o=(e,t,n)=>e.callWS({type:"conversation/agent/list",language:t,country:n})},60498:function(e,t,n){n.d(t,{L3:function(){return r},Mw:function(){return l},vA:function(){return a},w1:function(){return s}});n(19083),n(71695),n(61893),n(19423),n(39527),n(99790),n(67670),n(47021);var i=n(27486),o=n(73525);n(32770),n(56587);const a=(e,t)=>{if(t.name)return t.name;const n=e.states[t.entity_id];return n?(0,o.C)(n):t.original_name?t.original_name:t.entity_id},r=(e,t)=>e.callWS({type:"config/entity_registry/get",entity_id:t}),s=(0,i.Z)((e=>{const t={};for(const n of e)t[n.entity_id]=n;return t})),l=(0,i.Z)((e=>{const t={};for(const n of e)t[n.id]=n;return t}))},1275:function(e,t,n){n.d(t,{F3:function(){return o},Lh:function(){return i},t4:function(){return a}});n(56587);const i=(e,t,n)=>e(`component.${t}.title`)||(null==n?void 0:n.name)||t,o=(e,t)=>{const n={type:"manifest/list"};return t&&(n.integrations=t),e.callWS(n)},a=(e,t)=>e.callWS({type:"manifest/get",integration:t})},43373:function(e,t,n){n.d(t,{w:function(){return a}});n(71695),n(19423),n(40251),n(47021);var i=n(11297);const o=()=>Promise.all([n.e("6379"),n.e("6931"),n.e("2174"),n.e("1206"),n.e("2517"),n.e("9045")]).then(n.bind(n,22975)),a=(e,t,n)=>{(0,i.B)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:o,dialogParams:Object.assign(Object.assign({},t),{},{flowConfig:n,dialogParentElement:e})})}}}]);
|
|
//# sourceMappingURL=7615.d167dcef2bfd491f.js.map
|