@lexml/lexml-eta
Version:
Webcomponent lexml-eta following open-wc recommendations
229 lines (217 loc) • 510 kB
JavaScript
const t=Symbol("defaultState"),e=Symbol("delegatesFocus"),o=Symbol("firstRender"),i=Symbol("focusTarget"),n=Symbol("hasDynamicTemplate"),r=Symbol("ids"),s=Symbol("nativeInternals"),a=Symbol("raiseChangeEvents"),l=Symbol("render"),u=Symbol("renderChanges"),c=Symbol("rendered"),d=Symbol("rendering"),p=Symbol("setState"),h=Symbol("shadowRoot"),f=Symbol("shadowRootMode"),m=Symbol("state"),v=Symbol("stateEffects"),g=Symbol("template");function b(t,e){return"boolean"==typeof e?e:"string"==typeof e&&(""===e||t.toLowerCase()===e.toLowerCase())}function y(t,e){let o=e;for(;o;){const e=o.assignedSlot||o.parentNode||o.host;if(e===t)return!0;o=e}return!1}function x(t){const e=S(t,(t=>t instanceof HTMLElement&&t.matches('a[href],area[href],button:not([disabled]),details,iframe,input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[contentEditable="true"],[tabindex]')&&t.tabIndex>=0)),{value:o}=e.next();return o instanceof HTMLElement?o:null}function E(t,e){return Array.prototype.findIndex.call(t,(t=>t===e||y(t,e)))}function O(t,e){const o=e.composedPath()[0];return t===o||y(t,o)}function*w(t){t&&(yield t,yield*function*(t){let e=t;for(;e=e instanceof HTMLElement&&e.assignedSlot?e.assignedSlot:e instanceof ShadowRoot?e.host:e.parentNode,e;)yield e}(t))}function _(t,e,o){t.toggleAttribute(e,o),t[s]&&t[s].states&&t[s].states.toggle(e,o)}const A={checked:!0,defer:!0,disabled:!0,hidden:!0,ismap:!0,multiple:!0,noresize:!0,readonly:!0,selected:!0};function*S(t,e){let o;if(e(t)&&(yield t),t instanceof HTMLElement&&t.shadowRoot)o=t.shadowRoot.children;else{const e=t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):[];o=e.length>0?e:t.childNodes}if(o)for(let t=0;t<o.length;t++)yield*S(o[t],e)}const I={html:(t,...e)=>N.html(t,...e).content},N={html(t,...e){const o=document.createElement("template");return o.innerHTML=String.raw(t,...e),o}},P=new Map;function T(t){if("function"==typeof t){let e;try{e=new t}catch(o){if("TypeError"!==o.name)throw o;!function(t){let e;const o=/^[A-Za-z][A-Za-z0-9_$]*$/,i=t.name&&t.name.match(o);if(i){const t=/([A-Z])/g;e=i[0].replace(t,((t,e,o)=>o>0?`-${e}`:e)).toLowerCase()}else e="custom-element";let n,r=P.get(e)||0;for(;n=`${e}-${r}`,customElements.get(n);r++);customElements.define(n,t),P.set(e,r+1)}(t),e=new t}return e}return document.createElement(t)}function C(t,e){const o=t.parentNode;if(!o)throw"An element must have a parent before it can be substituted.";return(t instanceof HTMLElement||t instanceof SVGElement)&&(e instanceof HTMLElement||e instanceof SVGElement)&&(Array.prototype.forEach.call(t.attributes,(t=>{e.getAttribute(t.name)||"class"===t.name||"style"===t.name||e.setAttribute(t.name,t.value)})),Array.prototype.forEach.call(t.classList,(t=>{e.classList.add(t)})),Array.prototype.forEach.call(t.style,(o=>{e.style[o]||(e.style[o]=t.style[o])}))),e.append(...t.childNodes),o.replaceChild(e,t),e}function k(t,e){if("function"==typeof e&&t.constructor===e||"string"==typeof e&&t instanceof Element&&t.localName===e)return t;{const o=T(e);return C(t,o),o}}const R={tabindex:"tabIndex"},L={tabIndex:"tabindex"};function D(t){if(t===HTMLElement)return[];const e=Object.getPrototypeOf(t.prototype).constructor;let o=e.observedAttributes;o||(o=D(e));const i=Object.getOwnPropertyNames(t.prototype).filter((e=>{const o=Object.getOwnPropertyDescriptor(t.prototype,e);return o&&"function"==typeof o.set})).map((t=>function(t){let e=L[t];if(!e){const o=/([A-Z])/g;e=t.replace(o,"-$1").toLowerCase(),L[t]=e}return e}(t))).filter((t=>o.indexOf(t)<0));return o.concat(i)}const q=Symbol("state"),j=Symbol("raiseChangeEventsInNextRender"),M=Symbol("changedSinceLastRender");function F(t,e){const o={};for(const r in e)i=e[r],n=t[r],(i instanceof Date&&n instanceof Date?i.getTime()===n.getTime():i===n)||(o[r]=!0);var i,n;return o}const U=new Map,B=Symbol("shadowIdProxy"),V=Symbol("proxyElement"),z={get(t,e){const o=t[V][h];return o&&"string"==typeof e?o.getElementById(e):null}};const H=function(t){return class extends t{attributeChangedCallback(t,e,o){if(super.attributeChangedCallback&&super.attributeChangedCallback(t,e,o),o!==e&&!this[d]){const e=function(t){let e=R[t];if(!e){const o=/-([a-z])/g;e=t.replace(o,(t=>t[1].toUpperCase())),R[t]=e}return e}(t);if(e in this){const i=A[t]?b(t,o):o;this[e]=i}}}static get observedAttributes(){return D(this)}}}(function(e){class i extends e{constructor(){super(),this[o]=void 0,this[a]=!1,this[M]=null,this[p](this[t])}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this[u]()}get[t](){return super[t]||{}}[l](t){super[l]&&super[l](t)}[u](){void 0===this[o]&&(this[o]=!0);const t=this[M];if(this[o]||t){const e=this[a];this[a]=this[j],this[d]=!0,this[l](t),this[d]=!1,this[M]=null,this[c](t),this[o]=!1,this[a]=e,this[j]=e}}[c](t){super[c]&&super[c](t)}async[p](t){this[d]&&console.warn(`${this.constructor.name} called [setState] during rendering, which you should avoid.\nSee https://elix.org/documentation/ReactiveMixin.`);const{state:e,changed:i}=function(t,e){const o=Object.assign({},t[q]),i={};let n=e;for(;;){const e=F(o,n);if(0===Object.keys(e).length)break;Object.assign(o,n),Object.assign(i,e),n=t[v](o,e)}return{state:o,changed:i}}(this,t);if(this[q]&&0===Object.keys(i).length)return;Object.freeze(e),this[q]=e,this[a]&&(this[j]=!0);const n=void 0===this[o]||null!==this[M];this[M]=Object.assign(this[M]||{},i);this.isConnected&&!n&&(await Promise.resolve(),this[u]())}get[m](){return this[q]}[v](t,e){return super[v]?super[v](t,e):{}}}return"true"===new URLSearchParams(location.search).get("elixdebug")&&Object.defineProperty(i.prototype,"state",{get(){return this[m]}}),i}(function(t){return class extends t{get[r](){if(!this[B]){const t={[V]:this};this[B]=new Proxy(t,z)}return this[B]}[l](t){if(super[l]&&super[l](t),!this[h]){const t=function(t){let e=t[n]?void 0:U.get(t.constructor);if(void 0===e){if(e=t[g],e&&!(e instanceof HTMLTemplateElement))throw`Warning: the [template] property for ${t.constructor.name} must return an HTMLTemplateElement.`;t[n]||U.set(t.constructor,e||null)}return e}(this);if(t){const o=this.attachShadow({delegatesFocus:this[e],mode:this[f]}),i=document.importNode(t.content,!0);o.append(i),this[h]=o}else this[h]=null}}get[f](){return"open"}}}(HTMLElement))),$=Symbol("checkSize"),K=Symbol("closestAvailableItemIndex"),Q=Symbol("contentSlot"),G=t,W=Symbol("defaultTabIndex"),Z=e,X=Symbol("effectEndTarget"),Y=o,J=i,tt=Symbol("getItemText"),et=Symbol("goDown"),ot=Symbol("goEnd"),it=Symbol("goFirst"),nt=Symbol("goLast"),rt=Symbol("goLeft"),st=Symbol("goNext"),at=Symbol("goPrevious"),lt=Symbol("goRight"),ut=Symbol("goStart"),ct=Symbol("goToItemWithPrefix"),dt=Symbol("goUp"),pt=n,ht=r,ft=Symbol("inputDelegate"),mt=Symbol("itemsDelegate"),vt=Symbol("keydown"),gt=Symbol("mouseenter"),bt=Symbol("mouseleave"),yt=s,xt=a,Et=l,Ot=u,wt=Symbol("renderDataToElement"),_t=c,At=d,St=Symbol("scrollTarget"),It=p,Nt=h,Pt=f,Tt=Symbol("startEffect"),Ct=m,kt=v,Rt=Symbol("swipeDown"),Lt=Symbol("swipeDownComplete"),Dt=Symbol("swipeLeft"),qt=Symbol("swipeLeftTransitionEnd"),jt=Symbol("swipeRight"),Mt=Symbol("swipeRightTransitionEnd"),Ft=Symbol("swipeUp"),Ut=Symbol("swipeUpComplete"),Bt=Symbol("swipeStart"),Vt=Symbol("swipeTarget"),zt=Symbol("tap"),Ht=g,$t=Symbol("toggleSelectedFlag");"true"===new URLSearchParams(location.search).get("elixdebug")&&(window.elix={internal:{checkSize:$,closestAvailableItemIndex:K,contentSlot:Q,defaultState:G,defaultTabIndex:W,delegatesFocus:Z,effectEndTarget:X,firstRender:Y,focusTarget:J,getItemText:tt,goDown:et,goEnd:ot,goFirst:it,goLast:nt,goLeft:rt,goNext:st,goPrevious:at,goRight:lt,goStart:ut,goToItemWithPrefix:ct,goUp:dt,hasDynamicTemplate:pt,ids:ht,inputDelegate:ft,itemsDelegate:mt,keydown:vt,mouseenter:gt,mouseleave:bt,nativeInternals:yt,event:event,raiseChangeEvents:xt,render:Et,renderChanges:Ot,renderDataToElement:wt,rendered:_t,rendering:At,scrollTarget:St,setState:It,shadowRoot:Nt,shadowRootMode:Pt,startEffect:Tt,state:Ct,stateEffects:kt,swipeDown:Rt,swipeDownComplete:Lt,swipeLeft:Dt,swipeLeftTransitionEnd:qt,swipeRight:jt,swipeRightTransitionEnd:Mt,swipeUp:Ft,swipeUpComplete:Ut,swipeStart:Bt,swipeTarget:Vt,tap:zt,template:Ht,toggleSelectedFlag:$t}});const Kt=Symbol("previousBodyStyleOverflow"),Qt=Symbol("previousDocumentMarginRight");const Gt=Symbol("wrap"),Wt=Symbol("wrappingFocus");function Zt(t){return class extends t{[vt](t){const e=x(this[Nt]);if(e){const o=document.activeElement&&(document.activeElement===e||document.activeElement.contains(e)),i=this[Nt].activeElement,n=i&&(i===e||y(i,e));(o||n)&&"Tab"===t.key&&t.shiftKey&&(this[Wt]=!0,this[ht].focusCatcher.focus(),this[Wt]=!1)}return super[vt]&&super[vt](t)||!1}[Et](t){super[Et]&&super[Et](t),this[Y]&&this[ht].focusCatcher.addEventListener("focus",(()=>{if(!this[Wt]){const t=x(this[Nt]);t&&t.focus()}}))}[Gt](t){const e=I.html`
<style>
#focusCapture {
display: flex;
height: 100%;
overflow: hidden;
width: 100%;
}
#focusCaptureContainer {
align-items: center;
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
position: relative;
}
</style>
<div id="focusCapture">
<div id="focusCaptureContainer"></div>
<div id="focusCatcher" tabindex="0"></div>
</div>
`,o=e.getElementById("focusCaptureContainer");o&&(t.replaceWith(e),o.append(t))}}}function Xt(t){return class extends t{constructor(){super(),this.addEventListener("keydown",(async t=>{this[xt]=!0,this[Ct].focusVisible||this[It]({focusVisible:!0});this[vt](t)&&(t.preventDefault(),t.stopImmediatePropagation()),await Promise.resolve(),this[xt]=!1}))}attributeChangedCallback(t,e,o){if("tabindex"===t){let t;null===o?t=-1:(t=Number(o),isNaN(t)&&(t=this[W]?this[W]:0)),this.tabIndex=t}else super.attributeChangedCallback(t,e,o)}get[G](){const t=this[Z]?-1:0;return Object.assign(super[G]||{},{tabIndex:t})}[vt](t){return!!super[vt]&&super[vt](t)}[Et](t){super[Et]&&super[Et](t),t.tabIndex&&(this.tabIndex=this[Ct].tabIndex)}get tabIndex(){return super.tabIndex}set tabIndex(t){super.tabIndex!==t&&(super.tabIndex=t),this[At]||this[It]({tabIndex:t})}}}Zt.wrap=Gt;const Yt=function(t){return class extends t{get[G](){return Object.assign(super[G]||{},{role:null})}[Et](t){if(super[Et]&&super[Et](t),t.role){const{role:t}=this[Ct];t?this.setAttribute("role",t):this.removeAttribute("role")}}get role(){return super.role}set role(t){const e=String(t);super.role=e,this[At]||this[It]({s:e})}}}(H);class Jt extends Yt{get[G](){return Object.assign(super[G],{role:"none"})}get[Ht](){return N.html`
<style>
:host {
display: inline-block;
height: 100%;
left: 0;
position: fixed;
top: 0;
touch-action: manipulation;
width: 100%;
}
</style>
<slot></slot>
`}}class te extends Jt{constructor(){super(),"PointerEvent"in window||this.addEventListener("touchmove",(t=>{1===t.touches.length&&t.preventDefault()}))}}const ee=Symbol("closePromise"),oe=Symbol("closeResolve");function ie(t){return class extends t{attributeChangedCallback(t,e,o){if("opened"===t){const e=b(t,o);this.opened!==e&&(this.opened=e)}else super.attributeChangedCallback(t,e,o)}async close(t){super.close&&await super.close(),this[It]({closeResult:t}),await this.toggle(!1)}get closed(){return this[Ct]&&!this[Ct].opened}get closeFinished(){return this[Ct].closeFinished}get closeResult(){return this[Ct].closeResult}get[G](){const t={closeResult:null,opened:!1};return this[Tt]&&Object.assign(t,{closeFinished:!0,effect:"close",effectPhase:"after",openCloseEffects:!0}),Object.assign(super[G]||{},t)}async open(){super.open&&await super.open(),this[It]({closeResult:void 0}),await this.toggle(!0)}get opened(){return this[Ct]&&this[Ct].opened}set opened(t){this[It]({closeResult:void 0}),this.toggle(t)}[Et](t){if(super[Et](t),t.opened){const{opened:t}=this[Ct];_(this,"opened",t)}if(t.closeFinished){const{closeFinished:t}=this[Ct];_(this,"closed",t)}}[_t](t){if(super[_t]&&super[_t](t),t.opened&&this[xt]){const t=new CustomEvent("opened-changed",{bubbles:!0,detail:{closeResult:this[Ct].closeResult,opened:this[Ct].opened}});this.dispatchEvent(t);const e=new CustomEvent("openedchange",{bubbles:!0,detail:{closeResult:this[Ct].closeResult,opened:this[Ct].opened}});if(this.dispatchEvent(e),this[Ct].opened){const t=new CustomEvent("opened",{bubbles:!0});this.dispatchEvent(t);const e=new CustomEvent("open",{bubbles:!0});this.dispatchEvent(e)}else{const t=new CustomEvent("closed",{bubbles:!0,detail:{closeResult:this[Ct].closeResult}});this.dispatchEvent(t);const e=new CustomEvent("close",{bubbles:!0,detail:{closeResult:this[Ct].closeResult}});this.dispatchEvent(e)}}const e=this[oe];this.closeFinished&&e&&(this[oe]=null,this[ee]=null,e(this[Ct].closeResult))}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.openCloseEffects||e.effect||e.effectPhase||e.opened){const{effect:e,effectPhase:i,openCloseEffects:n,opened:r}=t,s=n?"close"===e&&"after"===i:!r;Object.assign(o,{closeFinished:s})}return o}async toggle(t=!this.opened){super.toggle&&await super.toggle(t);if(t!==this[Ct].opened){const e={opened:t};this[Ct].openCloseEffects&&(e.effect=t?"open":"close","after"===this[Ct].effectPhase&&(e.effectPhase="before")),await this[It](e)}}whenClosed(){return this[ee]||(this[ee]=new Promise((t=>{this[oe]=t}))),this[ee]}}}class ne extends H{get[Ht](){return N.html`
<style>
:host {
display: inline-block;
position: relative;
}
</style>
<slot></slot>
`}}const re=Symbol("appendedToDocument"),se=Symbol("assignedZIndex"),ae=Symbol("restoreFocusToElement");function le(t){const e=function(){const t=document.body.querySelectorAll("*"),e=Array.from(t,(t=>{const e=getComputedStyle(t);let o=0;if("static"!==e.position&&"auto"!==e.zIndex){const t=e.zIndex?parseInt(e.zIndex):0;o=isNaN(t)?0:t}return o}));return Math.max(...e)}()+1;t[se]=e,t.style.zIndex=e.toString()}function ue(t){const e=getComputedStyle(t).zIndex,o=t.style.zIndex,i=!isNaN(parseInt(o));if("auto"===e)return i;if("0"===e&&!i){const e=t.assignedSlot||(t instanceof ShadowRoot?t.host:t.parentNode);if(!(e instanceof HTMLElement))return!0;if(!ue(e))return!1}return!0}function ce(t){return class extends t{get[Q](){const t=this[Nt]&&this[Nt].querySelector("slot:not([name])");return this[Nt]&&t||console.warn(`SlotContentMixin expects ${this.constructor.name} to define a shadow tree that includes a default (unnamed) slot.\nSee https://elix.org/documentation/SlotContentMixin.`),t}get[G](){return Object.assign(super[G]||{},{content:null})}[_t](t){if(super[_t]&&super[_t](t),this[Y]){const t=this[Q];t&&t.addEventListener("slotchange",(async()=>{this[xt]=!0;const e=t.assignedNodes({flatten:!0});Object.freeze(e),this[It]({content:e}),await Promise.resolve(),this[xt]=!1}))}}}}const de=ie(function(t){return class extends t{get autoFocus(){return this[Ct].autoFocus}set autoFocus(t){this[It]({autoFocus:t})}get[G](){return Object.assign(super[G]||{},{autoFocus:!0,persistent:!1})}async open(){this[Ct].persistent||this.isConnected||(this[re]=!0,document.body.append(this)),super.open&&await super.open()}[Et](t){if(super[Et]&&super[Et](t),this[Y]&&this.addEventListener("blur",(t=>{const e=t.relatedTarget||document.activeElement;if(e instanceof HTMLElement){y(this,e)||(this.opened?this[ae]=e:(e.focus(),this[ae]=null))}})),(t.effectPhase||t.opened||t.persistent)&&!this[Ct].persistent){(void 0===this.closeFinished?this.closed:this.closeFinished)?this[se]&&(this.style.zIndex="",this[se]=null):this[se]?this.style.zIndex=this[se]:ue(this)||le(this)}}[_t](t){if(super[_t]&&super[_t](t),this[Y]&&this[Ct].persistent&&!ue(this)&&le(this),t.opened&&this[Ct].autoFocus)if(this[Ct].opened){this[ae]||document.activeElement===document.body||(this[ae]=document.activeElement);const t=x(this);t&&t.focus()}else this[ae]&&(this[ae].focus(),this[ae]=null);!this[Y]&&!this[Ct].persistent&&this.closeFinished&&this[re]&&(this[re]=!1,this.parentNode&&this.parentNode.removeChild(this))}get[Ht](){const t=super[Ht]||N.html``;return t.content.append(I.html`
<style>
:host([closed]) {
display: none;
}
</style>
`),t}}}(ce(H)));class pe extends de{get backdrop(){return this[ht]&&this[ht].backdrop}get backdropPartType(){return this[Ct].backdropPartType}set backdropPartType(t){this[It]({backdropPartType:t})}get[G](){return Object.assign(super[G],{backdropPartType:Jt,framePartType:ne})}get frame(){return this[ht].frame}get framePartType(){return this[Ct].framePartType}set framePartType(t){this[It]({framePartType:t})}[Et](t){super[Et](t),he(this[Nt],this[Ct],t)}[_t](t){super[_t](t),t.opened&&this[Ct].content&&this[Ct].content.forEach((t=>{t[$]&&t[$]()}))}get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
:host {
display: inline-grid;
/* Constrain content if overlay's height is constrained. */
grid-template: minmax(0, 1fr) / minmax(0, 1fr);
max-height: 100vh;
max-width: 100vw;
outline: none;
position: fixed;
-webkit-tap-highlight-color: transparent;
}
[part~="frame"] {
box-sizing: border-box;
display: grid;
overscroll-behavior: contain;
pointer-events: initial;
position: relative;
}
#frameContent {
display: grid;
grid-template: minmax(0, 1fr) / minmax(0, 1fr);
overflow: hidden;
}
</style>
<div id="backdrop" part="backdrop" tabindex="-1"></div>
<div id="frame" part="frame" role="none">
<div id="frameContent">
<slot></slot>
</div>
</div>
`),he(t.content,this[Ct]),t}}function he(t,e,o){if(!o||o.backdropPartType){const{backdropPartType:o}=e,i=t.getElementById("backdrop");i&&k(i,o)}if(!o||o.framePartType){const{framePartType:o}=e,i=t.getElementById("frame");i&&k(i,o)}}const fe=function(t){return class extends t{get[G](){return Object.assign(super[G]||{},{role:"dialog"})}[vt](t){let e=!1;switch(t.key){case"Escape":this.close({canceled:"Escape"}),e=!0}return e||super[vt]&&super[vt](t)||!1}[Et](t){if(super[Et]&&super[Et](t),t.opened)if(this[Ct].opened&&document.documentElement){const t=document.documentElement.clientWidth,e=window.innerWidth-t;this[Kt]=document.body.style.overflow,this[Qt]=e>0?document.documentElement.style.marginRight:null,document.body.style.overflow="hidden",e>0&&(document.documentElement.style.marginRight=`${e}px`)}else null!=this[Kt]&&(document.body.style.overflow=this[Kt],this[Kt]=null),null!=this[Qt]&&(document.documentElement.style.marginRight=this[Qt],this[Qt]=null);if(t.role){const{role:t}=this[Ct];this.setAttribute("role",t)}}get role(){return super.role}set role(t){super.role=t,this[At]||this[It]({role:t})}}}(Zt(Xt(pe)));class me extends fe{get[G](){return Object.assign(super[G],{backdropPartType:te,tabIndex:-1})}get[Ht](){const t=super[Ht],e=t.content.querySelector("#frame");return this[Zt.wrap](e),t.content.append(I.html`
<style>
:host {
height: 100%;
left: 0;
pointer-events: initial;
top: 0;
width: 100%;
}
</style>
`),t}}class ve extends me{get choiceButtons(){return this[Ct].choiceButtons}get choiceButtonPartType(){return this[Ct].choiceButtonPartType}set choiceButtonPartType(t){this[It]({choiceButtonPartType:t})}get choices(){return this[Ct].choices}set choices(t){this[It]({choices:t})}get[G](){return Object.assign(super[G],{choiceButtonPartType:"button",choiceButtons:[],choices:["OK"]})}[vt](t){let e=!1;const o=1===t.key.length&&t.key.toLowerCase();if(o){const t=this.choices.find((t=>t[0].toLowerCase()===o));t&&(this.close({choice:t}),e=!0)}return e||super[vt]&&super[vt](t)||!1}[Et](t){super[Et](t),this[Y]&&this[ht].choiceButtonContainer.addEventListener("click",(async t=>{const e=t.target;if(e instanceof HTMLElement){const t=e.textContent;this[xt]=!0,await this.close({choice:t}),this[xt]=!1}})),t.choiceButtons&&function(t,e){const o=[...e],i=t.childNodes.length,n=o.length,r=Math.max(i,n);for(let e=0;e<r;e++){const r=t.childNodes[e],s=o[e];e>=i?t.append(s):e>=n?t.removeChild(t.childNodes[n]):r!==s&&(o.indexOf(r,e)>=e?t.insertBefore(s,r):t.replaceChild(s,r))}}(this[ht].choiceButtonContainer,this[Ct].choiceButtons)}[kt](t,e){const o=super[kt](t,e);if(e.choiceButtonPartType||e.choices){const e=t.choices.map((e=>{const o=T(t.choiceButtonPartType);return"part"in o&&(o.part="choice-button"),o.textContent=e,o}));Object.freeze(e),Object.assign(o,{choiceButtons:e})}return o}get[Ht](){const t=super[Ht],e=t.content.querySelector("slot:not([name])");return e&&e.replaceWith(I.html`
<div id="alertDialogContent">
<slot></slot>
<div id="choiceButtonContainer" part="choice-button-container"></div>
</div>
`),t}}const ge=document.createElement("div");ge.attachShadow({mode:"open",delegatesFocus:!0});const be=ge.shadowRoot.delegatesFocus;function ye(t){if("selectedText"in t)return t.selectedText;if("value"in t&&"options"in t){const e=t.value,o=t.options.find((t=>t.value===e));return o?o.innerText:""}return"value"in t?t.value:t.innerText}function xe(t,e){const{ariaLabel:o,ariaLabelledby:i}=e,n=t.isConnected?t.getRootNode():null;let r=null;if(i&&n){r=i.split(" ").map((o=>{const i=n.getElementById(o);return i?i===t&&null!==e.value?e.selectedText:ye(i):""})).join(" ")}else if(o)r=o;else if(n){const e=t.id;if(e){const t=n.querySelector(`[for="${e}"]`);t instanceof HTMLElement&&(r=ye(t))}if(null===r){const e=t.closest("label");e&&(r=ye(e))}}return r&&(r=r.trim()),r}let Ee=!1;const Oe=Symbol("focusVisibleChangedListener");function we(t){return class extends t{constructor(){super(),this.addEventListener("focusout",(t=>{Promise.resolve().then((()=>{const e=t.relatedTarget||document.activeElement,o=this===e,i=y(this,e);!o&&!i&&(this[It]({focusVisible:!1}),document.removeEventListener("focusvisiblechange",this[Oe]),this[Oe]=null)}))})),this.addEventListener("focusin",(()=>{Promise.resolve().then((()=>{this[Ct].focusVisible!==Ee&&this[It]({focusVisible:Ee}),this[Oe]||(this[Oe]=()=>{this[It]({focusVisible:Ee})},document.addEventListener("focusvisiblechange",this[Oe]))}))}))}get[G](){return Object.assign(super[G]||{},{focusVisible:!1})}[Et](t){if(super[Et]&&super[Et](t),t.focusVisible){const{focusVisible:t}=this[Ct];this.toggleAttribute("focus-visible",t)}}get[Ht](){const t=super[Ht]||N.html``;return t.content.append(I.html`
<style>
:host {
outline: none;
}
:host([focus-visible]:focus-within) {
outline-color: Highlight; /* Firefox */
outline-color: -webkit-focus-ring-color; /* All other browsers */
outline-style: auto;
}
</style>
`),t}}}function _e(t){if(Ee!==t){Ee=t;const e=new CustomEvent("focus-visible-changed",{detail:{focusVisible:Ee}});document.dispatchEvent(e);const o=new CustomEvent("focusvisiblechange",{detail:{focusVisible:Ee}});document.dispatchEvent(o)}}function Ae(t){return class extends t{get[Z](){return!0}focus(t){const e=this[J];e&&e.focus(t)}get[J](){return x(this[Nt])}}}window.addEventListener("keydown",(()=>{_e(!0)}),{capture:!0}),window.addEventListener("mousedown",(()=>{_e(!1)}),{capture:!0});const Se=Symbol("extends"),Ie=Symbol("delegatedPropertySetters"),Ne={a:!0,area:!0,button:!0,details:!0,iframe:!0,input:!0,select:!0,textarea:!0},Pe={address:["scroll"],blockquote:["scroll"],caption:["scroll"],center:["scroll"],dd:["scroll"],dir:["scroll"],div:["scroll"],dl:["scroll"],dt:["scroll"],fieldset:["scroll"],form:["reset","scroll"],frame:["load"],h1:["scroll"],h2:["scroll"],h3:["scroll"],h4:["scroll"],h5:["scroll"],h6:["scroll"],iframe:["load"],img:["abort","error","load"],input:["abort","change","error","select","load"],li:["scroll"],link:["load"],menu:["scroll"],object:["error","scroll"],ol:["scroll"],p:["scroll"],script:["error","load"],select:["change","scroll"],tbody:["scroll"],tfoot:["scroll"],thead:["scroll"],textarea:["change","select","scroll"]},Te=["click","dblclick","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","wheel"],Ce={abort:!0,change:!0,reset:!0},ke=["address","article","aside","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],Re=["accept-charset","autoplay","buffered","challenge","codebase","colspan","contenteditable","controls","crossorigin","datetime","dirname","for","formaction","http-equiv","icon","ismap","itemprop","keytype","language","loop","manifest","maxlength","minlength","muted","novalidate","preload","radiogroup","readonly","referrerpolicy","rowspan","scoped","usemap"],Le=Ae(H);class De extends Le{constructor(){super();const t=this;!this[yt]&&t.attachInternals&&(this[yt]=t.attachInternals())}attributeChangedCallback(t,e,o){if(Re.indexOf(t)>=0){const e=Object.assign({},this[Ct].innerAttributes,{[t]:o});this[It]({innerAttributes:e})}else super.attributeChangedCallback(t,e,o)}blur(){this.inner.blur()}get[G](){return Object.assign(super[G],{innerAttributes:{}})}get[W](){return Ne[this.extends]?0:-1}get extends(){return this.constructor[Se]}get inner(){const t=this[ht]&&this[ht].inner;return t||console.warn("Attempted to get an inner standard element before it was instantiated."),t}static get observedAttributes(){return[...super.observedAttributes,...Re]}[Et](t){super[Et](t);const e=this.inner;if(this[Y]){(Pe[this.extends]||[]).forEach((t=>{e.addEventListener(t,(()=>{const e=new Event(t,{bubbles:Ce[t]||!1});this.dispatchEvent(e)}))})),"disabled"in e&&Te.forEach((t=>{this.addEventListener(t,(t=>{e.disabled&&t.stopImmediatePropagation()}))}))}if(t.tabIndex&&(e.tabIndex=this[Ct].tabIndex),t.innerAttributes){const{innerAttributes:t}=this[Ct];for(const o in t)qe(e,o,t[o])}this.constructor[Ie].forEach((o=>{if(t[o]){const t=this[Ct][o];("selectionEnd"===o||"selectionStart"===o)&&null===t||(e[o]=t)}}))}[_t](t){if(super[_t](t),t.disabled){const{disabled:t}=this[Ct];void 0!==t&&_(this,"disabled",t)}}get[Ht](){const t=ke.includes(this.extends)?"block":"inline-block",e=this.extends;return N.html`
<style>
:host {
display: ${t}
}
[part~="inner"] {
box-sizing: border-box;
height: 100%;
width: 100%;
}
</style>
<${e} id="inner" part="inner ${e}">
<slot></slot>
</${e}>
`}static wrap(t){class e extends De{}e[Se]=t;const o=document.createElement(t);return function(t,e){const o=Object.getOwnPropertyNames(e);t[Ie]=[],o.forEach((o=>{const i=Object.getOwnPropertyDescriptor(e,o);if(!i)return;const n=function(t,e){if("function"==typeof e.value){if("constructor"!==t)return function(t,e){const o=function(...e){this.inner[t](...e)};return{configurable:e.configurable,enumerable:e.enumerable,value:o,writable:e.writable}}(t,e)}else if("function"==typeof e.get||"function"==typeof e.set)return function(t,e){const o={configurable:e.configurable,enumerable:e.enumerable};e.get&&(o.get=function(){return function(t,e){return t[Ct][e]||t[Nt]&&t.inner[e]}(this,t)});e.set&&(o.set=function(e){!function(t,e,o){t[Ct][e]!==o&&t[It]({[e]:o})}(this,t,e)});e.writable&&(o.writable=e.writable);return o}(t,e);return null}(o,i);n&&(Object.defineProperty(t.prototype,o,n),n.set&&t[Ie].push(o))}))}(e,Object.getPrototypeOf(o)),e}}function qe(t,e,o){A[e]?"string"==typeof o?t.setAttribute(e,""):null===o&&t.removeAttribute(e):null!=o?t.setAttribute(e,o.toString()):t.removeAttribute(e)}const je=function(t){return class extends t{get[G](){return Object.assign(super[G]||{},{composeFocus:!be})}[Et](t){super[Et]&&super[Et](t),this[Y]&&this.addEventListener("mousedown",(t=>{if(this[Ct].composeFocus&&0===t.button&&t.target instanceof Element){const e=function(t){for(const e of w(t)){const t=e[i]||e,o=t;if(t instanceof HTMLElement&&t.tabIndex>=0&&!o.disabled&&!(t instanceof HTMLSlotElement))return t}return null}(t.target);e&&(e.focus(),t.preventDefault())}}))}}}(function(t){return class extends t{get ariaLabel(){return this[Ct].ariaLabel}set ariaLabel(t){this[Ct].removingAriaAttribute||this[It]({ariaLabel:String(t)})}get ariaLabelledby(){return this[Ct].ariaLabelledby}set ariaLabelledby(t){this[Ct].removingAriaAttribute||this[It]({ariaLabelledby:String(t)})}get[G](){return Object.assign(super[G]||{},{ariaLabel:null,ariaLabelledby:null,inputLabel:null,removingAriaAttribute:!1})}[Et](t){if(super[Et]&&super[Et](t),this[Y]&&this.addEventListener("focus",(()=>{this[xt]=!0;const t=xe(this,this[Ct]);this[It]({inputLabel:t}),this[xt]=!1})),t.inputLabel){const{inputLabel:t}=this[Ct];t?this[ft].setAttribute("aria-label",t):this[ft].removeAttribute("aria-label")}}[_t](t){if(super[_t]&&super[_t](t),this[Y]){(window.requestIdleCallback||setTimeout)((()=>{const t=xe(this,this[Ct]);this[It]({inputLabel:t})}))}const{ariaLabel:e,ariaLabelledby:o}=this[Ct];t.ariaLabel&&!this[Ct].removingAriaAttribute&&this.getAttribute("aria-label")&&(this.setAttribute("delegated-label",e),this[It]({removingAriaAttribute:!0}),this.removeAttribute("aria-label")),t.ariaLabelledby&&!this[Ct].removingAriaAttribute&&this.getAttribute("aria-labelledby")&&(this.setAttribute("delegated-labelledby",o),this[It]({removingAriaAttribute:!0}),this.removeAttribute("aria-labelledby")),t.removingAriaAttribute&&this[Ct].removingAriaAttribute&&this[It]({removingAriaAttribute:!1})}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.ariaLabel&&t.ariaLabel||e.selectedText&&t.ariaLabelledby&&this.matches(":focus-within")){const e=xe(this,t);Object.assign(o,{inputLabel:e})}return o}}}(we(De.wrap("button"))));class Me extends je{get[G](){return Object.assign(super[G],{role:"button"})}get[ft](){return this[ht].inner}[zt](){const t=new MouseEvent("click",{bubbles:!0,cancelable:!0});this.dispatchEvent(t)}get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
:host {
display: inline-flex;
outline: none;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
[part~="button"] {
align-items: center;
background: none;
border: none;
color: inherit;
flex: 1;
font: inherit;
outline: none;
padding: 0;
}
</style>
`),t}}class Fe extends(function(t){return class extends t{get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
:host([disabled]) ::slotted(*) {
opacity: 0.5;
}
[part~="button"] {
display: inline-flex;
justify-content: center;
margin: 0;
position: relative;
}
</style>
`),t}}}(Me)){}class Ue extends Fe{get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
[part~="button"] {
background: #eee;
border: 1px solid #ccc;
padding: 0.25em 0.5em;
}
</style>
`),t}}class Be extends te{get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
:host {
background: rgba(0, 0, 0, 0.2);
}
</style>
`),t}}class Ve extends ne{get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
:host {
background: white;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 0px 10px rgba(0, 0, 0, 0.5);
box-sizing: border-box;
}
</style>
`),t}}function ze(t){return class extends t{get[G](){return Object.assign(super[G]||{},{backdropPartType:Be,framePartType:Ve})}}}class He extends(ze(ve)){get[G](){return Object.assign(super[G],{choiceButtonPartType:Ue})}get[Ht](){const t=super[Ht];return t.content.append(I.html`
<style>
[part~="frame"] {
padding: 1em;
}
[part~="choice-button-container"] {
margin-top: 1em;
}
[part~="choice-button"]:not(:first-child) {
margin-left: 0.5em;
}
</style>
`),t}}customElements.define("elix-alert-dialog",class extends He{});class $e extends(ze(me)){}customElements.define("elix-dialog",class extends $e{});const Ke={a:"link",article:"region",button:"button",h1:"sectionhead",h2:"sectionhead",h3:"sectionhead",h4:"sectionhead",h5:"sectionhead",h6:"sectionhead",hr:"sectionhead",iframe:"region",link:"link",menu:"menu",ol:"list",option:"option",output:"liveregion",progress:"progressbar",select:"select",table:"table",td:"td",textarea:"textbox",th:"th",ul:"list"};function Qe(t){const e=t[Nt],o=e&&e.querySelector("slot:not([name])");return o&&o.parentNode instanceof Element&&function(t){for(const e of w(t))if(e instanceof HTMLElement&&Ge(e))return e;return null}(o.parentNode)||t}function Ge(t){const e=getComputedStyle(t),o=e.overflowX,i=e.overflowY;return"scroll"===o||"auto"===o||"scroll"===i||"auto"===i}function We(t,e,o){const i=t[K](t[Ct],{direction:o,index:e});if(i<0)return!1;const n=t[Ct].currentIndex!==i;return n&&t[It]({currentIndex:i}),n}const Ze=["applet","basefont","embed","font","frame","frameset","isindex","keygen","link","multicol","nextid","noscript","object","param","script","style","template","noembed"];function Xe(t,e,o){const i=t[Ct].items,n=o?0:i.length-1,r=o?i.length:0,s=o?1:-1;let a,l,u=null;const{availableItemFlags:c}=t[Ct];for(a=n;a!==r;a+=s){if((!c||c[a])&&(l=i[a].getBoundingClientRect(),l.top<=e&&e<=l.bottom)){u=i[a];break}}if(!u||!l)return null;const d=getComputedStyle(u),p=d.paddingTop?parseFloat(d.paddingTop):0,h=d.paddingBottom?parseFloat(d.paddingBottom):0,f=l.top+p,m=f+u.clientHeight-p-h;return o&&f<=e||!o&&m>=e?a:a-s}function Ye(t,e){const o=t[Ct].items,i=t[Ct].currentIndex,n=t[St].getBoundingClientRect(),r=Xe(t,e?n.bottom:n.top,e);let s;if(r&&i===r){const n=o[i].getBoundingClientRect(),r=t[St].clientHeight;s=Xe(t,e?n.bottom+r:n.top-r,e)}else s=r;if(!s){const i=e?o.length-1:0;s=t[K]?t[K](t[Ct],{direction:e?-1:1,index:i}):i}const a=s!==i;if(a){const e=t[xt];t[xt]=!0,t[It]({currentIndex:s}),t[xt]=e}return a}const Je=Symbol("typedPrefix"),to=Symbol("prefixTimeout");function eo(t){const e=t;e[to]&&(clearTimeout(e[to]),e[to]=!1)}function oo(t){t[Je]="",eo(t)}function io(t){eo(t),t[to]=setTimeout((()=>{oo(t)}),1e3)}function no(t){return class extends t{connectedCallback(){const t="rtl"===getComputedStyle(this).direction;this[It]({rightToLeft:t}),super.connectedCallback()}}}function ro(t){return class extends t{get[G](){return Object.assign(super[G]||{},{items:null})}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.content){const e=t.content,i=e?Array.prototype.filter.call(e,(t=>{return(e=t)instanceof Element&&(!e.localName||Ze.indexOf(e.localName)<0);var e})):null;i&&Object.freeze(i),Object.assign(o,{items:i})}return o}}}const so=function(t){return class extends t{get[G](){const t=super[G];return Object.assign(t,{itemRole:t.itemRole||"menuitem",role:t.role||"menu"})}get itemRole(){return this[Ct].itemRole}set itemRole(t){this[It]({itemRole:t})}[Et](t){super[Et]&&super[Et](t);const e=this[Ct].items;if((t.items||t.itemRole)&&e){const{itemRole:t}=this[Ct];e.forEach((e=>{t===Ke[e.localName]?e.removeAttribute("role"):e.setAttribute("role",t)}))}if(t.role){const{role:t}=this[Ct];this.setAttribute("role",t)}}get role(){return super.role}set role(t){super.role=t,this[At]||this[It]({role:t})}}}(function(t){return class extends t{attributeChangedCallback(t,e,o){if("current-index"===t)this.currentIndex=Number(o);else if("current-item-required"===t){const e=b(t,o);this.currentItemRequired!==e&&(this.currentItemRequired=e)}else if("cursor-operations-wrap"===t){const e=b(t,o);this.cursorOperationsWrap!==e&&(this.cursorOperationsWrap=e)}else super.attributeChangedCallback(t,e,o)}get currentIndex(){const{items:t,currentIndex:e}=this[Ct];return t&&t.length>0?e:-1}set currentIndex(t){isNaN(t)||this[It]({currentIndex:t})}get currentItem(){const{items:t,currentIndex:e}=this[Ct];return t&&t[e]}set currentItem(t){const{items:e}=this[Ct];if(!e)return;const o=e.indexOf(t);this[It]({currentIndex:o})}get currentItemRequired(){return this[Ct].currentItemRequired}set currentItemRequired(t){this[It]({currentItemRequired:t})}get cursorOperationsWrap(){return this[Ct].cursorOperationsWrap}set cursorOperationsWrap(t){this[It]({cursorOperationsWrap:t})}goFirst(){return super.goFirst&&super.goFirst(),this[it]()}goLast(){return super.goLast&&super.goLast(),this[nt]()}goNext(){return super.goNext&&super.goNext(),this[st]()}goPrevious(){return super.goPrevious&&super.goPrevious(),this[at]()}[_t](t){if(super[_t]&&super[_t](t),t.currentIndex&&this[xt]){const{currentIndex:t}=this[Ct],e=new CustomEvent("current-index-changed",{bubbles:!0,detail:{currentIndex:t}});this.dispatchEvent(e);const o=new CustomEvent("currentindexchange",{bubbles:!0,detail:{currentIndex:t}});this.dispatchEvent(o)}}}}(function(t){return class extends t{[_t](t){super[_t]&&super[_t](t),t.currentItem&&this.scrollCurrentItemIntoView()}scrollCurrentItemIntoView(){super.scrollCurrentItemIntoView&&super.scrollCurrentItemIntoView();const{currentItem:t,items:e}=this[Ct];if(!t||!e)return;const o=this[St].getBoundingClientRect(),i=t.getBoundingClientRect(),n=i.bottom-o.bottom,r=i.left-o.left,s=i.right-o.right,a=i.top-o.top,l=this[Ct].orientation||"both";"horizontal"!==l&&"both"!==l||(s>0?this[St].scrollLeft+=s:r<0&&(this[St].scrollLeft+=Math.ceil(r))),"vertical"!==l&&"both"!==l||(n>0?this[St].scrollTop+=n:a<0&&(this[St].scrollTop+=Math.ceil(a)))}get[St](){return super[St]||Qe(this)}}}(Ae(function(t){return class extends t{get[G](){return Object.assign(super[G]||{},{canGoDown:null,canGoLeft:null,canGoRight:null,canGoUp:null})}[et](){return super[et]&&super[et](),this[st]()}[ot](){return super[ot]&&super[ot](),this[nt]()}[rt](){return super[rt]&&super[rt](),this[Ct]&&this[Ct].rightToLeft?this[st]():this[at]()}[lt](){return super[lt]&&super[lt](),this[Ct]&&this[Ct].rightToLeft?this[at]():this[st]()}[ut](){return super[ut]&&super[ut](),this[it]()}[dt](){return super[dt]&&super[dt](),this[at]()}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.canGoNext||e.canGoPrevious||e.languageDirection||e.orientation||e.rightToLeft){const{canGoNext:e,canGoPrevious:i,orientation:n,rightToLeft:r}=t,s="horizontal"===n||"both"===n,a="vertical"===n||"both"===n,l=a&&e,u=!!s&&(r?e:i),c=!!s&&(r?i:e),d=a&&i;Object.assign(o,{canGoDown:l,canGoLeft:u,canGoRight:c,canGoUp:d})}return o}}}(function(t){return class extends t{get items(){return this[Ct]?this[Ct].items:null}[_t](t){if(super[_t]&&super[_t](t),!this[Y]&&t.items&&this[xt]){const t=new CustomEvent("items-changed",{bubbles:!0});this.dispatchEvent(t);const e=new CustomEvent("itemschange",{bubbles:!0});this.dispatchEvent(e)}}}}(function(t){return class extends t{[K](t,e={}){const o=void 0!==e.direction?e.direction:1,i=void 0!==e.index?e.index:t.currentIndex,n=void 0!==e.wrap?e.wrap:t.cursorOperationsWrap,{items:r}=t,s=r?r.length:0;if(0===s)return-1;if(n){let e=(i%s+s)%s;const n=((e-o)%s+s)%s;for(;e!==n;){if(!t.availableItemFlags||t.availableItemFlags[e])return e;e=((e+o)%s+s)%s}}else for(let e=i;e>=0&&e<s;e+=o){if(!t.availableItemFlags||t.availableItemFlags[e])return e}return-1}get[G](){return Object.assign(super[G]||{},{currentIndex:-1,desiredCurrentIndex:null,currentItem:null,currentItemRequired:!1,cursorOperationsWrap:!1})}[it](){return super[it]&&super[it](),We(this,0,1)}[nt](){return super[nt]&&super[nt](),We(this,this[Ct].items.length-1,-1)}[st](){super[st]&&super[st]();const{currentIndex:t,items:e}=this[Ct];return We(this,t<0&&e?0:t+1,1)}[at](){super[at]&&super[at]();const{currentIndex:t,items:e}=this[Ct];return We(this,t<0&&e?e.length-1:t-1,-1)}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.availableItemFlags||e.items||e.currentIndex||e.currentItemRequired){const{currentIndex:i,desiredCurrentIndex:n,currentItem:r,currentItemRequired:s,items:a}=t,l=a?a.length:0;let u,c=n;if(e.items&&!e.currentIndex&&r&&l>0&&a[i]!==r){const t=a.indexOf(r);t>=0&&(c=t)}else e.currentIndex&&(i<0&&null!==r||i>=0&&(0===l||a[i]!==r)||null===n)&&(c=i);s&&c<0&&(c=0),c<0?(c=-1,u=-1):0===l?u=-1:(u=Math.max(Math.min(l-1,c),0),u=this[K](t,{direction:1,index:u,wrap:!1}),u<0&&(u=this[K](t,{direction:-1,index:u-1,wrap:!1})));const d=a&&a[u]||null;Object.assign(o,{currentIndex:u,desiredCurrentIndex:c,currentItem:d})}return o}}}(function(t){return class extends t{get[G](){return Object.assign(super[G]||{},{texts:null})}[tt](t){return super[tt]?super[tt](t):(e=t).getAttribute("aria-label")||e.getAttribute("alt")||e.innerText||e.textContent||"";var e}[kt](t,e){const o=super[kt]?super[kt](t,e):{};if(e.items){const{items:e}=t,i=function(t,e){return t?Array.from(t,(t=>e(t))):null}(e,this[tt]);i&&(Object.freeze(i),Object.assign(o,{texts:i}))}return o}}}(function(t){return class extends t{[et](){if(super[et])return super[et]()}[ot](){if(super[ot])return super[ot]()}[rt](){if(super[rt])return super[rt]()}[lt](){if(super[lt])return super[lt]()}[ut](){if(super[ut])return super[ut]()}[dt](){if(super[dt])return super[dt]()}[vt](t){let e=!1;if(t.target===this){const o=this[Ct].orientation||"both",i="horizontal"===o||"both"===o,n="vertical"===o||"both"===o;switch(t.key){case"ArrowDown":n&&(e=t.altKey?this[ot]():this[et]());break;case"ArrowLeft":!i||t.metaKey||t.altKey||(e=this[rt]());break;case"ArrowRight":!i||t.metaKey||t.altKey||(e=this[lt]());break;case"ArrowUp":n&&(e=t.altKey?this[ut]():this[dt]());break;case"End":e=this[ot]();break;case"Home":e=this[ut]()}}return e||super[vt]&&super[vt](t)||!1}}}(Xt(function(t){return class extends t{[vt](t){let e=!1;if("horizontal"!==this.orientation)switch(t.key){case"PageDown":e=this.pageDown();break;case"PageUp":e=this.pageUp()}return e||super[vt]&&super[vt](t)}get orientation(){return super.orientation||this[Ct]&&this[Ct].orientation||"both"}pageDown(){return super.pageDown&&super.pageDown(),Ye(this,!0)}pageUp(){return super.pageUp&&super.pageUp(),Ye(this,!1)}get[St](){return super[St]||Qe(this)}}}(function(t){return class extends t{constructor(){super(),oo(this)}[ct](t){if(super[ct]&&super[ct](t),null==t||0===t.length)return!1;const e=t.toLowerCase(),o=this[Ct].texts.findIndex((o=>o.substr(0,t.length).toLowerCase()===e));if(o>=0){const t=this[Ct].currentIndex;return this[It]({currentIndex:o}),this[Ct].currentIndex!==t}return!1}[vt](t){let e;switch(t.key){case"Backspace":!function(t){const e=t,o=e[Je]?e[Je].length:0;o>0&&(e[Je]=e[Je].substr(0,o-1));t[ct](e[Je]),io(t)}(this),e=!0;break;case"Escape":oo(this);break;default:t.ctrlKey||t.metaKey||t.altKey||1!==t.key.length||function(t,e){const o=t,i=o[Je]||"";o[Je]=i+e,t[ct](o[Je]),io(t)}(this,t.key)}return e||super[vt]&&super[vt](t)}}}(no(function(t){return ro(ce(t))}(function(t){return class extends t{constructor(){super(),this.addEventListener("mousedown",(t=>{0===t.button&&(this[xt]=!0,this[zt](t),this[xt]=!1)}))}[Et](t){super[Et]&&super[Et](t),this[Y]&&Object.assign(this.style,{touchAction:"manipulation",mozUserSelect:"none",msUserSelect:"none",webkitUserSelect:"none",userSelect:"none"})}[zt](t){const e=t.composedPath?t.composedPath()[0]:t.target,{items:o,currentItemRequired:i}=this[Ct];if(o&&e instanceof Node){const n=E(o,e),r=n>=0?o[n]:null;(r&&!r.disabled||!r&&!i)&&(this[It]({currentIndex:n}),t.stopPropagation())}}}}(H)))))))))))))));class ao extends so{get[G](){return Object.assign(super[G],{availableItemFlags:null,highlightCurrentItem:!0,orientation:"vertical",currentItemFocused:!1})}async flashCurrentItem(){const t=this[Ct].focusVisible,e=matchMedia("(pointer: fine)").matches;if(t||e){const t=75;this[It]({highlightCurrentItem:!1}),await new Promise((e=>setTimeout(e,t))),this[It]({highlightCurrentItem:!0}),await new Promise((e=>setTimeout(e,t)))}}[Et](t){super[Et](t),this[Y]&&(this.addEventListener("disabledchange",(t=>{this[xt]=!0;const e=t.target,{items:o}=this[Ct],i=null===o?-1:o.indexOf(e);if(i>=0){const t=this[Ct].availableItemFlags.slice();t[i]=!e.disabled,this[It]({availableItemFlags:t})}this[xt]=!1})),"PointerEvent"in window?this.addEventListener("pointerdown",(t=>this[zt](t))):this.addEventListener("touchstart",(t=>this[zt](t))),this.removeAttribute("tabindex"));const{currentIndex:e,items:o}=this[Ct];if((t.items||t.currentIndex||t.highlightCurrentItem)&&o){const{highlightCurrentItem:t}=this[Ct];o.forEach(((o,i)=>{o.toggleAttribute("current",t&&i===e)}))}(t.items||t.currentIndex||t.currentItemFocused||t.focusVisible)&&o&&o.forEach(((t,o)=>{const i=o===e,n=e<0&&0===o;this[Ct].currentItemFocused?i||n||t.removeAttribute("tabindex"):(i||n)&&(t.tabIndex=0)}))}[_t](t){if(super[_t](t),!this[Y]&&t.currentIndex&&!this[Ct].currentItemFocused){const{currentItem:t}=this[Ct];(t instanceof HTMLElement?t:this).focus(),this[It]({currentItemFocused:!0})}}get[St](){return this[ht].content}[kt](t,e){const o=super[kt](t,e);if(e.currentIndex&&Object.assign(o,{currentItemFocused:!1}),e.items){const{items:e}=t,i=null===e?null:e.map((t=>!t.disabled));Object.assign(o,{availableItemFlags:i})}return o}get[Ht](){return N.html`
<style>
:host {
box-sizing: border-box;
cursor: default;
display: inline-flex;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
#content {
display: flex;
flex: 1;
flex-direction: column;
max-height: 100%;
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch; /* for momentum scrolling */
}
::slotted(*) {
flex-shrink: 0;
outline: none;
touch-action: manipulation;
}
::slotted(option) {
font: inherit;
min-height: inherit;
}
</style>
<div id="content" role="none">
<slot></slot>
</div>
`}}const lo=Symbol("documentMouseupListener");async function uo(t){const e=this,o=e[Nt].elementsFromPoint(t.clientX,t.clientY);if(e.opened){const t=o.indexOf(e[ht].source)>=0,i=e[ht].popup,n=o.indexOf(i)>=0,r=i.frame&&o.indexOf(i.frame)>=0;t?e[Ct].dragSelect&&(e[xt]=!0,e[It]({dragSelect:!1}),e[xt]=!1):n||r||(e[xt]=!0,await e.close(),e[xt]=!1)}}function co(t){t[Ct].opened&&t.isConnected?t[lo]||(t[lo]=uo.bind(t),document.addEventListener("mouseup",t[lo])):t[lo]&&(document.removeEventListener("mouseup",t[lo]),t[lo]=null)}function po(t){return class extends t{get[G](){return Object.assign(super[G]||{},{disabled:!1})}get disabled(){return this[Ct].disabled}set disabled(t){this[It]({disabled:t})}[_t](t){if(super[_t]&&super[_t](t),t.disabled&&(this.toggleAttribute("disabled",this.disabled),this[xt])){const t=new CustomEvent("disabled-changed",{bubbles:!0});this.dispatchEvent(t);const e=new CustomEvent("disabledchange",{bubbles:!0});this.dispatchEvent(e)}}}}function ho(t,e,o,i){const n=fo(t,o,i);let r=0,s=0;const a="above"===o||"below"===o;switch(o){case"above":r=n.y-e.top;break;case"below":r=e.bottom-n.y;break;case"left":s=n.x-e.left;break;case"right":s=e.right-n.x}switch(i){case"bottom":r=n.y-e.top;break;case"center":a?s=e.width:r=e.height;break;case"stretch":a?s=t.width:r=t.height;break;case"left":s=e.right-n.x;break;case"right":s=n.x-e.left;break;case"top":r=e.bottom-n.y}return r=Math.max(0,r),s=Math.max(0,s),{height:r,width:s}}function fo(t,e,o){let i=0,n=0;const r="above"===e||"below"===e;switch(e){case"above":n=t.top;break;case"below":n=t.bottom;break;case"left":case"right":i=t[e]}switch(o){case"bottom":case"top":n=t[o];break;case"left":case"right":i=t[o];break;case"center":r?i=t.left+t.width/2:n=t.top+t.height/2;break;case"stretch":r?i=t.left:n=t.top}return{x:i,y:n}}function mo(t,e,o,i){const n=function(t){const{align:e,direction:o,rightToLeft:i}=t,n="below",r={above:"above",below:"below",column:"below","column-reverse":"above",left:"left",right:"right",row:i?"left":"right","row-reverse":i?"right":"left"}[o]||n,s={above:"horizontal",below:"horizontal",left:"vertical",right:"vertical"}[r],a={horizontal:"left",vertical:"top"}[s];return{align:{horizontal:{center:"center",end:i?"left":"right",left:"left",right:"right",start:i?"right":"left",stretch:"stretch"},vertical:{bottom:"bottom",center:"center",end:"bottom",start:"top",stretch:"stretch",top:"top"}}[s][e]||a,direction:r,rightToLeft:i}}(i),r=function(t,e){const o={above:"below",below:"above",left:"right",right:"left"},i={top:"bottom",bottom:"top",left:"right",right:"left"},n=[{align:e,direction:t}];"center"===e||"stretch"===e?n.push({align:e,direction:o[t]}):(n.push({align:i[e],direction:t}),n.push({align:e,direction:o[t]}),n.push({align:i[e],direction:o[t]}));return n}(n.direction,n.align);r.sort(((i,n)=>function(t,e,o,i,n){const r=ho(o,n,t.direction,t.align),s=ho(o,n,e.direction,e.align),a=i.width<=r.width,l=i.height<=r.height,u=a||l,c=a&&l,d=i.width<=s.width,p=i.height<=s.height,h=d||p,f=d&&p,m=r.width*r.height,v=s.width*s.height;return c&&f?0:c?-1:f?1:u&&!h?-1:h&&!u?1:u&&m>v?-1:h&&v>m?1:m>v?-1:v>m?1:0}(i,n,t,e,o)));const s=r[0];return s.rect=function(t,e,o,i,n){const r=fo(t,i,n);let{x:s,y:a,bottom:l,right:u}=o,c=0,d=0,p=e.height,h=e.width;const f="above"===i||"below"===i;switch(i){case"above":d=r.y-e.height,l=r.y;break;case"below":d=r.y,a=r.y;break;case"left":c=r.x-e.width,u=r.x;break;case"right":c=r.x,s=r.x}switch(n){case"bottom":d=r.y-e.height,l=r.y;break;case"left":c=r.x,s=r.x;break;case"center":f?c=r.x-e.width/2:d=r.y-e.height/2;break;case"right":c=r.x-e.width,u=r.x;break;case"stretch":f?(c=r.x,h=t.width):(d=r.y,p=t.height);break;case"top":d=r.y,a=r.y}return c=Math.max(c,s),d=Math.max(d,a),h=Math.min(h,u-c),p=Math.min(p,l-d),new DOMRec