@aurodesignsystem/auro-dialog 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +3 -19
  2. package/README.md +8 -9
  3. package/demo/accessibility.html +42 -0
  4. package/demo/accessibility.js +21 -0
  5. package/demo/accessibility.md +129 -0
  6. package/demo/accessibility.min.js +3969 -0
  7. package/demo/api.html +16 -40
  8. package/demo/api.md +0 -750
  9. package/demo/customize.html +45 -0
  10. package/demo/{api.js → customize.js} +2 -14
  11. package/demo/customize.md +226 -0
  12. package/demo/customize.min.js +3974 -0
  13. package/demo/demo-nav.css +32 -0
  14. package/demo/design.html +42 -0
  15. package/demo/design.js +23 -0
  16. package/demo/design.md +306 -0
  17. package/demo/design.min.js +4041 -0
  18. package/demo/getting-started.html +38 -0
  19. package/demo/getting-started.md +295 -0
  20. package/demo/index.html +17 -36
  21. package/demo/index.js +2 -3
  22. package/demo/index.md +220 -144
  23. package/demo/index.min.js +3984 -7
  24. package/demo/keyboard-behavior.html +38 -0
  25. package/demo/keyboard-behavior.md +51 -0
  26. package/demo/pages.json +1 -0
  27. package/demo/readme.html +42 -0
  28. package/demo/readme.js +24 -0
  29. package/demo/readme.md +176 -0
  30. package/demo/{auro-dialog.min.js → readme.min.js} +434 -281
  31. package/demo/support/demo-support.js +140 -0
  32. package/demo/voiceover.html +38 -0
  33. package/demo/voiceover.md +19 -0
  34. package/demo/why-dialog.html +38 -0
  35. package/demo/why-dialog.md +36 -0
  36. package/dist/{auro-dialog-CWkXz5VA.js → auro-dialog-T9I85UZL.js} +20 -20
  37. package/dist/index.d.ts +198 -98
  38. package/dist/index.js +1 -1
  39. package/dist/registered.js +1 -1
  40. package/package.json +6 -6
  41. package/demo/api.min.js +0 -219
@@ -1,28 +1,3 @@
1
- function initBasicExample() {
2
- if (initBasicExample._initialized) {
3
- return;
4
- }
5
- const buttons = [
6
- document.querySelector("#openBasic"),
7
- document.querySelector("#closeBasic"),
8
- ];
9
- const dialog = document.querySelector("#defaultDialog");
10
- if (!buttons[0] || !buttons[1] || !dialog) {
11
- return;
12
- }
13
- initBasicExample._initialized = true;
14
-
15
- buttons.forEach((button) => {
16
- button.addEventListener("click", () => {
17
- if (dialog.hasAttribute("open")) {
18
- dialog.removeAttribute("open");
19
- } else {
20
- dialog.setAttribute("open", true);
21
- }
22
- });
23
- });
24
- }
25
-
26
1
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
27
2
  // See LICENSE in the project root for license information.
28
3
 
@@ -111,26 +86,26 @@ class AuroLibraryRuntimeUtils {
111
86
  * Copyright 2019 Google LLC
112
87
  * SPDX-License-Identifier: BSD-3-Clause
113
88
  */
114
- const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$3("string"==typeof t?t:t+"",void 0,s$3),i$5=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$3(o,t,s$3)},S$2=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
89
+ const t$2=globalThis,e$4=t$2.ShadowRoot&&(void 0===t$2.ShadyCSS||t$2.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$4&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$3("string"==typeof t?t:t+"",void 0,s$3),i$5=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$3)},S$2=(s,o)=>{if(e$4)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$2.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$4?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
115
90
 
116
91
  /**
117
92
  * @license
118
93
  * Copyright 2017 Google LLC
119
94
  * SPDX-License-Identifier: BSD-3-Clause
120
- */const{is:i$4,defineProperty:e$3,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$2=globalThis,c$2=a$2.trustedTypes,l$3=c$2?c$2.emptyScript:"",p$3=a$2.reactiveElementPolyfillSupport,d$2=(t,s)=>t,u$4={toAttribute(t,s){switch(s){case Boolean:t=t?l$3:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$3=(t,s)=>!i$4(t,s),b$1={attribute:true,type:String,converter:u$4,reflect:false,useDefault:false,hasChanged:f$3};Symbol.metadata??=Symbol("metadata"),a$2.litPropertyMetadata??=new WeakMap;let y$3 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$2("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$2("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$2("properties"))){const t=this.properties,s=[...r$1(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$2(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$4).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$4;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$3)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$3.elementStyles=[],y$3.shadowRootOptions={mode:"open"},y$3[d$2("elementProperties")]=new Map,y$3[d$2("finalized")]=new Map,p$3?.({ReactiveElement:y$3}),(a$2.reactiveElementVersions??=[]).push("2.1.1");
95
+ */const{is:i$4,defineProperty:e$3,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$2=globalThis,c$2=a$2.trustedTypes,l$3=c$2?c$2.emptyScript:"",p$3=a$2.reactiveElementPolyfillSupport,d$2=(t,s)=>t,u$4={toAttribute(t,s){switch(s){case Boolean:t=t?l$3:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$3=(t,s)=>!i$4(t,s),b$2={attribute:true,type:String,converter:u$4,reflect:false,useDefault:false,hasChanged:f$3};Symbol.metadata??=Symbol("metadata"),a$2.litPropertyMetadata??=new WeakMap;let y$3 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$2){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$3(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$2}static _$Ei(){if(this.hasOwnProperty(d$2("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$2("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$2("properties"))){const t=this.properties,s=[...r$1(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$2(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$4).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$4;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$3)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$3.elementStyles=[],y$3.shadowRootOptions={mode:"open"},y$3[d$2("elementProperties")]=new Map,y$3[d$2("finalized")]=new Map,p$3?.({ReactiveElement:y$3}),(a$2.reactiveElementVersions??=[]).push("2.1.2");
121
96
 
122
97
  /**
123
98
  * @license
124
99
  * Copyright 2017 Google LLC
125
100
  * SPDX-License-Identifier: BSD-3-Clause
126
101
  */
127
- const t$1=globalThis,i$3=t$1.trustedTypes,s$2=i$3?i$3.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$2="$lit$",h$1=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h$1,n$1=`<${o$3}>`,r=document,l$2=()=>r.createComment(""),c$1=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$1=Array.isArray,u$3=t=>a$1(t)||"function"==typeof t?.[Symbol.iterator],d$1="[ \t\n\f\r]",f$2=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v$1=/-->/g,_$1=/>/g,m$2=RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$2=/'/g,g$2=/"/g,$=/^(?:script|style|textarea|title)$/i,y$2=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x$1=y$2(1),T$1=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A$1=new WeakMap,C$1=r.createTreeWalker(r,129);function P(t,i){if(!a$1(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$2?s$2.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f$2;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f$2?"!--"===u[1]?c=v$1:void 0!==u[1]?c=_$1:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m$2):void 0!==u[3]&&(c=m$2):c===m$2?">"===u[0]?(c=r??f$2,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m$2:'"'===u[3]?g$2:p$2):c===g$2||c===p$2?c=m$2:c===v$1||c===_$1?c=f$2:(c=m$2,r=void 0);const x=c===m$2&&t[i+1].startsWith("/>")?" ":"";l+=c===f$2?s+n$1:d>=0?(o.push(a),s.slice(0,d)+e$2+s.slice(d)+h$1+x):s+h$1+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};let N$1 = class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C$1.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C$1.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$2)){const i=v[a++],s=r.getAttribute(t).split(h$1),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H$1:"?"===e[1]?I:"@"===e[1]?L:k$2}),r.removeAttribute(t);}else t.startsWith(h$1)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h$1),s=t.length-1;if(s>0){r.textContent=i$3?i$3.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$2()),C$1.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$2());}}}else if(8===r.nodeType)if(r.data===o$3)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h$1,t+1));)d.push({type:7,index:c}),t+=h$1.length-1;}c++;}}static createElement(t,i){const s=r.createElement("template");return s.innerHTML=t,s}};function S$1(t,i,s=t,e){if(i===T$1)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c$1(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S$1(t,h._$AS(t,i.values),h,e)),i}let M$2 = class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r).importNode(i,true);C$1.currentNode=e;let h=C$1.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R$1(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z$2(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C$1.nextNode(),o++);}return C$1.currentNode=r,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}};let R$1 = class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S$1(this,t,i),c$1(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T$1&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u$3(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c$1(this._$AH)?this._$AA.nextSibling.data=t:this.T(r.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N$1.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M$2(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A$1.get(t.strings);return void 0===i&&A$1.set(t.strings,i=new N$1(t)),i}k(t){a$1(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l$2()),this.O(l$2()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(false,true,i);t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}};let k$2 = class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S$1(this,t,i,0),o=!c$1(t)||t!==this._$AH&&t!==T$1,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S$1(this,e[s+n],i,n),r===T$1&&(r=this._$AH[n]),o||=!c$1(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}};let H$1 = class H extends k$2{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}};class I extends k$2{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k$2{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S$1(this,t,i,0)??E)===T$1)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}let z$2 = class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S$1(this,t);}};const j=t$1.litHtmlPolyfillSupport;j?.(N$1,R$1),(t$1.litHtmlVersions??=[]).push("3.3.1");const B$1=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R$1(i.insertBefore(l$2(),t),t,void 0,s??{});}return h._$AI(t),h};
102
+ const t$1=globalThis,i$3=t=>t,s$2=t$1.trustedTypes,e$2=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$3=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$3,r=`<${n$1}>`,l$2=document,c$1=()=>l$2.createComment(""),a$1=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$3=Array.isArray,d$1=t=>u$3(t)||"function"==typeof t?.[Symbol.iterator],f$2="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_$1=/-->/g,m$2=/>/g,p$2=RegExp(`>|${f$2}(?:([^\\s"'>=/]+)(${f$2}*=${f$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g$2=/'/g,$=/"/g,y$2=/^(?:script|style|textarea|title)$/i,x$1=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b$1=x$1(1),E=Symbol.for("lit-noChange"),A$1=Symbol.for("lit-nothing"),C$1=new WeakMap,P=l$2.createTreeWalker(l$2,129);function V(t,i){if(!u$3(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$2?e$2.createHTML(i):i}const N$1=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_$1:void 0!==u[1]?c=m$2:void 0!==u[2]?(y$2.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$2):void 0!==u[3]&&(c=p$2):c===p$2?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$2:'"'===u[3]?$:g$2):c===$||c===g$2?c=p$2:c===_$1||c===m$2?c=v$1:(c=p$2,n=void 0);const x=c===p$2&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$3+x):s+o$3+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};let S$1 = class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N$1(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$3),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z$2:H$1}),r.removeAttribute(t);}else t.startsWith(o$3)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y$2.test(r.tagName)){const t=r.textContent.split(o$3),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$3,t+1));)d.push({type:7,index:l}),t+=o$3.length-1;}l++;}}static createElement(t,i){const s=l$2.createElement("template");return s.innerHTML=t,s}};function M$2(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a$1(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$2(t,h._$AS(t,i.values),h,e)),i}let R$1 = class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l$2).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k$2(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l$2,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}};let k$2 = class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A$1,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$2(this,t,i),a$1(t)?t===A$1||null==t||""===t?(this._$AH!==A$1&&this._$AR(),this._$AH=A$1):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d$1(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A$1&&a$1(this._$AH)?this._$AA.nextSibling.data=t:this.T(l$2.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S$1.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R$1(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C$1.get(t.strings);return void 0===i&&C$1.set(t.strings,i=new S$1(t)),i}k(t){u$3(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$3(t).nextSibling;i$3(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}};let H$1 = class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A$1,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A$1;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$2(this,t,i,0),o=!a$1(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$2(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a$1(r)||r!==this._$AH[n],r===A$1?t=A$1:t!==A$1&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A$1?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}};class I extends H$1{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A$1?void 0:t;}}class L extends H$1{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A$1);}}let z$2 = class z extends H$1{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$2(this,t,i,0)??A$1)===E)return;const s=this._$AH,e=t===A$1&&s!==A$1||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A$1&&(s===A$1||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}};class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$2(this,t);}}const B$1=t$1.litHtmlPolyfillSupport;B$1?.(S$1,k$2),(t$1.litHtmlVersions??=[]).push("3.3.3");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k$2(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
128
103
 
129
104
  /**
130
105
  * @license
131
106
  * Copyright 2017 Google LLC
132
107
  * SPDX-License-Identifier: BSD-3-Clause
133
- */const s$1=globalThis;let i$2 = class i extends y$3{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B$1(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T$1}};i$2._$litElement$=true,i$2["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$2});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i$2});(s$1.litElementVersions??=[]).push("4.2.1");
108
+ */const s$1=globalThis;let i$2 = class i extends y$3{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$2._$litElement$=true,i$2["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$2});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i$2});(s$1.litElementVersions??=[]).push("4.2.2");
134
109
 
135
110
  /**
136
111
  * @license
@@ -143,20 +118,20 @@ const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = cl
143
118
  * @license
144
119
  * Copyright 2018 Google LLC
145
120
  * SPDX-License-Identifier: BSD-3-Clause
146
- */const e=e$1(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return T$1}});
121
+ */const e=e$1(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
147
122
 
148
123
  /**
149
124
  * @license
150
125
  * Copyright 2018 Google LLC
151
126
  * SPDX-License-Identifier: BSD-3-Clause
152
- */const o$1=o=>o??E;
127
+ */const o$1=o=>o??A$1;
153
128
 
154
129
  /**
155
130
  * @license
156
131
  * Copyright 2020 Google LLC
157
132
  * SPDX-License-Identifier: BSD-3-Clause
158
133
  */
159
- const a=Symbol.for(""),o=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(t,...r)=>({_$litStatic$:r.reduce(((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1]),t[0]),r:a}),l$1=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l$1.get(t))&&(n.raw=n,l$1.set(t,r=n)),e=u;}return t(r,...e)},u$2=n(x$1);
134
+ const a=Symbol.for(""),o=t=>{if(t?.r===a)return t?._$litStatic$},s=t=>({_$litStatic$:t,r:a}),i=(t,...r)=>({_$litStatic$:r.reduce((r,e,a)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[a+1],t[0]),r:a}),l$1=new Map,n=t=>(r,...e)=>{const a=e.length;let s,i;const n=[],u=[];let c,$=0,f=false;for(;$<a;){for(c=r[$];$<a&&void 0!==(i=e[$],s=o(i));)c+=s+r[++$],f=true;$!==a&&u.push(i),n.push(c),$++;}if($===a&&n.push(r[a]),f){const t=n.join("$$lit$$");void 0===(r=l$1.get(t))&&(n.raw=n,l$1.set(t,r=n)),e=u;}return t(r,...e)},u$2=n(b$1);
160
135
 
161
136
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
162
137
  // See LICENSE in the project root for license information.
@@ -595,10 +570,6 @@ const oppositeSideMap = {
595
570
  bottom: 'top',
596
571
  top: 'bottom'
597
572
  };
598
- const oppositeAlignmentMap = {
599
- start: 'end',
600
- end: 'start'
601
- };
602
573
  function clamp(start, value, end) {
603
574
  return max(start, min(value, end));
604
575
  }
@@ -617,9 +588,9 @@ function getOppositeAxis(axis) {
617
588
  function getAxisLength(axis) {
618
589
  return axis === 'y' ? 'height' : 'width';
619
590
  }
620
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
621
591
  function getSideAxis(placement) {
622
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
592
+ const firstChar = placement[0];
593
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
623
594
  }
624
595
  function getAlignmentAxis(placement) {
625
596
  return getOppositeAxis(getSideAxis(placement));
@@ -642,7 +613,7 @@ function getExpandedPlacements(placement) {
642
613
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
643
614
  }
644
615
  function getOppositeAlignmentPlacement(placement) {
645
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
616
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
646
617
  }
647
618
  const lrPlacement = ['left', 'right'];
648
619
  const rlPlacement = ['right', 'left'];
@@ -673,15 +644,16 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
673
644
  return list;
674
645
  }
675
646
  function getOppositePlacement(placement) {
676
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
647
+ const side = getSide(placement);
648
+ return oppositeSideMap[side] + placement.slice(side.length);
677
649
  }
678
650
  function expandPaddingObject(padding) {
651
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
679
652
  return {
680
- top: 0,
681
- right: 0,
682
- bottom: 0,
683
- left: 0,
684
- ...padding
653
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
654
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
655
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
656
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
685
657
  };
686
658
  }
687
659
  function getPaddingObject(padding) {
@@ -756,17 +728,78 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
756
728
  y: reference.y
757
729
  };
758
730
  }
759
- switch (getAlignment(placement)) {
760
- case 'start':
761
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
762
- break;
763
- case 'end':
764
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
765
- break;
731
+ const alignment = getAlignment(placement);
732
+ if (alignment) {
733
+ coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);
766
734
  }
767
735
  return coords;
768
736
  }
769
737
 
738
+ /**
739
+ * Resolves with an object of overflow side offsets that determine how much the
740
+ * element is overflowing a given clipping boundary on each side.
741
+ * - positive = overflowing the boundary by that number of pixels
742
+ * - negative = how many pixels left before it will overflow
743
+ * - 0 = lies flush with the boundary
744
+ * @see https://floating-ui.com/docs/detectOverflow
745
+ */
746
+ async function detectOverflow(state, options) {
747
+ var _await$platform$isEle;
748
+ if (options === void 0) {
749
+ options = {};
750
+ }
751
+ const {
752
+ x,
753
+ y,
754
+ platform,
755
+ rects,
756
+ elements,
757
+ strategy
758
+ } = state;
759
+ const {
760
+ boundary = 'clippingAncestors',
761
+ rootBoundary = 'viewport',
762
+ elementContext = 'floating',
763
+ altBoundary = false,
764
+ padding = 0
765
+ } = evaluate(options, state);
766
+ const paddingObject = getPaddingObject(padding);
767
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
768
+ const element = elements[altBoundary ? altContext : elementContext];
769
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
770
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
771
+ boundary,
772
+ rootBoundary,
773
+ strategy
774
+ }));
775
+ const rect = elementContext === 'floating' ? {
776
+ x,
777
+ y,
778
+ width: rects.floating.width,
779
+ height: rects.floating.height
780
+ } : rects.reference;
781
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
782
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
783
+ x: 1,
784
+ y: 1
785
+ };
786
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
787
+ elements,
788
+ rect,
789
+ offsetParent,
790
+ strategy
791
+ }) : rect);
792
+ return {
793
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
794
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
795
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
796
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
797
+ };
798
+ }
799
+
800
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
801
+ const MAX_RESET_COUNT = 50;
802
+
770
803
  /**
771
804
  * Computes the `x` and `y` coordinates that will place the floating element
772
805
  * next to a given reference element.
@@ -781,7 +814,10 @@ const computePosition$1 = async (reference, floating, config) => {
781
814
  middleware = [],
782
815
  platform
783
816
  } = config;
784
- const validMiddleware = middleware.filter(Boolean);
817
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
818
+ ...platform,
819
+ detectOverflow
820
+ };
785
821
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
786
822
  let rects = await platform.getElementRects({
787
823
  reference,
@@ -793,13 +829,17 @@ const computePosition$1 = async (reference, floating, config) => {
793
829
  y
794
830
  } = computeCoordsFromPlacement(rects, placement, rtl);
795
831
  let statefulPlacement = placement;
796
- let middlewareData = {};
797
832
  let resetCount = 0;
798
- for (let i = 0; i < validMiddleware.length; i++) {
833
+ const middlewareData = {};
834
+ for (let i = 0; i < middleware.length; i++) {
835
+ const currentMiddleware = middleware[i];
836
+ if (!currentMiddleware) {
837
+ continue;
838
+ }
799
839
  const {
800
840
  name,
801
841
  fn
802
- } = validMiddleware[i];
842
+ } = currentMiddleware;
803
843
  const {
804
844
  x: nextX,
805
845
  y: nextY,
@@ -813,7 +853,7 @@ const computePosition$1 = async (reference, floating, config) => {
813
853
  strategy,
814
854
  middlewareData,
815
855
  rects,
816
- platform,
856
+ platform: platformWithDetectOverflow,
817
857
  elements: {
818
858
  reference,
819
859
  floating
@@ -821,14 +861,11 @@ const computePosition$1 = async (reference, floating, config) => {
821
861
  });
822
862
  x = nextX != null ? nextX : x;
823
863
  y = nextY != null ? nextY : y;
824
- middlewareData = {
825
- ...middlewareData,
826
- [name]: {
827
- ...middlewareData[name],
828
- ...data
829
- }
864
+ middlewareData[name] = {
865
+ ...middlewareData[name],
866
+ ...data
830
867
  };
831
- if (reset && resetCount <= 50) {
868
+ if (reset && resetCount < MAX_RESET_COUNT) {
832
869
  resetCount++;
833
870
  if (typeof reset === 'object') {
834
871
  if (reset.placement) {
@@ -858,71 +895,6 @@ const computePosition$1 = async (reference, floating, config) => {
858
895
  };
859
896
  };
860
897
 
861
- /**
862
- * Resolves with an object of overflow side offsets that determine how much the
863
- * element is overflowing a given clipping boundary on each side.
864
- * - positive = overflowing the boundary by that number of pixels
865
- * - negative = how many pixels left before it will overflow
866
- * - 0 = lies flush with the boundary
867
- * @see https://floating-ui.com/docs/detectOverflow
868
- */
869
- async function detectOverflow(state, options) {
870
- var _await$platform$isEle;
871
- if (options === void 0) {
872
- options = {};
873
- }
874
- const {
875
- x,
876
- y,
877
- platform,
878
- rects,
879
- elements,
880
- strategy
881
- } = state;
882
- const {
883
- boundary = 'clippingAncestors',
884
- rootBoundary = 'viewport',
885
- elementContext = 'floating',
886
- altBoundary = false,
887
- padding = 0
888
- } = evaluate(options, state);
889
- const paddingObject = getPaddingObject(padding);
890
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
891
- const element = elements[altBoundary ? altContext : elementContext];
892
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
893
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
894
- boundary,
895
- rootBoundary,
896
- strategy
897
- }));
898
- const rect = elementContext === 'floating' ? {
899
- x,
900
- y,
901
- width: rects.floating.width,
902
- height: rects.floating.height
903
- } : rects.reference;
904
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
905
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
906
- x: 1,
907
- y: 1
908
- } : {
909
- x: 1,
910
- y: 1
911
- };
912
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
913
- elements,
914
- rect,
915
- offsetParent,
916
- strategy
917
- }) : rect);
918
- return {
919
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
920
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
921
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
922
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
923
- };
924
- }
925
-
926
898
  function getPlacementList(alignment, autoAlignment, allowedPlacements) {
927
899
  const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
928
900
  return allowedPlacementsSortedByAlignment.filter(placement => {
@@ -962,13 +934,11 @@ const autoPlacement$1 = function (options) {
962
934
  ...detectOverflowOptions
963
935
  } = evaluate(options, state);
964
936
  const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
965
- const overflow = await detectOverflow(state, detectOverflowOptions);
966
937
  const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
967
938
  const currentPlacement = placements$1[currentIndex];
968
939
  if (currentPlacement == null) {
969
940
  return {};
970
941
  }
971
- const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
972
942
 
973
943
  // Make `computeCoords` start from the right place.
974
944
  if (placement !== currentPlacement) {
@@ -978,6 +948,8 @@ const autoPlacement$1 = function (options) {
978
948
  }
979
949
  };
980
950
  }
951
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
952
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
981
953
  const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
982
954
  const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
983
955
  placement: currentPlacement,
@@ -1076,7 +1048,7 @@ const flip$1 = function (options) {
1076
1048
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1077
1049
  }
1078
1050
  const placements = [initialPlacement, ...fallbackPlacements];
1079
- const overflow = await detectOverflow(state, detectOverflowOptions);
1051
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
1080
1052
  const overflows = [];
1081
1053
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1082
1054
  if (checkMainAxis) {
@@ -1260,7 +1232,8 @@ const shift$1 = function (options) {
1260
1232
  const {
1261
1233
  x,
1262
1234
  y,
1263
- placement
1235
+ placement,
1236
+ platform
1264
1237
  } = state;
1265
1238
  const {
1266
1239
  mainAxis: checkMainAxis = true,
@@ -1283,24 +1256,17 @@ const shift$1 = function (options) {
1283
1256
  x,
1284
1257
  y
1285
1258
  };
1286
- const overflow = await detectOverflow(state, detectOverflowOptions);
1287
- const crossAxis = getSideAxis(getSide(placement));
1259
+ const overflow = await platform.detectOverflow(state, detectOverflowOptions);
1260
+ const crossAxis = getSideAxis(placement);
1288
1261
  const mainAxis = getOppositeAxis(crossAxis);
1289
1262
  let mainAxisCoord = coords[mainAxis];
1290
1263
  let crossAxisCoord = coords[crossAxis];
1264
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);
1291
1265
  if (checkMainAxis) {
1292
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1293
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1294
- const min = mainAxisCoord + overflow[minSide];
1295
- const max = mainAxisCoord - overflow[maxSide];
1296
- mainAxisCoord = clamp(min, mainAxisCoord, max);
1266
+ mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
1297
1267
  }
1298
1268
  if (checkCrossAxis) {
1299
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1300
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1301
- const min = crossAxisCoord + overflow[minSide];
1302
- const max = crossAxisCoord - overflow[maxSide];
1303
- crossAxisCoord = clamp(min, crossAxisCoord, max);
1269
+ crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
1304
1270
  }
1305
1271
  const limitedCoords = limiter.fn({
1306
1272
  ...state,
@@ -1366,7 +1332,6 @@ function isShadowRoot(value) {
1366
1332
  }
1367
1333
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1368
1334
  }
1369
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
1370
1335
  function isOverflowElement(element) {
1371
1336
  const {
1372
1337
  overflow,
@@ -1374,32 +1339,35 @@ function isOverflowElement(element) {
1374
1339
  overflowY,
1375
1340
  display
1376
1341
  } = getComputedStyle$1(element);
1377
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1342
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
1378
1343
  }
1379
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
1380
1344
  function isTableElement(element) {
1381
- return tableElements.has(getNodeName(element));
1345
+ return /^(table|td|th)$/.test(getNodeName(element));
1382
1346
  }
1383
- const topLayerSelectors = [':popover-open', ':modal'];
1384
1347
  function isTopLayer(element) {
1385
- return topLayerSelectors.some(selector => {
1386
- try {
1387
- return element.matches(selector);
1388
- } catch (_e) {
1389
- return false;
1348
+ try {
1349
+ if (element.matches(':popover-open')) {
1350
+ return true;
1390
1351
  }
1391
- });
1352
+ } catch (_e) {
1353
+ // no-op
1354
+ }
1355
+ try {
1356
+ return element.matches(':modal');
1357
+ } catch (_e) {
1358
+ return false;
1359
+ }
1392
1360
  }
1393
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
1394
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
1395
- const containValues = ['paint', 'layout', 'strict', 'content'];
1361
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1362
+ const containRe = /paint|layout|strict|content/;
1363
+ const isNotNone = value => !!value && value !== 'none';
1364
+ let isWebKitValue;
1396
1365
  function isContainingBlock(elementOrCss) {
1397
- const webkit = isWebKit();
1398
1366
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1399
1367
 
1400
1368
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1401
1369
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1402
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
1370
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
1403
1371
  }
1404
1372
  function getContainingBlock(element) {
1405
1373
  let currentNode = getParentNode(element);
@@ -1414,12 +1382,13 @@ function getContainingBlock(element) {
1414
1382
  return null;
1415
1383
  }
1416
1384
  function isWebKit() {
1417
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1418
- return CSS.supports('-webkit-backdrop-filter', 'none');
1385
+ if (isWebKitValue == null) {
1386
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
1387
+ }
1388
+ return isWebKitValue;
1419
1389
  }
1420
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
1421
1390
  function isLastTraversableNode(node) {
1422
- return lastTraversableNodeNames.has(getNodeName(node));
1391
+ return /^(html|body|#document)$/.test(getNodeName(node));
1423
1392
  }
1424
1393
  function getComputedStyle$1(element) {
1425
1394
  return getWindow(element).getComputedStyle(element);
@@ -1454,7 +1423,7 @@ function getParentNode(node) {
1454
1423
  function getNearestOverflowAncestor(node) {
1455
1424
  const parentNode = getParentNode(node);
1456
1425
  if (isLastTraversableNode(parentNode)) {
1457
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1426
+ return (node.ownerDocument || node).body;
1458
1427
  }
1459
1428
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1460
1429
  return parentNode;
@@ -1475,8 +1444,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
1475
1444
  if (isBody) {
1476
1445
  const frameElement = getFrameElement(win);
1477
1446
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1447
+ } else {
1448
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1478
1449
  }
1479
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1480
1450
  }
1481
1451
  function getFrameElement(win) {
1482
1452
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -1550,10 +1520,7 @@ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1550
1520
  if (isFixed === void 0) {
1551
1521
  isFixed = false;
1552
1522
  }
1553
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1554
- return false;
1555
- }
1556
- return isFixed;
1523
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
1557
1524
  }
1558
1525
 
1559
1526
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
@@ -1580,12 +1547,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1580
1547
  let y = (clientRect.top + visualOffsets.y) / scale.y;
1581
1548
  let width = clientRect.width / scale.x;
1582
1549
  let height = clientRect.height / scale.y;
1583
- if (domElement) {
1550
+ if (domElement && offsetParent) {
1584
1551
  const win = getWindow(domElement);
1585
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1552
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1586
1553
  let currentWin = win;
1587
1554
  let currentIFrame = getFrameElement(currentWin);
1588
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1555
+ while (currentIFrame && offsetWin !== currentWin) {
1589
1556
  const iframeScale = getScale(currentIFrame);
1590
1557
  const iframeRect = currentIFrame.getBoundingClientRect();
1591
1558
  const css = getComputedStyle$1(currentIFrame);
@@ -1649,11 +1616,11 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1649
1616
  let scale = createCoords(1);
1650
1617
  const offsets = createCoords(0);
1651
1618
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1652
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1619
+ if (isOffsetParentAnElement || !isFixed) {
1653
1620
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1654
1621
  scroll = getNodeScroll(offsetParent);
1655
1622
  }
1656
- if (isHTMLElement(offsetParent)) {
1623
+ if (isOffsetParentAnElement) {
1657
1624
  const offsetRect = getBoundingClientRect(offsetParent);
1658
1625
  scale = getScale(offsetParent);
1659
1626
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -1670,18 +1637,17 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1670
1637
  }
1671
1638
 
1672
1639
  function getClientRects(element) {
1673
- return Array.from(element.getClientRects());
1640
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
1674
1641
  }
1675
1642
 
1676
1643
  // Gets the entire size of the scrollable document area, even extending outside
1677
1644
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1678
- function getDocumentRect(element) {
1679
- const html = getDocumentElement(element);
1680
- const scroll = getNodeScroll(element);
1681
- const body = element.ownerDocument.body;
1645
+ function getDocumentRect(html) {
1646
+ const scroll = getNodeScroll(html);
1647
+ const body = html.ownerDocument.body;
1682
1648
  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1683
1649
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1684
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1650
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
1685
1651
  const y = -scroll.scrollTop;
1686
1652
  if (getComputedStyle$1(body).direction === 'rtl') {
1687
1653
  x += max(html.clientWidth, body.clientWidth) - width;
@@ -1698,7 +1664,11 @@ function getDocumentRect(element) {
1698
1664
  // calculation is affected by unusual styles.
1699
1665
  // Most scrollbars leave 15-18px of space.
1700
1666
  const SCROLLBAR_MAX = 25;
1701
- function getViewportRect(element, strategy) {
1667
+ function getViewportRect(element, strategy, rootBoundary) {
1668
+ if (rootBoundary === void 0) {
1669
+ rootBoundary = 'viewport';
1670
+ }
1671
+ const isLayoutViewport = rootBoundary === 'layoutViewport';
1702
1672
  const win = getWindow(element);
1703
1673
  const html = getDocumentElement(element);
1704
1674
  const visualViewport = win.visualViewport;
@@ -1707,31 +1677,42 @@ function getViewportRect(element, strategy) {
1707
1677
  let x = 0;
1708
1678
  let y = 0;
1709
1679
  if (visualViewport) {
1710
- width = visualViewport.width;
1711
- height = visualViewport.height;
1712
- const visualViewportBased = isWebKit();
1713
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1714
- x = visualViewport.offsetLeft;
1715
- y = visualViewport.offsetTop;
1680
+ // Client coordinates are relative to the layout viewport, except in
1681
+ // WebKit with an `absolute` strategy, where they are relative to the
1682
+ // visual viewport.
1683
+ const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';
1684
+ if (isLayoutViewport) {
1685
+ if (!layoutRelativeClientCoords) {
1686
+ x = -visualViewport.offsetLeft;
1687
+ y = -visualViewport.offsetTop;
1688
+ }
1689
+ } else {
1690
+ width = visualViewport.width;
1691
+ height = visualViewport.height;
1692
+ if (layoutRelativeClientCoords) {
1693
+ x = visualViewport.offsetLeft;
1694
+ y = visualViewport.offsetTop;
1695
+ }
1716
1696
  }
1717
1697
  }
1718
1698
  const windowScrollbarX = getWindowScrollBarX(html);
1719
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1720
- // visual width of the <html> but this is not considered in the size
1721
- // of `html.clientWidth`.
1699
+ // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks
1700
+ // the visual width but isn't reflected in `html.clientWidth`, so subtract it.
1701
+ // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also
1702
+ // reserves an empty inline-start gutter that clips nothing, so exclude just
1703
+ // the one scrollbar-side gutter — halve the measured (two-gutter) total. A
1704
+ // left-side scrollbar (`windowScrollbarX > 0`) is already handled by
1705
+ // `getHTMLOffset`/`visualViewport.width`; skip it here.
1722
1706
  if (windowScrollbarX <= 0) {
1723
1707
  const doc = html.ownerDocument;
1724
1708
  const body = doc.body;
1725
1709
  const bodyStyles = getComputedStyle(body);
1726
1710
  const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1727
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1728
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1729
- width -= clippingStableScrollbarWidth;
1711
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1712
+ const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;
1713
+ if (gutter <= SCROLLBAR_MAX) {
1714
+ width -= gutter;
1730
1715
  }
1731
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1732
- // If the <body> scrollbar is on the left, the width needs to be extended
1733
- // by the scrollbar amount so there isn't extra space on the right.
1734
- width += windowScrollbarX;
1735
1716
  }
1736
1717
  return {
1737
1718
  width,
@@ -1741,13 +1722,12 @@ function getViewportRect(element, strategy) {
1741
1722
  };
1742
1723
  }
1743
1724
 
1744
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1745
1725
  // Returns the inner client rect, subtracting scrollbars if present.
1746
1726
  function getInnerBoundingClientRect(element, strategy) {
1747
1727
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1748
1728
  const top = clientRect.top + element.clientTop;
1749
1729
  const left = clientRect.left + element.clientLeft;
1750
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1730
+ const scale = getScale(element);
1751
1731
  const width = element.clientWidth * scale.x;
1752
1732
  const height = element.clientHeight * scale.y;
1753
1733
  const x = left * scale.x;
@@ -1761,8 +1741,8 @@ function getInnerBoundingClientRect(element, strategy) {
1761
1741
  }
1762
1742
  function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1763
1743
  let rect;
1764
- if (clippingAncestor === 'viewport') {
1765
- rect = getViewportRect(element, strategy);
1744
+ if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {
1745
+ rect = getViewportRect(element, strategy, clippingAncestor);
1766
1746
  } else if (clippingAncestor === 'document') {
1767
1747
  rect = getDocumentRect(getDocumentElement(element));
1768
1748
  } else if (isElement(clippingAncestor)) {
@@ -1778,13 +1758,6 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
1778
1758
  }
1779
1759
  return rectToClientRect(rect);
1780
1760
  }
1781
- function hasFixedPositionAncestor(element, stopNode) {
1782
- const parentNode = getParentNode(element);
1783
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1784
- return false;
1785
- }
1786
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1787
- }
1788
1761
 
1789
1762
  // A "clipping ancestor" is an `overflow` element with the characteristic of
1790
1763
  // clipping (or hiding) child elements. This returns all clipping ancestors
@@ -1795,7 +1768,7 @@ function getClippingElementAncestors(element, cache) {
1795
1768
  return cachedResult;
1796
1769
  }
1797
1770
  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1798
- let currentContainingBlockComputedStyle = null;
1771
+ let lastKeptComputedStyle = null;
1799
1772
  const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1800
1773
  let currentNode = elementIsFixed ? getParentNode(element) : element;
1801
1774
 
@@ -1803,16 +1776,20 @@ function getClippingElementAncestors(element, cache) {
1803
1776
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1804
1777
  const computedStyle = getComputedStyle$1(currentNode);
1805
1778
  const currentNodeIsContaining = isContainingBlock(currentNode);
1806
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1807
- currentContainingBlockComputedStyle = null;
1808
- }
1809
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1779
+ // Position of the containing block chain below the current node. A fixed
1780
+ // element whose containing block hasn't been found yet is a fixed chain.
1781
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';
1782
+
1783
+ // A non-containing ancestor does not clip the element when the chain
1784
+ // below it escapes it: a fixed chain escapes all ancestors up to the
1785
+ // next containing block, an absolute chain escapes static ancestors.
1786
+ const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');
1810
1787
  if (shouldDropCurrentNode) {
1811
1788
  // Drop non-containing blocks.
1812
1789
  result = result.filter(ancestor => ancestor !== currentNode);
1813
1790
  } else {
1814
- // Record last containing block for next iteration.
1815
- currentContainingBlockComputedStyle = computedStyle;
1791
+ // The kept node carries the chain position for the next iteration.
1792
+ lastKeptComputedStyle = computedStyle;
1816
1793
  }
1817
1794
  currentNode = getParentNode(currentNode);
1818
1795
  }
@@ -1831,20 +1808,23 @@ function getClippingRect(_ref) {
1831
1808
  } = _ref;
1832
1809
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1833
1810
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1834
- const firstClippingAncestor = clippingAncestors[0];
1835
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1836
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1837
- accRect.top = max(rect.top, accRect.top);
1838
- accRect.right = min(rect.right, accRect.right);
1839
- accRect.bottom = min(rect.bottom, accRect.bottom);
1840
- accRect.left = max(rect.left, accRect.left);
1841
- return accRect;
1842
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1811
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1812
+ let top = firstRect.top;
1813
+ let right = firstRect.right;
1814
+ let bottom = firstRect.bottom;
1815
+ let left = firstRect.left;
1816
+ for (let i = 1; i < clippingAncestors.length; i++) {
1817
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1818
+ top = max(rect.top, top);
1819
+ right = min(rect.right, right);
1820
+ bottom = min(rect.bottom, bottom);
1821
+ left = max(rect.left, left);
1822
+ }
1843
1823
  return {
1844
- width: clippingRect.right - clippingRect.left,
1845
- height: clippingRect.bottom - clippingRect.top,
1846
- x: clippingRect.left,
1847
- y: clippingRect.top
1824
+ width: right - left,
1825
+ height: bottom - top,
1826
+ x: left,
1827
+ y: top
1848
1828
  };
1849
1829
  }
1850
1830
 
@@ -1869,13 +1849,7 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1869
1849
  scrollTop: 0
1870
1850
  };
1871
1851
  const offsets = createCoords(0);
1872
-
1873
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1874
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1875
- function setLeftRTLScrollbarOffset() {
1876
- offsets.x = getWindowScrollBarX(documentElement);
1877
- }
1878
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1852
+ if (isOffsetParentAnElement || !isFixed) {
1879
1853
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1880
1854
  scroll = getNodeScroll(offsetParent);
1881
1855
  }
@@ -1883,12 +1857,13 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1883
1857
  const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1884
1858
  offsets.x = offsetRect.x + offsetParent.clientLeft;
1885
1859
  offsets.y = offsetRect.y + offsetParent.clientTop;
1886
- } else if (documentElement) {
1887
- setLeftRTLScrollbarOffset();
1888
1860
  }
1889
1861
  }
1890
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1891
- setLeftRTLScrollbarOffset();
1862
+
1863
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1864
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1865
+ if (!isOffsetParentAnElement && documentElement) {
1866
+ offsets.x = getWindowScrollBarX(documentElement);
1892
1867
  }
1893
1868
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1894
1869
  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
@@ -1988,7 +1963,7 @@ function rectsAreEqual(a, b) {
1988
1963
  }
1989
1964
 
1990
1965
  // https://samthor.au/2021/observing-dom/
1991
- function observeMove(element, onMove) {
1966
+ function observeMove(element, onMove, ancestorResize) {
1992
1967
  let io = null;
1993
1968
  let timeoutId;
1994
1969
  const root = getDocumentElement(element);
@@ -2031,13 +2006,22 @@ function observeMove(element, onMove) {
2031
2006
  let isFirstUpdate = true;
2032
2007
  function handleObserve(entries) {
2033
2008
  const ratio = entries[0].intersectionRatio;
2009
+
2010
+ // The entry is a snapshot, so the reference may have moved since the
2011
+ // intersection was computed (under performance constraints, or between
2012
+ // consecutive frames of a multi-frame layout shift). The reported ratio
2013
+ // and the observed area are stale in that case and cannot be trusted to
2014
+ // detect subsequent movement, so refresh regardless of the ratio.
2015
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
2016
+ return refresh();
2017
+ }
2034
2018
  if (ratio !== threshold) {
2035
2019
  if (!isFirstUpdate) {
2036
2020
  return refresh();
2037
2021
  }
2038
2022
  if (!ratio) {
2039
- // If the reference is clipped, the ratio is 0. Throttle the refresh
2040
- // to prevent an infinite loop of updates.
2023
+ // If the reference is clipped in place, the ratio is 0. Throttle
2024
+ // the refresh to prevent an infinite loop of updates.
2041
2025
  timeoutId = setTimeout(() => {
2042
2026
  refresh(false, 1e-7);
2043
2027
  }, 1000);
@@ -2045,16 +2029,6 @@ function observeMove(element, onMove) {
2045
2029
  refresh(false, ratio);
2046
2030
  }
2047
2031
  }
2048
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
2049
- // It's possible that even though the ratio is reported as 1, the
2050
- // element is not actually fully within the IntersectionObserver's root
2051
- // area anymore. This can happen under performance constraints. This may
2052
- // be a bug in the browser's IntersectionObserver implementation. To
2053
- // work around this, we compare the element's bounding rect now with
2054
- // what it was at the time we created the IntersectionObserver. If they
2055
- // are not equal then the element moved, so we refresh.
2056
- refresh();
2057
- }
2058
2032
  isFirstUpdate = false;
2059
2033
  }
2060
2034
 
@@ -2071,8 +2045,18 @@ function observeMove(element, onMove) {
2071
2045
  }
2072
2046
  io.observe(element);
2073
2047
  }
2048
+ const win = getWindow(element);
2049
+ // The window is a resize ancestor, so when `ancestorResize` is enabled its
2050
+ // listener already runs the update on resize. Here we only need to rebuild
2051
+ // the `IntersectionObserver` for the new root size, skipping a redundant
2052
+ // update. When `ancestorResize` is disabled, this becomes the sole update.
2053
+ const handleResize = () => refresh(ancestorResize);
2054
+ win.addEventListener('resize', handleResize);
2074
2055
  refresh(true);
2075
- return cleanup;
2056
+ return () => {
2057
+ win.removeEventListener('resize', handleResize);
2058
+ cleanup();
2059
+ };
2076
2060
  }
2077
2061
 
2078
2062
  /**
@@ -2095,20 +2079,18 @@ function autoUpdate(reference, floating, update, options) {
2095
2079
  animationFrame = false
2096
2080
  } = options;
2097
2081
  const referenceEl = unwrapElement(reference);
2098
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2082
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
2099
2083
  ancestors.forEach(ancestor => {
2100
- ancestorScroll && ancestor.addEventListener('scroll', update, {
2101
- passive: true
2102
- });
2084
+ ancestorScroll && ancestor.addEventListener('scroll', update);
2103
2085
  ancestorResize && ancestor.addEventListener('resize', update);
2104
2086
  });
2105
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2087
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
2106
2088
  let reobserveFrame = -1;
2107
2089
  let resizeObserver = null;
2108
2090
  if (elementResize) {
2109
2091
  resizeObserver = new ResizeObserver(_ref => {
2110
2092
  let [firstEntry] = _ref;
2111
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2093
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
2112
2094
  // Prevent update loops when using the `size` middleware.
2113
2095
  // https://github.com/floating-ui/floating-ui/issues/1740
2114
2096
  resizeObserver.unobserve(floating);
@@ -2123,7 +2105,9 @@ function autoUpdate(reference, floating, update, options) {
2123
2105
  if (referenceEl && !animationFrame) {
2124
2106
  resizeObserver.observe(referenceEl);
2125
2107
  }
2126
- resizeObserver.observe(floating);
2108
+ if (floating) {
2109
+ resizeObserver.observe(floating);
2110
+ }
2127
2111
  }
2128
2112
  let frameId;
2129
2113
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -2195,11 +2179,9 @@ const computePosition = (reference, floating, options) => {
2195
2179
  // multiple lifecycle resets re-use the same result. It only lives for a
2196
2180
  // single call. If other functions become expensive, we can add them as well.
2197
2181
  const cache = new Map();
2198
- const mergedOptions = {
2199
- platform,
2200
- ...options
2201
- };
2182
+ const mergedOptions = options != null ? options : {};
2202
2183
  const platformWithCache = {
2184
+ ...platform,
2203
2185
  ...mergedOptions.platform,
2204
2186
  _c: cache
2205
2187
  };
@@ -2542,15 +2524,57 @@ class AuroFloatingUI {
2542
2524
  document.body.style.top = `-${this._savedScrollY}px`;
2543
2525
  document.body.style.width = "100%";
2544
2526
 
2545
- // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
2546
- if (element?.bib && window?.visualViewport?.offsetTop) {
2547
- element.bib.style.transform = `translateY(${window?.visualViewport?.offsetTop}px)`;
2527
+ // Keep the bib aligned with the visual viewport as the VKB opens.
2528
+ // A one-shot offsetTop check at lock time is stale by the time the user
2529
+ // taps an input mid-drawer — iOS then pans visualViewport upward and the
2530
+ // bib drifts off-screen. Listen continuously so the transform tracks the pan.
2531
+ // RAF-throttled to avoid a style recalc on every scroll tick during the
2532
+ // keyboard animation; the pending frame is canceled on unlock so it cannot
2533
+ // reapply a translate after bibTransform has been restored.
2534
+ if (window.visualViewport) {
2535
+ this._viewportRafId = undefined;
2536
+ this._viewportHandler = () => {
2537
+ if (this._viewportRafId !== undefined) {
2538
+ return;
2539
+ }
2540
+ this._viewportRafId = requestAnimationFrame(() => {
2541
+ this._viewportRafId = undefined;
2542
+ if (element?.bib) {
2543
+ element.bib.style.transform = `translateY(${window.visualViewport.offsetTop}px)`;
2544
+ }
2545
+ });
2546
+ };
2547
+ window.visualViewport.addEventListener(
2548
+ "resize",
2549
+ this._viewportHandler,
2550
+ );
2551
+ window.visualViewport.addEventListener(
2552
+ "scroll",
2553
+ this._viewportHandler,
2554
+ );
2555
+ this._viewportHandler();
2548
2556
  }
2549
2557
 
2550
2558
  this.lockTouchScroll(true);
2551
2559
  }
2552
2560
  } else {
2553
2561
  if (this._scrollLocked) {
2562
+ if (this._viewportHandler && window.visualViewport) {
2563
+ window.visualViewport.removeEventListener(
2564
+ "resize",
2565
+ this._viewportHandler,
2566
+ );
2567
+ window.visualViewport.removeEventListener(
2568
+ "scroll",
2569
+ this._viewportHandler,
2570
+ );
2571
+ this._viewportHandler = undefined;
2572
+ }
2573
+ if (this._viewportRafId !== undefined) {
2574
+ cancelAnimationFrame(this._viewportRafId);
2575
+ this._viewportRafId = undefined;
2576
+ }
2577
+
2554
2578
  document.documentElement.style.scrollbarGutter =
2555
2579
  this._savedScrollStyles?.rootScrollbarGutter ?? "";
2556
2580
  document.documentElement.style.overflow =
@@ -2642,7 +2666,7 @@ class AuroFloatingUI {
2642
2666
  bibContent.style.width = "";
2643
2667
  bibContent.style.height = "";
2644
2668
  bibContent.style.maxWidth = "";
2645
- bibContent.style.maxHeight = `${window?.visualViewport?.height}px`;
2669
+ bibContent.style.maxHeight = "";
2646
2670
  this.configureTrial = 0;
2647
2671
  } else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
2648
2672
  this.configureTrial += 1;
@@ -2729,12 +2753,40 @@ class AuroFloatingUI {
2729
2753
  return;
2730
2754
  }
2731
2755
 
2756
+ // Chrome-specific: during popover top-layer promotion after a click on a
2757
+ // slotted focusable, :focus-within can briefly evaluate false while the
2758
+ // active element is still structurally inside the trigger/bib. Fall back
2759
+ // to a shadow-piercing ancestry walk from the deep active element before
2760
+ // treating this as a real focus loss.
2761
+ try {
2762
+ let active = document.activeElement;
2763
+ while (active && active.shadowRoot && active.shadowRoot.activeElement) {
2764
+ active = active.shadowRoot.activeElement;
2765
+ }
2766
+ const targets = [element, element.trigger, element.bib].filter(Boolean);
2767
+ let node = active;
2768
+ while (node) {
2769
+ if (targets.includes(node)) {
2770
+ return;
2771
+ }
2772
+ node =
2773
+ node.parentElement ||
2774
+ (node.getRootNode && node.getRootNode().host) ||
2775
+ null;
2776
+ }
2777
+ } catch (e) {
2778
+ // Defensive: fall through to the existing close path if traversal fails.
2779
+ }
2780
+
2732
2781
  // if fullscreen bib is in fullscreen mode, do not close
2733
2782
  if (element.bib.hasAttribute("isfullscreen")) {
2734
2783
  return;
2735
2784
  }
2736
2785
 
2737
- this.hideBib("keydown");
2786
+ // eventType "focusloss" distinguishes a Tab/click-driven close from an
2787
+ // Escape keydown close. Consumers use this to decide whether to restore
2788
+ // focus to the trigger (Escape) or let it advance naturally (Tab).
2789
+ this.hideBib("focusloss");
2738
2790
  }
2739
2791
 
2740
2792
  setupHideHandlers() {
@@ -2911,6 +2963,24 @@ class AuroFloatingUI {
2911
2963
  if (!this.showing) {
2912
2964
  if (!element.modal) {
2913
2965
  this.setupHideHandlers();
2966
+ } else {
2967
+ if (this.keyDownHandler) {
2968
+ document.removeEventListener("keydown", this.keyDownHandler);
2969
+ }
2970
+ this.keyDownHandler = (evt) => {
2971
+ if (evt.key === "Escape" && element.isPopoverVisible) {
2972
+ // Intercept at keydown so CloseWatcher never sees the keystroke.
2973
+ // Canceling `cancel` alone is insufficient — a second Esc with no
2974
+ // intervening user activation triggers the anti-trap and fires `close`
2975
+ // directly, bypassing any `cancel` preventDefault (AB#1613688).
2976
+ // stopImmediatePropagation is intentional: it prevents other document
2977
+ // keydown handlers (e.g. consumer code, auro-dialog) from also acting
2978
+ // on Escape while the modal owns the key.
2979
+ evt.preventDefault();
2980
+ evt.stopImmediatePropagation();
2981
+ }
2982
+ };
2983
+ document.addEventListener("keydown", this.keyDownHandler);
2914
2984
  }
2915
2985
  this.showing = true;
2916
2986
  element.isPopoverVisible = true;
@@ -3225,14 +3295,14 @@ class AuroFloatingUI {
3225
3295
  class l{generateElementName(t,e){let o=t;return o+="-",o+=e.replace(/[.]/g,"_"),o}generateTag(o,s$1,a){const r=this.generateElementName(o,s$1),i$1=i`${s(r)}`;return customElements.get(r)||customElements.define(r,class extends a{}),i$1}}class d{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,o=(e,s=e&&e.closest(t))=>e&&e!==document&&e!==window?s||o(e.getRootNode().host):null){return o(e)}handleComponentTagRename(t,e){const o=e.toLowerCase();t.tagName.toLowerCase()!==o&&t.setAttribute(o,true);}elementMatch(t,e){const o=e.toLowerCase();return t.tagName.toLowerCase()===o||t.hasAttribute(o)}getSlotText(t,e){const o=t.shadowRoot?.querySelector(`slot[name="${e}"]`),s=(o?.assignedNodes({flatten:true})||[]).map(t=>t.textContent?.trim()).join(" ").trim();return s||null}}class h{registerComponent(t,e){customElements.get(t)||customElements.define(t,class extends e{});}closestElement(t,e=this,o=(e,s=e&&e.closest(t))=>e&&e!==document&&e!==window?s||o(e.getRootNode().host):null){return o(e)}handleComponentTagRename(t,e){const o=e.toLowerCase();t.tagName.toLowerCase()!==o&&t.setAttribute(o,true);}elementMatch(t,e){const o=e.toLowerCase();return t.tagName.toLowerCase()===o||t.hasAttribute(o)}}var c=i$5`:host{color:var(--ds-auro-loader-color)}:host>span{background-color:var(--ds-auro-loader-background-color);border-color:var(--ds-auro-loader-border-color)}:host([onlight]),:host([appearance=brand]){--ds-auro-loader-color: var(--ds-basic-color-brand-primary, #01426a)}:host([ondark]),:host([appearance=inverse]){--ds-auro-loader-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([orbit])>span{--ds-auro-loader-background-color: transparent}:host([orbit])>span:nth-child(1){--ds-auro-loader-border-color: currentcolor;opacity:.25}:host([orbit])>span:nth-child(2){--ds-auro-loader-border-color: currentcolor;border-right-color:transparent;border-bottom-color:transparent;border-left-color:transparent}
3226
3296
  `,u$1=i$5`.body-default{font-size:var(--wcss-body-default-font-size, 1rem);line-height:var(--wcss-body-default-line-height, 1.5rem)}.body-default,.body-lg{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-lg{font-size:var(--wcss-body-lg-font-size, 1.125rem);line-height:var(--wcss-body-lg-line-height, 1.625rem)}.body-sm{font-size:var(--wcss-body-sm-font-size, .875rem);line-height:var(--wcss-body-sm-line-height, 1.25rem)}.body-sm,.body-xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0)}.body-xs{font-size:var(--wcss-body-xs-font-size, .75rem);line-height:var(--wcss-body-xs-line-height, 1rem)}.body-2xs{font-family:var(--wcss-body-family, "AS Circular"),system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:var(--wcss-body-2xs-font-size, .625rem);font-weight:var(--wcss-body-weight, 450);letter-spacing:var(--wcss-body-letter-spacing, 0);line-height:var(--wcss-body-2xs-line-height, .875rem)}.display-2xl{font-family:var(--wcss-display-2xl-family, "AS Circular"),var(--wcss-display-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-2xl-font-size, clamp(3.5rem, 6vw, 5.375rem));font-weight:var(--wcss-display-2xl-weight, 300);letter-spacing:var(--wcss-display-2xl-letter-spacing, 0);line-height:var(--wcss-display-2xl-line-height, 1.3)}.display-xl{font-family:var(--wcss-display-xl-family, "AS Circular"),var(--wcss-display-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xl-font-size, clamp(3rem, 5.3333333333vw, 4.5rem));font-weight:var(--wcss-display-xl-weight, 300);letter-spacing:var(--wcss-display-xl-letter-spacing, 0);line-height:var(--wcss-display-xl-line-height, 1.3)}.display-lg{font-family:var(--wcss-display-lg-family, "AS Circular"),var(--wcss-display-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-lg-font-size, clamp(2.75rem, 4.6666666667vw, 4rem));font-weight:var(--wcss-display-lg-weight, 300);letter-spacing:var(--wcss-display-lg-letter-spacing, 0);line-height:var(--wcss-display-lg-line-height, 1.3)}.display-md{font-family:var(--wcss-display-md-family, "AS Circular"),var(--wcss-display-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-md-font-size, clamp(2.5rem, 4vw, 3.5rem));font-weight:var(--wcss-display-md-weight, 300);letter-spacing:var(--wcss-display-md-letter-spacing, 0);line-height:var(--wcss-display-md-line-height, 1.3)}.display-sm{font-family:var(--wcss-display-sm-family, "AS Circular"),var(--wcss-display-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-sm-font-size, clamp(2rem, 3.6666666667vw, 3rem));font-weight:var(--wcss-display-sm-weight, 300);letter-spacing:var(--wcss-display-sm-letter-spacing, 0);line-height:var(--wcss-display-sm-line-height, 1.3)}.display-xs{font-family:var(--wcss-display-xs-family, "AS Circular"),var(--wcss-display-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-display-xs-font-size, clamp(1.75rem, 3vw, 2.375rem));font-weight:var(--wcss-display-xs-weight, 300);letter-spacing:var(--wcss-display-xs-letter-spacing, 0);line-height:var(--wcss-display-xs-line-height, 1.3)}.heading-xl{font-family:var(--wcss-heading-xl-family, "AS Circular"),var(--wcss-heading-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xl-font-size, clamp(2rem, 3vw, 2.5rem));font-weight:var(--wcss-heading-xl-weight, 300);letter-spacing:var(--wcss-heading-xl-letter-spacing, 0);line-height:var(--wcss-heading-xl-line-height, 1.3)}.heading-lg{font-family:var(--wcss-heading-lg-family, "AS Circular"),var(--wcss-heading-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-lg-font-size, clamp(1.75rem, 2.6666666667vw, 2.25rem));font-weight:var(--wcss-heading-lg-weight, 300);letter-spacing:var(--wcss-heading-lg-letter-spacing, 0);line-height:var(--wcss-heading-lg-line-height, 1.3)}.heading-md{font-family:var(--wcss-heading-md-family, "AS Circular"),var(--wcss-heading-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-md-font-size, clamp(1.625rem, 2.3333333333vw, 1.75rem));font-weight:var(--wcss-heading-md-weight, 300);letter-spacing:var(--wcss-heading-md-letter-spacing, 0);line-height:var(--wcss-heading-md-line-height, 1.3)}.heading-sm{font-family:var(--wcss-heading-sm-family, "AS Circular"),var(--wcss-heading-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-sm-font-size, clamp(1.375rem, 2vw, 1.5rem));font-weight:var(--wcss-heading-sm-weight, 300);letter-spacing:var(--wcss-heading-sm-letter-spacing, 0);line-height:var(--wcss-heading-sm-line-height, 1.3)}.heading-xs{font-family:var(--wcss-heading-xs-family, "AS Circular"),var(--wcss-heading-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-xs-font-size, clamp(1.25rem, 1.6666666667vw, 1.25rem));font-weight:var(--wcss-heading-xs-weight, 450);letter-spacing:var(--wcss-heading-xs-letter-spacing, 0);line-height:var(--wcss-heading-xs-line-height, 1.3)}.heading-2xs{font-family:var(--wcss-heading-2xs-family, "AS Circular"),var(--wcss-heading-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-heading-2xs-font-size, clamp(1.125rem, 1.5vw, 1.125rem));font-weight:var(--wcss-heading-2xs-weight, 450);letter-spacing:var(--wcss-heading-2xs-letter-spacing, 0);line-height:var(--wcss-heading-2xs-line-height, 1.3)}.accent-2xl{font-family:var(--wcss-accent-2xl-family, "Good OT"),var(--wcss-accent-2xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xl-font-size, clamp(2rem, 3.1666666667vw, 2.375rem));font-weight:var(--wcss-accent-2xl-weight, 450);letter-spacing:var(--wcss-accent-2xl-letter-spacing, .05em);line-height:var(--wcss-accent-2xl-line-height, 1)}.accent-2xl,.accent-xl{text-transform:uppercase}.accent-xl{font-family:var(--wcss-accent-xl-family, "Good OT"),var(--wcss-accent-xl-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xl-font-size, clamp(1.625rem, 2.3333333333vw, 2rem));font-weight:var(--wcss-accent-xl-weight, 450);letter-spacing:var(--wcss-accent-xl-letter-spacing, .05em);line-height:var(--wcss-accent-xl-line-height, 1.3)}.accent-lg{font-family:var(--wcss-accent-lg-family, "Good OT"),var(--wcss-accent-lg-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-lg-font-size, clamp(1.5rem, 2.1666666667vw, 1.75rem));font-weight:var(--wcss-accent-lg-weight, 450);letter-spacing:var(--wcss-accent-lg-letter-spacing, .05em);line-height:var(--wcss-accent-lg-line-height, 1.3)}.accent-lg,.accent-md{text-transform:uppercase}.accent-md{font-family:var(--wcss-accent-md-family, "Good OT"),var(--wcss-accent-md-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-md-font-size, clamp(1.375rem, 1.8333333333vw, 1.5rem));font-weight:var(--wcss-accent-md-weight, 500);letter-spacing:var(--wcss-accent-md-letter-spacing, .05em);line-height:var(--wcss-accent-md-line-height, 1.3)}.accent-sm{font-family:var(--wcss-accent-sm-family, "Good OT"),var(--wcss-accent-sm-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-sm-font-size, clamp(1.125rem, 1.5vw, 1.25rem));font-weight:var(--wcss-accent-sm-weight, 500);letter-spacing:var(--wcss-accent-sm-letter-spacing, .05em);line-height:var(--wcss-accent-sm-line-height, 1.3)}.accent-sm,.accent-xs{text-transform:uppercase}.accent-xs{font-family:var(--wcss-accent-xs-family, "Good OT"),var(--wcss-accent-xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-xs-font-size, clamp(1rem, 1.3333333333vw, 1rem));font-weight:var(--wcss-accent-xs-weight, 500);letter-spacing:var(--wcss-accent-xs-letter-spacing, .1em);line-height:var(--wcss-accent-xs-line-height, 1.3)}.accent-2xs{font-family:var(--wcss-accent-2xs-family, "Good OT"),var(--wcss-accent-2xs-family-fallback, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);font-size:var(--wcss-accent-2xs-font-size, clamp(.875rem, 1.1666666667vw, .875rem));font-weight:var(--wcss-accent-2xs-weight, 450);letter-spacing:var(--wcss-accent-2xs-letter-spacing, .1em);line-height:var(--wcss-accent-2xs-line-height, 1.3);text-transform:uppercase}:focus:not(:focus-visible){outline:3px solid transparent}:host,:host>span{position:relative}:host{width:2rem;height:2rem;display:inline-block;font-size:0}:host>span{position:absolute;display:inline-block;float:none;top:0;left:0;width:2rem;height:2rem;border-radius:100%;border-style:solid;border-width:0;box-sizing:border-box}:host([xs]),:host([xs])>span{width:1.2rem;height:1.2rem}:host([sm]),:host([sm])>span{width:3rem;height:3rem}:host([md]),:host([md])>span{width:5rem;height:5rem}:host([lg]),:host([lg])>span{width:8rem;height:8rem}:host{--margin: .375rem;--margin-xs: .2rem;--margin-sm: .5rem;--margin-md: .75rem;--margin-lg: 1rem}:host([pulse]),:host([pulse])>span{position:relative}:host([pulse]){width:calc(3rem + var(--margin) * 6);height:calc(1rem + var(--margin) * 2)}:host([pulse])>span{width:1rem;height:1rem;margin:var(--margin);animation:pulse 1.5s ease infinite}:host([pulse][xs]){width:calc(1.95rem + var(--margin-xs) * 6);height:calc(.65rem + var(--margin-xs) * 2)}:host([pulse][xs])>span{margin:var(--margin-xs);width:.65rem;height:.65rem}:host([pulse][sm]){width:calc(6rem + var(--margin-sm) * 6);height:calc(2rem + var(--margin-sm) * 2)}:host([pulse][sm])>span{margin:var(--margin-sm);width:2rem;height:2rem}:host([pulse][md]){width:calc(9rem + var(--margin-md) * 6);height:calc(3rem + var(--margin-md) * 2)}:host([pulse][md])>span{margin:var(--margin-md);width:3rem;height:3rem}:host([pulse][lg]){width:calc(15rem + var(--margin-lg) * 6);height:calc(5rem + var(--margin-lg) * 2)}:host([pulse][lg])>span{margin:var(--margin-lg);width:5rem;height:5rem}:host([pulse])>span:nth-child(1){animation-delay:-.4s}:host([pulse])>span:nth-child(2){animation-delay:-.2s}:host([pulse])>span:nth-child(3){animation-delay:0ms}@keyframes pulse{0%,to{opacity:.1;transform:scale(.9)}50%{opacity:1;transform:scale(1.1)}}:host([orbit]),:host([orbit])>span{opacity:1}:host([orbit])>span{border-width:5px}:host([orbit])>span:nth-child(2){animation:orbit 2s linear infinite}:host([orbit][sm])>span{border-width:8px}:host([orbit][md])>span{border-width:13px}:host([orbit][lg])>span{border-width:21px}@keyframes orbit{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host([ringworm])>svg{animation:rotate 2s linear infinite;height:100%;width:100%;stroke:currentcolor;stroke-width:8}:host([ringworm]) .path{stroke-dashoffset:0;animation:ringworm 1.5s ease-in-out infinite;stroke-linecap:round}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes ringworm{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}:host([laser]){position:static;width:100%;display:block;height:0;overflow:hidden;font-size:unset}:host([laser])>span{position:fixed;width:100%;height:.25rem;border-radius:0;z-index:100}:host([laser])>span:nth-child(1){border-color:currentcolor;opacity:.25}:host([laser])>span:nth-child(2){border-color:currentcolor;animation:laser 2s linear infinite;opacity:1;width:50%}:host([laser][sm])>span:nth-child(2){width:20%}:host([laser][md])>span:nth-child(2){width:30%}:host([laser][lg])>span:nth-child(2){width:50%;animation-duration:1.5s}:host([laser][xl])>span:nth-child(2){width:80%;animation-duration:1.5s}@keyframes laser{0%{left:-100%}to{left:110%}}:host>.no-animation{display:none}@media (prefers-reduced-motion: reduce){:host{display:flex;align-items:center;justify-content:center}:host>span{opacity:1}:host>.loader{display:none}:host>svg{display:none}:host>.no-animation{display:block}}
3227
3297
  `,p$1=i$5`:host{--ds-auro-loader-background-color: currentcolor;--ds-auro-loader-border-color: currentcolor;--ds-auro-loader-color: currentcolor}
3228
- `;class b extends i$2{constructor(){super(),this.appearance="default",this.keys=[0,1,2,3,4,5,6,7,8,9],this.mdCount=3,this.smCount=2,this.runtimeUtils=new h,this.orbit=false,this.ringworm=false,this.laser=false,this.pulse=false;}static get properties(){return {appearance:{type:String,reflect:true},laser:{type:Boolean,reflect:true},orbit:{type:Boolean,reflect:true},pulse:{type:Boolean,reflect:true},ringworm:{type:Boolean,reflect:true}}}static get styles(){return [u$1,c,p$1]}static register(t="auro-loader"){h.prototype.registerComponent(t,b);}firstUpdated(){this.runtimeUtils.handleComponentTagRename(this,"auro-loader");}connectedCallback(){super.connectedCallback();}defineTemplate(){let t=Array.from(Array(this.mdCount).keys());return this.orbit||this.laser?t=Array.from(Array(this.smCount).keys()):this.ringworm&&(t=Array.from(Array(0).keys())),t}render(){return x$1`
3229
- ${this.defineTemplate().map(t=>x$1`
3298
+ `;class b extends i$2{constructor(){super(),this.appearance="default",this.keys=[0,1,2,3,4,5,6,7,8,9],this.mdCount=3,this.smCount=2,this.runtimeUtils=new h,this.orbit=false,this.ringworm=false,this.laser=false,this.pulse=false;}static get properties(){return {appearance:{type:String,reflect:true},laser:{type:Boolean,reflect:true},orbit:{type:Boolean,reflect:true},pulse:{type:Boolean,reflect:true},ringworm:{type:Boolean,reflect:true}}}static get styles(){return [u$1,c,p$1]}static register(t="auro-loader"){h.prototype.registerComponent(t,b);}firstUpdated(){this.runtimeUtils.handleComponentTagRename(this,"auro-loader");}connectedCallback(){super.connectedCallback();}defineTemplate(){let t=Array.from(Array(this.mdCount).keys());return this.orbit||this.laser?t=Array.from(Array(this.smCount).keys()):this.ringworm&&(t=Array.from(Array(0).keys())),t}render(){return b$1`
3299
+ ${this.defineTemplate().map(t=>b$1`
3230
3300
  <span part="element" class="loader node-${t}"></span>
3231
3301
  `)}
3232
3302
 
3233
3303
  <div class="no-animation body-default">Loading...</div>
3234
3304
 
3235
- ${this.ringworm?x$1`
3305
+ ${this.ringworm?b$1`
3236
3306
  <svg part="element" class="circular" viewBox="25 25 50 50">
3237
3307
  <circle class="path" cx="50" cy="50" r="20" fill="none"/>
3238
3308
  </svg>`:""}
@@ -3283,15 +3353,15 @@ class p{registerComponent(t,a){customElements.get(t)||customElements.define(t,cl
3283
3353
  `;class y extends m{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.onDark=false,this.appearance="default";}static get properties(){return {...m.properties,onDark:{type:Boolean,reflect:true},appearance:{type:String,reflect:true},svg:{attribute:false,reflect:true}}}static get styles(){return z}async fetchIcon(t,a){let e="";e="logos"===t?await w(`${this.uri}/${t}/${a}.svg`):await w(`${this.uri}/icons/${t}/${a}.svg`);return (new DOMParser).parseFromString(e,"text/html").body.querySelector("svg")}async firstUpdated(){try{if(!this.customSvg){const t=await this.fetchIcon(this.category,this.name);if(t)this.svg=t;else if(!t){const t=this.name?.startsWith("tail-")?g:u;this.svg=(new DOMParser).parseFromString(t,"text/html").body.querySelector("svg");}}}catch(t){this.svg=void 0;}}}i$5`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px,1px,1px,1px);width:1px;height:1px;padding:0;border:0}:host{display:inline-block;--ds-auro-icon-size: 100%;width:100%;height:100%}:host .logo{color:var(--ds-auro-alaska-color)}:host([onDark]),:host([appearance=inverse]){--ds-auro-alaska-color: #FFF}
3284
3354
  `;var M=i$5`:host{--ds-auro-icon-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-alaska-color: #02426D;--ds-auro-icon-size: var(--ds-size-300, 1.5rem)}
3285
3355
  `;var _=i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]),:host(:not([appearance=inverse])[variant=accent1]){--ds-auro-icon-color: var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]),:host(:not([appearance=inverse])[variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]),:host(:not([appearance=inverse])[variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]),:host(:not([appearance=inverse])[variant=statusDefault]){--ds-auro-icon-color: var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]),:host(:not([appearance=inverse])[variant=statusInfo]){--ds-auro-icon-color: var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]),:host(:not([appearance=inverse])[variant=statusSuccess]){--ds-auro-icon-color: var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]),:host(:not([appearance=inverse])[variant=statusWarning]){--ds-auro-icon-color: var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]),:host(:not([appearance=inverse])[variant=statusError]){--ds-auro-icon-color: var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]),:host(:not([appearance=inverse])[variant=statusInfoSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]),:host(:not([appearance=inverse])[variant=statusSuccessSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]),:host(:not([appearance=inverse])[variant=statusWarningSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]),:host(:not([appearance=inverse])[variant=statusErrorSubtle]){--ds-auro-icon-color: var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]),:host(:not([appearance=inverse])[variant=fareBasicEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]),:host(:not([appearance=inverse])[variant=fareBusiness]){--ds-auro-icon-color: var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]),:host(:not([appearance=inverse])[variant=fareEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]),:host(:not([appearance=inverse])[variant=fareFirst]){--ds-auro-icon-color: var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]),:host(:not([appearance=inverse])[variant=farePremiumEconomy]){--ds-auro-icon-color: var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]),:host(:not([appearance=inverse])[variant=tierOneWorldEmerald]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]),:host(:not([appearance=inverse])[variant=tierOneWorldSapphire]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]),:host(:not([appearance=inverse])[variant=tierOneWorldRuby]){--ds-auro-icon-color: var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]),:host([appearance=inverse]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]),:host([appearance=inverse][variant=disabled]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]),:host([appearance=inverse][variant=muted]){--ds-auro-icon-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][variant=statusError]),:host([appearance=inverse][variant=statusError]){--ds-auro-icon-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}
3286
- `;class k extends y{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.variant=void 0,this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...y.properties,ariaHidden:{type:String,reflect:true},category:{type:String,reflect:true},customColor:{type:Boolean,reflect:true},customSvg:{type:Boolean},label:{type:Boolean,reflect:true},name:{type:String,reflect:true},variant:{type:String,reflect:true}}}static get styles(){return [y.styles,M,z,_]}static register(t="auro-icon"){p.prototype.registerComponent(t,k);}connectedCallback(){super.connectedCallback(),this.runtimeUtils.handleComponentTagRename(this,"auro-icon");}exposeCssParts(){this.setAttribute("exportparts","svg:iconSvg");}async firstUpdated(){if(await super.firstUpdated(),this.hasAttribute("ariaHidden")&&this.svg){const t=this.svg.querySelector("desc");t&&(t.remove(),this.svg.removeAttribute("aria-labelledby"));}}render(){const t={labelWrapper:true,util_displayHiddenVisually:!this.label};return x$1`
3356
+ `;class k extends y{constructor(){super(),this._initializeDefaults();}_initializeDefaults(){this.variant=void 0,this.uri="https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist",this.runtimeUtils=new p;}static get properties(){return {...y.properties,ariaHidden:{type:String,reflect:true},category:{type:String,reflect:true},customColor:{type:Boolean,reflect:true},customSvg:{type:Boolean},label:{type:Boolean,reflect:true},name:{type:String,reflect:true},variant:{type:String,reflect:true}}}static get styles(){return [y.styles,M,z,_]}static register(t="auro-icon"){p.prototype.registerComponent(t,k);}connectedCallback(){super.connectedCallback(),this.runtimeUtils.handleComponentTagRename(this,"auro-icon");}exposeCssParts(){this.setAttribute("exportparts","svg:iconSvg");}async firstUpdated(){if(await super.firstUpdated(),this.hasAttribute("ariaHidden")&&this.svg){const t=this.svg.querySelector("desc");t&&(t.remove(),this.svg.removeAttribute("aria-labelledby"));}}render(){const t={labelWrapper:true,util_displayHiddenVisually:!this.label};return b$1`
3287
3357
  <div class="componentWrapper">
3288
3358
  <div
3289
3359
  class="${e({svgWrapper:true})}"
3290
3360
  title="${o$1(this.title||void 0)}">
3291
3361
  <span aria-hidden="${o$1(this.ariaHidden||true)}" part="svg">
3292
- ${this.customSvg?x$1`
3362
+ ${this.customSvg?b$1`
3293
3363
  <slot name="svg"></slot>
3294
- `:x$1`
3364
+ `:b$1`
3295
3365
  ${this.svg}
3296
3366
  `}
3297
3367
  </span>
@@ -3571,6 +3641,15 @@ class ComponentBase extends i$2 {
3571
3641
  clearTimeout(this._hidePopoverTimerId);
3572
3642
  this._hidePopoverTimerId = undefined;
3573
3643
  }
3644
+ if (this._focusFallbackTimerId) {
3645
+ clearTimeout(this._focusFallbackTimerId);
3646
+ this._focusFallbackTimerId = undefined;
3647
+ }
3648
+ if (this.focusTrap) {
3649
+ this.focusTrap.disconnect();
3650
+ this.focusTrap = undefined;
3651
+ }
3652
+ this._focusTrapActivated = false;
3574
3653
  this.floater.disconnect();
3575
3654
  }
3576
3655
 
@@ -3592,17 +3671,44 @@ class ComponentBase extends i$2 {
3592
3671
  this.dialog.showPopover();
3593
3672
  }
3594
3673
 
3674
+ if (this._focusFallbackTimerId) {
3675
+ clearTimeout(this._focusFallbackTimerId);
3676
+ this._focusFallbackTimerId = undefined;
3677
+ }
3678
+ if (this.focusTrap) {
3679
+ this.focusTrap.disconnect();
3680
+ }
3681
+
3595
3682
  this.focusTrap = new FocusTrap(this.dialog);
3596
- // Focus is moved after the CSS open animation completes (see onDialogTransitionEnd).
3683
+ this._focusTrapActivated = false;
3684
+
3685
+ // Fallback: if transitionend never fires (dialog mounted already-open,
3686
+ // reduced motion, or interrupted transition), engage the focus trap after
3687
+ // the transition duration elapses. 350ms = CSS open transition (300ms in
3688
+ // style.scss) + 50ms buffer.
3689
+ this._focusFallbackTimerId = setTimeout(() => {
3690
+ this._focusFallbackTimerId = undefined;
3691
+ if (this.isPopoverVisible && this.focusTrap && !this._focusTrapActivated) {
3692
+ this.focusTrap.focusFirstElement();
3693
+ this._focusTrapActivated = true;
3694
+ }
3695
+ }, 350);
3597
3696
  }
3598
3697
 
3599
3698
  /**
3600
- * set the focus on the first element after opening transition effect is complete.
3699
+ * Cancels the focus-trap fallback timer (if pending) and moves focus into
3700
+ * the dialog once the open CSS transition completes. No-ops when the
3701
+ * fallback timer already activated the trap (_focusTrapActivated === true).
3601
3702
  * @private
3602
3703
  */
3603
3704
  onDialogTransitionEnd() {
3604
- if (this.isPopoverVisible && this.focusTrap) {
3705
+ if (this._focusFallbackTimerId) {
3706
+ clearTimeout(this._focusFallbackTimerId);
3707
+ this._focusFallbackTimerId = undefined;
3708
+ }
3709
+ if (this.isPopoverVisible && this.focusTrap && !this._focusTrapActivated) {
3605
3710
  this.focusTrap.focusFirstElement();
3711
+ this._focusTrapActivated = true;
3606
3712
  }
3607
3713
  }
3608
3714
 
@@ -3611,6 +3717,12 @@ class ComponentBase extends i$2 {
3611
3717
  * @returns {void}
3612
3718
  */
3613
3719
  closeDialog() {
3720
+ if (this._focusFallbackTimerId) {
3721
+ clearTimeout(this._focusFallbackTimerId);
3722
+ this._focusFallbackTimerId = undefined;
3723
+ }
3724
+ this._focusTrapActivated = false;
3725
+
3614
3726
  if (this.focusTrap) {
3615
3727
  this.focusTrap.disconnect();
3616
3728
  this.focusTrap = undefined;
@@ -3809,4 +3921,45 @@ class AuroDialog extends ComponentBase {
3809
3921
  }
3810
3922
  }
3811
3923
 
3812
- export { AuroDialog as A, initBasicExample as i };
3924
+ AuroDialog.register();
3925
+
3926
+ function initCustomExample() {
3927
+ const buttons = [
3928
+ document.querySelector("#openCustom"),
3929
+ document.querySelector("#closeCustom"),
3930
+ ];
3931
+ const dialog = document.querySelector("#customDialog");
3932
+
3933
+ buttons.forEach((button) => {
3934
+ button.addEventListener("click", () => {
3935
+ if (dialog.hasAttribute("open")) {
3936
+ dialog.removeAttribute("open");
3937
+ } else {
3938
+ dialog.setAttribute("open", true);
3939
+ }
3940
+ });
3941
+ });
3942
+ }
3943
+
3944
+ // The README's live example uses a custom-registered `<custom-dialog>` tag
3945
+ // (see docs/partials/customRegistration.md). Register it so the element
3946
+ // upgrades and renders on the README demo page.
3947
+ AuroDialog.register("custom-dialog");
3948
+
3949
+ function initExamples(initCount) {
3950
+ // biome-ignore lint/style/noParameterAssign: legacy error handling
3951
+ initCount = initCount || 0;
3952
+
3953
+ try {
3954
+ initCustomExample();
3955
+ } catch (_err) {
3956
+ if (initCount <= 20) {
3957
+ // setTimeout handles issue where content is sometimes loaded after the functions get called
3958
+ setTimeout(() => {
3959
+ initExamples(initCount + 1);
3960
+ }, 100);
3961
+ }
3962
+ }
3963
+ }
3964
+
3965
+ export { initExamples };