UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

17 lines 35.2 kB
/*! For license information please see 70018.c126402989da584f.js.LICENSE.txt */ export const __rspack_esm_id=70018;export const __rspack_esm_ids=[70018];export const __webpack_modules__={69093(t,e,a){a.d(e,{t:()=>i});var o=a(71727);const i=t=>(0,o.m)(t.entity_id)},82286(t,e,a){a.d(e,{$:()=>o});const o=(t,e)=>i(t.attributes,e),i=(t,e)=>0!==(t.supported_features&e)},64481(t,e,a){a.d(e,{D:()=>i,J:()=>s});a(64979);let o=!1;try{o="true"===window.localStorage.getItem("disableViewTransition")}catch{}const i=t=>{o=t},r=t=>{if(!(t=>(t instanceof DOMException||t instanceof Error)&&"AbortError"===t.name)(t))throw t},s=t=>{if(!document.startViewTransition||o)return t(!1),Promise.resolve();let e=!1;try{const a=document.startViewTransition(()=>{e=!0,t(!0)});return a.ready.catch(r),a.finished.catch(r)}catch(a){return console.warn("View transition failed, falling back to direct execution.",a),e?Promise.reject(a):(t(!1),Promise.resolve())}}},89300(t,e,a){a.a(t,async function(t,e){try{var o=a(62826),i=a(5124),r=a(22441),s=a(6412),n=a(18350),l=a(65829),d=(a(67094),t([n,l]));[n,l]=d.then?(await d)():d;const h="M2.2,16.06L3.88,12L2.2,7.94L6.26,6.26L7.94,2.2L12,3.88L16.06,2.2L17.74,6.26L21.8,7.94L20.12,12L21.8,16.06L17.74,17.74L16.06,21.8L12,20.12L7.94,21.8L6.26,17.74L2.2,16.06M13,17V15H11V17H13M13,13V7H11V13H13Z",c="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z";class p extends i.WF{render(){const t=this.progress||this._result?"accent":this.appearance;return i.qy` <ha-button .appearance="${t}" .disabled="${this.disabled}" .loading="${this.progress}" .variant="${"success"===this._result?"success":"error"===this._result?"danger":this.variant}" class="${(0,s.H)({result:!!this._result,success:"success"===this._result,error:"error"===this._result})}"> ${this.iconPath?i.qy`<ha-svg-icon .path="${this.iconPath}" slot="start"></ha-svg-icon>`:i.s6} <slot>${this.label}</slot> </ha-button> ${this._result?i.qy` <div class="progress"> ${"success"===this._result?i.qy`<ha-svg-icon .path="${c}"></ha-svg-icon>`:"error"===this._result?i.qy`<ha-svg-icon .path="${h}"></ha-svg-icon>`:i.s6} </div> `:i.s6} `}actionSuccess(){this._setResult("success")}actionError(){this._setResult("error")}_setResult(t){this._result=t,setTimeout(()=>{this._result=void 0},2e3)}constructor(...t){super(...t),this.disabled=!1,this.progress=!1,this.appearance="accent",this.variant="brand"}}p.styles=i.AH`:host{outline:0;display:inline-block;position:relative}:host([progress]){pointer-events:none}.progress{bottom:0;display:flex;justify-content:center;align-items:center;position:absolute;top:0;width:100%}ha-button{width:100%}ha-button.result::part(caret),ha-button.result::part(end),ha-button.result::part(label),ha-button.result::part(spinner),ha-button.result::part(start){visibility:hidden}:host([appearance=brand]) ha-svg-icon{color:var(--white-color)}`,(0,o.Cg)([(0,r.MZ)()],p.prototype,"label",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],p.prototype,"progress",void 0),(0,o.Cg)([(0,r.MZ)()],p.prototype,"appearance",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"iconPath",void 0),(0,o.Cg)([(0,r.MZ)()],p.prototype,"variant",void 0),(0,o.Cg)([(0,r.wk)()],p.prototype,"_result",void 0),p=(0,o.Cg)([(0,r.EM)("ha-progress-button")],p),e()}catch(t){e(t)}})},93444(t,e,a){var o=a(62826),i=a(5124),r=a(22441);class s extends i.WF{render(){return i.qy` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `}static get styles(){return[i.AH`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`]}}s=(0,o.Cg)([(0,r.EM)("ha-dialog-footer")],s)},76538(t,e,a){var o=a(62826),i=a(5124),r=a(22441);class s extends i.WF{render(){const t=i.qy`<div class="header-title"> <slot name="title"></slot> </div>`,e=i.qy`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`;return i.qy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${"above"===this.subtitlePosition?i.qy`${e}${t}`:i.qy`${t}${e}`} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}static get styles(){return[i.AH`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:center;padding:0 var(--ha-space-1);box-sizing:border-box}.header-content{flex:1;padding:10px var(--ha-space-1);display:flex;flex-direction:column;justify-content:center;min-height:var(--ha-space-12);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{height:var(--ha-dialog-header-title-height,calc(var(--ha-font-size-xl) + var(--ha-space-1)));font-size:var(--ha-font-size-xl);line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-medium);color:var(--ha-dialog-header-title-color,var(--primary-text-color))}.header-subtitle{font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal);color:var(--ha-dialog-header-subtitle-color,var(--secondary-text-color))}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:0 var(--ha-space-2)}}.header-navigation-icon{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}`]}constructor(...t){super(...t),this.subtitlePosition="below",this.showBorder=!1}}(0,o.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],s.prototype,"subtitlePosition",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],s.prototype,"showBorder",void 0),s=(0,o.Cg)([(0,r.EM)("ha-dialog-header")],s)},72554(t,e,a){a.a(t,async function(t,e){try{var o=a(62826),i=a(93900),r=a(35211),s=a(5124),n=a(22441),l=a(63672),d=a(1087),h=a(64481),c=a(22792),p=a(59992),u=a(14503),g=a(22348),v=(a(76538),a(26300)),f=t([i,v]);[i,v]=f.then?(await f)():f;const m="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";class b extends((0,p.V)(s.WF)){connectedCallback(){super.connectedCallback(),this.addEventListener("dialog-set-fullscreen",this._handleFullscreenChanged)}get scrollableElement(){return this.bodyContainer}updated(t){super.updated(t),t.has("open")&&(this._open=this.open)}render(){return s.qy` <wa-dialog .open="${this._open}" .lightDismiss="${!this.preventScrimClose}" without-header aria-labelledby="${(0,l.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0))}" aria-describedby="${(0,l.J)(this.ariaDescribedBy)}" @keydown="${this._handleKeyDown}" @wa-hide="${this._handleHide}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-after-hide="${this._handleAfterHide}"> ${this.withoutHeader?s.s6:s.qy`<slot name="header"> <ha-dialog-header .subtitlePosition="${this.headerSubtitlePosition}" .showBorder="${this._bodyScrolled}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${this._i18n?.localize?.("ui.common.close")??"Close"}" .path="${m}"></ha-icon-button> </slot> ${void 0!==this.headerTitle?s.qy`<span slot="title" class="title" id="ha-dialog-title"> ${this.headerTitle} </span>`:s.qy`<slot name="headerTitle" slot="title"></slot>`} ${void 0!==this.headerSubtitle?s.qy`<span slot="subtitle">${this.headerSubtitle}</span>`:s.qy`<slot name="headerSubtitle" slot="subtitle"></slot>`} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`} <div class="content-wrapper"> <div class="body ha-scrollbar" @scroll="${this._handleBodyScroll}"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(t){this._open?(0,h.J)(()=>{this._setFullscreen(t.detail)}):this._setFullscreen(t.detail)}_setFullscreen(t){this.toggleAttribute("fullscreen",t)}_handleBodyScroll(t){this._bodyScrolled=t.target.scrollTop>0}_handleKeyDown(t){"Escape"===t.key&&(this._escapePressed=!0,this.preventScrimClose&&t.preventDefault(),t.stopPropagation(),t.currentTarget.open=!1)}_handleHide(t){const e=t.detail?.source===t.target.dialog;this.preventScrimClose&&this._escapePressed&&e&&t.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,s.AH`wa-dialog{--full-width:var( --ha-dialog-width-full, min(95vw, var(--safe-width)) );--width:min(var(--ha-dialog-width-md, 580px), var(--full-width));--spacing:var(--dialog-content-padding, var(--ha-space-6));--show-duration:var(--ha-dialog-show-duration, 200ms);--hide-duration:var(--ha-dialog-hide-duration, 200ms);--wa-color-surface-raised:var( --ha-dialog-surface-background, var(--card-background-color, var(--ha-color-surface-default)) );--wa-panel-border-radius:var( --ha-dialog-border-radius, var(--ha-border-radius-3xl) );max-width:var(--ha-dialog-max-width,var(--safe-width))}@media (prefers-reduced-motion:reduce){wa-dialog{--show-duration:0ms;--hide-duration:0ms}}:host([width=small]) wa-dialog{--width:min(var(--ha-dialog-width-sm, 320px), var(--full-width))}:host([width=large]) wa-dialog{--width:min(var(--ha-dialog-width-lg, 1024px), var(--full-width))}:host([fullscreen]) wa-dialog,:host([width=full]) wa-dialog{--width:var(--full-width)}:host([fullscreen]) wa-dialog::part(dialog){min-height:var(--safe-height);max-height:var(--safe-height);margin-top:0;transform:none}:host([fullscreen]) .content-wrapper{overflow:hidden}:host([fullscreen]) .body{overflow:hidden;padding:0}wa-dialog::part(dialog){-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);box-shadow:var(--dialog-box-shadow,var(--wa-shadow-l));color:var(--primary-text-color);min-width:var(--width,var(--full-width));max-width:var(--width,var(--full-width));max-height:var(--ha-dialog-max-height,calc(var(--safe-height) - var(--ha-space-20)));min-height:var(--ha-dialog-min-height);margin-top:var(--dialog-surface-margin-top,auto);transform:translate(calc(var(--safe-area-offset-left,0px) - var(--safe-area-offset-right,0px)),calc(var(--safe-area-offset-top,0px) - var(--safe-area-offset-bottom,0px)));display:flex;flex-direction:column;overflow:hidden}wa-dialog::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));background-color:var(--mdc-dialog-scrim-color,none)}@media all and (max-width:450px),all and (max-height:500px){:host([type=standard]){--ha-dialog-border-radius:0}:host([type=standard]) wa-dialog{--full-width:var(--ha-dialog-width-full, 100vw);--width:var(--full-width)}:host([type=standard]) wa-dialog::part(dialog){min-height:var(--ha-dialog-min-height,100vh);min-height:var(--ha-dialog-min-height,100dvh);max-height:var(--ha-dialog-max-height,100vh);max-height:var(--ha-dialog-max-height,100dvh);margin-top:0;margin-bottom:0;padding-top:var(--safe-area-inset-top);padding-bottom:var(--safe-area-inset-bottom);padding-left:var(--safe-area-inset-left);padding-right:var(--safe-area-inset-right);transform:none}}.header-title-container{display:flex;align-items:center}.header-title{margin:0;margin-bottom:0;color:var(--ha-dialog-header-title-color,var(--primary-text-color));font-size:var( --ha-dialog-header-title-font-size, var(--ha-font-size-2xl) );line-height:var( --ha-dialog-header-title-line-height, var(--ha-line-height-condensed) );font-weight:var(--ha-dialog-header-title-font-weight,var(--ha-font-weight-normal));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:var(--ha-space-3)}wa-dialog::part(body){padding:0;display:flex;flex-direction:column;max-width:100%;overflow:hidden}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6));overflow:auto;flex-grow:1}:host([flexcontent]) .body{max-width:100%;flex:1;display:flex;flex-direction:column}wa-dialog::part(footer){padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`]}constructor(...t){super(...t),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.flexContent=!1,this.withoutHeader=!1,this._open=!1,this._bodyScrolled=!1,this._escapePressed=!1,this._handleShow=async t=>{t.eventPhase===Event.AT_TARGET&&(this._open=!0,(0,d.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{if(this._hassConfig?.auth.external&&(0,g.V)(this._hassConfig.auth.external)){const t=this.querySelector("[autofocus]");return void(null!==t&&(t.id||(t.id="ha-dialog-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})))}this.querySelector("[autofocus]")?.focus()}))},this._handleAfterShow=t=>{t.eventPhase===Event.AT_TARGET&&(0,d.r)(this,"after-show")},this._handleAfterHide=t=>{t.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,d.r)(this,"closed"))}}}(0,o.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],b.prototype,"ariaLabelledBy",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],b.prototype,"ariaDescribedBy",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],b.prototype,"open",void 0),(0,o.Cg)([(0,n.MZ)({reflect:!0})],b.prototype,"type",void 0),(0,o.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],b.prototype,"width",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],b.prototype,"preventScrimClose",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-title"})],b.prototype,"headerTitle",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],b.prototype,"headerSubtitle",void 0),(0,o.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],b.prototype,"headerSubtitlePosition",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],b.prototype,"flexContent",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],b.prototype,"withoutHeader",void 0),(0,o.Cg)([(0,n.wk)()],b.prototype,"_open",void 0),(0,o.Cg)([(0,n.P)(".body")],b.prototype,"bodyContainer",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],b.prototype,"_i18n",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],b.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,n.wk)()],b.prototype,"_bodyScrolled",void 0),(0,o.Cg)([(0,n.Ls)({passive:!0})],b.prototype,"_handleBodyScroll",null),b=(0,o.Cg)([(0,n.EM)("ha-dialog")],b),e()}catch(t){e(t)}})},59992(t,e,a){a.d(e,{V:()=>l});var o=a(62826),i=a(88696),r=a(5124),s=a(6412),n=a(22441);const l=t=>{class e extends t{get scrollableElement(){return e.DEFAULT_SCROLLABLE_ELEMENT}firstUpdated(t){super.firstUpdated?.(t),this.scrollableElement&&this._updateScrollableState(this.scrollableElement),this._attachScrollableElement()}updated(t){super.updated?.(t),this._attachScrollableElement()}disconnectedCallback(){this._detachScrollableElement(),this._contentScrolled=!1,this._contentScrollable=!1,super.disconnectedCallback()}renderScrollableFades(t=!1){return r.qy` <div class="${(0,s.H)({"fade-top":!0,rounded:t,visible:this._contentScrolled})}"></div> <div class="${(0,s.H)({"fade-bottom":!0,rounded:t,visible:this._contentScrollable})}"></div> `}static get styles(){const t=Object.getPrototypeOf(this);var e;return[...void 0===(e=t?.styles??[])?[]:Array.isArray(e)?e:[e],r.AH`.fade-bottom,.fade-top{position:absolute;left:0;right:0;height:var(--ha-space-2);pointer-events:none;transition:opacity 180ms ease-in-out;border-radius:var(--ha-border-radius-square);opacity:0;background:linear-gradient(to bottom,var(--ha-color-shadow-scrollable-fade),transparent)}.fade-top{top:0}.fade-bottom{bottom:0;transform:rotate(180deg)}.fade-bottom.visible,.fade-top.visible{opacity:1}.fade-bottom.rounded,.fade-top.rounded{border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}.fade-top.rounded{border-top-left-radius:var(--ha-border-radius-square);border-top-right-radius:var(--ha-border-radius-square)}.fade-bottom.rounded{border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}`]}_attachScrollableElement(){const t=this.scrollableElement;t!==this._scrollTarget&&(this._detachScrollableElement(),t&&(this._scrollTarget=t,t.addEventListener("scroll",this._onScroll,{passive:!0}),this._resize.observe(t),this._updateScrollableState(t)))}_detachScrollableElement(){this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._onScroll),this._resize.unobserve?.(this._scrollTarget),this._scrollTarget=void 0)}_updateScrollableState(t){const e=parseFloat(getComputedStyle(t).getPropertyValue("--safe-area-inset-bottom"))||0,{scrollHeight:a=0,clientHeight:o=0,scrollTop:i=0}=t;this._contentScrollable=a-o>i+e+this.scrollFadeSafeAreaPadding}constructor(...t){super(...t),this._contentScrolled=!1,this._contentScrollable=!1,this._onScroll=t=>{const e=t.currentTarget;this._contentScrolled=(e.scrollTop??0)>this.scrollFadeThreshold,this._updateScrollableState(e)},this._resize=new i.P(this,{target:null,callback:t=>{const e=t[0]?.target;e&&this._updateScrollableState(e)}}),this.scrollFadeSafeAreaPadding=4,this.scrollFadeThreshold=4}}return e.DEFAULT_SCROLLABLE_ELEMENT=null,(0,o.Cg)([(0,n.wk)()],e.prototype,"_contentScrolled",void 0),(0,o.Cg)([(0,n.wk)()],e.prototype,"_contentScrollable",void 0),e}},24367(t,e,a){a.d(e,{L:()=>i,z:()=>r});var o=a(23832);const i=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],r=(0,o.g)(i)},67642(t,e,a){a.a(t,async function(t,o){try{a.r(e);a(74423);var i=a(62826),r=a(5124),s=a(22441),n=a(22786),l=a(1087),d=a(15638),h=a(89300),c=(a(93444),a(52763)),p=a(26300),u=a(72554),g=a(47351),v=a(96273),f=a(14503),m=a(36918),b=t([h,c,p,u]);[h,c,p,u]=b.then?(await b)():b;const w="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z",y=(0,n.A)((t,e,a,o)=>[{name:"name",required:!0,disabled:e,selector:{text:{}}},{name:"usage",required:!0,type:"select",options:[[v.h1.BACKUP,t("ui.panel.config.storage.network_mounts.mount_usage.backup")],[v.h1.MEDIA,t("ui.panel.config.storage.network_mounts.mount_usage.media")],[v.h1.SHARE,t("ui.panel.config.storage.network_mounts.mount_usage.share")]]},{name:"server",required:!0,selector:{text:{}}},{name:"type",required:!0,type:"select",options:[[v.Wu.CIFS,t("ui.panel.config.storage.network_mounts.mount_type.cifs")],[v.Wu.NFS,t("ui.panel.config.storage.network_mounts.mount_type.nfs")]]},..."nfs"===a?[{name:"path",required:!0,selector:{text:{}}}]:"cifs"===a?[...o?[{name:"version",required:!0,selector:{select:{options:[{label:t("ui.panel.config.storage.network_mounts.cifs_versions.auto"),value:"auto"},{label:t("ui.panel.config.storage.network_mounts.cifs_versions.legacy",{version:"2.0"}),value:"2.0"},{label:t("ui.panel.config.storage.network_mounts.cifs_versions.legacy",{version:"1.0"}),value:"1.0"}],mode:"dropdown"}}}]:[],{name:"share",required:!0,selector:{text:{}}},{name:"username",required:!1,selector:{text:{}}},{name:"password",required:!1,selector:{text:{type:"password"}}}]:[]]);class _ extends r.WF{async showDialog(t){this._data=t.mount,this._existing=void 0!==t.mount,this._reloadMounts=t.reloadMounts,this._open=!0,"cifs"===t.mount?.type&&t.mount.version&&"auto"!==t.mount.version&&(this._showCIFSVersion=!0)}closeDialog(){this._open=!1}_dialogClosed(){this._data=void 0,this._waiting=void 0,this._error=void 0,this._validationError=void 0,this._validationWarning=void 0,this._existing=void 0,this._showCIFSVersion=void 0,this._reloadMounts=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){return void 0===this._existing?r.s6:r.qy` <ha-dialog .open="${this._open}" header-title="${this._existing?this.hass.localize("ui.panel.config.storage.network_mounts.update_title"):this.hass.localize("ui.panel.config.storage.network_mounts.add_title")}" prevent-scrim-close @closed="${this._dialogClosed}"> <a slot="headerActionItems" class="header_button" href="${(0,m.o)(this.hass,"/common-tasks/os#network-storage")}" title="${this.hass.localize("ui.panel.config.storage.network_mounts.documentation")}" target="_blank" rel="noreferrer" dir="${(0,d.Vc)(this.hass)}"> <ha-icon-button .path="${w}"></ha-icon-button> </a> ${this._error?r.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:r.s6} <ha-form autofocus .data="${this._data}" .schema="${y(this.hass.localize,this._existing,this._data?.type,this._showCIFSVersion)}" .error="${this._validationError}" .warning="${this._validationWarning}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}" .computeError="${this._computeErrorCallback}" .computeWarning="${this._computeWarningCallback}" @value-changed="${this._valueChanged}"></ha-form> <ha-dialog-footer slot="footer"> ${this._existing?r.qy`<ha-button @click="${this._deleteMount}" variant="danger" slot="secondaryAction" appearance="plain"> ${this.hass.localize("ui.common.delete")} </ha-button>`:r.s6} <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-progress-button slot="primaryAction" .progress="${!!this._waiting}" @click="${this._connectMount}"> ${this._existing?this.hass.localize("ui.panel.config.storage.network_mounts.update"):this.hass.localize("ui.panel.config.storage.network_mounts.connect")} </ha-progress-button> </ha-dialog-footer> </ha-dialog> `}_valueChanged(t){this._validationError={},this._validationWarning={},this._data=t.detail.value,this._data?.name&&!/^\w+$/.test(this._data.name)&&(this._validationError.name="invalid_name"),"cifs"!==this._data?.type||this._data.version||(this._data.version="auto"),"cifs"===this._data?.type&&this._data.version&&["1.0","2.0"].includes(this._data.version)&&(this._validationWarning.version="not_recomeded_cifs_version")}async _connectMount(t){const e=t.target;this._error=void 0,this._waiting=!0;const a={...this._data};"cifs"===a.type&&"auto"===a.version&&(a.version=void 0);try{this._existing?await(0,v.Bt)(this.hass,a):await(0,v.Qf)(this.hass,a)}catch(t){return this._error=(0,g.VR)(t),this._waiting=!1,e.actionError(),void("cifs"!==this._data.type||this._showCIFSVersion||(this._showCIFSVersion=!0))}this._reloadMounts&&this._reloadMounts(),this.closeDialog()}async _deleteMount(){this._error=void 0,this._waiting=!0;try{await(0,v.wZ)(this.hass,this._data.name)}catch(t){return this._error=(0,g.VR)(t),void(this._waiting=!1)}this._reloadMounts&&this._reloadMounts(),this.closeDialog()}static get styles(){return[f.RF,f.nA,r.AH`ha-icon-button{color:var(--primary-text-color)}`]}constructor(...t){super(...t),this._open=!1,this._computeLabelCallback=t=>this.hass.localize(`ui.panel.config.storage.network_mounts.options.${t.name}.title`),this._computeHelperCallback=t=>this.hass.localize(`ui.panel.config.storage.network_mounts.options.${t.name}.description`),this._computeErrorCallback=t=>this.hass.localize(`ui.panel.config.storage.network_mounts.errors.${t}`)||t,this._computeWarningCallback=t=>this.hass.localize(`ui.panel.config.storage.network_mounts.warnings.${t}`)||t}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_data",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_waiting",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_error",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_validationError",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_validationWarning",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_existing",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_showCIFSVersion",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_reloadMounts",void 0),(0,i.Cg)([(0,s.wk)()],_.prototype,"_open",void 0),_=(0,i.Cg)([(0,s.EM)("dialog-mount-view")],_),o()}catch(t){o(t)}})},22348(t,e,a){a.d(e,{V:()=>i});var o=a(37177);const i=t=>!!t&&o.n},37177(t,e,a){a.d(e,{n:()=>o});const o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},48646(t,e,a){var o=a(69565),i=a(28551),r=a(1767),s=a(50851);t.exports=function(t,e){e&&"string"==typeof t||i(t);var a=s(t);return r(i(void 0!==a?o(a,t):t))}},30531(t,e,a){var o=a(46518),i=a(69565),r=a(79306),s=a(28551),n=a(1767),l=a(48646),d=a(19462),h=a(9539),c=a(96395),p=a(30684),u=a(84549);var g=!c&&!p("flatMap",function(){}),v=!c&&!g&&u("flatMap",TypeError),f=c||g||v||function(){try{var t=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(t){return t});t.next(),t.return()}catch(t){return!0}}(),m=d(function(){for(var t,e,a=this.iterator,o=this.mapper;;){if(e=this.inner)try{if(!(t=s(i(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){h(a,"throw",t)}if(t=s(i(this.next,a)),this.done=!!t.done)return;try{this.inner=l(o(t.value,this.counter++),!1)}catch(t){h(a,"throw",t)}}});o({target:"Iterator",proto:!0,real:!0,forced:f},{flatMap:function(t){s(this);try{r(t)}catch(t){h(this,"throw",t)}return v?i(v,this,t):new m(n(this),{mapper:t,inner:null})}})},93900(t,e,a){a.a(t,async function(t,e){try{var o=a(5124),i=a(22441),r=a(6412),s=a(63672),n=a(17051),l=a(42462),d=a(28438),h=a(98779),c=a(27259),p=a(25877),u=a(31247),g=a(4444),v=a(92070),f=a(9395),m=a(717),b=a(17060),w=a(88496),y=a(91470),_=t([w,b]);[w,b]=_.then?(await _)():_;var x=Object.defineProperty,k=Object.getOwnPropertyDescriptor,C=(t,e,a,o)=>{for(var i,r=o>1?void 0:o?k(e,a):e,s=t.length-1;s>=0;s--)(i=t[s])&&(r=(o?i(e,a,r):i(r))||r);return o&&r&&x(e,a,r),r};let $=class extends m.A{firstUpdated(){this.open&&(this.addOpenListeners(),this.dialog.showModal(),(0,g.JG)(this))}disconnectedCallback(){super.disconnectedCallback(),(0,g.I7)(this),this.removeOpenListeners()}async requestClose(t){const e=new d.L({source:t});if(this.dispatchEvent(e),e.defaultPrevented)return this.open=!0,void(0,c.Ud)(this.dialog,"pulse");this.removeOpenListeners(),await(0,c.Ud)(this.dialog,"hide"),this.open=!1,this.dialog.close(),(0,g.I7)(this);const a=this.originalTrigger;"function"==typeof a?.focus&&setTimeout(()=>a.focus()),this.dispatchEvent(new n.Z)}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown),(0,p.AZ)(this)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown),(0,p.Fw)(this)}handleDialogCancel(t){t.preventDefault(),!this.dialog.classList.contains("hide")&&t.target===this.dialog&&(0,p.a0)(this)&&this.requestClose(this.dialog)}handleDialogClick(t){const e=t.target.closest('[data-dialog="close"]');e&&(t.stopPropagation(),this.requestClose(e))}async handleDialogPointerDown(t){t.target===this.dialog&&(this.lightDismiss?this.requestClose(this.dialog):await(0,c.Ud)(this.dialog,"pulse"))}handleOpenChange(){this.open&&!this.dialog.open?this.show():!this.open&&this.dialog.open&&(this.open=!0,this.requestClose(this.dialog))}async show(){const t=new h.k;this.dispatchEvent(t),t.defaultPrevented?this.open=!1:(this.addOpenListeners(),this.originalTrigger=document.activeElement,this.open=!0,this.dialog.showModal(),(0,g.JG)(this),requestAnimationFrame(()=>{const t=this.querySelector("[autofocus]");t&&"function"==typeof t.focus?t.focus():this.dialog.focus()}),await(0,c.Ud)(this.dialog,"show"),this.dispatchEvent(new l.q))}render(){const t=!this.withoutHeader,e=this.hasUpdated?this.hasSlotController.test("footer"):this.withFooter;return o.qy` <dialog aria-labelledby="${this.ariaLabelledby??"title"}" aria-describedby="${(0,s.J)(this.ariaDescribedby)}" part="dialog" class="${(0,r.H)({dialog:!0,open:this.open})}" @cancel="${this.handleDialogCancel}" @click="${this.handleDialogClick}" @pointerdown="${this.handleDialogPointerDown}"> ${t?o.qy` <header part="header" class="header"> <h2 part="title" class="title" id="title"> <slot name="label"> ${this.label.length>0?this.label:String.fromCharCode(8203)} </slot> </h2> <div part="header-actions" class="header-actions"> <slot name="header-actions"></slot> <wa-button part="close-button" exportparts="base:close-button__base" class="close" appearance="plain" @click="${t=>this.requestClose(t.target)}"> <wa-icon name="xmark" label="${this.localize.term("close")}" library="system" variant="solid"></wa-icon> </wa-button> </div> </header> `:""} <div part="body" class="body"><slot></slot></div> ${e?o.qy` <footer part="footer" class="footer"> <slot name="footer"></slot> </footer> `:""} </dialog> `}constructor(){super(...arguments),this.localize=new b.c(this),this.hasSlotController=new v.X(this,"footer","header-actions","label"),this.open=!1,this.label="",this.withoutHeader=!1,this.lightDismiss=!1,this.withFooter=!1,this.handleDocumentKeyDown=t=>{"Escape"===t.key&&this.open&&(0,p.a0)(this)&&(t.preventDefault(),t.stopPropagation(),this.requestClose(this.dialog))}}};$.css=y.A,C([(0,i.P)(".dialog")],$.prototype,"dialog",2),C([(0,i.MZ)({type:Boolean,reflect:!0})],$.prototype,"open",2),C([(0,i.MZ)({reflect:!0})],$.prototype,"label",2),C([(0,i.MZ)({attribute:"without-header",type:Boolean,reflect:!0})],$.prototype,"withoutHeader",2),C([(0,i.MZ)({attribute:"light-dismiss",type:Boolean})],$.prototype,"lightDismiss",2),C([(0,i.MZ)({attribute:"aria-labelledby"})],$.prototype,"ariaLabelledby",2),C([(0,i.MZ)({attribute:"aria-describedby"})],$.prototype,"ariaDescribedby",2),C([(0,i.MZ)({attribute:"with-footer",type:Boolean})],$.prototype,"withFooter",2),C([(0,f.w)("open",{waitUntilFirstUpdate:!0})],$.prototype,"handleOpenChange",1),$=C([(0,i.EM)("wa-dialog")],$),o.S$||(document.addEventListener("click",t=>{const e=t.target.closest("[data-dialog]");if(e instanceof Element){const[t,a]=(0,u.v)(e.getAttribute("data-dialog")||"");if("open"===t&&a?.length){const t=e.getRootNode().getElementById(a);"wa-dialog"===t?.localName?t.open=!0:console.warn(`A dialog with an ID of "${a}" could not be found in this document.`)}}}),document.addEventListener("pointerdown",()=>{})),e()}catch(t){e(t)}})},91470(t,e,a){a.d(e,{A:()=>o});var o=a(5124).AH`:host{--width:31rem;--spacing:var(--wa-space-l);--backdrop-filter:none;--show-duration:200ms;--hide-duration:200ms;display:none}:host([open]){display:block}.dialog{display:flex;flex-direction:column;top:0;right:0;bottom:0;left:0;width:var(--width);max-width:calc(100% - var(--wa-space-2xl));max-height:calc(100% - var(--wa-space-2xl));color:inherit;background-color:var(--wa-color-surface-raised);border-radius:var(--wa-panel-border-radius);border:none;box-shadow:var(--wa-shadow-l);padding:0;margin:auto}.dialog.show{animation:show-dialog var(--show-duration) ease}.dialog.show::backdrop{animation:show-backdrop var(--show-duration,200ms) ease}.dialog.hide{animation:show-dialog var(--hide-duration) ease reverse}.dialog.hide::backdrop{animation:show-backdrop var(--hide-duration,200ms) ease reverse}.dialog.pulse{animation:pulse 250ms ease}.dialog:focus{outline:0}@media screen and (max-width:420px){.dialog{max-height:80vh}}.open{display:flex;opacity:1}.header{flex:0 0 auto;display:flex;flex-wrap:nowrap;padding-inline-start:var(--spacing);padding-block-end:0;padding-inline-end:calc(var(--spacing) - var(--wa-form-control-padding-block));padding-block-start:calc(var(--spacing) - var(--wa-form-control-padding-block))}.title{align-self:center;flex:1 1 auto;font-family:inherit;font-size:var(--wa-font-size-l);font-weight:var(--wa-font-weight-heading);line-height:var(--wa-line-height-condensed);margin:0}.header-actions{align-self:start;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:end;gap:var(--wa-space-2xs);padding-inline-start:var(--spacing)}.header-actions ::slotted(wa-button),.header-actions wa-button{flex:0 0 auto;display:flex;align-items:center}.body{flex:1 1 auto;display:block;padding:var(--spacing);overflow:auto;-webkit-overflow-scrolling:touch}.body:focus{outline:0}.body:focus-visible{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}.footer{flex:0 0 auto;display:flex;flex-wrap:wrap;gap:var(--wa-space-xs);justify-content:end;padding:var(--spacing);padding-block-start:0}.footer ::slotted(wa-button:not(:first-of-type)){margin-inline-start:var(--wa-spacing-xs)}.dialog::backdrop{background-color:var(--wa-color-overlay-modal,rgb(0 0 0 / .25));-webkit-backdrop-filter:var(--backdrop-filter);backdrop-filter:var(--backdrop-filter)}@keyframes pulse{0%{scale:1}50%{scale:1.02}100%{scale:1}}@keyframes show-dialog{from{opacity:0;scale:0.8}to{opacity:1;scale:1}}@keyframes show-backdrop{from{opacity:0}to{opacity:1}}@media (forced-colors:active){.dialog{border:solid 1px #fff}}`},31247(t,e,a){a.d(e,{v:()=>o});a(18111),a(22489),a(61701);function o(t){return t.split(" ").map(t=>t.trim()).filter(t=>""!==t)}},4444(t,e,a){a.d(e,{JG:()=>i,Rt:()=>s,I7:()=>r});a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);const o=new Set;function i(t){if(o.add(t),!document.documentElement.classList.contains("wa-scroll-lock")){const t=function(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}()+function(){const t=Number(getComputedStyle(document.body).paddingRight.replace(/px/,""));return isNaN(t)||!t?0:t}();let e=getComputedStyle(document.documentElement).scrollbarGutter;e&&"auto"!==e||(e="stable"),t<2&&(e=""),document.documentElement.style.setProperty("--wa-scroll-lock-gutter",e),document.documentElement.classList.add("wa-scroll-lock"),document.documentElement.style.setProperty("--wa-scroll-lock-size",`${t}px`)}}function r(t){o.delete(t),0===o.size&&(document.documentElement.classList.remove("wa-scroll-lock"),document.documentElement.style.removeProperty("--wa-scroll-lock-size"))}function s(t,e,a="vertical",o="smooth"){const i=function(t,e){return{top:Math.round(t.getBoundingClientRect().top-e.getBoundingClientRect().top),left:Math.round(t.getBoundingClientRect().left-e.getBoundingClientRect().left)}}(t,e),r=i.top+e.scrollTop,s=i.left+e.scrollLeft,n=e.scrollLeft,l=e.scrollLeft+e.offsetWidth,d=e.scrollTop,h=e.scrollTop+e.offsetHeight;"horizontal"!==a&&"both"!==a||(s<n?e.scrollTo({left:s,behavior:o}):s+t.clientWidth>l&&e.scrollTo({left:s-e.offsetWidth+t.clientWidth,behavior:o})),"vertical"!==a&&"both"!==a||(r<d?e.scrollTo({top:r,behavior:o}):r+t.clientHeight>h&&e.scrollTo({top:r-e.offsetHeight+t.clientHeight,behavior:o}))}}};