import{aP as e,aQ as t,aR as i,aS as a,aT as n,aU as o,aV as s,aW as r,aX as l,aY as d,aZ as c,a_ as u,a$ as h,b0 as p,d as v,_ as m,j as f,e as g,$ as _,n as y,t as k,i as b,b1 as $,k as x,D as w,E as C,J as A,a5 as I,Q as E,T as z,P as S,U as O,a7 as T,b2 as M,b3 as L,b4 as P,Z as B,W as F,b5 as D,b6 as N,Y as V,a4 as q,b7 as R,p as j,I as U,a1 as H,a2 as G,b8 as W,aF as K,b9 as Y,ba as Z,bb as Q,bc as X,bd as J,be as ee,bf as te,bg as ie,bh as ae,bi as ne,bj as oe,bk as se,bl as re,bm as le,bn as de,bo as ce,bp as ue,bq as he,br as pe,bs as ve,bt as me,bu as fe,bv as ge,aH as _e,bw as ye,bx as ke,by as be,bz as $e,a9 as xe,bA as we,bB as Ce,bC as Ae,bD as Ie,bE as Ee,bF as ze,bG as Se,bH as Oe,bI as Te,bJ as Me,bK as Le,bL as Pe,bM as Be,bN as Fe,bO as De,bP as Ne,bQ as Ve,bR as qe,bS as Re,bT as je,bU as Ue,bV as He,bW as Ge,bX as We,bY as Ke,bZ as Ye,b_ as Ze,b$ as Qe,N as Xe,c0 as Je,c1 as et,c2 as tt,c3 as it,c4 as at,c5 as nt,c6 as ot,c7 as st,c8 as rt,c9 as lt,ca as dt,cb as ct,cc as ut,cd as ht,ce as pt,cf as vt,cg as mt,ch as ft,ci as gt,cj as _t,ck as yt,cl as kt,cm as bt,cn as $t,co as xt,cp as wt,cq as Ct,cr as At,cs as It,ct as Et,cu as zt,cv as St,cw as Ot,cx as Tt,cy as Mt,cz as Lt,cA as Pt,cB as Bt,cC as Ft,cD as Dt,cE as Nt,cF as Vt,cG as qt,cH as Rt,cI as jt,cJ as Ut,cK as Ht,cL as Gt,cM as Wt,cN as Kt,cO as Yt,cP as Zt,cQ as Qt,cR as Xt,cS as Jt,cT as ei,cU as ti,cV as ii,cW as ai,cX as ni,cY as oi,cZ as si,c_ as ri,c$ as li,d0 as di,d1 as ci,d2 as ui,d3 as hi,d4 as pi,d5 as vi,d6 as mi,d7 as fi,d8 as gi,d9 as _i,da as yi,db as ki,dc as bi,dd as $i,de as xi,df as wi,dg as Ci,dh as Ai,di as Ii,dj as Ei,dk as zi,dl as Si,dm as Oi,dn as Ti,dp as Mi,dq as Li,dr as Pi,ds as Bi,dt as Fi,du as Di,dv as Ni,dw as Vi,dx as qi,dy as Ri,dz as ji,dA as Ui,dB as Hi,dC as Gi,dD as Wi,dE as Ki,dF as Yi,dG as Zi,dH as Qi,dI as Xi,dJ as Ji,dK as ea,dL as ta,dM as ia,dN as aa,dO as na,dP as oa,dQ as sa,dR as ra,dS as la,dT as da,dU as ca,dV as ua,dW as ha,dX as pa,dY as va,dZ as ma,d_ as fa,d$ as ga,A as _a,m as ya,aA as ka,aB as ba,e0 as $a,e1 as xa,e2 as wa,e3 as Ca,e4 as Aa,e5 as Ia,e6 as Ea,e7 as za,au as Sa,e8 as Oa,e9 as Ta,ea as Ma,eb as La,ec as Pa,ed as Ba,f as Fa,as as Da,ar as Na,ee as Va,ef as qa,eg as Ra,eh as ja,ei as Ua,ej as Ha,ek as Ga,el as Wa,em as Ka,en as Ya,eo as Za,ep as Qa,eq as Xa,er as Ja,es as en,et as tn,eu as an,ev as nn,ew as on,ex as sn,ey as rn,ez as ln,eA as dn,eB as cn,eC as un,eD as hn,eE as pn,eF as vn,G as mn,a8 as fn}from"./main-bd0f996b.js";import{d as gn,s as _n}from"./c.eef9df6a.js";import{c as yn,d as kn,i as bn}from"./c.35e839f3.js";import{L as $n,s as xn,b as wn}from"./c.09c1108b.js";import{r as Cn,t as An,d as In,T as En,b as zn,e as Sn}from"./c.b764d104.js";import{c as On,u as Tn}from"./c.743a15a1.js";import{s as Mn,a as Ln,b as Pn}from"./c.7692ecb7.js";import"./c.edefd651.js";import{g as Bn}from"./c.f2bb3724.js";import"./c.23be34f7.js";import"./c.9e27c745.js";let Fn=!1,Dn=[],Nn=[];function Vn(){Fn=!0,requestAnimationFrame((function(){Fn=!1,function(e){for(;e.length;)qn(e.shift())}(Dn),setTimeout((function(){!function(e){for(let t=0,i=e.length;t{throw e}))}}function Rn(e,t,i){Fn||Vn(),Nn.push([e,t,i])}const jn=(e,t)=>et?1:0,Un=(e,t)=>jn(e.toLowerCase(),t.toLowerCase()),Hn={condition:e,delay:t,event:i,play_media:a,activate_scene:n,service:o,wait_template:s,wait_for_trigger:r,repeat:l,choose:d,if:c,device_id:u,stop:h,parallel:p},Gn=v` #sortable a:nth-of-type(2n) paper-icon-item { animation-name: keyframes1; animation-iteration-count: infinite; transform-origin: 50% 10%; animation-delay: -0.75s; animation-duration: 0.25s; } #sortable a:nth-of-type(2n-1) paper-icon-item { animation-name: keyframes2; animation-iteration-count: infinite; animation-direction: alternate; transform-origin: 30% 5%; animation-delay: -0.5s; animation-duration: 0.33s; } #sortable a { height: 48px; display: flex; } #sortable { outline: none; display: block !important; } .hidden-panel { display: flex !important; } .sortable-fallback { display: none; } .sortable-ghost { opacity: 0.4; } .sortable-fallback { opacity: 0; } @keyframes keyframes1 { 0% { transform: rotate(-1deg); animation-timing-function: ease-in; } 50% { transform: rotate(1.5deg); animation-timing-function: ease-out; } } @keyframes keyframes2 { 0% { transform: rotate(1deg); animation-timing-function: ease-in; } 50% { transform: rotate(-1.5deg); animation-timing-function: ease-out; } } .show-panel, .hide-panel { display: none; position: absolute; top: 0; right: 4px; --mdc-icon-button-size: 40px; } :host([rtl]) .show-panel { right: initial; left: 4px; } .hide-panel { top: 4px; right: 8px; } :host([rtl]) .hide-panel { right: initial; left: 8px; } :host([expanded]) .hide-panel { display: block; } :host([expanded]) .show-panel { display: inline-flex; } paper-icon-item.hidden-panel, paper-icon-item.hidden-panel span, paper-icon-item.hidden-panel ha-icon[slot="item-icon"] { color: var(--secondary-text-color); cursor: pointer; } `;let Wn;const Kn=async()=>(Wn||(Wn=(await import("./c.c177bbc3.js")).default),Wn),Yn=e=>e.charAt(0).toUpperCase()+e.slice(1);class Zn extends TypeError{constructor(e,t){let i;const{message:a,...n}=e,{path:o}=e;super(0===o.length?a:"At path: "+o.join(".")+" -- "+a),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>{var a;return null!=(a=i)?a:i=[e,...t()]}}}function Qn(e){return"object"==typeof e&&null!=e}function Xn(e){return"string"==typeof e?JSON.stringify(e):""+e}function Jn(e,t,i,a){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:n,branch:o}=t,{type:s}=i,{refinement:r,message:l="Expected a value of type `"+s+"`"+(r?" with refinement `"+r+"`":"")+", but received: `"+Xn(a)+"`"}=e;return{value:a,type:s,refinement:r,key:n[n.length-1],path:n,branch:o,...e,message:l}}function*eo(e,t,i,a){(function(e){return Qn(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const n of e){const e=Jn(n,t,i,a);e&&(yield e)}}function*to(e,t,i){void 0===i&&(i={});const{path:a=[],branch:n=[e],coerce:o=!1,mask:s=!1}=i,r={path:a,branch:n};if(o&&(e=t.coercer(e,r),s&&"type"!==t.type&&Qn(t.schema)&&Qn(e)&&!Array.isArray(e)))for(const i in e)void 0===t.schema[i]&&delete e[i];let l=!0;for(const i of t.validator(e,r))l=!1,yield[i,void 0];for(let[i,d,c]of t.entries(e,r)){const t=to(d,c,{path:void 0===i?a:[...a,i],branch:void 0===i?n:[...n,d],coerce:o,mask:s});for(const a of t)a[0]?(l=!1,yield[a[0],void 0]):o&&(d=a[1],void 0===i?e=d:e instanceof Map?e.set(i,d):e instanceof Set?e.add(d):Qn(e)&&(e[i]=d))}if(l)for(const i of t.refiner(e,r))l=!1,yield[i,void 0];l&&(yield[void 0,e])}class io{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:i,validator:a,refiner:n,coercer:o=(e=>e),entries:s=function*(){}}=e;this.type=t,this.schema=i,this.entries=s,this.coercer=o,this.validator=a?(e,t)=>eo(a(e,t),t,this,e):()=>[],this.refiner=n?(e,t)=>eo(n(e,t),t,this,e):()=>[]}assert(e){return ao(e,this)}create(e){return function(e,t){const i=oo(e,t,{coerce:!0});if(i[0])throw i[0];return i[1]}(e,this)}is(e){return no(e,this)}mask(e){return function(e,t){const i=oo(e,t,{coerce:!0,mask:!0});if(i[0])throw i[0];return i[1]}(e,this)}validate(e,t){return void 0===t&&(t={}),oo(e,this,t)}}function ao(e,t){const i=oo(e,t);if(i[0])throw i[0]}function no(e,t){return!oo(e,t)[0]}function oo(e,t,i){void 0===i&&(i={});const a=to(e,t,i),n=function(e){const{done:t,value:i}=e.next();return t?void 0:i}(a);if(n[0]){const e=new Zn(n[0],(function*(){for(const e of a)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,n[1]]}function so(){for(var e=arguments.length,t=new Array(e),i=0;ie.schema)),o=Object.assign({},...n);return a?go(o):vo(o)}function ro(e,t){return new io({type:e,schema:null,validator:t})}function lo(){return ro("any",(()=>!0))}function co(e){return new io({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[i,a]of t.entries())yield[i,a,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+Xn(e)})}function uo(){return ro("boolean",(e=>"boolean"==typeof e))}function ho(e){const t=Xn(e),i=typeof e;return new io({type:"literal",schema:"string"===i||"number"===i||"boolean"===i?e:null,validator:i=>i===e||"Expected the literal `"+t+"`, but received: "+Xn(i)})}function po(){return ro("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+Xn(e)))}function vo(e){const t=e?Object.keys(e):[],i=ro("never",(()=>!1));return new io({type:"object",schema:e||null,*entries(a){if(e&&Qn(a)){const n=new Set(Object.keys(a));for(const i of t)n.delete(i),yield[i,a[i],e[i]];for(const e of n)yield[e,a[e],i]}},validator:e=>Qn(e)||"Expected an object, but received: "+Xn(e),coercer:e=>Qn(e)?{...e}:e})}function mo(e){return new io({...e,validator:(t,i)=>void 0===t||e.validator(t,i),refiner:(t,i)=>void 0===t||e.refiner(t,i)})}function fo(){return ro("string",(e=>"string"==typeof e||"Expected a string, but received: "+Xn(e)))}function go(e){const t=Object.keys(e);return new io({type:"type",schema:e,*entries(i){if(Qn(i))for(const a of t)yield[a,i[a],e[a]]},validator:e=>Qn(e)||"Expected an object, but received: "+Xn(e)})}function _o(e){const t=e.map((e=>e.type)).join(" | ");return new io({type:"union",schema:null,coercer(t,i){const a=e.find((e=>{const[i]=e.validate(t,{coerce:!0});return!i}))||ro("unknown",(()=>!0));return a.coercer(t,i)},validator(i,a){const n=[];for(const t of e){const[...e]=to(i,t,a),[o]=e;if(!o[0])return[];for(const[t]of e)t&&n.push(t)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+Xn(i),...n]}})}const yo=(e,t)=>{if(!(t instanceof Zn))return{warnings:[t.message],errors:void 0};const i=[],a=[];for(const n of t.failures())if(void 0===n.value)i.push(e.localize("ui.errors.config.key_missing","key",n.path.join(".")));else if("never"===n.type)a.push(e.localize("ui.errors.config.key_not_expected","key",n.path.join(".")));else{if("union"===n.type)continue;"enums"===n.type?a.push(e.localize("ui.errors.config.key_wrong_type","key",n.path.join("."),"type_correct",n.message.replace("Expected ","").split(", ")[0],"type_wrong",JSON.stringify(n.value))):a.push(e.localize("ui.errors.config.key_wrong_type","key",n.path.join("."),"type_correct",n.refinement||n.type,"type_wrong",JSON.stringify(n.value)))}return{warnings:a,errors:i}};m([y("ha-card")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[g()],key:"header",value:void 0},{kind:"field",decorators:[g({type:Boolean,reflect:!0})],key:"outlined",value:()=>!1},{kind:"get",static:!0,key:"styles",value:function(){return v` :host { background: var( --ha-card-background, var(--card-background-color, white) ); border-radius: var(--ha-card-border-radius, 4px); box-shadow: var( --ha-card-box-shadow, 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12) ); color: var(--primary-text-color); display: block; transition: all 0.3s ease-out; position: relative; } :host([outlined]) { box-shadow: none; border-width: var(--ha-card-border-width, 1px); border-style: solid; border-color: var( --ha-card-border-color, var(--divider-color, #e0e0e0) ); } .card-header, :host ::slotted(.card-header) { color: var(--ha-card-header-color, --primary-text-color); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; line-height: 48px; padding: 12px 16px 16px; display: block; margin-block-start: 0px; margin-block-end: 0px; font-weight: normal; } :host ::slotted(.card-content:not(:first-child)), slot:not(:first-child)::slotted(.card-content) { padding-top: 0px; margin-top: -8px; } :host ::slotted(.card-content) { padding: 16px; } :host ::slotted(.card-actions) { border-top: 1px solid var(--divider-color, #e8e8e8); padding: 5px 16px; } `}},{kind:"method",key:"render",value:function(){return _` ${this.header?_`

${this.header}

`:_``} `}}]}}),f),m([y("ha-expansion-panel")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[g({type:Boolean,reflect:!0})],key:"expanded",value:()=>!1},{kind:"field",decorators:[g({type:Boolean,reflect:!0})],key:"outlined",value:()=>!1},{kind:"field",decorators:[g({type:Boolean,reflect:!0})],key:"leftChevron",value:()=>!1},{kind:"field",decorators:[g()],key:"header",value:void 0},{kind:"field",decorators:[g()],key:"secondary",value:void 0},{kind:"field",decorators:[k()],key:"_showContent",value(){return this.expanded}},{kind:"field",decorators:[b(".container")],key:"_container",value:void 0},{kind:"method",key:"render",value:function(){return _`
${this.leftChevron?_` `:""}
${this.header} ${this.secondary}
${this.leftChevron?"":_` `}
${this._showContent?_``:""}
`}},{kind:"method",key:"willUpdate",value:function(e){w(C(i.prototype),"willUpdate",this).call(this,e),e.has("expanded")&&this.expanded&&(this._showContent=this.expanded,setTimeout((()=>{this.expanded&&(this._container.style.overflow="initial")}),300))}},{kind:"method",key:"_handleTransitionEnd",value:function(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}},{kind:"method",key:"_toggleContainer",value:async function(e){if(e.defaultPrevented)return;if("keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)return;e.preventDefault();const t=!this.expanded;A(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await I());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,t||setTimeout((()=>{this._container.style.height="0px"}),0),this.expanded=t,A(this,"expanded-changed",{expanded:this.expanded})}},{kind:"method",key:"_focusChanged",value:function(e){this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}},{kind:"get",static:!0,key:"styles",value:function(){return v` :host { display: block; } .top { display: flex; align-items: center; } .top.focused { background: var(--input-fill-color); } :host([outlined]) { box-shadow: none; border-width: 1px; border-style: solid; border-color: var( --ha-card-border-color, var(--divider-color, #e0e0e0) ); border-radius: var(--ha-card-border-radius, 4px); } .summary-icon { margin-left: 8px; } :host([leftchevron]) .summary-icon { margin-left: 0; margin-right: 8px; } #summary { flex: 1; display: flex; padding: var(--expansion-panel-summary-padding, 0 8px); min-height: 48px; align-items: center; cursor: pointer; overflow: hidden; font-weight: 500; outline: none; } .summary-icon { transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1); direction: var(--direction); } .summary-icon.expanded { transform: rotate(180deg); } .header, ::slotted([slot="header"]) { flex: 1; } .container { padding: var(--expansion-panel-content-padding, 0 8px); overflow: hidden; transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1); height: 0px; } .container.expanded { height: auto; } .secondary { display: block; color: var(--secondary-text-color); font-size: 12px; } `}}]}}),f);const ko=(e,t)=>e.callWS({type:"validate_config",...t}),bo=vo({alias:mo(fo()),enabled:mo(uo())}),$o=vo({entity_id:mo(_o([fo(),co(fo())])),device_id:mo(_o([fo(),co(fo())])),area_id:mo(_o([fo(),co(fo())]))});so(bo,vo({service:mo(fo()),service_template:mo(fo()),entity_id:mo(fo()),target:mo($o),data:mo(vo())}));const xo=so(bo,vo({service:ho("media_player.play_media"),target:mo(vo({entity_id:mo(fo())})),entity_id:mo(fo()),data:vo({media_content_id:fo(),media_content_type:fo()}),metadata:vo()})),wo=so(bo,vo({service:ho("scene.turn_on"),target:mo(vo({entity_id:mo(fo())})),entity_id:mo(fo()),metadata:vo()})),Co=e=>{if("delay"in e)return"delay";if("wait_template"in e)return"wait_template";if(["condition","and","or","not"].some((t=>t in e)))return"check_condition";if("event"in e)return"fire_event";if("device_id"in e)return"device_action";if("scene"in e)return"activate_scene";if("repeat"in e)return"repeat";if("choose"in e)return"choose";if("if"in e)return"if";if("wait_for_trigger"in e)return"wait_for_trigger";if("variables"in e)return"variables";if("stop"in e)return"stop";if("parallel"in e)return"parallel";if("service"in e){if("metadata"in e){if(no(e,wo))return"activate_scene";if(no(e,xo))return"play_media"}return"service"}return"unknown"},Ao=e=>e<10?`0${e}`:e,Io=e=>{const t=e.days||0,i=e.hours||0,a=e.minutes||0,n=e.seconds||0,o=e.milliseconds||0;return t>0?`${t} days ${i}:${Ao(a)}:${Ao(n)}`:i>0?`${i}:${Ao(a)}:${Ao(n)}`:a>0?`${a}:${Ao(n)}`:n>0?`${n} seconds`:o>0?`${o} milliseconds`:null},Eo=e=>e<10?`0${e}`:e;function zo(e){const t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=Math.floor(e%3600%60);return t>0?`${t}:${Eo(i)}:${Eo(a)}`:i>0?`${i}:${Eo(a)}`:a>0?""+a:null}function So(e){return void 0===e||Array.isArray(e)?e:[e]}const Oo=e=>e.substr(e.indexOf(".")+1),To=e=>{return t=e.entity_id,void 0===(i=e.attributes).friendly_name?Oo(t).replace(/_/g," "):i.friendly_name||"";var t,i},Mo=new RegExp("{%|{{"),Lo=e=>Mo.test(e),Po=e=>{if(!e)return!1;if("string"==typeof e)return Lo(e);if("object"==typeof e){return(Array.isArray(e)?e:Object.values(e)).some((e=>e&&Po(e)))}return!1},Bo=(e,t)=>e.callWS({type:"device_automation/action/list",device_id:t}),Fo=(e,t)=>e.callWS({type:"device_automation/condition/list",device_id:t}),Do=(e,t)=>e.callWS({type:"device_automation/trigger/list",device_id:t}),No=["device_id","domain","entity_id","type","subtype","event","condition","platform"],Vo=(e,t)=>{if(typeof e!=typeof t)return!1;for(const i in e)if(No.includes(i)&&!Object.is(e[i],t[i]))return!1;for(const i in t)if(No.includes(i)&&!Object.is(e[i],t[i]))return!1;return!0},qo=(e,t)=>{const i=t.entity_id?e.states[t.entity_id]:void 0;return e.localize(`component.${t.domain}.device_automation.action_type.${t.type}`,"entity_name",i?To(i):t.entity_id||"","subtype",t.subtype?e.localize(`component.${t.domain}.device_automation.action_subtype.${t.subtype}`)||t.subtype:"")||(t.subtype?`"${t.subtype}" ${t.type}`:t.type)},Ro=(e,t)=>{const i=t.entity_id?e.states[t.entity_id]:void 0;return e.localize(`component.${t.domain}.device_automation.condition_type.${t.type}`,"entity_name",i?To(i):t.entity_id||"","subtype",t.subtype?e.localize(`component.${t.domain}.device_automation.condition_subtype.${t.subtype}`)||t.subtype:"")||(t.subtype?`"${t.subtype}" ${t.type}`:t.type)},jo=(e,t)=>{const i=t.entity_id?e.states[t.entity_id]:void 0;return e.localize(`component.${t.domain}.device_automation.trigger_type.${t.type}`,"entity_name",i?To(i):t.entity_id||"","subtype",t.subtype?e.localize(`component.${t.domain}.device_automation.trigger_subtype.${t.subtype}`)||t.subtype:"")||(t.subtype?`"${t.subtype}" ${t.type}`:t.type)},Uo=(e,t)=>{var i,a,n,o;return null===(i=e.metadata)||void 0===i||!i.secondary||null!==(a=t.metadata)&&void 0!==a&&a.secondary?null!==(n=e.metadata)&&void 0!==n&&n.secondary||null===(o=t.metadata)||void 0===o||!o.secondary?0:-1:1},Ho=(e,t)=>{var i,a;const n=e._$AN;if(void 0===n)return!1;for(const e of n)null===(a=(i=e)._$AO)||void 0===a||a.call(i,t,!1),Ho(e,t);return!0},Go=e=>{let t,i;do{if(void 0===(t=e._$AM))break;i=t._$AN,i.delete(e),e=t}while(0===(null==i?void 0:i.size))},Wo=e=>{for(let t;t=e._$AM;e=t){let i=t._$AN;if(void 0===i)t._$AN=i=new Set;else if(i.has(e))break;i.add(e),Zo(t)}};function Ko(e){void 0!==this._$AN?(Go(this),this._$AM=e,Wo(this)):this._$AM=e}function Yo(e,t=!1,i=0){const a=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(t)if(Array.isArray(a))for(let e=i;e{var t,i,a,n;e.type==z.CHILD&&(null!==(t=(a=e)._$AP)&&void 0!==t||(a._$AP=Yo),null!==(i=(n=e)._$AQ)&&void 0!==i||(n._$AQ=Ko))};class Qo extends E{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,i){super._$AT(e,t,i),Wo(this),this.isConnected=e._$AU}_$AO(e,t=!0){var i,a;e!==this.isConnected&&(this.isConnected=e,e?null===(i=this.reconnected)||void 0===i||i.call(this):null===(a=this.disconnected)||void 0===a||a.call(this)),t&&(Ho(this,e),Go(this))}setValue(e){if(Cn(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}class Xo{constructor(e){this.U=e}disconnect(){this.U=void 0}reconnect(e){this.U=e}deref(){return this.U}}class Jo{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var e;null!==(e=this.Y)&&void 0!==e||(this.Y=new Promise((e=>this.q=e)))}resume(){var e;null===(e=this.q)||void 0===e||e.call(this),this.Y=this.q=void 0}}const es=e=>!An(e)&&"function"==typeof e.then;const ts=S(class extends Qo{constructor(){super(...arguments),this._$Cft=1073741823,this._$Cwt=[],this._$CG=new Xo(this),this._$CK=new Jo}render(...e){var t;return null!==(t=e.find((e=>!es(e))))&&void 0!==t?t:O}update(e,t){const i=this._$Cwt;let a=i.length;this._$Cwt=t;const n=this._$CG,o=this._$CK;this.isConnected||this.disconnected();for(let e=0;ethis._$Cft);e++){const s=t[e];if(!es(s))return this._$Cft=e,s;e{for(;o.get();)await o.get();const t=n.deref();if(void 0!==t){const i=t._$Cwt.indexOf(s);i>-1&&i=2&&"-"===i[a-2]&&(a-=2),i=i.slice(0,a)}}function ss(e,t){ns(2===t.length,"key must have 2 elements");var i=e.length,a="-".concat(t,"-"),n=e.indexOf(a);if(-1!==n){for(var o=n+4,s=o,r=o,l=!1;!l;){var d=e.indexOf("-",r);2===(-1===d?i-r:d-r)?l=!0:-1===d?(s=i,l=!0):(s=d,r=d+1)}return e.slice(o,s)}if(a="-".concat(t),-1!==(n=e.indexOf(a))&&n+3===i)return""}function rs(e,t,i,a,n,o){var s;s="lookup"===i.localeMatcher?function(e,t,i){for(var a={locale:""},n=0,o=t;n2){var y=r.indexOf("-x-");if(-1===y)r+=d;else{var k=r.slice(0,y),b=r.slice(y,r.length);r=k+d+b}r=Intl.getCanonicalLocales(r)[0]}return l.locale=r,l}function ls(e,t,i,a){var n=t.reduce((function(e,t){return e.add(t),e}),new Set);return rs(n,function(e){return Intl.getCanonicalLocales(e)}(e),{localeMatcher:(null==a?void 0:a.algorithm)||"best fit"},[],{},(function(){return i})).locale}var ds=Object.freeze({__proto__:null,match:ls,LookupSupportedLocales:function(e,t){for(var i=[],a=0,n=t;a=2&&"-"===i[a-2]&&(a-=2),i=i.slice(0,a)}}}));Tn(ps),ps.BestAvailableLocale;var vs=On((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.LookupMatcher=void 0,t.LookupMatcher=function(e,t,i){for(var a={locale:""},n=0,o=t;n2){var y=r.indexOf("-x-");if(-1===y)r+=d;else{var k=r.slice(0,y),b=r.slice(y,r.length);r=k+d+b}r=Intl.getCanonicalLocales(r)[0]}return l.locale=r,l}}));Tn(gs),gs.ResolveLocale;var _s=On((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.LookupSupportedLocales=void 0,t.LookupSupportedLocales=function(e,t){for(var i=[],a=0,n=t;ae.toLowerCase()===t));return i||(e.includes("-")?Ss(e.split("-")[0]):void 0)}const Os=new Set,Ts=[];"Locale"in Intl&&!function(){try{return"x-private"===new Intl.Locale("und-x-private").toString()}catch(e){return!0}}()||Ts.push(import("./c.3409009c.js")),function(e){if(void 0===e&&(e="en"),!("PluralRules"in Intl)||"one"===new Intl.PluralRules("en",{minimumFractionDigits:2}).select(1)||!function(e){if(!e)return!0;var t=Array.isArray(e)?e:[e];return Intl.PluralRules.supportedLocalesOf(t).length===t.length}(e))return e?ls([e],cs,"en"):void 0}()&&(Ts.push(import("./c.972872d1.js")),Ts.push(import("./c.e23b0d0b.js"))),function(e){if(void 0===e&&(e="en"),!("RelativeTimeFormat"in Intl)||!function(e){if(!e)return!0;var t=Array.isArray(e)?e:[e];return Intl.RelativeTimeFormat.supportedLocalesOf(t).length===t.length}(e)||!function(e){try{return"numberingSystem"in new Intl.RelativeTimeFormat(e||"en",{numeric:"auto"}).resolvedOptions()}catch(e){return!1}}(e))return $s([e],xs,"en")}()&&Ts.push(import("./c.4bd66a13.js")),function(e){if(void 0===e&&(e="en"),!("DateTimeFormat"in Intl)||!("formatToParts"in Intl.DateTimeFormat.prototype)||!("formatRange"in Intl.DateTimeFormat.prototype)||function(){try{return"dayPeriod"!==new Intl.DateTimeFormat("en",{hourCycle:"h11",hour:"numeric"}).formatToParts(0)[2].type}catch(e){return!1}}()||function(){try{return!!new Intl.DateTimeFormat("en",{dateStyle:"short",hour:"numeric"}).format(new Date(0))}catch(e){return!1}}()||!function(){try{return!!new Intl.DateTimeFormat(void 0,{dateStyle:"short"}).resolvedOptions().dateStyle}catch(e){return!1}}()||!function(e){if(!e)return!0;var t=Array.isArray(e)?e:[e];return Intl.DateTimeFormat.supportedLocalesOf(t).length===t.length}(e))return e?$s([e],ws,"en"):void 0}()&&(Ts.push(import("./c.61c359ee.js")),Ts.push(import("./c.ad739743.js")));const Ms=0===Ts.length?void 0:Promise.all(Ts).then((()=>Ls(function(){let e=null;if(Es.selectedLanguage)try{const t=JSON.parse(Es.selectedLanguage);if(t&&(e=Ss(t),e))return e}catch(e){}if(navigator.languages)for(const t of navigator.languages)if(e=Ss(t),e)return e;return e=Ss(navigator.language),e||"en"}()))),Ls=async e=>{if(!Os.has(e)){Os.add(e);try{if(Intl.NumberFormat&&"function"==typeof Intl.NumberFormat.__addLocaleData){const t=await fetch(`/static/locale-data/intl-numberformat/${e}.json`);Intl.NumberFormat.__addLocaleData(await t.json())}if(Intl.RelativeTimeFormat&&"function"==typeof Intl.RelativeTimeFormat.__addLocaleData){const t=await fetch(`/static/locale-data/intl-relativetimeformat/${e}.json`);Intl.RelativeTimeFormat.__addLocaleData(await t.json())}if(Intl.DateTimeFormat&&"function"==typeof Intl.DateTimeFormat.__addLocaleData){const t=await fetch(`/static/locale-data/intl-datetimeformat/${e}.json`);Intl.DateTimeFormat.__addLocaleData(await t.json())}}catch(e){}}};Ms&&await Ms,T((e=>new Intl.DateTimeFormat(e.language,{weekday:"long",month:"long",day:"numeric"})));const Ps=(e,t)=>Bs(t).format(e),Bs=T((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric"}))),Fs=T((e=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"numeric",day:"numeric"})));T((e=>new Intl.DateTimeFormat(e.language,{day:"numeric",month:"short"}))),T((e=>new Intl.DateTimeFormat(e.language,{month:"long",year:"numeric"}))),T((e=>new Intl.DateTimeFormat(e.language,{month:"long"}))),T((e=>new Intl.DateTimeFormat(e.language,{year:"numeric"})));const Ds=T((e=>{if(e.time_format===As.language||e.time_format===As.system){const t=e.time_format===As.language?e.language:void 0,i=(new Date).toLocaleString(t);return i.includes("AM")||i.includes("PM")}return e.time_format===As.am_pm}));Ms&&await Ms;const Ns=(e,t)=>Vs(t).format(e),Vs=T((e=>new Intl.DateTimeFormat("en"!==e.language||Ds(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:Ds(e)?"numeric":"2-digit",minute:"2-digit",hour12:Ds(e)})));T((e=>new Intl.DateTimeFormat("en"!==e.language||Ds(e)?e.language:"en-u-hc-h23",{month:"short",day:"numeric",hour:Ds(e)?"numeric":"2-digit",minute:"2-digit",hour12:Ds(e)})));const qs=T((e=>new Intl.DateTimeFormat("en"!==e.language||Ds(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"long",day:"numeric",hour:Ds(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:Ds(e)})));T((e=>new Intl.DateTimeFormat("en"!==e.language||Ds(e)?e.language:"en-u-hc-h23",{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",hour12:Ds(e)})));const Rs=(e,t,i)=>{const a=t?(e=>{switch(e.number_format){case Cs.comma_decimal:return["en-US","en"];case Cs.decimal_comma:return["de","es","it"];case Cs.space_comma:return["fr","sv","cs"];case Cs.system:return;default:return e.language}})(t):void 0;if(Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},(null==t?void 0:t.number_format)!==Cs.none&&!Number.isNaN(Number(e))&&Intl)try{return new Intl.NumberFormat(a,js(e,i)).format(Number(e))}catch(t){return console.error(t),new Intl.NumberFormat(void 0,js(e,i)).format(Number(e))}return"string"==typeof e?e:`${((e,t=2)=>Math.round(e*10**t)/10**t)(e,null==i?void 0:i.maximumFractionDigits).toString()}${"currency"===(null==i?void 0:i.style)?` ${i.currency}`:""}`},js=(e,t)=>{const i={maximumFractionDigits:2,...t};if("string"!=typeof e)return i;if(!t||!t.minimumFractionDigits&&!t.maximumFractionDigits){const t=e.indexOf(".")>-1?e.split(".")[1].length:0;i.minimumFractionDigits=t,i.maximumFractionDigits=t}return i},Us="^\\d{4}-(0[1-9]|1[0-2])-([12]\\d|0[1-9]|3[01])",Hs=new RegExp(Us+"$"),Gs=new RegExp(Us),Ws=/^\d{4}-(0[1-9]|1[0-2])-([12]\d|0[1-9]|3[01])[T| ](((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)(\8[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)$/;let Ks;function Ys(e){return e=e.replace(/_/g," ").replace(/\bid\b/g,"ID").replace(/\bip\b/g,"IP").replace(/\bmac\b/g,"MAC").replace(/\bgps\b/g,"GPS"),Yn(e)}function Zs(e,t){if(null===t)return"—";if(Array.isArray(t)&&t.some((e=>e instanceof Object))||!Array.isArray(t)&&t instanceof Object){Ks||(Ks=import("./c.77812857.js"));const e=Ks.then((e=>e.dump(t)));return _`
${ts(e,"")}
`}if("number"==typeof t)return Rs(t,e.locale);if("string"==typeof t){if(t.startsWith("http"))try{const e=new URL(t);if("http:"===e.protocol||"https:"===e.protocol)return _`${t}`}catch(e){}if(((e,t=!1)=>t?Gs.test(e):Hs.test(e))(t,!0)){if(n=t,Ws.test(n)){const n=new Date(t);if(is(n))return i=n,a=e.locale,qs(a).format(i)}const o=new Date(t);if(is(o))return Ps(o,e.locale)}}var i,a,n;return Array.isArray(t)?t.join(", "):t}const Qs=(e,t,i=!1)=>{if(e.alias&&!i)return e.alias;if("event"===e.platform&&e.event_type){let t="";if(Array.isArray(e.event_type))for(const[i,a]of e.event_type.entries())t+=`${i>0?",":""} ${e.event_type.length>1&&i===e.event_type.length-1?"or":""} ${a}`;else t=e.event_type.toString();return`When ${t} event is fired`}if("homeassistant"===e.platform&&e.event)return"When Home Assistant is "+("start"===e.event?"started":"shutdown");if("numeric_state"===e.platform&&e.entity_id){let i="When";const a=t.states[e.entity_id],n=a?To(a):e.entity_id;return e.attribute&&(i+=` ${Ys(e.attribute)} from`),i+=` ${n} is`,"above"in e&&(i+=` above ${e.above}`),"below"in e&&"above"in e&&(i+=" and"),"below"in e&&(i+=` below ${e.below}`),i}if("state"===e.platform){let i="When",a="";const n=t.states;if(e.attribute&&(i+=` ${Ys(e.attribute)} from`),Array.isArray(e.entity_id))for(const[t,i]of e.entity_id.entries())n[i]&&(a+=`${t>0?",":""} ${e.entity_id.length>1&&t===e.entity_id.length-1?"or":""} ${To(n[i])||i}`);else e.entity_id&&(a=n[e.entity_id]?To(n[e.entity_id]):e.entity_id);if(a||(a="something"),i+=` ${a} changes`,e.from){let t="";if(Array.isArray(e.from))for(const[i,a]of e.from.entries())t+=`${i>0?",":""} ${e.from.length>1&&i===e.from.length-1?"or":""} ${a}`;else t=e.from.toString();i+=` from ${t}`}if(e.to){let t="";if(Array.isArray(e.to))for(const[i,a]of e.to.entries())t+=`${i>0?",":""} ${e.to.length>1&&i===e.to.length-1?"or":""} ${a}`;else e.to&&(t=e.to.toString());i+=` to ${t}`}if(e.for){let t;t="number"==typeof e.for?zo(e.for):"string"==typeof e.for?e.for:Io(e.for),t&&(i+=` for ${t}`)}return i}if("sun"===e.platform&&e.event){let t="When the sun "+("sunset"===e.event?"sets":"rises");if(e.offset){let i="";e.offset&&(i="number"==typeof e.offset?` offset by ${zo(e.offset)}`:"string"==typeof e.offset?` offset by ${e.offset}`:` offset by ${JSON.stringify(e.offset)}`),t+=i}return t}if("tag"===e.platform)return"When a tag is scanned";if("time"===e.platform&&e.at){return`When the time is equal to ${e.at.includes(".")?`entity ${t.states[e.at]?To(t.states[e.at]):e.at}`:e.at}`}if("time_pattern"===e.platform)return"Time pattern trigger";if("zone"===e.platform&&e.entity_id&&e.zone){let i="",a="",n=!1;const o=t.states;if(Array.isArray(e.entity_id))for(const[t,a]of e.entity_id.entries())o[a]&&(i+=`${t>0?",":""} ${e.entity_id.length>1&&t===e.entity_id.length-1?"or":""} ${To(o[a])||a}`);else i=o[e.entity_id]?To(o[e.entity_id]):e.entity_id;if(Array.isArray(e.zone)){e.zone.length>1&&(n=!0);for(const[t,i]of e.zone.entries())o[i]&&(a+=`${t>0?",":""} ${e.zone.length>1&&t===e.zone.length-1?"or":""} ${To(o[i])||i}`)}else a=o[e.zone]?To(o[e.zone]):e.zone;return`When ${i} ${e.event}s ${a} ${n?"zones":"zone"}`}if("geo_location"===e.platform&&e.source&&e.zone){let i="",a="",n=!1;const o=t.states;if(Array.isArray(e.source))for(const[t,a]of e.source.entries())i+=`${t>0?",":""} ${e.source.length>1&&t===e.source.length-1?"or":""} ${a}`;else i=e.source;if(Array.isArray(e.zone)){e.zone.length>1&&(n=!0);for(const[t,i]of e.zone.entries())o[i]&&(a+=`${t>0?",":""} ${e.zone.length>1&&t===e.zone.length-1?"or":""} ${To(o[i])||i}`)}else a=o[e.zone]?To(o[e.zone]):e.zone;return`When ${i} ${e.event}s ${a} ${n?"zones":"zone"}`}if("mqtt"===e.platform)return"When an MQTT message has been received";if("template"===e.platform)return"When a template triggers";if("webhook"===e.platform)return"When a Webhook payload has been received";if("device"===e.platform){if(!e.device_id)return"Device trigger";const i=e,a=jo(t,i);if(a)return a;const n=t.states[i.entity_id];return`${n?To(n):i.entity_id} ${i.type}`}return`${e.platform?e.platform.replace(/_/g," "):"Unknown"} trigger`},Xs=(e,t,i=!1)=>{if(e.alias&&!i)return e.alias;if(!e.condition){const t=["and","or","not"];for(const i of t)i in e&&So(e[i])&&(e={condition:i,conditions:e[i]})}if("or"===e.condition){const t=So(e.conditions);let i="condition";return t&&t.length>0&&(i=`of ${t.length} conditions`),`Test if any ${i} matches`}if("and"===e.condition){const t=So(e.conditions);return`Test if ${t&&t.length>0?`${t.length} `:"multiple"} conditions match`}if("not"===e.condition){const t=So(e.conditions);return`Test if ${t&&t.length>0?`none of ${t.length} conditions match`:"no condition matches"}`}if("state"===e.condition){let i="Confirm";const a=t.states[e.entity_id],n=a?To(a):e.entity_id?e.entity_id:"an entity";"attribute"in e&&(i+=` ${e.attribute} from`);let o="";if(Array.isArray(e.state))for(const[t,i]of e.state.entries())o+=`${t>0?",":""} ${e.state.length>1&&t===e.state.length-1?"or":""} ${i}`;else e.state&&(o=e.state.toString());if(o||(o="a state"),i+=` ${n} is ${o}`,"for"in e){let t;t="number"==typeof e.for?`for ${zo(e.for)}`:"string"==typeof e.for?`for ${e.for}`:`for ${JSON.stringify(e.for)}`,i+=` for ${t}`}return i}if("numeric_state"===e.condition&&e.entity_id){let i="Confirm";const a=t.states[e.entity_id],n=a?To(a):e.entity_id;return"attribute"in e&&(i+=` ${e.attribute} from`),i+=` ${n} is`,"above"in e&&(i+=` above ${e.above}`),"below"in e&&"above"in e&&(i+=" and"),"below"in e&&(i+=` below ${e.below}`),i}if("sun"===e.condition&&("before"in e||"after"in e)){let t="Confirm";if(!e.after&&!e.before)return t+=" sun",t;if(t+=" sun",e.after){let i="";e.after_offset&&(i="number"==typeof e.after_offset?` offset by ${zo(e.after_offset)}`:"string"==typeof e.after_offset?` offset by ${e.after_offset}`:` offset by ${JSON.stringify(e.after_offset)}`),t+=` after ${e.after}${i}`}return e.before&&(t+=` before ${e.before}`),t}if("zone"===e.condition&&e.entity_id&&e.zone){let i="",a=!1,n="",o=!1;const s=t.states;if(Array.isArray(e.entity_id)){e.entity_id.length>1&&(a=!0);for(const[t,a]of e.entity_id.entries())s[a]&&(i+=`${t>0?",":""} ${e.entity_id.length>1&&t===e.entity_id.length-1?"or":""} ${To(s[a])||a}`)}else i=s[e.entity_id]?To(s[e.entity_id]):e.entity_id;if(Array.isArray(e.zone)){e.zone.length>1&&(o=!0);for(const[t,i]of e.zone.entries())s[i]&&(n+=`${t>0?",":""} ${e.zone.length>1&&t===e.zone.length-1?"or":""} ${To(s[i])||i}`)}else n=s[e.zone]?To(s[e.zone]):e.zone;return`Confirm ${i} ${a?"are":"is"} in ${n} ${o?"zones":"zone"}`}if("device"===e.condition){if(!e.device_id)return"Device condition";const i=e,a=Ro(t,i);if(a)return a;const n=t.states[i.entity_id];return`${n?To(n):i.entity_id} ${i.type}`}return"trigger"===e.condition?e.id?`When triggered by ${e.id}`:"Trigger condition":`${e.condition?e.condition.replace(/_/g," "):"Unknown"} condition`},Js=(e,t,i)=>e.name_by_user||e.name||i&&((e,t)=>{for(const i of t||[]){const t="string"==typeof i?i:i.entity_id,a=e.states[t];if(a)return To(a)}})(t,i)||t.localize("ui.panel.config.devices.unnamed_device","type",t.localize(`ui.panel.config.devices.type.${e.entry_type||"device"}`)),er=e=>e.sendMessagePromise({type:"config/device_registry/list"}),tr=(e,t)=>e.subscribeEvents(In((()=>er(e).then((e=>t.setState(e,!0)))),500,!0),"device_registry_updated"),ir=(e,t)=>M("_dr",er,tr,e,t),ar=(e,t)=>{const i={};for(const a of t){const t=e[a.entity_id];null!=t&&t.domain&&null!==a.device_id&&(i[a.device_id]||(i[a.device_id]=[]),i[a.device_id].push(t.domain))}return i},nr=(e,t)=>{if(t.name)return t.name;const i=e.states[t.entity_id];return i?To(i):t.original_name?t.original_name:t.entity_id},or=e=>e.sendMessagePromise({type:"config/entity_registry/list"}),sr=(e,t)=>e.subscribeEvents(In((()=>or(e).then((e=>t.setState(e,!0)))),500,!0),"entity_registry_updated"),rr=(e,t)=>M("_entityRegistry",or,sr,e,t),lr=T((e=>{const t={};for(const i of Object.values(e))t[i.id]=i;return t})),dr=(e,t,i)=>e(`component.${t}.title`)||(null==i?void 0:i.name)||t,cr=(e,t,i,a=!1)=>{if(t.alias&&!a)return t.alias;if(i||(i=Co(t)),"service"===i){const i=t;let a;if(i.service_template||i.service&&Lo(i.service))a="Call a service based on a template";else{if(!i.service)return"Call a service";{const[t,n]=i.service.split(".",2),o=e.services[t][n];a=o?`${dr(e.localize,t)}: ${o.name}`:`Call service: ${i.service}`}}if(i.target){const t=[];for(const[a,n]of Object.entries({area_id:"areas",device_id:"devices",entity_id:"entities"})){if(!(a in i.target))continue;const o=Array.isArray(i.target[a])?i.target[a]:[i.target[a]];for(const i of o){if(Lo(i)){t.push(`templated ${n}`);break}if("entity_id"===a)if(i.includes(".")){const a=e.states[i];a?t.push(To(a)):t.push(i)}else{const a=lr(e.entities)[i];a?t.push(nr(e,a)||i):t.push("unknown entity")}else if("device_id"===a){const a=e.devices[i];a?t.push(Js(a,e)):t.push("unknown device")}else if("area_id"===a){const a=e.areas[i];null!=a&&a.name?t.push(a.name):t.push("unknown area")}else t.push(i)}}t.length>0&&(a+=` ${t.join(", ")}`)}return a}if("delay"===i){const e=t;let i;return i="number"==typeof e.delay?`for ${zo(e.delay)}`:"string"==typeof e.delay?Lo(e.delay)?"based on a template":`for ${e.delay||"a duration"}`:e.delay?`for ${Io(e.delay)}`:"for a duration",`Delay ${i}`}if("activate_scene"===i){const i=t;let a;var n;if("scene"in i)a=i.scene;else a=(null===(n=i.target)||void 0===n?void 0:n.entity_id)||i.entity_id;if(!a)return"Activate a scene";const o=a?e.states[a]:void 0;return`Active scene ${o?To(o):a}`}if("play_media"===i){var o;const i=t,a=(null===(o=i.target)||void 0===o?void 0:o.entity_id)||i.entity_id,n=a?e.states[a]:void 0;return`Play ${i.metadata.title||i.data.media_content_id||"media"} on ${n?To(n):a||"a media player"}`}if("wait_for_trigger"===i){const i=So(t.wait_for_trigger);return i&&0!==i.length?`Wait for ${i.map((t=>Qs(t,e))).join(", ")}`:"Wait for a trigger"}if("variables"===i){const e=t;return`Define variables ${Object.keys(e.variables).join(", ")}`}if("fire_event"===i){const e=t;return Lo(e.event)?"Fire event based on a template":`Fire event ${e.event}`}if("wait_template"===i)return"Wait for a template to render true";if("check_condition"===i)return Xs(t,e);if("stop"===i){const e=t;return"Stop"+(e.stop?` because: ${e.stop}`:"")}if("if"===i){const i=t;return`Perform an action if: ${i.if?"string"==typeof i.if?i.if:So(i.if).length>1?`${So(i.if).length} conditions`:So(i.if).length?Xs(So(i.if)[0],e):"":""}${i.else?" (or else!)":""}`}if("choose"===i){const e=t;return e.choose?`Choose between ${So(e.choose).length+(e.default?1:0)} actions`:"Choose an action"}if("repeat"===i){const i=t;return`Repeat an action ${"count"in i.repeat?`${i.repeat.count} times`:""}${"while"in i.repeat?`while ${So(i.repeat.while).map((t=>Xs(t,e))).join(", ")} is true`:"until"in i.repeat?`until ${So(i.repeat.until).map((t=>Xs(t,e))).join(", ")} is true`:"for_each"in i.repeat?`for every item: ${So(i.repeat.for_each).map((e=>JSON.stringify(e))).join(", ")}`:""}`}if("check_condition"===i)return`Test ${Xs(t,e)}`;if("device_action"===i){const i=t;if(!i.device_id)return"Device action";const a=qo(e,i);if(a)return a;const n=e.states[i.entity_id];return`${i.type||"Perform action with"} ${n?To(n):i.entity_id}`}if("parallel"===i){return`Run ${So(t.parallel).length} actions in parallel`}return i},ur=(e,t)=>A(e,"hass-notification",t),hr=e=>e.substr(0,e.indexOf("."));class pr extends HTMLElement{static get version(){return"23.2.3"}}customElements.define("vaadin-material-styles",pr);const vr=e=>class extends e{static get properties(){return{theme:{type:String,reflectToAttribute:!0,observer:"__deprecatedThemePropertyChanged"},_theme:{type:String,readOnly:!0}}}__deprecatedThemePropertyChanged(e){this._set_theme(e)}},mr=[];function fr(e,t,i={}){var a;e&&(a=e,br(customElements.get(a))&&console.warn(`The custom element definition for "${e}"\n was finalized before a style module was registered.\n Make sure to add component specific style modules before\n importing the corresponding custom element.`)),t=function(e=[]){return[e].flat(1/0).filter((e=>e instanceof L||(console.warn("An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`."),!1)))}(t),window.Vaadin&&window.Vaadin.styleModules?window.Vaadin.styleModules.registerStyles(e,t,i):mr.push({themeFor:e,styles:t,include:i.include,moduleId:i.moduleId})}function gr(){return window.Vaadin&&window.Vaadin.styleModules?window.Vaadin.styleModules.getAllThemes():mr}function _r(e=""){let t=0;return e.startsWith("lumo-")||e.startsWith("material-")?t=1:e.startsWith("vaadin-")&&(t=2),t}function yr(e){const t=[];return e.include&&[].concat(e.include).forEach((e=>{const i=gr().find((t=>t.moduleId===e));i?t.push(...yr(i),...i.styles):console.warn(`Included moduleId ${e} not found in style registry`)}),e.styles),t}function kr(e){const t=`${e}-default-theme`,i=gr().filter((i=>i.moduleId!==t&&function(e,t){return(e||"").split(" ").some((e=>new RegExp(`^${e.split("*").join(".*")}$`).test(t)))}(i.themeFor,e))).map((e=>({...e,styles:[...yr(e),...e.styles],includePriority:_r(e.moduleId)}))).sort(((e,t)=>t.includePriority-e.includePriority));return i.length>0?i:gr().filter((e=>e.moduleId===t))}function br(e){return e&&Object.prototype.hasOwnProperty.call(e,"__themes")}const $r=e=>class extends(vr(e)){static finalize(){if(super.finalize(),this.elementStyles)return;const e=this.prototype._template;e&&!br(this)&&function(e,t){const i=document.createElement("style");i.innerHTML=e.map((e=>e.cssText)).join("\n"),t.content.appendChild(i)}(this.getStylesForThis(),e)}static finalizeStyles(e){const t=this.getStylesForThis();return e?[...super.finalizeStyles(e),...t]:t}static getStylesForThis(){const e=Object.getPrototypeOf(this.prototype),t=(e?e.constructor.__themes:[])||[];this.__themes=[...t,...kr(this.is)];const i=this.__themes.flatMap((e=>e.styles));return i.filter(((e,t)=>t===i.lastIndexOf(e)))}};fr("",v` :host { /* Text colors */ --material-body-text-color: var(--light-theme-text-color, rgba(0, 0, 0, 0.87)); --material-secondary-text-color: var(--light-theme-secondary-color, rgba(0, 0, 0, 0.54)); --material-disabled-text-color: var(--light-theme-disabled-color, rgba(0, 0, 0, 0.38)); /* Primary colors */ --material-primary-color: var(--primary-color, #6200ee); --material-primary-contrast-color: var(--dark-theme-base-color, #fff); --material-primary-text-color: var(--material-primary-color); /* Error colors */ --material-error-color: var(--error-color, #b00020); --material-error-text-color: var(--material-error-color); /* Background colors */ --material-background-color: var(--light-theme-background-color, #fff); --material-secondary-background-color: var(--light-theme-secondary-background-color, #f5f5f5); --material-disabled-color: rgba(0, 0, 0, 0.26); /* Divider colors */ --material-divider-color: rgba(0, 0, 0, 0.12); /* Undocumented internal properties (prefixed with three dashes) */ /* Text field tweaks */ --_material-text-field-input-line-background-color: initial; --_material-text-field-input-line-opacity: initial; --_material-text-field-input-line-hover-opacity: initial; --_material-text-field-focused-label-opacity: initial; /* Button tweaks */ --_material-button-raised-background-color: initial; --_material-button-outline-color: initial; /* Grid tweaks */ --_material-grid-row-hover-background-color: initial; /* Split layout tweaks */ --_material-split-layout-splitter-background-color: initial; background-color: var(--material-background-color); color: var(--material-body-text-color); } [theme~='dark'] { /* Text colors */ --material-body-text-color: var(--dark-theme-text-color, rgba(255, 255, 255, 1)); --material-secondary-text-color: var(--dark-theme-secondary-color, rgba(255, 255, 255, 0.7)); --material-disabled-text-color: var(--dark-theme-disabled-color, rgba(255, 255, 255, 0.5)); /* Primary colors */ --material-primary-color: var(--light-primary-color, #7e3ff2); --material-primary-text-color: #b794f6; /* Error colors */ --material-error-color: var(--error-color, #de2839); --material-error-text-color: var(--material-error-color); /* Background colors */ --material-background-color: var(--dark-theme-background-color, #303030); --material-secondary-background-color: var(--dark-theme-secondary-background-color, #3b3b3b); --material-disabled-color: rgba(255, 255, 255, 0.3); /* Divider colors */ --material-divider-color: rgba(255, 255, 255, 0.12); /* Undocumented internal properties (prefixed with three dashes) */ /* Text field tweaks */ --_material-text-field-input-line-background-color: #fff; --_material-text-field-input-line-opacity: 0.7; --_material-text-field-input-line-hover-opacity: 1; --_material-text-field-focused-label-opacity: 1; /* Button tweaks */ --_material-button-raised-background-color: rgba(255, 255, 255, 0.08); --_material-button-outline-color: rgba(255, 255, 255, 0.2); /* Grid tweaks */ --_material-grid-row-hover-background-color: rgba(255, 255, 255, 0.08); --_material-grid-row-selected-overlay-opacity: 0.16; /* Split layout tweaks */ --_material-split-layout-splitter-background-color: rgba(255, 255, 255, 0.8); background-color: var(--material-background-color); color: var(--material-body-text-color); } a { color: inherit; } `,{moduleId:"material-color-light"});fr("",v` :host { /* Text colors */ --material-body-text-color: var(--dark-theme-text-color, rgba(255, 255, 255, 1)); --material-secondary-text-color: var(--dark-theme-secondary-color, rgba(255, 255, 255, 0.7)); --material-disabled-text-color: var(--dark-theme-disabled-color, rgba(255, 255, 255, 0.5)); /* Primary colors */ --material-primary-color: var(--light-primary-color, #7e3ff2); --material-primary-text-color: #b794f6; /* Error colors */ --material-error-color: var(--error-color, #de2839); --material-error-text-color: var(--material-error-color); /* Background colors */ --material-background-color: var(--dark-theme-background-color, #303030); --material-secondary-background-color: var(--dark-theme-secondary-background-color, #3b3b3b); --material-disabled-color: rgba(255, 255, 255, 0.3); /* Divider colors */ --material-divider-color: rgba(255, 255, 255, 0.12); /* Undocumented internal properties (prefixed with three dashes) */ /* Text field tweaks */ --_material-text-field-input-line-background-color: #fff; --_material-text-field-input-line-opacity: 0.7; --_material-text-field-input-line-hover-opacity: 1; --_material-text-field-focused-label-opacity: 1; /* Button tweaks */ --_material-button-raised-background-color: rgba(255, 255, 255, 0.08); --_material-button-outline-color: rgba(255, 255, 255, 0.2); /* Grid tweaks */ --_material-grid-row-hover-background-color: rgba(255, 255, 255, 0.08); --_material-grid-row-selected-overlay-opacity: 0.16; /* Split layout tweaks */ --_material-split-layout-splitter-background-color: rgba(255, 255, 255, 0.8); background-color: var(--material-background-color); color: var(--material-body-text-color); } `,{moduleId:"material-color-dark"});const xr=v` :host { /* Text colors */ --material-body-text-color: var(--light-theme-text-color, rgba(0, 0, 0, 0.87)); --material-secondary-text-color: var(--light-theme-secondary-color, rgba(0, 0, 0, 0.54)); --material-disabled-text-color: var(--light-theme-disabled-color, rgba(0, 0, 0, 0.38)); /* Primary colors */ --material-primary-color: var(--primary-color, #6200ee); --material-primary-contrast-color: var(--dark-theme-base-color, #fff); --material-primary-text-color: var(--material-primary-color); /* Error colors */ --material-error-color: var(--error-color, #b00020); --material-error-text-color: var(--material-error-color); /* Background colors */ --material-background-color: var(--light-theme-background-color, #fff); --material-secondary-background-color: var(--light-theme-secondary-background-color, #f5f5f5); --material-disabled-color: rgba(0, 0, 0, 0.26); /* Divider colors */ --material-divider-color: rgba(0, 0, 0, 0.12); } `,wr=document.createElement("template");wr.innerHTML=``,document.head.appendChild(wr.content);const Cr=v` :host { /* Font family */ --material-font-family: 'Roboto', sans-serif; /* Font sizes */ --material-h1-font-size: 6rem; --material-h2-font-size: 3.75rem; --material-h3-font-size: 3rem; --material-h4-font-size: 2.125rem; --material-h5-font-size: 1.5rem; --material-h6-font-size: 1.25rem; --material-body-font-size: 1rem; --material-small-font-size: 0.875rem; --material-button-font-size: 0.875rem; --material-caption-font-size: 0.75rem; /* Icon size */ --material-icon-font-size: 20px; } `;fr("",v` body, :host { font-family: var(--material-font-family); font-size: var(--material-body-font-size); line-height: 1.4; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } h1, h2, h3, h4, h5, h6 { color: inherit; line-height: 1.1; margin-top: 1.5em; } h1 { font-size: var(--material-h3-font-size); font-weight: 300; letter-spacing: -0.015em; margin-bottom: 1em; text-indent: -0.07em; } h2 { font-size: var(--material-h4-font-size); font-weight: 300; letter-spacing: -0.01em; margin-bottom: 0.75em; text-indent: -0.07em; } h3 { font-size: var(--material-h5-font-size); font-weight: 400; margin-bottom: 0.75em; text-indent: -0.05em; } h4 { font-size: var(--material-h6-font-size); font-weight: 400; letter-spacing: 0.01em; margin-bottom: 0.75em; text-indent: -0.05em; } h5 { font-size: var(--material-body-font-size); font-weight: 500; margin-bottom: 0.5em; text-indent: -0.025em; } h6 { font-size: var(--material-small-font-size); font-weight: 500; letter-spacing: 0.01em; margin-bottom: 0.25em; text-indent: -0.025em; } a, b, strong { font-weight: 500; } `,{moduleId:"material-typography"});const Ar=document.createElement("template");if(Ar.innerHTML=``,document.head.appendChild(Ar.content),!window.polymerSkipLoadingFontRoboto){const e="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic",t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.crossOrigin="anonymous",t.href=e,document.head.appendChild(t)}const Ir=v` /* prettier-ignore */ :host { /* from http://codepen.io/shyndman/pen/c5394ddf2e8b2a5c9185904b57421cdb */ --material-shadow-elevation-2dp: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2); --material-shadow-elevation-3dp: 0 3px 4px 0 rgba(0, 0, 0, 0.14), 0 1px 8px 0 rgba(0, 0, 0, 0.12), 0 3px 3px -2px rgba(0, 0, 0, 0.4); --material-shadow-elevation-4dp: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.4); --material-shadow-elevation-6dp: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.4); --material-shadow-elevation-8dp: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.4); --material-shadow-elevation-12dp: 0 12px 16px 1px rgba(0, 0, 0, 0.14), 0 4px 22px 3px rgba(0, 0, 0, 0.12), 0 6px 7px -4px rgba(0, 0, 0, 0.4); --material-shadow-elevation-16dp: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.4); --material-shadow-elevation-24dp: 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12), 0 11px 15px -7px rgba(0, 0, 0, 0.4); } `,Er=document.createElement("template");Er.innerHTML=``,document.head.appendChild(Er.content);const zr=v` :host { top: 16px; right: 16px; /* TODO (@jouni): remove unnecessary multiplication after https://github.com/vaadin/vaadin-overlay/issues/90 is fixed */ bottom: calc(1px * var(--vaadin-overlay-viewport-bottom) + 16px); left: 16px; } [part='overlay'] { background-color: var(--material-background-color); border-radius: 4px; box-shadow: var(--material-shadow-elevation-4dp); color: var(--material-body-text-color); font-family: var(--material-font-family); font-size: var(--material-body-font-size); font-weight: 400; } [part='content'] { padding: 8px 0; } [part='backdrop'] { opacity: 0.2; animation: 0.2s vaadin-overlay-backdrop-enter; will-change: opacity; } @keyframes vaadin-overlay-backdrop-enter { 0% { opacity: 0; } } `;fr("",zr,{moduleId:"material-overlay"}),fr("vaadin-overlay",zr,{moduleId:"material-vaadin-overlay"});const Sr=e=>e.test(navigator.userAgent),Or=e=>e.test(navigator.platform);Sr(/Android/),Sr(/Chrome/)&&(e=>{e.test(navigator.vendor)})(/Google Inc/),Sr(/Firefox/);const Tr=Or(/^iPad/)||Or(/^Mac/)&&navigator.maxTouchPoints>1,Mr=Or(/^iPhone/)||Tr,Lr=Sr(/^((?!chrome|android).)*safari/i),Pr=(()=>{try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}})(),Br=P((e=>class extends e{constructor(){super(),this.__controllers=new Set}connectedCallback(){super.connectedCallback(),this.__controllers.forEach((e=>{e.hostConnected&&e.hostConnected()}))}disconnectedCallback(){super.disconnectedCallback(),this.__controllers.forEach((e=>{e.hostDisconnected&&e.hostDisconnected()}))}addController(e){this.__controllers.add(e),void 0!==this.$&&this.isConnected&&e.hostConnected&&e.hostConnected()}removeController(e){this.__controllers.delete(e)}}));class Fr{static detectScrollType(){const e=document.createElement("div");e.textContent="ABCD",e.dir="rtl",e.style.fontSize="14px",e.style.width="4px",e.style.height="1px",e.style.position="absolute",e.style.top="-1000px",e.style.overflow="scroll",document.body.appendChild(e);let t="reverse";return e.scrollLeft>0?t="default":(e.scrollLeft=2,e.scrollLeft<2&&(t="negative")),document.body.removeChild(e),t}static getNormalizedScrollLeft(e,t,i){const{scrollLeft:a}=i;if("rtl"!==t||!e)return a;switch(e){case"negative":return i.scrollWidth-i.clientWidth+a;case"reverse":return i.scrollWidth-i.clientWidth-a;default:return a}}static setNormalizedScrollLeft(e,t,i,a){if("rtl"===t&&e)switch(e){case"negative":i.scrollLeft=i.clientWidth-i.scrollWidth+a;break;case"reverse":i.scrollLeft=i.scrollWidth-i.clientWidth-a;break;default:i.scrollLeft=a}else i.scrollLeft=a}}const Dr=[];let Nr;function Vr(e,t,i=e.getAttribute("dir")){t?e.setAttribute("dir",t):null!=i&&e.removeAttribute("dir")}function qr(){return document.documentElement.getAttribute("dir")}new MutationObserver((function(){const e=qr();Dr.forEach((t=>{Vr(t,e)}))})).observe(document.documentElement,{attributes:!0,attributeFilter:["dir"]});const Rr=e=>class extends e{static get properties(){return{dir:{type:String,value:"",reflectToAttribute:!0,converter:{fromAttribute:e=>e||"",toAttribute:e=>""===e?null:e}}}}static finalize(){super.finalize(),Nr||(Nr=Fr.detectScrollType())}connectedCallback(){super.connectedCallback(),this.hasAttribute("dir")||(this.__subscribe(),Vr(this,qr(),null))}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"dir"!==e)return;const a=qr(),n=i===a&&-1===Dr.indexOf(this),o=!i&&t&&-1===Dr.indexOf(this),s=i!==a&&t===a;n||o?(this.__subscribe(),Vr(this,a,i)):s&&this.__subscribe(!1)}disconnectedCallback(){super.disconnectedCallback(),this.__subscribe(!1),this.removeAttribute("dir")}_valueToNodeAttribute(e,t,i){("dir"!==i||""!==t||e.hasAttribute("dir"))&&super._valueToNodeAttribute(e,t,i)}_attributeToProperty(e,t,i){"dir"!==e||t?super._attributeToProperty(e,t,i):this.dir=""}__subscribe(e=!0){e?Dr.includes(this)||Dr.push(this):Dr.includes(this)&&Dr.splice(Dr.indexOf(this),1)}__getNormalizedScrollLeft(e){return Fr.getNormalizedScrollLeft(Nr,this.getAttribute("dir")||"ltr",e)}__setNormalizedScrollLeft(e,t){return Fr.setNormalizedScrollLeft(Nr,this.getAttribute("dir")||"ltr",e,t)}};function jr(e,t){const i=Math.max(e.tabIndex,0),a=Math.max(t.tabIndex,0);return 0===i||0===a?a>i:i>a}function Ur(e){const t=e.length;if(t<2)return e;const i=Math.ceil(t/2);return function(e,t){const i=[];for(;e.length>0&&t.length>0;)jr(e[0],t[0])?i.push(t.shift()):i.push(e.shift());return i.concat(e,t)}(Ur(e.slice(0,i)),Ur(e.slice(i)))}function Hr(e,t){if(e.nodeType!==Node.ELEMENT_NODE||function(e){const t=e.style;if("hidden"===t.visibility||"none"===t.display)return!0;const i=window.getComputedStyle(e);return"hidden"===i.visibility||"none"===i.display}(e))return!1;const i=e,a=function(e){if(!function(e){return!e.matches('[tabindex="-1"]')&&(e.matches("input, select, textarea, button, object")?e.matches(":not([disabled])"):e.matches("a[href], area[href], iframe, [tabindex], [contentEditable]"))}(e))return-1;const t=e.getAttribute("tabindex")||0;return Number(t)}(i);let n=a>0;a>=0&&t.push(i);let o=[];return o="slot"===i.localName?i.assignedNodes({flatten:!0}):(i.shadowRoot||i).children,[...o].forEach((e=>{n=Hr(e,t)||n})),n}function Gr(e){return e.getRootNode().activeElement===e}window.addEventListener("keydown",(()=>{}),{capture:!0}),window.addEventListener("mousedown",(()=>{}),{capture:!0});const Wr=[];class Kr{constructor(e){this.host=e,this.__trapNode=null,this.__onKeyDown=this.__onKeyDown.bind(this)}hostConnected(){document.addEventListener("keydown",this.__onKeyDown)}hostDisconnected(){document.removeEventListener("keydown",this.__onKeyDown)}trapFocus(e){if(this.__trapNode=e,0===this.__focusableElements.length)throw this.__trapNode=null,new Error("The trap node should have at least one focusable descendant or be focusable itself.");Wr.push(this),-1===this.__focusedElementIndex&&this.__focusableElements[0].focus()}releaseFocus(){this.__trapNode=null,Wr.pop()}__onKeyDown(e){if(this.__trapNode&&this===Array.from(Wr).pop()&&"Tab"===e.key){e.preventDefault();const t=e.shiftKey;this.__focusNextElement(t)}}__focusNextElement(e=!1){const t=this.__focusableElements,i=e?-1:1,a=this.__focusedElementIndex,n=t[(t.length+a+i)%t.length];n.focus(),"input"===n.localName&&n.select()}get __focusableElements(){return function(e){const t=[];return Hr(e,t)?Ur(t):t}(this.__trapNode)}get __focusedElementIndex(){const e=this.__focusableElements;return e.indexOf(e.filter(Gr).pop())}}class Yr extends($r(Rr(Br(B)))){static get template(){return F`
`}static get is(){return"vaadin-overlay"}static get properties(){return{opened:{type:Boolean,notify:!0,observer:"_openedChanged",reflectToAttribute:!0},owner:Element,renderer:Function,template:{type:Object,notify:!0},content:{type:Object,notify:!0},withBackdrop:{type:Boolean,value:!1,reflectToAttribute:!0},model:Object,modeless:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_modelessChanged"},hidden:{type:Boolean,reflectToAttribute:!0,observer:"_hiddenChanged"},focusTrap:{type:Boolean,value:!1},restoreFocusOnClose:{type:Boolean,value:!1},restoreFocusNode:{type:HTMLElement},_mouseDownInside:{type:Boolean},_mouseUpInside:{type:Boolean},_instance:{type:Object},_originalContentPart:Object,_contentNodes:Array,_oldOwner:Element,_oldModel:Object,_oldTemplate:Object,_oldRenderer:Object,_oldOpened:Boolean}}static get observers(){return["_templateOrRendererChanged(template, renderer, owner, model, opened)"]}constructor(){super(),this._boundMouseDownListener=this._mouseDownListener.bind(this),this._boundMouseUpListener=this._mouseUpListener.bind(this),this._boundOutsideClickListener=this._outsideClickListener.bind(this),this._boundKeydownListener=this._keydownListener.bind(this),this._observer=new D(this,(e=>{this._setTemplateFromNodes(e.addedNodes)})),this._boundIronOverlayCanceledListener=this._ironOverlayCanceled.bind(this),Mr&&(this._boundIosResizeListener=()=>this._detectIosNavbar()),this.__focusTrapController=new Kr(this)}ready(){super.ready(),this._observer.flush(),this.addEventListener("click",(()=>{})),this.$.backdrop.addEventListener("click",(()=>{})),this.addController(this.__focusTrapController)}_detectIosNavbar(){if(!this.opened)return;const e=window.innerHeight,t=window.innerWidth>e,i=document.documentElement.clientHeight;t&&i>e?this.style.setProperty("--vaadin-overlay-viewport-bottom",i-e+"px"):this.style.setProperty("--vaadin-overlay-viewport-bottom","0")}_setTemplateFromNodes(e){this.template=e.filter((e=>e.localName&&"template"===e.localName))[0]||this.template}close(e){const t=new CustomEvent("vaadin-overlay-close",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),t.defaultPrevented||(this.opened=!1)}connectedCallback(){super.connectedCallback(),this._boundIosResizeListener&&(this._detectIosNavbar(),window.addEventListener("resize",this._boundIosResizeListener))}disconnectedCallback(){super.disconnectedCallback(),this._boundIosResizeListener&&window.removeEventListener("resize",this._boundIosResizeListener)}requestContentUpdate(){this.renderer&&this.renderer.call(this.owner,this.content,this.owner,this.model)}_ironOverlayCanceled(e){e.preventDefault()}_mouseDownListener(e){this._mouseDownInside=e.composedPath().indexOf(this.$.overlay)>=0}_mouseUpListener(e){this._mouseUpInside=e.composedPath().indexOf(this.$.overlay)>=0}_outsideClickListener(e){if(e.composedPath().includes(this.$.overlay)||this._mouseDownInside||this._mouseUpInside)return this._mouseDownInside=!1,void(this._mouseUpInside=!1);if(!this._last)return;const t=new CustomEvent("vaadin-overlay-outside-click",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),this.opened&&!t.defaultPrevented&&this.close(e)}_keydownListener(e){if(this._last&&(!this.modeless||e.composedPath().includes(this.$.overlay))&&"Escape"===e.key){const t=new CustomEvent("vaadin-overlay-escape-press",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),this.opened&&!t.defaultPrevented&&this.close(e)}}_ensureTemplatized(){this._setTemplateFromNodes(Array.from(this.children))}_openedChanged(e,t){this._instance||this._ensureTemplatized(),e?(this.__restoreFocusNode=this._getActiveElement(),this._animatedOpening(),Rn(this,(()=>{this.focusTrap&&this.__focusTrapController.trapFocus(this.$.overlay);const e=new CustomEvent("vaadin-overlay-open",{bubbles:!0});this.dispatchEvent(e)})),document.addEventListener("keydown",this._boundKeydownListener),this.modeless||this._addGlobalListeners()):t&&(this.focusTrap&&this.__focusTrapController.releaseFocus(),this._animatedClosing(),document.removeEventListener("keydown",this._boundKeydownListener),this.modeless||this._removeGlobalListeners())}_hiddenChanged(e){e&&this.hasAttribute("closing")&&this._flushAnimation("closing")}_shouldAnimate(){const e=getComputedStyle(this).getPropertyValue("animation-name");return!("none"===getComputedStyle(this).getPropertyValue("display"))&&e&&"none"!==e}_enqueueAnimation(e,t){const i=`__${e}Handler`,a=e=>{e&&e.target!==this||(t(),this.removeEventListener("animationend",a),delete this[i])};this[i]=a,this.addEventListener("animationend",a)}_flushAnimation(e){const t=`__${e}Handler`;"function"==typeof this[t]&&this[t]()}_animatedOpening(){this.parentNode===document.body&&this.hasAttribute("closing")&&this._flushAnimation("closing"),this._attachOverlay(),this.modeless||this._enterModalState(),this.setAttribute("opening",""),this._shouldAnimate()?this._enqueueAnimation("opening",(()=>{this._finishOpening()})):this._finishOpening()}_attachOverlay(){this._placeholder=document.createComment("vaadin-overlay-placeholder"),this.parentNode.insertBefore(this._placeholder,this),document.body.appendChild(this),this.bringToFront()}_finishOpening(){document.addEventListener("iron-overlay-canceled",this._boundIronOverlayCanceledListener),this.removeAttribute("opening")}_finishClosing(){document.removeEventListener("iron-overlay-canceled",this._boundIronOverlayCanceledListener),this._detachOverlay(),this.$.overlay.style.removeProperty("pointer-events"),this.removeAttribute("closing")}_animatedClosing(){if(this.hasAttribute("opening")&&this._flushAnimation("opening"),this._placeholder){this._exitModalState();const e=this.restoreFocusNode||this.__restoreFocusNode;if(this.restoreFocusOnClose&&e){const t=this._getActiveElement();(t===document.body||this._deepContains(t))&&setTimeout((()=>e.focus())),this.__restoreFocusNode=null}this.setAttribute("closing",""),this.dispatchEvent(new CustomEvent("vaadin-overlay-closing")),this._shouldAnimate()?this._enqueueAnimation("closing",(()=>{this._finishClosing()})):this._finishClosing()}}_detachOverlay(){this._placeholder.parentNode.insertBefore(this,this._placeholder),this._placeholder.parentNode.removeChild(this._placeholder)}static get __attachedInstances(){return Array.from(document.body.children).filter((e=>e instanceof Yr&&!e.hasAttribute("closing"))).sort(((e,t)=>e.__zIndex-t.__zIndex||0))}get _last(){return this===Yr.__attachedInstances.pop()}_modelessChanged(e){e?(this._removeGlobalListeners(),this._exitModalState()):this.opened&&(this._addGlobalListeners(),this._enterModalState())}_addGlobalListeners(){document.addEventListener("mousedown",this._boundMouseDownListener),document.addEventListener("mouseup",this._boundMouseUpListener),document.documentElement.addEventListener("click",this._boundOutsideClickListener,!0)}_enterModalState(){"none"!==document.body.style.pointerEvents&&(this._previousDocumentPointerEvents=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),Yr.__attachedInstances.forEach((e=>{e!==this&&(e.shadowRoot.querySelector('[part="overlay"]').style.pointerEvents="none")}))}_removeGlobalListeners(){document.removeEventListener("mousedown",this._boundMouseDownListener),document.removeEventListener("mouseup",this._boundMouseUpListener),document.documentElement.removeEventListener("click",this._boundOutsideClickListener,!0)}_exitModalState(){void 0!==this._previousDocumentPointerEvents&&(document.body.style.pointerEvents=this._previousDocumentPointerEvents,delete this._previousDocumentPointerEvents);const e=Yr.__attachedInstances;let t;for(;(t=e.pop())&&(t===this||(t.shadowRoot.querySelector('[part="overlay"]').style.removeProperty("pointer-events"),t.modeless)););}_removeOldContent(){this.content&&this._contentNodes&&(this._observer.disconnect(),this._contentNodes.forEach((e=>{e.parentNode===this.content&&this.content.removeChild(e)})),this._originalContentPart&&(this.$.content.parentNode.replaceChild(this._originalContentPart,this.$.content),this.$.content=this._originalContentPart,this._originalContentPart=void 0),this._observer.connect(),this._contentNodes=void 0,this.content=void 0)}_stampOverlayTemplate(e){this._removeOldContent(),e._Templatizer||(e._Templatizer=N(e,this,{forwardHostProp(e,t){this._instance&&this._instance.forwardHostProp(e,t)}})),this._instance=new e._Templatizer({}),this._contentNodes=Array.from(this._instance.root.childNodes);const t=e._templateRoot||(e._templateRoot=e.getRootNode());if(t!==document){this.$.content.shadowRoot||this.$.content.attachShadow({mode:"open"});let e=Array.from(t.querySelectorAll("style")).reduce(((e,t)=>e+t.textContent),"");if(e=e.replace(/:host/g,":host-nomatch"),e){const t=document.createElement("style");t.textContent=e,this.$.content.shadowRoot.appendChild(t),this._contentNodes.unshift(t)}this.$.content.shadowRoot.appendChild(this._instance.root),this.content=this.$.content.shadowRoot}else this.appendChild(this._instance.root),this.content=this}_removeNewRendererOrTemplate(e,t,i,a){e!==t?this.template=void 0:i!==a&&(this.renderer=void 0)}_templateOrRendererChanged(e,t,i,a,n){if(e&&t)throw this._removeNewRendererOrTemplate(e,this._oldTemplate,t,this._oldRenderer),new Error("You should only use either a renderer or a template for overlay content");const o=this._oldOwner!==i||this._oldModel!==a;this._oldModel=a,this._oldOwner=i;const s=this._oldTemplate!==e;this._oldTemplate=e;const r=this._oldRenderer!==t;this._oldRenderer=t;const l=this._oldOpened!==n;this._oldOpened=n,r&&(this.content=this,this.content.innerHTML="",delete this.content._$litPart$),e&&s?this._stampOverlayTemplate(e):t&&(r||l||o)&&n&&this.requestContentUpdate()}_getActiveElement(){let e=document.activeElement||document.body;for(;e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}_deepContains(e){if(this.contains(e))return!0;let t=e;const i=e.ownerDocument;for(;t&&t!==i&&t!==this;)t=t.parentNode||t.host;return t===this}bringToFront(){let e="";const t=Yr.__attachedInstances.filter((e=>e!==this)).pop();if(t){e=t.__zIndex+1}this.style.zIndex=e,this.__zIndex=e||parseFloat(getComputedStyle(this).zIndex)}}customElements.define(Yr.is,Yr);const Zr=v` [part~='loader'] { height: 2px; background: var(--material-background-color) linear-gradient( 90deg, transparent 0%, transparent 20%, var(--material-primary-color) 20%, var(--material-primary-color) 40%, transparent 40%, transparent 60%, var(--material-primary-color) 60%, var(--material-primary-color) 80%, transparent 80%, transparent 100% ) 0 0 / 400% 100% repeat-x; opacity: 0; } :host(:not([loading])) [part~='loader'] { display: none; } :host([loading]) [part='loader'] { animation: 3s linear infinite material-loader-progress, 0.3s 0.1s both material-loader-fade-in; } [part='loader']::before { content: ''; display: block; height: 100%; opacity: 0.16; background: var(--material-primary-color); } @keyframes material-loader-fade-in { 0% { opacity: 0; } 100% { opacity: 1; } } @keyframes material-loader-progress { 0% { background-position: 0 0; background-size: 300% 100%; } 33% { background-position: -100% 0; background-size: 400% 100%; } 67% { background-position: -200% 0; background-size: 250% 100%; } 100% { background-position: -300% 0; background-size: 300% 100%; } } /* RTL specific styles */ @keyframes material-loader-progress-rtl { 0% { background-position: 100% 0; background-size: 300% 100%; } 33% { background-position: 200% 0; background-size: 400% 100%; } 67% { background-position: 300% 0; background-size: 250% 100%; } 100% { background-position: 400% 0; background-size: 300% 100%; } } :host([loading][dir='rtl']) [part='loader'] { animation: 3s linear infinite material-loader-progress-rtl, 0.3s 0.1s both material-loader-fade-in; } `,Qr=zr;fr("",Qr,{moduleId:"material-menu-overlay"});fr("vaadin-combo-box-overlay",[Qr,v` :host { --_vaadin-combo-box-items-container-border-width: 8px 0; --_vaadin-combo-box-items-container-border-style: solid; --_vaadin-combo-box-items-container-border-color: transparent; } [part='overlay'] { position: relative; overflow: visible; border-top-left-radius: 0; border-top-right-radius: 0; } [part='content'] { padding: 0; } [part~='loader'] { position: absolute; z-index: 1; top: -2px; left: 0; right: 0; } `,Zr],{moduleId:"material-combo-box-overlay"});const Xr=document.createElement("template");Xr.innerHTML='\n \n',document.head.appendChild(Xr.content);const Jr=v` :host { display: flex; align-items: center; box-sizing: border-box; min-height: 36px; padding: 8px 32px 8px 10px; overflow: hidden; font-family: var(--material-font-family); font-size: var(--material-small-font-size); line-height: 24px; } /* It's the list-box's responsibility to add the focus style */ :host([focused]) { outline: none; } /* Checkmark */ [part='checkmark']::before { display: var(--_material-item-selected-icon-display, none); content: ''; font-family: material-icons; font-size: 24px; line-height: 1; font-weight: 400; width: 24px; text-align: center; margin-right: 10px; color: var(--material-secondary-text-color); flex: none; } :host([selected]) [part='checkmark']::before { content: var(--material-icons-check); } @media (any-hover: hover) { :host(:hover:not([disabled])) { background-color: var(--material-secondary-background-color); } :host([focused]:not([disabled])) { background-color: var(--material-divider-color); } } /* Disabled */ :host([disabled]) { color: var(--material-disabled-text-color); cursor: default; pointer-events: none; } /* RTL specific styles */ :host([dir='rtl']) { padding: 8px 10px 8px 32px; } :host([dir='rtl']) [part='checkmark']::before { margin-right: 0; margin-left: 10px; } `;fr("vaadin-item",Jr,{moduleId:"material-item"});fr("vaadin-combo-box-item",[Jr,v` :host { cursor: pointer; -webkit-tap-highlight-color: transparent; padding: 4px 10px; --_material-item-selected-icon-display: block; } `],{moduleId:"material-combo-box-item"});class el extends($r(Rr(B))){static get template(){return F`
`}static get is(){return"vaadin-combo-box-item"}static get properties(){return{index:Number,item:Object,label:String,selected:{type:Boolean,value:!1,reflectToAttribute:!0},focused:{type:Boolean,value:!1,reflectToAttribute:!0},renderer:Function,_oldRenderer:Function}}static get observers(){return["__rendererOrItemChanged(renderer, index, item.*, selected, focused)","__updateLabel(label, renderer)"]}connectedCallback(){super.connectedCallback(),this._comboBox=this.parentNode.comboBox;const e=this._comboBox.getAttribute("dir");e&&this.setAttribute("dir",e)}requestContentUpdate(){if(!this.renderer)return;const e={index:this.index,item:this.item,focused:this.focused,selected:this.selected};this.renderer(this,this._comboBox,e)}__rendererOrItemChanged(e,t,i){void 0!==i&&void 0!==t&&(this._oldRenderer!==e&&(this.innerHTML="",delete this._$litPart$),e&&(this._oldRenderer=e,this.requestContentUpdate()))}__updateLabel(e,t){t||(this.textContent=e)}}customElements.define(el.is,el);const tl={start:"top",end:"bottom"},il={start:"left",end:"right"},al=e=>class extends e{static get properties(){return{positionTarget:{type:Object,value:null},horizontalAlign:{type:String,value:"start"},verticalAlign:{type:String,value:"top"},noHorizontalOverlap:{type:Boolean,value:!1},noVerticalOverlap:{type:Boolean,value:!1}}}static get observers(){return["__positionSettingsChanged(horizontalAlign, verticalAlign, noHorizontalOverlap, noVerticalOverlap)","__overlayOpenedChanged(opened, positionTarget)"]}constructor(){super(),this._updatePosition=this._updatePosition.bind(this)}connectedCallback(){super.connectedCallback(),this.opened&&this.__addUpdatePositionEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.__removeUpdatePositionEventListeners()}__addUpdatePositionEventListeners(){window.addEventListener("resize",this._updatePosition),this.__positionTargetAncestorRootNodes=function(e){const t=[];for(;e;){if(e.nodeType===Node.DOCUMENT_NODE){t.push(e);break}e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?e=e.assignedSlot?e.assignedSlot:e.parentNode:(t.push(e),e=e.host)}return t}(this.positionTarget),this.__positionTargetAncestorRootNodes.forEach((e=>{e.addEventListener("scroll",this._updatePosition,!0)}))}__removeUpdatePositionEventListeners(){window.removeEventListener("resize",this._updatePosition),this.__positionTargetAncestorRootNodes&&(this.__positionTargetAncestorRootNodes.forEach((e=>{e.removeEventListener("scroll",this._updatePosition,!0)})),this.__positionTargetAncestorRootNodes=null)}__overlayOpenedChanged(e,t){if(this.__removeUpdatePositionEventListeners(),e&&t&&this.__addUpdatePositionEventListeners(),e){const e=getComputedStyle(this);this.__margins||(this.__margins={},["top","bottom","left","right"].forEach((t=>{this.__margins[t]=parseInt(e[t],10)}))),this.setAttribute("dir",e.direction),this._updatePosition(),requestAnimationFrame((()=>this._updatePosition()))}}get __isRTL(){return"rtl"===this.getAttribute("dir")}__positionSettingsChanged(){this._updatePosition()}_updatePosition(){if(!this.positionTarget||!this.opened)return;const e=this.positionTarget.getBoundingClientRect(),t=this.__shouldAlignStartVertically(e);this.style.justifyContent=t?"flex-start":"flex-end";const i=this.__shouldAlignStartHorizontally(e,this.__isRTL),a=!this.__isRTL&&i||this.__isRTL&&!i;this.style.alignItems=a?"flex-start":"flex-end";const n=this.getBoundingClientRect(),o=this.__calculatePositionInOneDimension(e,n,this.noVerticalOverlap,tl,this,t),s=this.__calculatePositionInOneDimension(e,n,this.noHorizontalOverlap,il,this,i);Object.assign(this.style,o,s),this.toggleAttribute("bottom-aligned",!t),this.toggleAttribute("top-aligned",t),this.toggleAttribute("end-aligned",!a),this.toggleAttribute("start-aligned",a)}__shouldAlignStartHorizontally(e,t){const i=Math.max(this.__oldContentWidth||0,this.$.overlay.offsetWidth);this.__oldContentWidth=this.$.overlay.offsetWidth;const a=Math.min(window.innerWidth,document.documentElement.clientWidth),n=!t&&"start"===this.horizontalAlign||t&&"end"===this.horizontalAlign;return this.__shouldAlignStart(e,i,a,this.__margins,n,this.noHorizontalOverlap,il)}__shouldAlignStartVertically(e){const t=Math.max(this.__oldContentHeight||0,this.$.overlay.offsetHeight);this.__oldContentHeight=this.$.overlay.offsetHeight;const i=Math.min(window.innerHeight,document.documentElement.clientHeight),a="top"===this.verticalAlign;return this.__shouldAlignStart(e,t,i,this.__margins,a,this.noVerticalOverlap,tl)}__shouldAlignStart(e,t,i,a,n,o,s){const r=i-e[o?s.end:s.start]-a[s.end],l=e[o?s.start:s.end]-a[s.start],d=n?r:l;return n===(d>(n?l:r)||d>t)}__calculatePositionInOneDimension(e,t,i,a,n,o){const s=o?a.start:a.end,r=o?a.end:a.start;return{[s]:`${parseFloat(n.style[s]||getComputedStyle(n)[s])+(t[o?a.start:a.end]-e[i===o?a.end:a.start])*(o?-1:1)}px`,[r]:""}}};let nl;fr("vaadin-combo-box-overlay",v` #overlay { width: var(--vaadin-combo-box-overlay-width, var(--_vaadin-combo-box-overlay-default-width, auto)); } [part='content'] { display: flex; flex-direction: column; height: 100%; } `,{moduleId:"vaadin-combo-box-overlay-styles"});class ol extends(al(Yr)){static get is(){return"vaadin-combo-box-overlay"}static get template(){return nl||(nl=super.template.cloneNode(!0),nl.content.querySelector('[part~="overlay"]').removeAttribute("tabindex")),nl}static get observers(){return["_setOverlayWidth(positionTarget, opened)"]}connectedCallback(){super.connectedCallback();const e=this._comboBox,t=e&&e.getAttribute("dir");t&&this.setAttribute("dir",t)}ready(){super.ready();const e=document.createElement("div");e.setAttribute("part","loader");const t=this.shadowRoot.querySelector('[part~="content"]');t.parentNode.insertBefore(e,t)}_outsideClickListener(e){const t=e.composedPath();t.includes(this.positionTarget)||t.includes(this)||this.close()}_setOverlayWidth(e,t){if(e&&t){const t=this.localName;this.style.setProperty(`--_${t}-default-width`,`${e.clientWidth}px`);const i=getComputedStyle(this._comboBox).getPropertyValue(`--${t}-width`);""===i?this.style.removeProperty(`--${t}-width`):this.style.setProperty(`--${t}-width`,i),this._updatePosition()}}}customElements.define(ol.is,ol);let sl=0;let rl=0,ll=0;const dl=[];let cl=0,ul=!1;const hl=document.createTextNode("");new window.MutationObserver((function(){ul=!1;const e=dl.length;for(let t=0;t{throw e}))}}dl.splice(0,e),ll+=e})).observe(hl,{characterData:!0});const pl={after:e=>({run:t=>window.setTimeout(t,e),cancel(e){window.clearTimeout(e)}}),run:(e,t)=>window.setTimeout(e,t),cancel(e){window.clearTimeout(e)}},vl={run:e=>window.requestAnimationFrame(e),cancel(e){window.cancelAnimationFrame(e)}},ml={run:e=>window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,16),cancel(e){window.cancelIdleCallback?window.cancelIdleCallback(e):window.clearTimeout(e)}},fl={run(e){ul||(ul=!0,hl.textContent=cl,cl+=1),dl.push(e);const t=rl;return rl+=1,t},cancel(e){const t=e-ll;if(t>=0){if(!dl[t])throw new Error(`invalid async handle: ${e}`);dl[t]=null}}};class gl{static debounce(e,t,i){return e instanceof gl?e._cancelAsync():e=new gl,e.setConfig(t,i),e}constructor(){this._asyncModule=null,this._callback=null,this._timer=null}setConfig(e,t){this._asyncModule=e,this._callback=t,this._timer=this._asyncModule.run((()=>{this._timer=null,_l.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),_l.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}}let _l=new Set;function yl(){const e=Boolean(_l.size);return _l.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e}const kl=()=>{let e;do{e=yl()}while(e)},bl=navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/),$l=bl&&bl[1]>=8,xl={_ratio:.5,_scrollerPaddingTop:0,_scrollPosition:0,_physicalSize:0,_physicalAverage:0,_physicalAverageCount:0,_physicalTop:0,_virtualCount:0,_estScrollHeight:0,_scrollHeight:0,_viewportHeight:0,_viewportWidth:0,_physicalItems:null,_physicalSizes:null,_firstVisibleIndexVal:null,_lastVisibleIndexVal:null,_maxPages:2,_templateCost:0,get _physicalBottom(){return this._physicalTop+this._physicalSize},get _scrollBottom(){return this._scrollPosition+this._viewportHeight},get _virtualEnd(){return this._virtualStart+this._physicalCount-1},get _hiddenContentSize(){return this._physicalSize-this._viewportHeight},get _maxScrollTop(){return this._estScrollHeight-this._viewportHeight+this._scrollOffset},get _maxVirtualStart(){const e=this._virtualCount;return Math.max(0,e-this._physicalCount)},get _virtualStart(){return this._virtualStartVal||0},set _virtualStart(e){e=this._clamp(e,0,this._maxVirtualStart),this._virtualStartVal=e},get _physicalStart(){return this._physicalStartVal||0},set _physicalStart(e){(e%=this._physicalCount)<0&&(e=this._physicalCount+e),this._physicalStartVal=e},get _physicalEnd(){return(this._physicalStart+this._physicalCount-1)%this._physicalCount},get _physicalCount(){return this._physicalCountVal||0},set _physicalCount(e){this._physicalCountVal=e},get _optPhysicalSize(){return 0===this._viewportHeight?1/0:this._viewportHeight*this._maxPages},get _isVisible(){return Boolean(this.offsetWidth||this.offsetHeight)},get firstVisibleIndex(){let e=this._firstVisibleIndexVal;if(null==e){let t=this._physicalTop+this._scrollOffset;e=this._iterateItems(((e,i)=>{if(t+=this._getPhysicalSizeIncrement(e),t>this._scrollPosition)return i}))||0,this._firstVisibleIndexVal=e}return e},get lastVisibleIndex(){let e=this._lastVisibleIndexVal;if(null==e){let t=this._physicalTop+this._scrollOffset;this._iterateItems(((i,a)=>{t=0;if(this._scrollPosition=e,this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,Math.abs(t)>this._physicalSize&&this._physicalSize>0){t-=this._scrollOffset;const e=Math.round(t/this._physicalAverage);this._virtualStart+=e,this._physicalStart+=e,this._physicalTop=Math.min(Math.floor(this._virtualStart)*this._physicalAverage,this._scrollPosition),this._update()}else if(this._physicalCount>0){const e=this._getReusables(i);i?(this._physicalTop=e.physicalTop,this._virtualStart+=e.indexes.length,this._physicalStart+=e.indexes.length):(this._virtualStart-=e.indexes.length,this._physicalStart-=e.indexes.length),this._update(e.indexes,i?null:e.indexes),this._debounce("_increasePoolIfNeeded",this._increasePoolIfNeeded.bind(this,0),fl)}},_getReusables(e){let t,i,a;const n=[],o=this._hiddenContentSize*this._ratio,s=this._virtualStart,r=this._virtualEnd,l=this._physicalCount;let d=this._physicalTop+this._scrollOffset;const c=this._physicalBottom+this._scrollOffset,u=this._scrollPosition,h=this._scrollBottom;for(e?(t=this._physicalStart,i=u-d):(t=this._physicalEnd,i=c-h);a=this._getPhysicalSizeIncrement(t),i-=a,!(n.length>=l||i<=o);)if(e){if(r+n.length+1>=this._virtualCount)break;if(d+a>=u-this._scrollOffset)break;n.push(t),d+=a,t=(t+1)%l}else{if(s-n.length<=0)break;if(d+this._physicalSize-a<=h)break;n.push(t),d-=a,t=0===t?l-1:t-1}return{indexes:n,physicalTop:d-this._scrollOffset}},_update(e,t){if(!(e&&0===e.length||0===this._physicalCount)){if(this._assignModels(e),this._updateMetrics(e),t)for(;t.length;){const e=t.pop();this._physicalTop-=this._getPhysicalSizeIncrement(e)}this._positionItems(),this._updateScrollerSize()}},_isClientFull(){return 0!==this._scrollBottom&&this._physicalBottom-1>=this._scrollBottom&&this._physicalTop<=this._scrollPosition},_increasePoolIfNeeded(e){const t=this._clamp(this._physicalCount+e,3,this._virtualCount-this._virtualStart)-this._physicalCount;let i=Math.round(.5*this._physicalCount);if(!(t<0)){if(t>0){const e=window.performance.now();[].push.apply(this._physicalItems,this._createPool(t));for(let e=0;ethis._physicalEnd&&this._isIndexRendered(this._focusedVirtualIndex)&&this._getPhysicalIndex(this._focusedVirtualIndex)=this._virtualCount-1||0===i||(this._isClientFull()?this._physicalSize0&&(this.updateViewportBoundaries(),this._increasePoolIfNeeded(3))},_itemsChanged(e){"items"===e.path&&(this._virtualStart=0,this._physicalTop=0,this._virtualCount=this.items?this.items.length:0,this._physicalIndexForKey={},this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,this._physicalCount=this._physicalCount||0,this._physicalItems=this._physicalItems||[],this._physicalSizes=this._physicalSizes||[],this._physicalStart=0,this._scrollTop>this._scrollOffset&&this._resetScrollPosition(0),this._debounce("_render",this._render,vl))},_iterateItems(e,t){let i,a,n,o;if(2===arguments.length&&t){for(o=0;o=this._physicalStart?this._virtualStart+(e-this._physicalStart):this._virtualStart+(this._physicalCount-this._physicalStart)+e},_updateMetrics(e){kl();let t=0,i=0;const a=this._physicalAverageCount,n=this._physicalAverage;this._iterateItems(((e,a)=>{i+=this._physicalSizes[e],this._physicalSizes[e]=this._physicalItems[e].offsetHeight,t+=this._physicalSizes[e],this._physicalAverageCount+=this._physicalSizes[e]?1:0}),e),this._physicalSize=this._physicalSize+t-i,this._physicalAverageCount!==a&&(this._physicalAverage=Math.round((n*a+t)/this._physicalAverageCount))},_positionItems(){this._adjustScrollPosition();let e=this._physicalTop;this._iterateItems((t=>{this.translate3d(0,`${e}px`,0,this._physicalItems[t]),e+=this._physicalSizes[t]}))},_getPhysicalSizeIncrement(e){return this._physicalSizes[e]},_adjustScrollPosition(){const e=0===this._virtualStart?this._physicalTop:Math.min(this._scrollPosition+this._physicalTop,0);if(0!==e){this._physicalTop-=e;const t=this._scrollPosition;!$l&&t>0&&this._resetScrollPosition(t-e)}},_resetScrollPosition(e){this.scrollTarget&&e>=0&&(this._scrollTop=e,this._scrollPosition=this._scrollTop)},_updateScrollerSize(e){this._estScrollHeight=this._physicalBottom+Math.max(this._virtualCount-this._physicalCount-this._virtualStart,0)*this._physicalAverage,((e=(e=e||0===this._scrollHeight)||this._scrollPosition>=this._estScrollHeight-this._physicalSize)||Math.abs(this._estScrollHeight-this._scrollHeight)>=this._viewportHeight)&&(this.$.items.style.height=`${this._estScrollHeight}px`,this._scrollHeight=this._estScrollHeight)},scrollToIndex(e){if("number"!=typeof e||e<0||e>this.items.length-1)return;if(kl(),0===this._physicalCount)return;e=this._clamp(e,0,this._virtualCount-1),(!this._isIndexRendered(e)||e>=this._maxVirtualStart)&&(this._virtualStart=e-1),this._assignModels(),this._updateMetrics(),this._physicalTop=this._virtualStart*this._physicalAverage;let t=this._physicalStart,i=this._virtualStart,a=0;const n=this._hiddenContentSize;for(;i{this._firstVisibleIndexVal=null,this._lastVisibleIndexVal=null,this._isVisible?(this.updateViewportBoundaries(),this.toggleScrollListener(!0),this._resetAverage(),this._render()):this.toggleScrollListener(!1)}),vl)},_isIndexRendered(e){return e>=this._virtualStart&&e<=this._virtualEnd},_getPhysicalIndex(e){return(this._physicalStart+(e-this._virtualStart))%this._physicalCount},_clamp:(e,t,i)=>Math.min(i,Math.max(t,e)),_debounce(e,t,i){var a;this._debouncers=this._debouncers||{},this._debouncers[e]=gl.debounce(this._debouncers[e],i,t.bind(this)),a=this._debouncers[e],_l.add(a)}};class wl{constructor({createElements:e,updateElement:t,scrollTarget:i,scrollContainer:a,elementsContainer:n,reorderElements:o}){this.isAttached=!0,this._vidxOffset=0,this.createElements=e,this.updateElement=t,this.scrollTarget=i,this.scrollContainer=a,this.elementsContainer=n||a,this.reorderElements=o,this._maxPages=1.3,this.__placeholderHeight=200,this.__elementHeightQueue=Array(10),this.timeouts={SCROLL_REORDER:500,IGNORE_WHEEL:500},this.__resizeObserver=new ResizeObserver((()=>this._resizeHandler())),"visible"===getComputedStyle(this.scrollTarget).overflow&&(this.scrollTarget.style.overflow="auto"),"static"===getComputedStyle(this.scrollContainer).position&&(this.scrollContainer.style.position="relative"),this.__resizeObserver.observe(this.scrollTarget),this.scrollTarget.addEventListener("scroll",(()=>this._scrollHandler())),this._scrollLineHeight=this._getScrollLineHeight(),this.scrollTarget.addEventListener("wheel",(e=>this.__onWheel(e))),this.reorderElements&&(this.scrollTarget.addEventListener("mousedown",(()=>{this.__mouseDown=!0})),this.scrollTarget.addEventListener("mouseup",(()=>{this.__mouseDown=!1,this.__pendingReorder&&this.__reorderElements()})))}get scrollOffset(){return 0}get adjustedFirstVisibleIndex(){return this.firstVisibleIndex+this._vidxOffset}get adjustedLastVisibleIndex(){return this.lastVisibleIndex+this._vidxOffset}scrollToIndex(e){if("number"!=typeof e||isNaN(e)||0===this.size||!this.scrollTarget.offsetHeight)return;e=this._clamp(e,0,this.size-1);const t=this.__getVisibleElements().length;let i=Math.floor(e/this.size*this._virtualCount);this._virtualCount-i{i.__virtualIndex>=e&&i.__virtualIndex<=t&&this.__updateElement(i,i.__virtualIndex,!0)}))}__updateElement(e,t,i){e.style.paddingTop&&(e.style.paddingTop=""),this.__preventElementUpdates||e.__lastUpdatedIndex===t&&!i||(this.updateElement(e,t),e.__lastUpdatedIndex=t);const a=e.offsetHeight;if(0===a)e.style.paddingTop=`${this.__placeholderHeight}px`;else{this.__elementHeightQueue.push(a),this.__elementHeightQueue.shift();const e=this.__elementHeightQueue.filter((e=>void 0!==e));this.__placeholderHeight=Math.round(e.reduce(((e,t)=>e+t),0)/e.length)}}__getIndexScrollOffset(e){const t=this.__getVisibleElements().find((t=>t.__virtualIndex===e));return t?this.scrollTarget.getBoundingClientRect().top-t.getBoundingClientRect().top:void 0}get size(){return this.__size}set size(e){if(e===this.size)return;let t,i;if(this.__preventElementUpdates=!0,e>0&&(t=this.adjustedFirstVisibleIndex,i=this.__getIndexScrollOffset(t)),this.__size=e,kl(),this._itemsChanged({path:"items"}),kl(),e>0){t=Math.min(t,e-1),this.scrollToIndex(t);const a=this.__getIndexScrollOffset(t);void 0!==i&&void 0!==a&&(this._scrollTop+=i-a)}this.elementsContainer.children.length||requestAnimationFrame((()=>this._resizeHandler())),this.__preventElementUpdates=!1,this._resizeHandler(),kl()}get _scrollTop(){return this.scrollTarget.scrollTop}set _scrollTop(e){this.scrollTarget.scrollTop=e}get items(){return{length:Math.min(this.size,1e5)}}get offsetHeight(){return this.scrollTarget.offsetHeight}get $(){return{items:this.scrollContainer}}updateViewportBoundaries(){const e=window.getComputedStyle(this.scrollTarget);this._scrollerPaddingTop=this.scrollTarget===this?0:parseInt(e["padding-top"],10),this._isRTL=Boolean("rtl"===e.direction),this._viewportWidth=this.elementsContainer.offsetWidth,this._viewportHeight=this.scrollTarget.offsetHeight,this._scrollPageHeight=this._viewportHeight-this._scrollLineHeight,this.grid&&this._updateGridMetrics()}setAttribute(){}_createPool(e){const t=this.createElements(e),i=document.createDocumentFragment();return t.forEach((e=>{e.style.position="absolute",i.appendChild(e),this.__resizeObserver.observe(e)})),this.elementsContainer.appendChild(i),t}_assignModels(e){this._iterateItems(((e,t)=>{const i=this._physicalItems[e];i.hidden=t>=this.size,i.hidden?delete i.__lastUpdatedIndex:(i.__virtualIndex=t+(this._vidxOffset||0),this.__updateElement(i,i.__virtualIndex))}),e)}_isClientFull(){return setTimeout((()=>{this.__clientFull=!0})),this.__clientFull||super._isClientFull()}translate3d(e,t,i,a){a.style.transform=`translateY(${t})`}toggleScrollListener(){}_scrollHandler(){this._adjustVirtualIndexOffset(this._scrollTop-(this.__previousScrollTop||0));const e=this.scrollTarget.scrollTop-this._scrollPosition;if(super._scrollHandler(),0!==this._physicalCount){const t=e>=0,i=this._getReusables(!t);i.indexes.length&&(this._physicalTop=i.physicalTop,t?(this._virtualStart-=i.indexes.length,this._physicalStart-=i.indexes.length):(this._virtualStart+=i.indexes.length,this._physicalStart+=i.indexes.length),this._resizeHandler())}this.reorderElements&&(this.__scrollReorderDebouncer=gl.debounce(this.__scrollReorderDebouncer,pl.after(this.timeouts.SCROLL_REORDER),(()=>this.__reorderElements()))),this.__previousScrollTop=this._scrollTop}__onWheel(e){if(e.ctrlKey||this._hasScrolledAncestor(e.target,e.deltaX,e.deltaY))return;let t=e.deltaY;if(e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._scrollLineHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._scrollPageHeight),this._deltaYAcc=this._deltaYAcc||0,this._wheelAnimationFrame)return this._deltaYAcc+=t,void e.preventDefault();t+=this._deltaYAcc,this._deltaYAcc=0,this._wheelAnimationFrame=!0,this.__debouncerWheelAnimationFrame=gl.debounce(this.__debouncerWheelAnimationFrame,vl,(()=>{this._wheelAnimationFrame=!1}));const i=Math.abs(e.deltaX)+Math.abs(t);this._canScroll(this.scrollTarget,e.deltaX,t)?(e.preventDefault(),this.scrollTarget.scrollTop+=t,this.scrollTarget.scrollLeft+=e.deltaX,this._hasResidualMomentum=!0,this._ignoreNewWheel=!0,this._debouncerIgnoreNewWheel=gl.debounce(this._debouncerIgnoreNewWheel,pl.after(this.timeouts.IGNORE_WHEEL),(()=>{this._ignoreNewWheel=!1}))):this._hasResidualMomentum&&i<=this._previousMomentum||this._ignoreNewWheel?e.preventDefault():i>this._previousMomentum&&(this._hasResidualMomentum=!1),this._previousMomentum=i}_hasScrolledAncestor(e,t,i){return e!==this.scrollTarget&&e!==this.scrollTarget.getRootNode().host&&(!(!this._canScroll(e,t,i)||-1===["auto","scroll"].indexOf(getComputedStyle(e).overflow))||(e!==this&&e.parentElement?this._hasScrolledAncestor(e.parentElement,t,i):void 0))}_canScroll(e,t,i){return i>0&&e.scrollTop0||t>0&&e.scrollLeft0}_getScrollLineHeight(){const e=document.createElement("div");e.style.fontSize="initial",e.style.display="none",document.body.appendChild(e);const t=window.getComputedStyle(e).fontSize;return document.body.removeChild(e),t?window.parseInt(t):void 0}__getVisibleElements(){return Array.from(this.elementsContainer.children).filter((e=>!e.hidden))}__reorderElements(){if(this.__mouseDown)return void(this.__pendingReorder=!0);this.__pendingReorder=!1;const e=this._virtualStart+(this._vidxOffset||0),t=this.__getVisibleElements(),i=t.find((e=>e.contains(this.elementsContainer.getRootNode().activeElement)||e.contains(this.scrollTarget.getRootNode().activeElement)))||t[0];if(!i)return;const a=i.__virtualIndex-e,n=t.indexOf(i)-a;if(n>0)for(let e=0;e{this.scrollTarget.style.transform=e}))}}_adjustVirtualIndexOffset(e){if(this._virtualCount>=this.size)this._vidxOffset=0;else if(this.__skipNextVirtualIndexAdjust)this.__skipNextVirtualIndexAdjust=!1;else if(Math.abs(e)>1e4){const e=this._scrollTop/(this.scrollTarget.scrollHeight-this.scrollTarget.offsetHeight),t=e*this.size;this._vidxOffset=Math.round(t-e*this._virtualCount)}else{const e=this._vidxOffset,t=1e3,i=100;0===this._scrollTop?(this._vidxOffset=0,e!==this._vidxOffset&&super.scrollToIndex(0)):this.firstVisibleIndex0&&(this._vidxOffset-=Math.min(this._vidxOffset,i),super.scrollToIndex(this.firstVisibleIndex+(e-this._vidxOffset)));const a=this.size-this._virtualCount;this._scrollTop>=this._maxScrollTop&&this._maxScrollTop>0?(this._vidxOffset=a,e!==this._vidxOffset&&super.scrollToIndex(this._virtualCount-1)):this.firstVisibleIndex>this._virtualCount-t&&this._vidxOffset :host { display: block; min-height: 1px; overflow: auto; /* Fixes item background from getting on top of scrollbars on Safari */ transform: translate3d(0, 0, 0); /* Enable momentum scrolling on iOS */ -webkit-overflow-scrolling: touch; /* Fixes scrollbar disappearing when 'Show scroll bars: Always' enabled in Safari */ box-shadow: 0 0 0 white; } #selector { border-width: var(--_vaadin-combo-box-items-container-border-width); border-style: var(--_vaadin-combo-box-items-container-border-style); border-color: var(--_vaadin-combo-box-items-container-border-color); }
`}static get properties(){return{items:{type:Array,observer:"__itemsChanged"},focusedIndex:{type:Number,observer:"__focusedIndexChanged"},loading:{type:Boolean,observer:"__loadingChanged"},opened:{type:Boolean,observer:"__openedChanged"},selectedItem:{type:Object,observer:"__selectedItemChanged"},itemIdPath:{type:String},comboBox:{type:Object},getItemLabel:{type:Object},renderer:{type:Object,observer:"__rendererChanged"},theme:{type:String}}}constructor(){super(),this.__boundOnItemClick=this.__onItemClick.bind(this)}__openedChanged(e){e&&this.requestContentUpdate()}ready(){super.ready(),this.id=`${this.localName}-${sl++}`,this.__hostTagName=this.constructor.is.replace("-scroller",""),this.setAttribute("role","listbox"),this.addEventListener("click",(e=>e.stopPropagation())),this.__patchWheelOverScrolling(),this.__virtualizer=new Cl({createElements:this.__createElements.bind(this),updateElement:this.__updateElement.bind(this),elementsContainer:this,scrollTarget:this,scrollContainer:this.$.selector})}requestContentUpdate(){this.__virtualizer&&this.__virtualizer.update()}scrollIntoView(e){if(!(this.opened&&e>=0))return;const t=this._visibleItemsCount();let i=e;e>this.__virtualizer.lastVisibleIndex-1?(this.__virtualizer.scrollToIndex(e),i=e-t+1):e>this.__virtualizer.firstVisibleIndex&&(i=this.__virtualizer.firstVisibleIndex),this.__virtualizer.scrollToIndex(Math.max(0,i));const a=[...this.children].find((e=>!e.hidden&&e.index===this.__virtualizer.lastVisibleIndex));if(!a||e!==a.index)return;const n=a.getBoundingClientRect(),o=this.getBoundingClientRect(),s=n.bottom-o.bottom+this._viewportTotalPaddingBottom;s>0&&(this.scrollTop+=s)}__getAriaRole(e){return void 0!==e&&"option"}__getAriaSelected(e,t){return this.__isItemFocused(e,t).toString()}__isItemFocused(e,t){return!this.loading&&e===t}__isItemSelected(e,t,i){return!(e instanceof Al)&&(i&&void 0!==e&&void 0!==t?this.get(i,e)===this.get(i,t):e===t)}__itemsChanged(e){this.__virtualizer&&e&&(this.__virtualizer.size=e.length,this.__virtualizer.flush(),this.setAttribute("aria-setsize",e.length),this.requestContentUpdate())}__loadingChanged(){this.__virtualizer&&this.requestContentUpdate()}__selectedItemChanged(){this.__virtualizer&&this.requestContentUpdate()}__focusedIndexChanged(e,t){this.__virtualizer&&(e!==t&&this.requestContentUpdate(),e>=0&&!this.loading&&this.scrollIntoView(e))}__rendererChanged(e,t){(e||t)&&this.requestContentUpdate()}__createElements(e){return[...Array(e)].map((()=>{const e=document.createElement(`${this.__hostTagName}-item`);return e.addEventListener("click",this.__boundOnItemClick),e.tabIndex="-1",e.style.width="100%",e}))}__updateElement(e,t){const i=this.items[t],a=this.focusedIndex;e.setProperties({item:i,index:t,label:this.getItemLabel(i),selected:this.__isItemSelected(i,this.selectedItem,this.itemIdPath),renderer:this.renderer,focused:this.__isItemFocused(a,t)}),e.id=`${this.__hostTagName}-item-${t}`,e.setAttribute("role",this.__getAriaRole(t)),e.setAttribute("aria-selected",this.__getAriaSelected(a,t)),e.setAttribute("aria-posinset",t+1),this.theme?e.setAttribute("theme",this.theme):e.removeAttribute("theme"),i instanceof Al&&this.__requestItemByIndex(t)}__onItemClick(e){this.dispatchEvent(new CustomEvent("selection-changed",{detail:{item:e.currentTarget.item}}))}__patchWheelOverScrolling(){this.$.selector.addEventListener("wheel",(e=>{const t=0===this.scrollTop,i=this.scrollHeight-this.scrollTop-this.clientHeight<=1;(t&&e.deltaY<0||i&&e.deltaY>0)&&e.preventDefault()}))}get _viewportTotalPaddingBottom(){if(void 0===this._cachedViewportTotalPaddingBottom){const e=window.getComputedStyle(this.$.selector);this._cachedViewportTotalPaddingBottom=[e.paddingBottom,e.borderBottomWidth].map((e=>parseInt(e,10))).reduce(((e,t)=>e+t))}return this._cachedViewportTotalPaddingBottom}__requestItemByIndex(e){requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("index-requested",{detail:{index:e,currentScrollerPos:this._oldScrollerPosition}}))}))}_visibleItemsCount(){this.__virtualizer.scrollToIndex(this.__virtualizer.firstVisibleIndex);return this.__virtualizer.size>0?this.__virtualizer.lastVisibleIndex-this.__virtualizer.firstVisibleIndex+1:0}}customElements.define(Il.is,Il);const El=P((e=>class extends e{static get properties(){return{invalid:{type:Boolean,reflectToAttribute:!0,notify:!0,value:!1},required:{type:Boolean,reflectToAttribute:!0}}}validate(){const e=this.checkValidity();return this._setInvalid(!e),this.dispatchEvent(new CustomEvent("validated",{detail:{valid:e}})),e}checkValidity(){return!this.required||!!this.value}_setInvalid(e){this._shouldSetInvalid(e)&&(this.invalid=e)}_shouldSetInvalid(e){return!0}})),zl=e=>class extends e{static get properties(){return{pageSize:{type:Number,value:50,observer:"_pageSizeChanged"},size:{type:Number,observer:"_sizeChanged"},dataProvider:{type:Object,observer:"_dataProviderChanged"},_pendingRequests:{value:()=>({})},__placeHolder:{value:new Al},__previousDataProviderFilter:{type:String}}}static get observers(){return["_dataProviderFilterChanged(filter)","_warnDataProviderValue(dataProvider, value)","_ensureFirstPage(opened)"]}ready(){super.ready(),this._scroller.addEventListener("index-requested",(e=>{const t=e.detail.index,i=e.detail.currentScrollerPos,a=Math.floor(1.5*this.pageSize);if(!this._shouldSkipIndex(t,a,i)&&void 0!==t){const e=this._getPageForIndex(t);this._shouldLoadPage(e)&&this._loadPage(e)}}))}_dataProviderFilterChanged(e){void 0!==this.__previousDataProviderFilter||""!==e?this.__previousDataProviderFilter!==e&&(this.__previousDataProviderFilter=e,this._pendingRequests={},this.loading=this._shouldFetchData(),this.size=void 0,this.clearCache()):this.__previousDataProviderFilter=e}_shouldFetchData(){return!!this.dataProvider&&(this.opened||this.filter&&this.filter.length)}_ensureFirstPage(e){e&&this._shouldLoadPage(0)&&this._loadPage(0)}_shouldSkipIndex(e,t,i){return 0!==i&&e>=i-t&&e<=i+t}_shouldLoadPage(e){if(!this.filteredItems||this._forceNextRequest)return this._forceNextRequest=!1,!0;const t=this.filteredItems[e*this.pageSize];return void 0!==t?t instanceof Al:void 0===this.size}_loadPage(e){if(this._pendingRequests[e]||!this.dataProvider)return;const t={page:e,pageSize:this.pageSize,filter:this.filter},i=(a,n)=>{if(this._pendingRequests[e]!==i)return;const o=this.filteredItems?[...this.filteredItems]:[];o.splice(t.page*t.pageSize,a.length,...a),this.filteredItems=o,this.opened||this._isInputFocused()||this._commitValue(),void 0!==n&&(this.size=n),delete this._pendingRequests[e],0===Object.keys(this._pendingRequests).length&&(this.loading=!1)};this._pendingRequests[e]=i,this.loading=!0,this.dataProvider(t,i)}_getPageForIndex(e){return Math.floor(e/this.pageSize)}clearCache(){if(!this.dataProvider)return;this._pendingRequests={};const e=[];for(let t=0;t<(this.size||0);t++)e.push(this.__placeHolder);this.filteredItems=e,this._shouldFetchData()?(this._forceNextRequest=!1,this._loadPage(0)):this._forceNextRequest=!0}_sizeChanged(e=0){const t=(this.filteredItems||[]).slice(0,e);for(let i=0;i 0");this.clearCache()}_dataProviderChanged(e,t){this._ensureItemsOrDataProvider((()=>{this.dataProvider=t})),this.clearCache()}_ensureItemsOrDataProvider(e){if(void 0!==this.items&&void 0!==this.dataProvider)throw e(),new Error("Using `items` and `dataProvider` together is not supported");this.dataProvider&&!this.filteredItems&&(this.filteredItems=[])}_warnDataProviderValue(e,t){if(e&&""!==t&&(void 0===this.selectedItem||null===this.selectedItem)){const e=this.__getItemIndexByValue(this.filteredItems,t);(e<0||!this._getItemLabel(this.filteredItems[e]))&&console.warn("Warning: unable to determine the label for the provided `value`. Nothing to display in the text field. This usually happens when setting an initial `value` before any items are returned from the `dataProvider` callback. Consider setting `selectedItem` instead of `value`")}}_flushPendingRequests(e){if(this._pendingRequests){const t=Math.ceil(e/this.pageSize),i=Object.keys(this._pendingRequests);for(let a=0;a=t&&this._pendingRequests[n]([],e)}}}},Sl=P((e=>class extends e{static get properties(){return{disabled:{type:Boolean,value:!1,observer:"_disabledChanged",reflectToAttribute:!0}}}_disabledChanged(e){this._setAriaDisabled(e)}_setAriaDisabled(e){e?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled")}click(){this.disabled||super.click()}})),Ol=P((e=>class extends e{ready(){super.ready(),this.addEventListener("keydown",(e=>{this._onKeyDown(e)})),this.addEventListener("keyup",(e=>{this._onKeyUp(e)}))}_onKeyDown(e){switch(e.key){case"Enter":this._onEnter(e);break;case"Escape":this._onEscape(e)}}_onKeyUp(e){}_onEnter(e){}_onEscape(e){}}));const Tl=P((e=>class extends e{static get properties(){return{inputElement:{type:Object,readOnly:!0,observer:"_inputElementChanged"},type:{type:String,readOnly:!0},value:{type:String,value:"",observer:"_valueChanged",notify:!0},_hasInputValue:{type:Boolean,value:!1,observer:"_hasInputValueChanged"}}}constructor(){super(),this._boundOnInput=this.__onInput.bind(this),this._boundOnChange=this._onChange.bind(this)}clear(){this.value=""}_addInputListeners(e){e.addEventListener("input",this._boundOnInput),e.addEventListener("change",this._boundOnChange)}_removeInputListeners(e){e.removeEventListener("input",this._boundOnInput),e.removeEventListener("change",this._boundOnChange)}_forwardInputValue(e){this.inputElement&&(this.inputElement.value=null!=e?e:"")}_inputElementChanged(e,t){e?this._addInputListeners(e):t&&this._removeInputListeners(t)}_hasInputValueChanged(e,t){(e||t)&&this.dispatchEvent(new CustomEvent("has-input-value-changed"))}__onInput(e){const t=e.composedPath()[0];this._hasInputValue=t.value.length>0,this._onInput(e)}_onInput(e){const t=e.composedPath()[0];this.__userInput=e.isTrusted,this.value=t.value,this.__userInput=!1}_onChange(e){}_toggleHasValue(e){this.toggleAttribute("has-value",e)}_valueChanged(e,t){this._toggleHasValue(this._hasValue),""===e&&void 0===t||this.__userInput||this._forwardInputValue(e)}get _hasValue(){return null!=this.value&&""!==this.value}}));class Ml{constructor(e){this.host=e,e.addEventListener("opened-changed",(()=>{e.opened||this.__setVirtualKeyboardEnabled(!1)})),e.addEventListener("blur",(()=>this.__setVirtualKeyboardEnabled(!0))),e.addEventListener("touchstart",(()=>this.__setVirtualKeyboardEnabled(!0)))}__setVirtualKeyboardEnabled(e){this.host.inputElement&&(this.host.inputElement.inputMode=e?"":"none")}}function Ll(e){return null!=e}function Pl(e,t){return e.findIndex((e=>!(e instanceof Al)&&t(e)))}const Bl=e=>class extends(Br(Ol(Tl(Sl(e))))){static get properties(){return{opened:{type:Boolean,notify:!0,value:!1,reflectToAttribute:!0,observer:"_openedChanged"},autoOpenDisabled:{type:Boolean},readonly:{type:Boolean,value:!1,reflectToAttribute:!0},renderer:Function,items:{type:Array,observer:"_itemsChanged"},allowCustomValue:{type:Boolean,value:!1},filteredItems:{type:Array,observer:"_filteredItemsChanged"},_lastCommittedValue:String,loading:{type:Boolean,value:!1,reflectToAttribute:!0},_focusedIndex:{type:Number,observer:"_focusedIndexChanged",value:-1},filter:{type:String,value:"",notify:!0},selectedItem:{type:Object,notify:!0},itemLabelPath:{type:String,value:"label",observer:"_itemLabelPathChanged"},itemValuePath:{type:String,value:"value"},itemIdPath:String,_toggleElement:{type:Object,observer:"_toggleElementChanged"},_closeOnBlurIsPrevented:Boolean,_scroller:Object,_overlayOpened:{type:Boolean,observer:"_overlayOpenedChanged"}}}static get observers(){return["_selectedItemChanged(selectedItem, itemValuePath, itemLabelPath)","_openedOrItemsChanged(opened, filteredItems, loading)","_updateScroller(_scroller, filteredItems, opened, loading, selectedItem, itemIdPath, _focusedIndex, renderer, theme)"]}constructor(){super(),this._boundOnFocusout=this._onFocusout.bind(this),this._boundOverlaySelectedItemChanged=this._overlaySelectedItemChanged.bind(this),this._boundOnClearButtonMouseDown=this.__onClearButtonMouseDown.bind(this),this._boundOnClick=this._onClick.bind(this),this._boundOnOverlayTouchAction=this._onOverlayTouchAction.bind(this),this._boundOnTouchend=this._onTouchend.bind(this)}get _tagNamePrefix(){return"vaadin-combo-box"}get _inputElementValue(){return this.inputElement?this.inputElement[this._propertyForValue]:void 0}set _inputElementValue(e){this.inputElement&&(this.inputElement[this._propertyForValue]=e)}get _nativeInput(){return this.inputElement}_inputElementChanged(e){super._inputElementChanged(e);const t=this._nativeInput;t&&(t.autocomplete="off",t.autocapitalize="off",t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded",!!this.opened),t.setAttribute("spellcheck","false"),t.setAttribute("autocorrect","off"),this._revertInputValueToValue(),this.clearElement&&this.clearElement.addEventListener("mousedown",this._boundOnClearButtonMouseDown))}ready(){super.ready(),this._initOverlay(),this._initScroller(),this.addEventListener("focusout",this._boundOnFocusout),this._lastCommittedValue=this.value,this.addEventListener("click",this._boundOnClick),this.addEventListener("touchend",this._boundOnTouchend);const e=()=>{requestAnimationFrame((()=>{this.$.overlay.bringToFront()}))};var t;this.addEventListener("mousedown",e),this.addEventListener("touchstart",e),t=this,window.Vaadin&&window.Vaadin.templateRendererCallback?window.Vaadin.templateRendererCallback(t):t.querySelector("template")&&console.warn(`WARNING: