@aurodesignsystem-dev/auro-formkit 0.0.0-pr593.0

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 (268) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +2 -0
  4. package/README.md +314 -0
  5. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +39 -0
  6. package/components/bibtemplate/dist/headerVersion.d.ts +2 -0
  7. package/components/bibtemplate/dist/iconVersion.d.ts +2 -0
  8. package/components/bibtemplate/dist/index.d.ts +2 -0
  9. package/components/bibtemplate/dist/index.js +709 -0
  10. package/components/bibtemplate/dist/registered.js +709 -0
  11. package/components/bibtemplate/dist/styles/color-css.d.ts +2 -0
  12. package/components/bibtemplate/dist/styles/style-css.d.ts +2 -0
  13. package/components/bibtemplate/dist/styles/tokens-css.d.ts +2 -0
  14. package/components/checkbox/README.md +142 -0
  15. package/components/checkbox/demo/api.html +55 -0
  16. package/components/checkbox/demo/api.js +17 -0
  17. package/components/checkbox/demo/api.md +401 -0
  18. package/components/checkbox/demo/api.min.js +1833 -0
  19. package/components/checkbox/demo/index.html +51 -0
  20. package/components/checkbox/demo/index.js +8 -0
  21. package/components/checkbox/demo/index.md +327 -0
  22. package/components/checkbox/demo/index.min.js +1808 -0
  23. package/components/checkbox/demo/readme.html +50 -0
  24. package/components/checkbox/demo/readme.md +142 -0
  25. package/components/checkbox/dist/auro-checkbox-group.d.ts +166 -0
  26. package/components/checkbox/dist/auro-checkbox.d.ts +129 -0
  27. package/components/checkbox/dist/helptextVersion.d.ts +2 -0
  28. package/components/checkbox/dist/index.d.ts +3 -0
  29. package/components/checkbox/dist/index.js +1757 -0
  30. package/components/checkbox/dist/registered.js +1758 -0
  31. package/components/checkbox/dist/styles/auro-checkbox-css.d.ts +2 -0
  32. package/components/checkbox/dist/styles/auro-checkbox-group-css.d.ts +2 -0
  33. package/components/checkbox/dist/styles/color-css.d.ts +2 -0
  34. package/components/checkbox/dist/styles/colorGroup-css.d.ts +2 -0
  35. package/components/checkbox/dist/styles/tokens-css.d.ts +2 -0
  36. package/components/combobox/README.md +152 -0
  37. package/components/combobox/demo/api.html +57 -0
  38. package/components/combobox/demo/api.js +36 -0
  39. package/components/combobox/demo/api.md +1209 -0
  40. package/components/combobox/demo/api.min.js +15117 -0
  41. package/components/combobox/demo/index.html +56 -0
  42. package/components/combobox/demo/index.js +26 -0
  43. package/components/combobox/demo/index.md +621 -0
  44. package/components/combobox/demo/index.min.js +14971 -0
  45. package/components/combobox/demo/readme.html +50 -0
  46. package/components/combobox/demo/readme.md +152 -0
  47. package/components/combobox/dist/auro-combobox.d.ts +384 -0
  48. package/components/combobox/dist/bibtemplateVersion.d.ts +2 -0
  49. package/components/combobox/dist/dropdownVersion.d.ts +2 -0
  50. package/components/combobox/dist/index.d.ts +2 -0
  51. package/components/combobox/dist/index.js +13554 -0
  52. package/components/combobox/dist/inputVersion.d.ts +2 -0
  53. package/components/combobox/dist/registered.js +13556 -0
  54. package/components/combobox/dist/styles/style-css.d.ts +2 -0
  55. package/components/counter/README.md +146 -0
  56. package/components/counter/demo/api.html +54 -0
  57. package/components/counter/demo/api.js +20 -0
  58. package/components/counter/demo/api.md +584 -0
  59. package/components/counter/demo/api.min.js +7111 -0
  60. package/components/counter/demo/index.html +54 -0
  61. package/components/counter/demo/index.js +21 -0
  62. package/components/counter/demo/index.md +244 -0
  63. package/components/counter/demo/index.min.js +7075 -0
  64. package/components/counter/demo/readme.html +50 -0
  65. package/components/counter/demo/readme.md +146 -0
  66. package/components/counter/dist/auro-counter-button.d.ts +12 -0
  67. package/components/counter/dist/auro-counter-group.d.ts +235 -0
  68. package/components/counter/dist/auro-counter-wrapper.d.ts +22 -0
  69. package/components/counter/dist/auro-counter.d.ts +97 -0
  70. package/components/counter/dist/bibtemplateVersion.d.ts +2 -0
  71. package/components/counter/dist/dropdownVersion.d.ts +2 -0
  72. package/components/counter/dist/iconVersion.d.ts +2 -0
  73. package/components/counter/dist/index.d.ts +3 -0
  74. package/components/counter/dist/index.js +7018 -0
  75. package/components/counter/dist/registered.js +7019 -0
  76. package/components/counter/dist/styles/color-css.d.ts +2 -0
  77. package/components/counter/dist/styles/counter-button-color-css.d.ts +2 -0
  78. package/components/counter/dist/styles/counter-button-css.d.ts +2 -0
  79. package/components/counter/dist/styles/counter-group-css.d.ts +2 -0
  80. package/components/counter/dist/styles/counter-wrapper-color-css.d.ts +2 -0
  81. package/components/counter/dist/styles/counter-wrapper-css.d.ts +2 -0
  82. package/components/counter/dist/styles/style-css.d.ts +2 -0
  83. package/components/counter/dist/styles/tokens-css.d.ts +2 -0
  84. package/components/datepicker/README.md +140 -0
  85. package/components/datepicker/demo/api.html +57 -0
  86. package/components/datepicker/demo/api.js +35 -0
  87. package/components/datepicker/demo/api.md +1479 -0
  88. package/components/datepicker/demo/api.min.js +24534 -0
  89. package/components/datepicker/demo/index.html +56 -0
  90. package/components/datepicker/demo/index.js +19 -0
  91. package/components/datepicker/demo/index.md +112 -0
  92. package/components/datepicker/demo/index.min.js +24255 -0
  93. package/components/datepicker/demo/readme.html +50 -0
  94. package/components/datepicker/demo/readme.md +140 -0
  95. package/components/datepicker/dist/auro-calendar-cell.d.ts +163 -0
  96. package/components/datepicker/dist/auro-calendar-month.d.ts +20 -0
  97. package/components/datepicker/dist/auro-calendar.d.ts +133 -0
  98. package/components/datepicker/dist/auro-datepicker.d.ts +466 -0
  99. package/components/datepicker/dist/bibtemplateVersion.d.ts +2 -0
  100. package/components/datepicker/dist/buttonVersion.d.ts +2 -0
  101. package/components/datepicker/dist/dropdownVersion.d.ts +2 -0
  102. package/components/datepicker/dist/index.d.ts +2 -0
  103. package/components/datepicker/dist/index.js +24185 -0
  104. package/components/datepicker/dist/inputVersion.d.ts +2 -0
  105. package/components/datepicker/dist/popoverVersion.d.ts +2 -0
  106. package/components/datepicker/dist/registered.js +24185 -0
  107. package/components/datepicker/dist/styles/color-calendar-css.d.ts +2 -0
  108. package/components/datepicker/dist/styles/color-cell-css.d.ts +2 -0
  109. package/components/datepicker/dist/styles/color-css.d.ts +2 -0
  110. package/components/datepicker/dist/styles/color-month-css.d.ts +2 -0
  111. package/components/datepicker/dist/styles/style-auro-calendar-cell-css.d.ts +2 -0
  112. package/components/datepicker/dist/styles/style-auro-calendar-css.d.ts +2 -0
  113. package/components/datepicker/dist/styles/style-auro-calendar-month-css.d.ts +2 -0
  114. package/components/datepicker/dist/styles/style-css.d.ts +2 -0
  115. package/components/datepicker/dist/styles/tokens-css.d.ts +2 -0
  116. package/components/datepicker/dist/utilities.d.ts +78 -0
  117. package/components/datepicker/dist/utilitiesCalendar.d.ts +38 -0
  118. package/components/datepicker/dist/utilitiesCalendarRender.d.ts +50 -0
  119. package/components/datepicker/dist/vendor/wc-range-datepicker/day.d.ts +5 -0
  120. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-calendar.d.ts +60 -0
  121. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker-cell.d.ts +1 -0
  122. package/components/datepicker/dist/vendor/wc-range-datepicker/range-datepicker.d.ts +57 -0
  123. package/components/dropdown/README.md +144 -0
  124. package/components/dropdown/demo/api.html +57 -0
  125. package/components/dropdown/demo/api.js +21 -0
  126. package/components/dropdown/demo/api.md +1434 -0
  127. package/components/dropdown/demo/api.min.js +3826 -0
  128. package/components/dropdown/demo/index.html +55 -0
  129. package/components/dropdown/demo/index.js +19 -0
  130. package/components/dropdown/demo/index.md +510 -0
  131. package/components/dropdown/demo/index.min.js +3789 -0
  132. package/components/dropdown/demo/readme.html +50 -0
  133. package/components/dropdown/demo/readme.md +144 -0
  134. package/components/dropdown/dist/auro-dropdown.d.ts +406 -0
  135. package/components/dropdown/dist/auro-dropdownBib.d.ts +46 -0
  136. package/components/dropdown/dist/dropdownVersion.d.ts +2 -0
  137. package/components/dropdown/dist/helptextVersion.d.ts +2 -0
  138. package/components/dropdown/dist/iconVersion.d.ts +2 -0
  139. package/components/dropdown/dist/index.d.ts +2 -0
  140. package/components/dropdown/dist/index.js +3734 -0
  141. package/components/dropdown/dist/registered.js +3734 -0
  142. package/components/dropdown/dist/styles/bibColors-css.d.ts +2 -0
  143. package/components/dropdown/dist/styles/bibStyles-css.d.ts +2 -0
  144. package/components/dropdown/dist/styles/color-css.d.ts +2 -0
  145. package/components/dropdown/dist/styles/style-css.d.ts +2 -0
  146. package/components/dropdown/dist/styles/tokens-css.d.ts +2 -0
  147. package/components/form/README.md +142 -0
  148. package/components/form/demo/api.html +49 -0
  149. package/components/form/demo/api.js +3 -0
  150. package/components/form/demo/api.md +51 -0
  151. package/components/form/demo/api.min.js +638 -0
  152. package/components/form/demo/autocomplete.html +15 -0
  153. package/components/form/demo/index.html +50 -0
  154. package/components/form/demo/index.js +4 -0
  155. package/components/form/demo/index.md +403 -0
  156. package/components/form/demo/index.min.js +639 -0
  157. package/components/form/demo/readme.html +50 -0
  158. package/components/form/demo/readme.md +142 -0
  159. package/components/form/demo/registerDemoDeps.js +23 -0
  160. package/components/form/demo/working.html +118 -0
  161. package/components/form/dist/auro-form.d.ts +223 -0
  162. package/components/form/dist/index.d.ts +2 -0
  163. package/components/form/dist/index.js +614 -0
  164. package/components/form/dist/registered.d.ts +1 -0
  165. package/components/form/dist/registered.js +614 -0
  166. package/components/form/dist/styles/style-css.d.ts +2 -0
  167. package/components/helptext/dist/auro-helptext.d.ts +61 -0
  168. package/components/helptext/dist/index.d.ts +2 -0
  169. package/components/helptext/dist/index.js +209 -0
  170. package/components/helptext/dist/registered.js +209 -0
  171. package/components/helptext/dist/styles/color-css.d.ts +2 -0
  172. package/components/helptext/dist/styles/style-css.d.ts +2 -0
  173. package/components/helptext/dist/styles/tokens-css.d.ts +2 -0
  174. package/components/input/README.md +135 -0
  175. package/components/input/demo/api.html +42 -0
  176. package/components/input/demo/api.js +29 -0
  177. package/components/input/demo/api.md +1252 -0
  178. package/components/input/demo/api.min.js +7238 -0
  179. package/components/input/demo/index.html +43 -0
  180. package/components/input/demo/index.js +20 -0
  181. package/components/input/demo/index.md +202 -0
  182. package/components/input/demo/index.min.js +7157 -0
  183. package/components/input/demo/readme.html +50 -0
  184. package/components/input/demo/readme.md +135 -0
  185. package/components/input/dist/auro-input.d.ts +31 -0
  186. package/components/input/dist/base-input.d.ts +512 -0
  187. package/components/input/dist/buttonVersion.d.ts +2 -0
  188. package/components/input/dist/helptextVersion.d.ts +2 -0
  189. package/components/input/dist/i18n.d.ts +18 -0
  190. package/components/input/dist/iconVersion.d.ts +2 -0
  191. package/components/input/dist/index.d.ts +2 -0
  192. package/components/input/dist/index.js +7063 -0
  193. package/components/input/dist/registered.js +7063 -0
  194. package/components/input/dist/styles/borders-css.d.ts +2 -0
  195. package/components/input/dist/styles/color-css.d.ts +2 -0
  196. package/components/input/dist/styles/input-css.d.ts +2 -0
  197. package/components/input/dist/styles/label-css.d.ts +2 -0
  198. package/components/input/dist/styles/mixins-css.d.ts +2 -0
  199. package/components/input/dist/styles/notificationIcons-css.d.ts +2 -0
  200. package/components/input/dist/styles/style-css.d.ts +2 -0
  201. package/components/input/dist/styles/tokens-css.d.ts +2 -0
  202. package/components/input/dist/utilities.d.ts +25 -0
  203. package/components/menu/README.md +145 -0
  204. package/components/menu/demo/api.html +55 -0
  205. package/components/menu/demo/api.js +27 -0
  206. package/components/menu/demo/api.md +954 -0
  207. package/components/menu/demo/api.min.js +1538 -0
  208. package/components/menu/demo/index.html +52 -0
  209. package/components/menu/demo/index.js +28 -0
  210. package/components/menu/demo/index.md +61 -0
  211. package/components/menu/demo/index.min.js +1484 -0
  212. package/components/menu/demo/readme.html +50 -0
  213. package/components/menu/demo/readme.md +145 -0
  214. package/components/menu/dist/auro-menu-utils.d.ts +42 -0
  215. package/components/menu/dist/auro-menu.d.ts +205 -0
  216. package/components/menu/dist/auro-menuoption.d.ts +63 -0
  217. package/components/menu/dist/dropdownVersion.d.ts +2 -0
  218. package/components/menu/dist/iconVersion.d.ts +2 -0
  219. package/components/menu/dist/index.d.ts +4 -0
  220. package/components/menu/dist/index.js +1426 -0
  221. package/components/menu/dist/registered.js +1427 -0
  222. package/components/menu/dist/styles/color-menu-css.d.ts +2 -0
  223. package/components/menu/dist/styles/color-menuoption-css.d.ts +2 -0
  224. package/components/menu/dist/styles/style-menu-css.d.ts +2 -0
  225. package/components/menu/dist/styles/style-menuoption-css.d.ts +2 -0
  226. package/components/menu/dist/styles/tokens-css.d.ts +2 -0
  227. package/components/radio/README.md +137 -0
  228. package/components/radio/demo/api.html +53 -0
  229. package/components/radio/demo/api.js +19 -0
  230. package/components/radio/demo/api.md +562 -0
  231. package/components/radio/demo/api.min.js +1944 -0
  232. package/components/radio/demo/index.html +50 -0
  233. package/components/radio/demo/index.js +8 -0
  234. package/components/radio/demo/index.md +150 -0
  235. package/components/radio/demo/index.min.js +1901 -0
  236. package/components/radio/demo/readme.html +50 -0
  237. package/components/radio/demo/readme.md +137 -0
  238. package/components/radio/dist/auro-radio-group.d.ts +194 -0
  239. package/components/radio/dist/auro-radio.d.ts +144 -0
  240. package/components/radio/dist/helptextVersion.d.ts +2 -0
  241. package/components/radio/dist/index.d.ts +3 -0
  242. package/components/radio/dist/index.js +1850 -0
  243. package/components/radio/dist/registered.js +1851 -0
  244. package/components/radio/dist/styles/auro-radio-group-css.d.ts +2 -0
  245. package/components/radio/dist/styles/color-css.d.ts +2 -0
  246. package/components/radio/dist/styles/groupColor-css.d.ts +2 -0
  247. package/components/radio/dist/styles/style-css.d.ts +2 -0
  248. package/components/radio/dist/styles/tokens-css.d.ts +2 -0
  249. package/components/select/README.md +144 -0
  250. package/components/select/demo/api.html +71 -0
  251. package/components/select/demo/api.js +35 -0
  252. package/components/select/demo/api.md +1313 -0
  253. package/components/select/demo/api.min.js +7763 -0
  254. package/components/select/demo/index.html +66 -0
  255. package/components/select/demo/index.js +9 -0
  256. package/components/select/demo/index.md +815 -0
  257. package/components/select/demo/index.min.js +7651 -0
  258. package/components/select/demo/readme.html +50 -0
  259. package/components/select/demo/readme.md +144 -0
  260. package/components/select/dist/auro-select.d.ts +359 -0
  261. package/components/select/dist/bibtemplateVersion.d.ts +2 -0
  262. package/components/select/dist/dropdownVersion.d.ts +2 -0
  263. package/components/select/dist/index.d.ts +2 -0
  264. package/components/select/dist/index.js +6300 -0
  265. package/components/select/dist/registered.js +6300 -0
  266. package/components/select/dist/styles/style-css.d.ts +2 -0
  267. package/package.json +217 -0
  268. package/packages/build-tools/src/postinstall.mjs +12 -0
@@ -0,0 +1,3826 @@
1
+ function showExample() {
2
+ const triggerInput = document.querySelector('#showExampleTriggerInput');
3
+ const dropdownElem = document.querySelector('#showMethodExample');
4
+
5
+ triggerInput.addEventListener('keydown', () => {
6
+ dropdownElem.show();
7
+ });
8
+ }
9
+
10
+ function hideExample() {
11
+ const btn = document.querySelector('#hideExampleBtn');
12
+ const dropdown = document.querySelector('#hideExample');
13
+
14
+ btn.addEventListener('click', () => {
15
+ dropdown.hide();
16
+ });
17
+ }
18
+
19
+ function inDialogExample() {
20
+ document.querySelector("#dropdown-dialog-opener").addEventListener("click", () => {
21
+ const dialog = document.querySelector("#dropdown-dialog");
22
+ dialog.open = true;
23
+ });
24
+ }
25
+
26
+ /**
27
+ * @license
28
+ * Copyright 2017 Google LLC
29
+ * SPDX-License-Identifier: BSD-3-Clause
30
+ */
31
+ const t$2=globalThis,i$5=t$2.trustedTypes,s$3=i$5?i$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$4="$lit$",h$1=`lit$${Math.random().toFixed(9).slice(2)}$`,o$5="?"+h$1,n$3=`<${o$5}>`,r$2=document,l$2=()=>r$2.createComment(""),c$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$2=Array.isArray,u$2=t=>a$2(t)||"function"==typeof t?.[Symbol.iterator],d$1="[ \t\n\f\r]",f$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$1=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y$1=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y$1(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$2.createTreeWalker(r$2,129);function P(t,i){if(!a$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$3?s$3.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f$1;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$1?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p$1):c===g||c===p$1?c=m:c===v||c===_?c=f$1:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f$1?s+n$3:d>=0?(o.push(a),s.slice(0,d)+e$4+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]};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.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$4)){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:"?"===e[1]?I:"@"===e[1]?L:k}),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$5?i$5.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$2()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$2());}}}else if(8===r.nodeType)if(r.data===o$5)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$2.createElement("template");return s.innerHTML=t,s}}function S$1(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c$2(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}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$2).importNode(i,true);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(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(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$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++;}}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$2(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u$2(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$2(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$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=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a$2(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&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}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$2(t)||t!==this._$AH&&t!==T,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&&(r=this._$AH[n]),o||=!c$2(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??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{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)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);}}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$2.litHtmlPolyfillSupport;j?.(N,R),(t$2.litHtmlVersions??=[]).push("3.3.0");const B=(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(i.insertBefore(l$2(),t),t,void 0,s??{});}return h._$AI(t),h};
32
+
33
+ /**
34
+ * @license
35
+ * Copyright 2020 Google LLC
36
+ * SPDX-License-Identifier: BSD-3-Clause
37
+ */
38
+ const a$1=Symbol.for(""),o$4=t=>{if(t?.r===a$1)return t?._$litStatic$},s$2=t=>({_$litStatic$:t,r:a$1}),i$4=(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$1}),l$1=new Map,n$2=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$4(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$1=n$2(x);
39
+
40
+ /**
41
+ * @license
42
+ * Copyright 2019 Google LLC
43
+ * SPDX-License-Identifier: BSD-3-Clause
44
+ */
45
+ const t$1=globalThis,e$3=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$3=new WeakMap;let n$1 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$1)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$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$1=t=>new n$1("string"==typeof t?t:t+"",void 0,s$1),i$3=(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$1(o,t,s$1)},S=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$1(e)})(t):t;
46
+
47
+ /**
48
+ * @license
49
+ * Copyright 2017 Google LLC
50
+ * SPDX-License-Identifier: BSD-3-Clause
51
+ */const{is:i$2,defineProperty:e$2,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o$2,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l: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=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;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){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$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(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}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r(t),...o$2(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$1(s));}else void 0!==s&&i.push(c$1(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(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).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;this._$Em=e,this[e]=h.fromAttribute(s,t.type)??this._$Ej?.get(e)??null,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)(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.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.0");
52
+
53
+ /**
54
+ * @license
55
+ * Copyright 2017 Google LLC
56
+ * SPDX-License-Identifier: BSD-3-Clause
57
+ */const s=globalThis;let i$1 = class i extends y{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(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}};i$1._$litElement$=true,i$1["finalized"]=true,s.litElementHydrateSupport?.({LitElement:i$1});const o$1=s.litElementPolyfillSupport;o$1?.({LitElement:i$1});(s.litElementVersions??=[]).push("4.2.0");
58
+
59
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
60
+ // See LICENSE in the project root for license information.
61
+
62
+ // ---------------------------------------------------------------------
63
+
64
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
65
+
66
+ let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
67
+
68
+ /* eslint-disable jsdoc/require-param */
69
+
70
+ /**
71
+ * This will register a new custom element with the browser.
72
+ * @param {String} name - The name of the custom element.
73
+ * @param {Object} componentClass - The class to register as a custom element.
74
+ * @returns {void}
75
+ */
76
+ registerComponent(name, componentClass) {
77
+ if (!customElements.get(name)) {
78
+ customElements.define(name, class extends componentClass {});
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Finds and returns the closest HTML Element based on a selector.
84
+ * @returns {void}
85
+ */
86
+ closestElement(
87
+ selector, // selector like in .closest()
88
+ base = this, // extra functionality to skip a parent
89
+ __Closest = (el, found = el && el.closest(selector)) =>
90
+ !el || el === document || el === window
91
+ ? null // standard .closest() returns null for non-found selectors also
92
+ : found
93
+ ? found // found a selector INside this element
94
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
95
+ ) {
96
+ return __Closest(base);
97
+ }
98
+ /* eslint-enable jsdoc/require-param */
99
+
100
+ /**
101
+ * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
102
+ * @param {Object} elem - The element to check.
103
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
104
+ * @returns {void}
105
+ */
106
+ handleComponentTagRename(elem, tagName) {
107
+ const tag = tagName.toLowerCase();
108
+ const elemTag = elem.tagName.toLowerCase();
109
+
110
+ if (elemTag !== tag) {
111
+ elem.setAttribute(tag, true);
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Validates if an element is a specific Auro component.
117
+ * @param {Object} elem - The element to validate.
118
+ * @param {String} tagName - The name of the Auro component to check against.
119
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
120
+ */
121
+ elementMatch(elem, tagName) {
122
+ const tag = tagName.toLowerCase();
123
+ const elemTag = elem.tagName.toLowerCase();
124
+
125
+ return elemTag === tag || elem.hasAttribute(tag);
126
+ }
127
+ };
128
+
129
+ /**
130
+ * Custom positioning reference element.
131
+ * @see https://floating-ui.com/docs/virtual-elements
132
+ */
133
+
134
+ const sides = ['top', 'right', 'bottom', 'left'];
135
+ const alignments = ['start', 'end'];
136
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
137
+ const min = Math.min;
138
+ const max = Math.max;
139
+ const round = Math.round;
140
+ const floor = Math.floor;
141
+ const createCoords = v => ({
142
+ x: v,
143
+ y: v
144
+ });
145
+ const oppositeSideMap = {
146
+ left: 'right',
147
+ right: 'left',
148
+ bottom: 'top',
149
+ top: 'bottom'
150
+ };
151
+ const oppositeAlignmentMap = {
152
+ start: 'end',
153
+ end: 'start'
154
+ };
155
+ function evaluate(value, param) {
156
+ return typeof value === 'function' ? value(param) : value;
157
+ }
158
+ function getSide(placement) {
159
+ return placement.split('-')[0];
160
+ }
161
+ function getAlignment(placement) {
162
+ return placement.split('-')[1];
163
+ }
164
+ function getOppositeAxis(axis) {
165
+ return axis === 'x' ? 'y' : 'x';
166
+ }
167
+ function getAxisLength(axis) {
168
+ return axis === 'y' ? 'height' : 'width';
169
+ }
170
+ function getSideAxis(placement) {
171
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
172
+ }
173
+ function getAlignmentAxis(placement) {
174
+ return getOppositeAxis(getSideAxis(placement));
175
+ }
176
+ function getAlignmentSides(placement, rects, rtl) {
177
+ if (rtl === void 0) {
178
+ rtl = false;
179
+ }
180
+ const alignment = getAlignment(placement);
181
+ const alignmentAxis = getAlignmentAxis(placement);
182
+ const length = getAxisLength(alignmentAxis);
183
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
184
+ if (rects.reference[length] > rects.floating[length]) {
185
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
186
+ }
187
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
188
+ }
189
+ function getExpandedPlacements(placement) {
190
+ const oppositePlacement = getOppositePlacement(placement);
191
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
192
+ }
193
+ function getOppositeAlignmentPlacement(placement) {
194
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
195
+ }
196
+ function getSideList(side, isStart, rtl) {
197
+ const lr = ['left', 'right'];
198
+ const rl = ['right', 'left'];
199
+ const tb = ['top', 'bottom'];
200
+ const bt = ['bottom', 'top'];
201
+ switch (side) {
202
+ case 'top':
203
+ case 'bottom':
204
+ if (rtl) return isStart ? rl : lr;
205
+ return isStart ? lr : rl;
206
+ case 'left':
207
+ case 'right':
208
+ return isStart ? tb : bt;
209
+ default:
210
+ return [];
211
+ }
212
+ }
213
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
214
+ const alignment = getAlignment(placement);
215
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
216
+ if (alignment) {
217
+ list = list.map(side => side + "-" + alignment);
218
+ if (flipAlignment) {
219
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
220
+ }
221
+ }
222
+ return list;
223
+ }
224
+ function getOppositePlacement(placement) {
225
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
226
+ }
227
+ function expandPaddingObject(padding) {
228
+ return {
229
+ top: 0,
230
+ right: 0,
231
+ bottom: 0,
232
+ left: 0,
233
+ ...padding
234
+ };
235
+ }
236
+ function getPaddingObject(padding) {
237
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
238
+ top: padding,
239
+ right: padding,
240
+ bottom: padding,
241
+ left: padding
242
+ };
243
+ }
244
+ function rectToClientRect(rect) {
245
+ const {
246
+ x,
247
+ y,
248
+ width,
249
+ height
250
+ } = rect;
251
+ return {
252
+ width,
253
+ height,
254
+ top: y,
255
+ left: x,
256
+ right: x + width,
257
+ bottom: y + height,
258
+ x,
259
+ y
260
+ };
261
+ }
262
+
263
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
264
+ let {
265
+ reference,
266
+ floating
267
+ } = _ref;
268
+ const sideAxis = getSideAxis(placement);
269
+ const alignmentAxis = getAlignmentAxis(placement);
270
+ const alignLength = getAxisLength(alignmentAxis);
271
+ const side = getSide(placement);
272
+ const isVertical = sideAxis === 'y';
273
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
274
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
275
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
276
+ let coords;
277
+ switch (side) {
278
+ case 'top':
279
+ coords = {
280
+ x: commonX,
281
+ y: reference.y - floating.height
282
+ };
283
+ break;
284
+ case 'bottom':
285
+ coords = {
286
+ x: commonX,
287
+ y: reference.y + reference.height
288
+ };
289
+ break;
290
+ case 'right':
291
+ coords = {
292
+ x: reference.x + reference.width,
293
+ y: commonY
294
+ };
295
+ break;
296
+ case 'left':
297
+ coords = {
298
+ x: reference.x - floating.width,
299
+ y: commonY
300
+ };
301
+ break;
302
+ default:
303
+ coords = {
304
+ x: reference.x,
305
+ y: reference.y
306
+ };
307
+ }
308
+ switch (getAlignment(placement)) {
309
+ case 'start':
310
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
311
+ break;
312
+ case 'end':
313
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
314
+ break;
315
+ }
316
+ return coords;
317
+ }
318
+
319
+ /**
320
+ * Computes the `x` and `y` coordinates that will place the floating element
321
+ * next to a given reference element.
322
+ *
323
+ * This export does not have any `platform` interface logic. You will need to
324
+ * write one for the platform you are using Floating UI with.
325
+ */
326
+ const computePosition$1 = async (reference, floating, config) => {
327
+ const {
328
+ placement = 'bottom',
329
+ strategy = 'absolute',
330
+ middleware = [],
331
+ platform
332
+ } = config;
333
+ const validMiddleware = middleware.filter(Boolean);
334
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
335
+ let rects = await platform.getElementRects({
336
+ reference,
337
+ floating,
338
+ strategy
339
+ });
340
+ let {
341
+ x,
342
+ y
343
+ } = computeCoordsFromPlacement(rects, placement, rtl);
344
+ let statefulPlacement = placement;
345
+ let middlewareData = {};
346
+ let resetCount = 0;
347
+ for (let i = 0; i < validMiddleware.length; i++) {
348
+ const {
349
+ name,
350
+ fn
351
+ } = validMiddleware[i];
352
+ const {
353
+ x: nextX,
354
+ y: nextY,
355
+ data,
356
+ reset
357
+ } = await fn({
358
+ x,
359
+ y,
360
+ initialPlacement: placement,
361
+ placement: statefulPlacement,
362
+ strategy,
363
+ middlewareData,
364
+ rects,
365
+ platform,
366
+ elements: {
367
+ reference,
368
+ floating
369
+ }
370
+ });
371
+ x = nextX != null ? nextX : x;
372
+ y = nextY != null ? nextY : y;
373
+ middlewareData = {
374
+ ...middlewareData,
375
+ [name]: {
376
+ ...middlewareData[name],
377
+ ...data
378
+ }
379
+ };
380
+ if (reset && resetCount <= 50) {
381
+ resetCount++;
382
+ if (typeof reset === 'object') {
383
+ if (reset.placement) {
384
+ statefulPlacement = reset.placement;
385
+ }
386
+ if (reset.rects) {
387
+ rects = reset.rects === true ? await platform.getElementRects({
388
+ reference,
389
+ floating,
390
+ strategy
391
+ }) : reset.rects;
392
+ }
393
+ ({
394
+ x,
395
+ y
396
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
397
+ }
398
+ i = -1;
399
+ }
400
+ }
401
+ return {
402
+ x,
403
+ y,
404
+ placement: statefulPlacement,
405
+ strategy,
406
+ middlewareData
407
+ };
408
+ };
409
+
410
+ /**
411
+ * Resolves with an object of overflow side offsets that determine how much the
412
+ * element is overflowing a given clipping boundary on each side.
413
+ * - positive = overflowing the boundary by that number of pixels
414
+ * - negative = how many pixels left before it will overflow
415
+ * - 0 = lies flush with the boundary
416
+ * @see https://floating-ui.com/docs/detectOverflow
417
+ */
418
+ async function detectOverflow(state, options) {
419
+ var _await$platform$isEle;
420
+ if (options === void 0) {
421
+ options = {};
422
+ }
423
+ const {
424
+ x,
425
+ y,
426
+ platform,
427
+ rects,
428
+ elements,
429
+ strategy
430
+ } = state;
431
+ const {
432
+ boundary = 'clippingAncestors',
433
+ rootBoundary = 'viewport',
434
+ elementContext = 'floating',
435
+ altBoundary = false,
436
+ padding = 0
437
+ } = evaluate(options, state);
438
+ const paddingObject = getPaddingObject(padding);
439
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
440
+ const element = elements[altBoundary ? altContext : elementContext];
441
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
442
+ 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))),
443
+ boundary,
444
+ rootBoundary,
445
+ strategy
446
+ }));
447
+ const rect = elementContext === 'floating' ? {
448
+ x,
449
+ y,
450
+ width: rects.floating.width,
451
+ height: rects.floating.height
452
+ } : rects.reference;
453
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
454
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
455
+ x: 1,
456
+ y: 1
457
+ } : {
458
+ x: 1,
459
+ y: 1
460
+ };
461
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
462
+ elements,
463
+ rect,
464
+ offsetParent,
465
+ strategy
466
+ }) : rect);
467
+ return {
468
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
469
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
470
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
471
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
472
+ };
473
+ }
474
+
475
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
476
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
477
+ return allowedPlacementsSortedByAlignment.filter(placement => {
478
+ if (alignment) {
479
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
480
+ }
481
+ return true;
482
+ });
483
+ }
484
+ /**
485
+ * Optimizes the visibility of the floating element by choosing the placement
486
+ * that has the most space available automatically, without needing to specify a
487
+ * preferred placement. Alternative to `flip`.
488
+ * @see https://floating-ui.com/docs/autoPlacement
489
+ */
490
+ const autoPlacement$1 = function (options) {
491
+ if (options === void 0) {
492
+ options = {};
493
+ }
494
+ return {
495
+ name: 'autoPlacement',
496
+ options,
497
+ async fn(state) {
498
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
499
+ const {
500
+ rects,
501
+ middlewareData,
502
+ placement,
503
+ platform,
504
+ elements
505
+ } = state;
506
+ const {
507
+ crossAxis = false,
508
+ alignment,
509
+ allowedPlacements = placements,
510
+ autoAlignment = true,
511
+ ...detectOverflowOptions
512
+ } = evaluate(options, state);
513
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
514
+ const overflow = await detectOverflow(state, detectOverflowOptions);
515
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
516
+ const currentPlacement = placements$1[currentIndex];
517
+ if (currentPlacement == null) {
518
+ return {};
519
+ }
520
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
521
+
522
+ // Make `computeCoords` start from the right place.
523
+ if (placement !== currentPlacement) {
524
+ return {
525
+ reset: {
526
+ placement: placements$1[0]
527
+ }
528
+ };
529
+ }
530
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
531
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
532
+ placement: currentPlacement,
533
+ overflows: currentOverflows
534
+ }];
535
+ const nextPlacement = placements$1[currentIndex + 1];
536
+
537
+ // There are more placements to check.
538
+ if (nextPlacement) {
539
+ return {
540
+ data: {
541
+ index: currentIndex + 1,
542
+ overflows: allOverflows
543
+ },
544
+ reset: {
545
+ placement: nextPlacement
546
+ }
547
+ };
548
+ }
549
+ const placementsSortedByMostSpace = allOverflows.map(d => {
550
+ const alignment = getAlignment(d.placement);
551
+ return [d.placement, alignment && crossAxis ?
552
+ // Check along the mainAxis and main crossAxis side.
553
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
554
+ // Check only the mainAxis.
555
+ d.overflows[0], d.overflows];
556
+ }).sort((a, b) => a[1] - b[1]);
557
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
558
+ // Aligned placements should not check their opposite crossAxis
559
+ // side.
560
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
561
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
562
+ if (resetPlacement !== placement) {
563
+ return {
564
+ data: {
565
+ index: currentIndex + 1,
566
+ overflows: allOverflows
567
+ },
568
+ reset: {
569
+ placement: resetPlacement
570
+ }
571
+ };
572
+ }
573
+ return {};
574
+ }
575
+ };
576
+ };
577
+
578
+ /**
579
+ * Optimizes the visibility of the floating element by flipping the `placement`
580
+ * in order to keep it in view when the preferred placement(s) will overflow the
581
+ * clipping boundary. Alternative to `autoPlacement`.
582
+ * @see https://floating-ui.com/docs/flip
583
+ */
584
+ const flip$1 = function (options) {
585
+ if (options === void 0) {
586
+ options = {};
587
+ }
588
+ return {
589
+ name: 'flip',
590
+ options,
591
+ async fn(state) {
592
+ var _middlewareData$arrow, _middlewareData$flip;
593
+ const {
594
+ placement,
595
+ middlewareData,
596
+ rects,
597
+ initialPlacement,
598
+ platform,
599
+ elements
600
+ } = state;
601
+ const {
602
+ mainAxis: checkMainAxis = true,
603
+ crossAxis: checkCrossAxis = true,
604
+ fallbackPlacements: specifiedFallbackPlacements,
605
+ fallbackStrategy = 'bestFit',
606
+ fallbackAxisSideDirection = 'none',
607
+ flipAlignment = true,
608
+ ...detectOverflowOptions
609
+ } = evaluate(options, state);
610
+
611
+ // If a reset by the arrow was caused due to an alignment offset being
612
+ // added, we should skip any logic now since `flip()` has already done its
613
+ // work.
614
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
615
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
616
+ return {};
617
+ }
618
+ const side = getSide(placement);
619
+ const initialSideAxis = getSideAxis(initialPlacement);
620
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
621
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
622
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
623
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
624
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
625
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
626
+ }
627
+ const placements = [initialPlacement, ...fallbackPlacements];
628
+ const overflow = await detectOverflow(state, detectOverflowOptions);
629
+ const overflows = [];
630
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
631
+ if (checkMainAxis) {
632
+ overflows.push(overflow[side]);
633
+ }
634
+ if (checkCrossAxis) {
635
+ const sides = getAlignmentSides(placement, rects, rtl);
636
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
637
+ }
638
+ overflowsData = [...overflowsData, {
639
+ placement,
640
+ overflows
641
+ }];
642
+
643
+ // One or more sides is overflowing.
644
+ if (!overflows.every(side => side <= 0)) {
645
+ var _middlewareData$flip2, _overflowsData$filter;
646
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
647
+ const nextPlacement = placements[nextIndex];
648
+ if (nextPlacement) {
649
+ // Try next placement and re-run the lifecycle.
650
+ return {
651
+ data: {
652
+ index: nextIndex,
653
+ overflows: overflowsData
654
+ },
655
+ reset: {
656
+ placement: nextPlacement
657
+ }
658
+ };
659
+ }
660
+
661
+ // First, find the candidates that fit on the mainAxis side of overflow,
662
+ // then find the placement that fits the best on the main crossAxis side.
663
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
664
+
665
+ // Otherwise fallback.
666
+ if (!resetPlacement) {
667
+ switch (fallbackStrategy) {
668
+ case 'bestFit':
669
+ {
670
+ var _overflowsData$filter2;
671
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
672
+ if (hasFallbackAxisSideDirection) {
673
+ const currentSideAxis = getSideAxis(d.placement);
674
+ return currentSideAxis === initialSideAxis ||
675
+ // Create a bias to the `y` side axis due to horizontal
676
+ // reading directions favoring greater width.
677
+ currentSideAxis === 'y';
678
+ }
679
+ return true;
680
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
681
+ if (placement) {
682
+ resetPlacement = placement;
683
+ }
684
+ break;
685
+ }
686
+ case 'initialPlacement':
687
+ resetPlacement = initialPlacement;
688
+ break;
689
+ }
690
+ }
691
+ if (placement !== resetPlacement) {
692
+ return {
693
+ reset: {
694
+ placement: resetPlacement
695
+ }
696
+ };
697
+ }
698
+ }
699
+ return {};
700
+ }
701
+ };
702
+ };
703
+
704
+ // For type backwards-compatibility, the `OffsetOptions` type was also
705
+ // Derivable.
706
+
707
+ async function convertValueToCoords(state, options) {
708
+ const {
709
+ placement,
710
+ platform,
711
+ elements
712
+ } = state;
713
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
714
+ const side = getSide(placement);
715
+ const alignment = getAlignment(placement);
716
+ const isVertical = getSideAxis(placement) === 'y';
717
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
718
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
719
+ const rawValue = evaluate(options, state);
720
+
721
+ // eslint-disable-next-line prefer-const
722
+ let {
723
+ mainAxis,
724
+ crossAxis,
725
+ alignmentAxis
726
+ } = typeof rawValue === 'number' ? {
727
+ mainAxis: rawValue,
728
+ crossAxis: 0,
729
+ alignmentAxis: null
730
+ } : {
731
+ mainAxis: rawValue.mainAxis || 0,
732
+ crossAxis: rawValue.crossAxis || 0,
733
+ alignmentAxis: rawValue.alignmentAxis
734
+ };
735
+ if (alignment && typeof alignmentAxis === 'number') {
736
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
737
+ }
738
+ return isVertical ? {
739
+ x: crossAxis * crossAxisMulti,
740
+ y: mainAxis * mainAxisMulti
741
+ } : {
742
+ x: mainAxis * mainAxisMulti,
743
+ y: crossAxis * crossAxisMulti
744
+ };
745
+ }
746
+
747
+ /**
748
+ * Modifies the placement by translating the floating element along the
749
+ * specified axes.
750
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
751
+ * object may be passed.
752
+ * @see https://floating-ui.com/docs/offset
753
+ */
754
+ const offset$1 = function (options) {
755
+ if (options === void 0) {
756
+ options = 0;
757
+ }
758
+ return {
759
+ name: 'offset',
760
+ options,
761
+ async fn(state) {
762
+ var _middlewareData$offse, _middlewareData$arrow;
763
+ const {
764
+ x,
765
+ y,
766
+ placement,
767
+ middlewareData
768
+ } = state;
769
+ const diffCoords = await convertValueToCoords(state, options);
770
+
771
+ // If the placement is the same and the arrow caused an alignment offset
772
+ // then we don't need to change the positioning coordinates.
773
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
774
+ return {};
775
+ }
776
+ return {
777
+ x: x + diffCoords.x,
778
+ y: y + diffCoords.y,
779
+ data: {
780
+ ...diffCoords,
781
+ placement
782
+ }
783
+ };
784
+ }
785
+ };
786
+ };
787
+
788
+ function hasWindow() {
789
+ return typeof window !== 'undefined';
790
+ }
791
+ function getNodeName(node) {
792
+ if (isNode(node)) {
793
+ return (node.nodeName || '').toLowerCase();
794
+ }
795
+ // Mocked nodes in testing environments may not be instances of Node. By
796
+ // returning `#document` an infinite loop won't occur.
797
+ // https://github.com/floating-ui/floating-ui/issues/2317
798
+ return '#document';
799
+ }
800
+ function getWindow(node) {
801
+ var _node$ownerDocument;
802
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
803
+ }
804
+ function getDocumentElement(node) {
805
+ var _ref;
806
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
807
+ }
808
+ function isNode(value) {
809
+ if (!hasWindow()) {
810
+ return false;
811
+ }
812
+ return value instanceof Node || value instanceof getWindow(value).Node;
813
+ }
814
+ function isElement(value) {
815
+ if (!hasWindow()) {
816
+ return false;
817
+ }
818
+ return value instanceof Element || value instanceof getWindow(value).Element;
819
+ }
820
+ function isHTMLElement(value) {
821
+ if (!hasWindow()) {
822
+ return false;
823
+ }
824
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
825
+ }
826
+ function isShadowRoot(value) {
827
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
828
+ return false;
829
+ }
830
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
831
+ }
832
+ function isOverflowElement(element) {
833
+ const {
834
+ overflow,
835
+ overflowX,
836
+ overflowY,
837
+ display
838
+ } = getComputedStyle$1(element);
839
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
840
+ }
841
+ function isTableElement(element) {
842
+ return ['table', 'td', 'th'].includes(getNodeName(element));
843
+ }
844
+ function isTopLayer(element) {
845
+ return [':popover-open', ':modal'].some(selector => {
846
+ try {
847
+ return element.matches(selector);
848
+ } catch (e) {
849
+ return false;
850
+ }
851
+ });
852
+ }
853
+ function isContainingBlock(elementOrCss) {
854
+ const webkit = isWebKit();
855
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
856
+
857
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
858
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
859
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].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) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
860
+ }
861
+ function getContainingBlock(element) {
862
+ let currentNode = getParentNode(element);
863
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
864
+ if (isContainingBlock(currentNode)) {
865
+ return currentNode;
866
+ } else if (isTopLayer(currentNode)) {
867
+ return null;
868
+ }
869
+ currentNode = getParentNode(currentNode);
870
+ }
871
+ return null;
872
+ }
873
+ function isWebKit() {
874
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
875
+ return CSS.supports('-webkit-backdrop-filter', 'none');
876
+ }
877
+ function isLastTraversableNode(node) {
878
+ return ['html', 'body', '#document'].includes(getNodeName(node));
879
+ }
880
+ function getComputedStyle$1(element) {
881
+ return getWindow(element).getComputedStyle(element);
882
+ }
883
+ function getNodeScroll(element) {
884
+ if (isElement(element)) {
885
+ return {
886
+ scrollLeft: element.scrollLeft,
887
+ scrollTop: element.scrollTop
888
+ };
889
+ }
890
+ return {
891
+ scrollLeft: element.scrollX,
892
+ scrollTop: element.scrollY
893
+ };
894
+ }
895
+ function getParentNode(node) {
896
+ if (getNodeName(node) === 'html') {
897
+ return node;
898
+ }
899
+ const result =
900
+ // Step into the shadow DOM of the parent of a slotted node.
901
+ node.assignedSlot ||
902
+ // DOM Element detected.
903
+ node.parentNode ||
904
+ // ShadowRoot detected.
905
+ isShadowRoot(node) && node.host ||
906
+ // Fallback.
907
+ getDocumentElement(node);
908
+ return isShadowRoot(result) ? result.host : result;
909
+ }
910
+ function getNearestOverflowAncestor(node) {
911
+ const parentNode = getParentNode(node);
912
+ if (isLastTraversableNode(parentNode)) {
913
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
914
+ }
915
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
916
+ return parentNode;
917
+ }
918
+ return getNearestOverflowAncestor(parentNode);
919
+ }
920
+ function getOverflowAncestors(node, list, traverseIframes) {
921
+ var _node$ownerDocument2;
922
+ if (list === void 0) {
923
+ list = [];
924
+ }
925
+ if (traverseIframes === void 0) {
926
+ traverseIframes = true;
927
+ }
928
+ const scrollableAncestor = getNearestOverflowAncestor(node);
929
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
930
+ const win = getWindow(scrollableAncestor);
931
+ if (isBody) {
932
+ const frameElement = getFrameElement(win);
933
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
934
+ }
935
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
936
+ }
937
+ function getFrameElement(win) {
938
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
939
+ }
940
+
941
+ function getCssDimensions(element) {
942
+ const css = getComputedStyle$1(element);
943
+ // In testing environments, the `width` and `height` properties are empty
944
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
945
+ let width = parseFloat(css.width) || 0;
946
+ let height = parseFloat(css.height) || 0;
947
+ const hasOffset = isHTMLElement(element);
948
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
949
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
950
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
951
+ if (shouldFallback) {
952
+ width = offsetWidth;
953
+ height = offsetHeight;
954
+ }
955
+ return {
956
+ width,
957
+ height,
958
+ $: shouldFallback
959
+ };
960
+ }
961
+
962
+ function unwrapElement(element) {
963
+ return !isElement(element) ? element.contextElement : element;
964
+ }
965
+
966
+ function getScale(element) {
967
+ const domElement = unwrapElement(element);
968
+ if (!isHTMLElement(domElement)) {
969
+ return createCoords(1);
970
+ }
971
+ const rect = domElement.getBoundingClientRect();
972
+ const {
973
+ width,
974
+ height,
975
+ $
976
+ } = getCssDimensions(domElement);
977
+ let x = ($ ? round(rect.width) : rect.width) / width;
978
+ let y = ($ ? round(rect.height) : rect.height) / height;
979
+
980
+ // 0, NaN, or Infinity should always fallback to 1.
981
+
982
+ if (!x || !Number.isFinite(x)) {
983
+ x = 1;
984
+ }
985
+ if (!y || !Number.isFinite(y)) {
986
+ y = 1;
987
+ }
988
+ return {
989
+ x,
990
+ y
991
+ };
992
+ }
993
+
994
+ const noOffsets = /*#__PURE__*/createCoords(0);
995
+ function getVisualOffsets(element) {
996
+ const win = getWindow(element);
997
+ if (!isWebKit() || !win.visualViewport) {
998
+ return noOffsets;
999
+ }
1000
+ return {
1001
+ x: win.visualViewport.offsetLeft,
1002
+ y: win.visualViewport.offsetTop
1003
+ };
1004
+ }
1005
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1006
+ if (isFixed === void 0) {
1007
+ isFixed = false;
1008
+ }
1009
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1010
+ return false;
1011
+ }
1012
+ return isFixed;
1013
+ }
1014
+
1015
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1016
+ if (includeScale === void 0) {
1017
+ includeScale = false;
1018
+ }
1019
+ if (isFixedStrategy === void 0) {
1020
+ isFixedStrategy = false;
1021
+ }
1022
+ const clientRect = element.getBoundingClientRect();
1023
+ const domElement = unwrapElement(element);
1024
+ let scale = createCoords(1);
1025
+ if (includeScale) {
1026
+ if (offsetParent) {
1027
+ if (isElement(offsetParent)) {
1028
+ scale = getScale(offsetParent);
1029
+ }
1030
+ } else {
1031
+ scale = getScale(element);
1032
+ }
1033
+ }
1034
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1035
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1036
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1037
+ let width = clientRect.width / scale.x;
1038
+ let height = clientRect.height / scale.y;
1039
+ if (domElement) {
1040
+ const win = getWindow(domElement);
1041
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1042
+ let currentWin = win;
1043
+ let currentIFrame = getFrameElement(currentWin);
1044
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1045
+ const iframeScale = getScale(currentIFrame);
1046
+ const iframeRect = currentIFrame.getBoundingClientRect();
1047
+ const css = getComputedStyle$1(currentIFrame);
1048
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1049
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1050
+ x *= iframeScale.x;
1051
+ y *= iframeScale.y;
1052
+ width *= iframeScale.x;
1053
+ height *= iframeScale.y;
1054
+ x += left;
1055
+ y += top;
1056
+ currentWin = getWindow(currentIFrame);
1057
+ currentIFrame = getFrameElement(currentWin);
1058
+ }
1059
+ }
1060
+ return rectToClientRect({
1061
+ width,
1062
+ height,
1063
+ x,
1064
+ y
1065
+ });
1066
+ }
1067
+
1068
+ // If <html> has a CSS width greater than the viewport, then this will be
1069
+ // incorrect for RTL.
1070
+ function getWindowScrollBarX(element, rect) {
1071
+ const leftScroll = getNodeScroll(element).scrollLeft;
1072
+ if (!rect) {
1073
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1074
+ }
1075
+ return rect.left + leftScroll;
1076
+ }
1077
+
1078
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1079
+ if (ignoreScrollbarX === void 0) {
1080
+ ignoreScrollbarX = false;
1081
+ }
1082
+ const htmlRect = documentElement.getBoundingClientRect();
1083
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1084
+ // RTL <body> scrollbar.
1085
+ getWindowScrollBarX(documentElement, htmlRect));
1086
+ const y = htmlRect.top + scroll.scrollTop;
1087
+ return {
1088
+ x,
1089
+ y
1090
+ };
1091
+ }
1092
+
1093
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1094
+ let {
1095
+ elements,
1096
+ rect,
1097
+ offsetParent,
1098
+ strategy
1099
+ } = _ref;
1100
+ const isFixed = strategy === 'fixed';
1101
+ const documentElement = getDocumentElement(offsetParent);
1102
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1103
+ if (offsetParent === documentElement || topLayer && isFixed) {
1104
+ return rect;
1105
+ }
1106
+ let scroll = {
1107
+ scrollLeft: 0,
1108
+ scrollTop: 0
1109
+ };
1110
+ let scale = createCoords(1);
1111
+ const offsets = createCoords(0);
1112
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1113
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1114
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1115
+ scroll = getNodeScroll(offsetParent);
1116
+ }
1117
+ if (isHTMLElement(offsetParent)) {
1118
+ const offsetRect = getBoundingClientRect(offsetParent);
1119
+ scale = getScale(offsetParent);
1120
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1121
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1122
+ }
1123
+ }
1124
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1125
+ return {
1126
+ width: rect.width * scale.x,
1127
+ height: rect.height * scale.y,
1128
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1129
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1130
+ };
1131
+ }
1132
+
1133
+ function getClientRects(element) {
1134
+ return Array.from(element.getClientRects());
1135
+ }
1136
+
1137
+ // Gets the entire size of the scrollable document area, even extending outside
1138
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1139
+ function getDocumentRect(element) {
1140
+ const html = getDocumentElement(element);
1141
+ const scroll = getNodeScroll(element);
1142
+ const body = element.ownerDocument.body;
1143
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1144
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1145
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1146
+ const y = -scroll.scrollTop;
1147
+ if (getComputedStyle$1(body).direction === 'rtl') {
1148
+ x += max(html.clientWidth, body.clientWidth) - width;
1149
+ }
1150
+ return {
1151
+ width,
1152
+ height,
1153
+ x,
1154
+ y
1155
+ };
1156
+ }
1157
+
1158
+ function getViewportRect(element, strategy) {
1159
+ const win = getWindow(element);
1160
+ const html = getDocumentElement(element);
1161
+ const visualViewport = win.visualViewport;
1162
+ let width = html.clientWidth;
1163
+ let height = html.clientHeight;
1164
+ let x = 0;
1165
+ let y = 0;
1166
+ if (visualViewport) {
1167
+ width = visualViewport.width;
1168
+ height = visualViewport.height;
1169
+ const visualViewportBased = isWebKit();
1170
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1171
+ x = visualViewport.offsetLeft;
1172
+ y = visualViewport.offsetTop;
1173
+ }
1174
+ }
1175
+ return {
1176
+ width,
1177
+ height,
1178
+ x,
1179
+ y
1180
+ };
1181
+ }
1182
+
1183
+ // Returns the inner client rect, subtracting scrollbars if present.
1184
+ function getInnerBoundingClientRect(element, strategy) {
1185
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1186
+ const top = clientRect.top + element.clientTop;
1187
+ const left = clientRect.left + element.clientLeft;
1188
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1189
+ const width = element.clientWidth * scale.x;
1190
+ const height = element.clientHeight * scale.y;
1191
+ const x = left * scale.x;
1192
+ const y = top * scale.y;
1193
+ return {
1194
+ width,
1195
+ height,
1196
+ x,
1197
+ y
1198
+ };
1199
+ }
1200
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1201
+ let rect;
1202
+ if (clippingAncestor === 'viewport') {
1203
+ rect = getViewportRect(element, strategy);
1204
+ } else if (clippingAncestor === 'document') {
1205
+ rect = getDocumentRect(getDocumentElement(element));
1206
+ } else if (isElement(clippingAncestor)) {
1207
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1208
+ } else {
1209
+ const visualOffsets = getVisualOffsets(element);
1210
+ rect = {
1211
+ x: clippingAncestor.x - visualOffsets.x,
1212
+ y: clippingAncestor.y - visualOffsets.y,
1213
+ width: clippingAncestor.width,
1214
+ height: clippingAncestor.height
1215
+ };
1216
+ }
1217
+ return rectToClientRect(rect);
1218
+ }
1219
+ function hasFixedPositionAncestor(element, stopNode) {
1220
+ const parentNode = getParentNode(element);
1221
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1222
+ return false;
1223
+ }
1224
+ return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1225
+ }
1226
+
1227
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1228
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1229
+ // of the given element up the tree.
1230
+ function getClippingElementAncestors(element, cache) {
1231
+ const cachedResult = cache.get(element);
1232
+ if (cachedResult) {
1233
+ return cachedResult;
1234
+ }
1235
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1236
+ let currentContainingBlockComputedStyle = null;
1237
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1238
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1239
+
1240
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1241
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1242
+ const computedStyle = getComputedStyle$1(currentNode);
1243
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1244
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1245
+ currentContainingBlockComputedStyle = null;
1246
+ }
1247
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1248
+ if (shouldDropCurrentNode) {
1249
+ // Drop non-containing blocks.
1250
+ result = result.filter(ancestor => ancestor !== currentNode);
1251
+ } else {
1252
+ // Record last containing block for next iteration.
1253
+ currentContainingBlockComputedStyle = computedStyle;
1254
+ }
1255
+ currentNode = getParentNode(currentNode);
1256
+ }
1257
+ cache.set(element, result);
1258
+ return result;
1259
+ }
1260
+
1261
+ // Gets the maximum area that the element is visible in due to any number of
1262
+ // clipping ancestors.
1263
+ function getClippingRect(_ref) {
1264
+ let {
1265
+ element,
1266
+ boundary,
1267
+ rootBoundary,
1268
+ strategy
1269
+ } = _ref;
1270
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1271
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1272
+ const firstClippingAncestor = clippingAncestors[0];
1273
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1274
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1275
+ accRect.top = max(rect.top, accRect.top);
1276
+ accRect.right = min(rect.right, accRect.right);
1277
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1278
+ accRect.left = max(rect.left, accRect.left);
1279
+ return accRect;
1280
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1281
+ return {
1282
+ width: clippingRect.right - clippingRect.left,
1283
+ height: clippingRect.bottom - clippingRect.top,
1284
+ x: clippingRect.left,
1285
+ y: clippingRect.top
1286
+ };
1287
+ }
1288
+
1289
+ function getDimensions(element) {
1290
+ const {
1291
+ width,
1292
+ height
1293
+ } = getCssDimensions(element);
1294
+ return {
1295
+ width,
1296
+ height
1297
+ };
1298
+ }
1299
+
1300
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1301
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1302
+ const documentElement = getDocumentElement(offsetParent);
1303
+ const isFixed = strategy === 'fixed';
1304
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1305
+ let scroll = {
1306
+ scrollLeft: 0,
1307
+ scrollTop: 0
1308
+ };
1309
+ const offsets = createCoords(0);
1310
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1311
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1312
+ scroll = getNodeScroll(offsetParent);
1313
+ }
1314
+ if (isOffsetParentAnElement) {
1315
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1316
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1317
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1318
+ } else if (documentElement) {
1319
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1320
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1321
+ offsets.x = getWindowScrollBarX(documentElement);
1322
+ }
1323
+ }
1324
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1325
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1326
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1327
+ return {
1328
+ x,
1329
+ y,
1330
+ width: rect.width,
1331
+ height: rect.height
1332
+ };
1333
+ }
1334
+
1335
+ function isStaticPositioned(element) {
1336
+ return getComputedStyle$1(element).position === 'static';
1337
+ }
1338
+
1339
+ function getTrueOffsetParent(element, polyfill) {
1340
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1341
+ return null;
1342
+ }
1343
+ if (polyfill) {
1344
+ return polyfill(element);
1345
+ }
1346
+ let rawOffsetParent = element.offsetParent;
1347
+
1348
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1349
+ // while Chrome and Safari return the <body> element. The <body> element must
1350
+ // be used to perform the correct calculations even if the <html> element is
1351
+ // non-static.
1352
+ if (getDocumentElement(element) === rawOffsetParent) {
1353
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1354
+ }
1355
+ return rawOffsetParent;
1356
+ }
1357
+
1358
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1359
+ // such as table ancestors and cross browser bugs.
1360
+ function getOffsetParent(element, polyfill) {
1361
+ const win = getWindow(element);
1362
+ if (isTopLayer(element)) {
1363
+ return win;
1364
+ }
1365
+ if (!isHTMLElement(element)) {
1366
+ let svgOffsetParent = getParentNode(element);
1367
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1368
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1369
+ return svgOffsetParent;
1370
+ }
1371
+ svgOffsetParent = getParentNode(svgOffsetParent);
1372
+ }
1373
+ return win;
1374
+ }
1375
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1376
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1377
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1378
+ }
1379
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1380
+ return win;
1381
+ }
1382
+ return offsetParent || getContainingBlock(element) || win;
1383
+ }
1384
+
1385
+ const getElementRects = async function (data) {
1386
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1387
+ const getDimensionsFn = this.getDimensions;
1388
+ const floatingDimensions = await getDimensionsFn(data.floating);
1389
+ return {
1390
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1391
+ floating: {
1392
+ x: 0,
1393
+ y: 0,
1394
+ width: floatingDimensions.width,
1395
+ height: floatingDimensions.height
1396
+ }
1397
+ };
1398
+ };
1399
+
1400
+ function isRTL(element) {
1401
+ return getComputedStyle$1(element).direction === 'rtl';
1402
+ }
1403
+
1404
+ const platform = {
1405
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1406
+ getDocumentElement,
1407
+ getClippingRect,
1408
+ getOffsetParent,
1409
+ getElementRects,
1410
+ getClientRects,
1411
+ getDimensions,
1412
+ getScale,
1413
+ isElement,
1414
+ isRTL
1415
+ };
1416
+
1417
+ function rectsAreEqual(a, b) {
1418
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1419
+ }
1420
+
1421
+ // https://samthor.au/2021/observing-dom/
1422
+ function observeMove(element, onMove) {
1423
+ let io = null;
1424
+ let timeoutId;
1425
+ const root = getDocumentElement(element);
1426
+ function cleanup() {
1427
+ var _io;
1428
+ clearTimeout(timeoutId);
1429
+ (_io = io) == null || _io.disconnect();
1430
+ io = null;
1431
+ }
1432
+ function refresh(skip, threshold) {
1433
+ if (skip === void 0) {
1434
+ skip = false;
1435
+ }
1436
+ if (threshold === void 0) {
1437
+ threshold = 1;
1438
+ }
1439
+ cleanup();
1440
+ const elementRectForRootMargin = element.getBoundingClientRect();
1441
+ const {
1442
+ left,
1443
+ top,
1444
+ width,
1445
+ height
1446
+ } = elementRectForRootMargin;
1447
+ if (!skip) {
1448
+ onMove();
1449
+ }
1450
+ if (!width || !height) {
1451
+ return;
1452
+ }
1453
+ const insetTop = floor(top);
1454
+ const insetRight = floor(root.clientWidth - (left + width));
1455
+ const insetBottom = floor(root.clientHeight - (top + height));
1456
+ const insetLeft = floor(left);
1457
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1458
+ const options = {
1459
+ rootMargin,
1460
+ threshold: max(0, min(1, threshold)) || 1
1461
+ };
1462
+ let isFirstUpdate = true;
1463
+ function handleObserve(entries) {
1464
+ const ratio = entries[0].intersectionRatio;
1465
+ if (ratio !== threshold) {
1466
+ if (!isFirstUpdate) {
1467
+ return refresh();
1468
+ }
1469
+ if (!ratio) {
1470
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1471
+ // to prevent an infinite loop of updates.
1472
+ timeoutId = setTimeout(() => {
1473
+ refresh(false, 1e-7);
1474
+ }, 1000);
1475
+ } else {
1476
+ refresh(false, ratio);
1477
+ }
1478
+ }
1479
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1480
+ // It's possible that even though the ratio is reported as 1, the
1481
+ // element is not actually fully within the IntersectionObserver's root
1482
+ // area anymore. This can happen under performance constraints. This may
1483
+ // be a bug in the browser's IntersectionObserver implementation. To
1484
+ // work around this, we compare the element's bounding rect now with
1485
+ // what it was at the time we created the IntersectionObserver. If they
1486
+ // are not equal then the element moved, so we refresh.
1487
+ refresh();
1488
+ }
1489
+ isFirstUpdate = false;
1490
+ }
1491
+
1492
+ // Older browsers don't support a `document` as the root and will throw an
1493
+ // error.
1494
+ try {
1495
+ io = new IntersectionObserver(handleObserve, {
1496
+ ...options,
1497
+ // Handle <iframe>s
1498
+ root: root.ownerDocument
1499
+ });
1500
+ } catch (e) {
1501
+ io = new IntersectionObserver(handleObserve, options);
1502
+ }
1503
+ io.observe(element);
1504
+ }
1505
+ refresh(true);
1506
+ return cleanup;
1507
+ }
1508
+
1509
+ /**
1510
+ * Automatically updates the position of the floating element when necessary.
1511
+ * Should only be called when the floating element is mounted on the DOM or
1512
+ * visible on the screen.
1513
+ * @returns cleanup function that should be invoked when the floating element is
1514
+ * removed from the DOM or hidden from the screen.
1515
+ * @see https://floating-ui.com/docs/autoUpdate
1516
+ */
1517
+ function autoUpdate(reference, floating, update, options) {
1518
+ if (options === void 0) {
1519
+ options = {};
1520
+ }
1521
+ const {
1522
+ ancestorScroll = true,
1523
+ ancestorResize = true,
1524
+ elementResize = typeof ResizeObserver === 'function',
1525
+ layoutShift = typeof IntersectionObserver === 'function',
1526
+ animationFrame = false
1527
+ } = options;
1528
+ const referenceEl = unwrapElement(reference);
1529
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1530
+ ancestors.forEach(ancestor => {
1531
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1532
+ passive: true
1533
+ });
1534
+ ancestorResize && ancestor.addEventListener('resize', update);
1535
+ });
1536
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1537
+ let reobserveFrame = -1;
1538
+ let resizeObserver = null;
1539
+ if (elementResize) {
1540
+ resizeObserver = new ResizeObserver(_ref => {
1541
+ let [firstEntry] = _ref;
1542
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1543
+ // Prevent update loops when using the `size` middleware.
1544
+ // https://github.com/floating-ui/floating-ui/issues/1740
1545
+ resizeObserver.unobserve(floating);
1546
+ cancelAnimationFrame(reobserveFrame);
1547
+ reobserveFrame = requestAnimationFrame(() => {
1548
+ var _resizeObserver;
1549
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1550
+ });
1551
+ }
1552
+ update();
1553
+ });
1554
+ if (referenceEl && !animationFrame) {
1555
+ resizeObserver.observe(referenceEl);
1556
+ }
1557
+ resizeObserver.observe(floating);
1558
+ }
1559
+ let frameId;
1560
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1561
+ if (animationFrame) {
1562
+ frameLoop();
1563
+ }
1564
+ function frameLoop() {
1565
+ const nextRefRect = getBoundingClientRect(reference);
1566
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1567
+ update();
1568
+ }
1569
+ prevRefRect = nextRefRect;
1570
+ frameId = requestAnimationFrame(frameLoop);
1571
+ }
1572
+ update();
1573
+ return () => {
1574
+ var _resizeObserver2;
1575
+ ancestors.forEach(ancestor => {
1576
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1577
+ ancestorResize && ancestor.removeEventListener('resize', update);
1578
+ });
1579
+ cleanupIo == null || cleanupIo();
1580
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1581
+ resizeObserver = null;
1582
+ if (animationFrame) {
1583
+ cancelAnimationFrame(frameId);
1584
+ }
1585
+ };
1586
+ }
1587
+
1588
+ /**
1589
+ * Modifies the placement by translating the floating element along the
1590
+ * specified axes.
1591
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1592
+ * object may be passed.
1593
+ * @see https://floating-ui.com/docs/offset
1594
+ */
1595
+ const offset = offset$1;
1596
+
1597
+ /**
1598
+ * Optimizes the visibility of the floating element by choosing the placement
1599
+ * that has the most space available automatically, without needing to specify a
1600
+ * preferred placement. Alternative to `flip`.
1601
+ * @see https://floating-ui.com/docs/autoPlacement
1602
+ */
1603
+ const autoPlacement = autoPlacement$1;
1604
+
1605
+ /**
1606
+ * Optimizes the visibility of the floating element by flipping the `placement`
1607
+ * in order to keep it in view when the preferred placement(s) will overflow the
1608
+ * clipping boundary. Alternative to `autoPlacement`.
1609
+ * @see https://floating-ui.com/docs/flip
1610
+ */
1611
+ const flip = flip$1;
1612
+
1613
+ /**
1614
+ * Computes the `x` and `y` coordinates that will place the floating element
1615
+ * next to a given reference element.
1616
+ */
1617
+ const computePosition = (reference, floating, options) => {
1618
+ // This caches the expensive `getClippingElementAncestors` function so that
1619
+ // multiple lifecycle resets re-use the same result. It only lives for a
1620
+ // single call. If other functions become expensive, we can add them as well.
1621
+ const cache = new Map();
1622
+ const mergedOptions = {
1623
+ platform,
1624
+ ...options
1625
+ };
1626
+ const platformWithCache = {
1627
+ ...mergedOptions.platform,
1628
+ _c: cache
1629
+ };
1630
+ return computePosition$1(reference, floating, {
1631
+ ...mergedOptions,
1632
+ platform: platformWithCache
1633
+ });
1634
+ };
1635
+
1636
+ /* eslint-disable line-comment-position, no-inline-comments */
1637
+
1638
+
1639
+
1640
+ const MAX_CONFIGURATION_COUNT = 10;
1641
+
1642
+ class AuroFloatingUI {
1643
+
1644
+ /**
1645
+ * @private
1646
+ */
1647
+ static isMousePressed = false;
1648
+
1649
+ /**
1650
+ * @private
1651
+ */
1652
+ static isMousePressHandlerInitialized = false;
1653
+
1654
+ /**
1655
+ * @private
1656
+ */
1657
+ static setupMousePressChecker() {
1658
+ if (!AuroFloatingUI.isMousePressHandlerInitialized && window && window.addEventListener) {
1659
+ AuroFloatingUI.isMousePressHandlerInitialized = true;
1660
+
1661
+ const mouseEventGlobalHandler = (event) => {
1662
+ AuroFloatingUI.isMousePressed = event.type === 'mousedown';
1663
+ };
1664
+
1665
+ window.addEventListener('mousedown', mouseEventGlobalHandler);
1666
+ window.addEventListener('mouseup', mouseEventGlobalHandler);
1667
+ }
1668
+ }
1669
+
1670
+ constructor(element, behavior) {
1671
+ this.element = element;
1672
+ this.behavior = behavior;
1673
+
1674
+ // Store event listener references for cleanup
1675
+ this.focusHandler = null;
1676
+ this.clickHandler = null;
1677
+ this.keyDownHandler = null;
1678
+
1679
+ /**
1680
+ * @private
1681
+ */
1682
+ this.configureTrial = 0;
1683
+
1684
+ /**
1685
+ * @private
1686
+ */
1687
+ this.eventPrefix = undefined;
1688
+
1689
+ /**
1690
+ * @private
1691
+ */
1692
+ this.id = undefined;
1693
+
1694
+ /**
1695
+ * @private
1696
+ */
1697
+ this.showing = false;
1698
+
1699
+ /**
1700
+ * @private
1701
+ */
1702
+ this.strategy = undefined;
1703
+ }
1704
+
1705
+ /**
1706
+ * Mirrors the size of the bibSizer element to the bib content.
1707
+ * Copies the width, height, max-width, and max-height styles from the bibSizer element to the bib content container.
1708
+ * This ensures that the bib content has the same dimensions as the sizer element.
1709
+ */
1710
+ mirrorSize() {
1711
+ // mirror the boxsize from bibSizer
1712
+ if (this.element.bibSizer) {
1713
+ const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1714
+ const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1715
+ if (sizerStyle.width !== '0px') {
1716
+ bibContent.style.width = sizerStyle.width;
1717
+ }
1718
+ if (sizerStyle.height !== '0px') {
1719
+ bibContent.style.height = sizerStyle.height;
1720
+ }
1721
+ bibContent.style.maxWidth = sizerStyle.maxWidth;
1722
+ bibContent.style.maxHeight = sizerStyle.maxHeight;
1723
+ }
1724
+ }
1725
+
1726
+ /**
1727
+ * @private
1728
+ * Determines the positioning strategy based on the current viewport size and mobile breakpoint.
1729
+ *
1730
+ * This method checks if the current viewport width is less than or equal to the specified mobile fullscreen breakpoint
1731
+ * defined in the bib element. If it is, the strategy is set to 'fullscreen'; otherwise, it defaults to 'floating'.
1732
+ *
1733
+ * @returns {String} The positioning strategy, one of 'fullscreen', 'floating', 'cover'.
1734
+ */
1735
+ getPositioningStrategy() {
1736
+ const breakpoint = this.element.bib.mobileFullscreenBreakpoint || this.element.floaterConfig?.fullscreenBreakpoint;
1737
+ switch (this.behavior) {
1738
+ case "tooltip":
1739
+ return "floating";
1740
+ case "dialog":
1741
+ case "drawer":
1742
+ if (breakpoint) {
1743
+ const smallerThanBreakpoint = window.matchMedia(`(max-width: ${breakpoint})`).matches;
1744
+
1745
+ this.element.expanded = smallerThanBreakpoint;
1746
+ }
1747
+ if (this.element.nested) {
1748
+ return "cover";
1749
+ }
1750
+ return 'fullscreen';
1751
+ case "dropdown":
1752
+ case undefined:
1753
+ case null:
1754
+ if (breakpoint) {
1755
+ const smallerThanBreakpoint = window.matchMedia(`(max-width: ${breakpoint})`).matches;
1756
+ if (smallerThanBreakpoint) {
1757
+ return 'fullscreen';
1758
+ }
1759
+ }
1760
+ return "floating";
1761
+ default:
1762
+ return this.behavior;
1763
+ }
1764
+ }
1765
+
1766
+ /**
1767
+ * @private
1768
+ * Positions the bib element based on the current configuration and positioning strategy.
1769
+ *
1770
+ * This method determines the appropriate positioning strategy (fullscreen or not) and configures the bib accordingly.
1771
+ * It also sets up middleware for the floater configuration, computes the position of the bib relative to the trigger element,
1772
+ * and applies the calculated position to the bib's style.
1773
+ */
1774
+ position() {
1775
+ const strategy = this.getPositioningStrategy();
1776
+ this.configureBibStrategy(strategy);
1777
+
1778
+ if (strategy === 'floating') {
1779
+ this.mirrorSize();
1780
+ // Define the middlware for the floater configuration
1781
+ const middleware = [
1782
+ offset(this.element.floaterConfig?.offset || 0),
1783
+ ...this.element.floaterConfig?.flip ? [flip()] : [], // Add flip middleware if flip is enabled.
1784
+ ...this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : [], // Add autoPlacement middleware if autoPlacement is enabled.
1785
+ ];
1786
+
1787
+ // Compute the position of the bib
1788
+ computePosition(this.element.trigger, this.element.bib, {
1789
+ placement: this.element.floaterConfig?.placement,
1790
+ middleware: middleware || []
1791
+ }).then(({ x, y }) => { // eslint-disable-line id-length
1792
+ Object.assign(this.element.bib.style, {
1793
+ left: `${x}px`,
1794
+ top: `${y}px`,
1795
+ });
1796
+ });
1797
+ } else if (strategy === 'cover') {
1798
+ // Compute the position of the bib
1799
+ computePosition(this.element.parentNode, this.element.bib, {
1800
+ placement: 'bottom-start'
1801
+ }).then(({ x, y }) => { // eslint-disable-line id-length
1802
+ Object.assign(this.element.bib.style, {
1803
+ left: `${x}px`,
1804
+ top: `${y - this.element.parentNode.offsetHeight}px`,
1805
+ width: `${this.element.parentNode.offsetWidth}px`,
1806
+ height: `${this.element.parentNode.offsetHeight}px`
1807
+ });
1808
+ });
1809
+ }
1810
+ }
1811
+
1812
+ /**
1813
+ * @private
1814
+ * Controls whether to lock the scrolling for the document's body.
1815
+ * @param {Boolean} lock - If true, locks the body's scrolling functionlity; otherwise, unlock.
1816
+ */
1817
+ lockScroll(lock = true) {
1818
+ if (lock) {
1819
+ document.body.style.overflow = 'hidden'; // hide body's scrollbar
1820
+
1821
+ // Move `bib` by the amount the viewport is shifted to stay aligned in fullscreen.
1822
+ this.element.bib.style.transform = `translateY(${visualViewport.offsetTop}px)`;
1823
+ } else {
1824
+ document.body.style.overflow = '';
1825
+ }
1826
+ }
1827
+
1828
+ /**
1829
+ * @private
1830
+ * Configures the bib element's display strategy.
1831
+ *
1832
+ * Sets the bib to fullscreen or floating mode based on the provided strategy.
1833
+ * Dispatches a 'strategy-change' event if the strategy changes.
1834
+ *
1835
+ * @param {string} strategy - The positioning strategy ('fullscreen' or 'floating').
1836
+ */
1837
+ configureBibStrategy(value) {
1838
+ if (value === 'fullscreen') {
1839
+ this.element.isBibFullscreen = true;
1840
+ // reset the prev position
1841
+ this.element.bib.setAttribute('isfullscreen', "");
1842
+ this.element.bib.style.position = 'fixed';
1843
+ this.element.bib.style.top = "0px";
1844
+ this.element.bib.style.left = "0px";
1845
+ this.element.bib.style.width = '';
1846
+ this.element.bib.style.height = '';
1847
+
1848
+ // reset the size that was mirroring `size` css-part
1849
+ const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1850
+ if (bibContent) {
1851
+ bibContent.style.width = '';
1852
+ bibContent.style.height = '';
1853
+ bibContent.style.maxWidth = '';
1854
+ bibContent.style.maxHeight = `${window.visualViewport.height}px`;
1855
+ this.configureTrial = 0;
1856
+ } else if (this.configureTrial < MAX_CONFIGURATION_COUNT) {
1857
+ this.configureTrial += 1;
1858
+
1859
+ setTimeout(() => {
1860
+ this.configureBibStrategy(value);
1861
+ }, 0);
1862
+ }
1863
+
1864
+ if (this.element.isPopoverVisible) {
1865
+ this.lockScroll(true);
1866
+ }
1867
+ } else {
1868
+ this.element.bib.style.position = '';
1869
+ this.element.bib.removeAttribute('isfullscreen');
1870
+ this.element.isBibFullscreen = false;
1871
+ }
1872
+
1873
+ const isChanged = this.strategy && this.strategy !== value;
1874
+ this.strategy = value;
1875
+ if (isChanged) {
1876
+ const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-strategy-change` : 'strategy-change', {
1877
+ detail: {
1878
+ value,
1879
+ },
1880
+ composed: true
1881
+ });
1882
+
1883
+ this.element.dispatchEvent(event);
1884
+ }
1885
+ }
1886
+
1887
+ updateState() {
1888
+ const isVisible = this.element.isPopoverVisible;
1889
+ if (!isVisible) {
1890
+ this.cleanupHideHandlers();
1891
+ try {
1892
+ this.element.cleanup?.();
1893
+ } catch (error) {
1894
+ // Do nothing
1895
+ }
1896
+ }
1897
+ }
1898
+
1899
+ /**
1900
+ * @private
1901
+ * getting called on 'blur' in trigger or `focusin` in document
1902
+ *
1903
+ * Hides the bib if focus moves outside of the trigger or bib, unless a 'noHideOnThisFocusLoss' flag is set.
1904
+ * This method checks if the currently active element is still within the trigger or bib.
1905
+ * If not, and if the bib isn't in fullscreen mode with focus lost, it hides the bib.
1906
+ */
1907
+ handleFocusLoss() {
1908
+ // if mouse is being pressed, skip and let click event to handle the action
1909
+ if (AuroFloatingUI.isMousePressed) {
1910
+ return;
1911
+ }
1912
+
1913
+ if (this.element.noHideOnThisFocusLoss ||
1914
+ this.element.hasAttribute('noHideOnThisFocusLoss')) {
1915
+ return;
1916
+ }
1917
+
1918
+ const { activeElement } = document;
1919
+ // if focus is still inside of trigger or bib, do not close
1920
+ if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1921
+ return;
1922
+ }
1923
+ // if fullscreen bib is still open and the focus is missing, do not close
1924
+ if (this.element.bib.hasAttribute('isfullscreen') && activeElement === document.body) {
1925
+ return;
1926
+ }
1927
+
1928
+ this.hideBib();
1929
+ }
1930
+
1931
+ setupHideHandlers() {
1932
+ this.preventFocusLoseOnBibClick = (event) => {
1933
+ event.preventDefault();
1934
+ event.stopPropagation();
1935
+ };
1936
+ this.element.bib.addEventListener('mousedown', this.preventFocusLoseOnBibClick);
1937
+
1938
+ // Define handlers & store references
1939
+ this.focusHandler = () => this.handleFocusLoss();
1940
+
1941
+ this.clickHandler = (evt) => {
1942
+ if ((!evt.composedPath().includes(this.element.trigger) &&
1943
+ !evt.composedPath().includes(this.element.bib)) ||
1944
+ (this.element.bib.backdrop && evt.composedPath().includes(this.element.bib.backdrop))) {
1945
+ const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
1946
+
1947
+ if (existedVisibleFloatingUI && existedVisibleFloatingUI.element.isPopoverVisible) {
1948
+ // if something else is open, close that
1949
+ existedVisibleFloatingUI.hideBib();
1950
+ document.expandedAuroFormkitDropdown = null;
1951
+ document.expandedAuroFloater = this;
1952
+ } else {
1953
+ this.hideBib();
1954
+ }
1955
+ }
1956
+ };
1957
+
1958
+ // ESC key handler
1959
+ this.keyDownHandler = (evt) => {
1960
+ if (evt.key === 'Escape' && this.element.isPopoverVisible) {
1961
+ const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
1962
+ if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this && existedVisibleFloatingUI.element.isPopoverVisible) {
1963
+ // if something else is open, let it handle itself
1964
+ return;
1965
+ }
1966
+ this.hideBib();
1967
+ }
1968
+ };
1969
+
1970
+ if (this.behavior !== 'drawer' && this.behavior !== 'dialog') {
1971
+ // Add event listeners using the stored references
1972
+ document.addEventListener('focusin', this.focusHandler);
1973
+ }
1974
+
1975
+ document.addEventListener('keydown', this.keyDownHandler);
1976
+
1977
+ // send this task to the end of queue to prevent conflicting
1978
+ // it conflicts if showBib gets call from a button that's not this.element.trigger
1979
+ setTimeout(() => {
1980
+ window.addEventListener('click', this.clickHandler);
1981
+ }, 0);
1982
+ }
1983
+
1984
+ cleanupHideHandlers() {
1985
+ // Remove event listeners if they exist
1986
+
1987
+ if (this.preventFocusLoseOnBibClick) {
1988
+ this.element.bib.removeEventListener('mousedown', this.preventFocusLoseOnBibClick);
1989
+ delete this.preventFocusLoseOnBibClick;
1990
+ }
1991
+
1992
+ if (this.focusHandler) {
1993
+ document.removeEventListener('focusin', this.focusHandler);
1994
+ this.focusHandler = null;
1995
+ }
1996
+
1997
+ if (this.clickHandler) {
1998
+ window.removeEventListener('click', this.clickHandler);
1999
+ this.clickHandler = null;
2000
+ }
2001
+
2002
+ if (this.keyDownHandler) {
2003
+ document.removeEventListener('keydown', this.keyDownHandler);
2004
+ this.keyDownHandler = null;
2005
+ }
2006
+ }
2007
+
2008
+ handleUpdate(changedProperties) {
2009
+ if (changedProperties.has('isPopoverVisible')) {
2010
+ this.updateState();
2011
+ }
2012
+ }
2013
+
2014
+ updateCurrentExpandedDropdown() {
2015
+ // Close any other dropdown that is already open
2016
+ const existedVisibleFloatingUI = document.expandedAuroFormkitDropdown || document.expandedAuroFloater;
2017
+ if (existedVisibleFloatingUI && existedVisibleFloatingUI !== this &&
2018
+ existedVisibleFloatingUI.element.isPopoverVisible &&
2019
+ document.expandedAuroFloater.eventPrefix === this.eventPrefix) {
2020
+ document.expandedAuroFloater.hideBib();
2021
+ }
2022
+
2023
+ document.expandedAuroFloater = this;
2024
+ }
2025
+
2026
+ showBib() {
2027
+ if (!this.element.disabled && !this.showing) {
2028
+ this.updateCurrentExpandedDropdown();
2029
+ this.element.triggerChevron?.setAttribute('data-expanded', true);
2030
+
2031
+ // prevent double showing: isPopovervisible gets first and showBib gets called later
2032
+ if (!this.showing) {
2033
+ if (!this.element.modal) {
2034
+ this.setupHideHandlers();
2035
+ }
2036
+ this.showing = true;
2037
+ this.element.isPopoverVisible = true;
2038
+ this.position();
2039
+ this.dispatchEventDropdownToggle();
2040
+ }
2041
+
2042
+ // Setup auto update to handle resize and scroll
2043
+ this.element.cleanup = autoUpdate(this.element.trigger || this.element.parentNode, this.element.bib, () => {
2044
+ this.position();
2045
+ });
2046
+ }
2047
+ }
2048
+
2049
+ hideBib() {
2050
+ if (!this.element.disabled && !this.element.noToggle) {
2051
+ this.lockScroll(false);
2052
+ this.element.triggerChevron?.removeAttribute('data-expanded');
2053
+
2054
+ if (this.element.isPopoverVisible) {
2055
+ this.element.isPopoverVisible = false;
2056
+ }
2057
+ if (this.showing) {
2058
+ this.cleanupHideHandlers();
2059
+ this.showing = false;
2060
+ this.dispatchEventDropdownToggle();
2061
+ }
2062
+ }
2063
+ document.expandedAuroFloater = null;
2064
+ }
2065
+
2066
+ /**
2067
+ * @private
2068
+ * @returns {void} Dispatches event with an object showing the state of the dropdown.
2069
+ */
2070
+ dispatchEventDropdownToggle() {
2071
+ const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
2072
+ detail: {
2073
+ expanded: this.showing,
2074
+ },
2075
+ composed: true
2076
+ });
2077
+
2078
+ this.element.dispatchEvent(event);
2079
+ }
2080
+
2081
+ handleClick() {
2082
+ if (this.element.isPopoverVisible) {
2083
+ this.hideBib();
2084
+ } else {
2085
+ this.showBib();
2086
+ }
2087
+
2088
+ const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-triggerClick` : "triggerClick", {
2089
+ composed: true,
2090
+ detail: {
2091
+ expanded: this.element.isPopoverVisible
2092
+ }
2093
+ });
2094
+
2095
+ this.element.dispatchEvent(event);
2096
+ }
2097
+
2098
+ handleEvent(event) {
2099
+ if (!this.element.disableEventShow) {
2100
+ switch (event.type) {
2101
+ case 'keydown':
2102
+ // Support both Enter and Space keys for accessibility
2103
+ // Space is included as it's expected behavior for interactive elements
2104
+
2105
+ const origin = event.composedPath()[0];
2106
+ if (event.key === 'Enter' || ((!origin || origin.tagName !== "INPUT") && event.key === ' ')) {
2107
+ event.preventDefault(); // Prevent page scroll on space
2108
+ this.handleClick();
2109
+ }
2110
+ break;
2111
+ case 'mouseenter':
2112
+ if (this.element.hoverToggle) {
2113
+ this.showBib();
2114
+ }
2115
+ break;
2116
+ case 'mouseleave':
2117
+ if (this.element.hoverToggle) {
2118
+ this.hideBib();
2119
+ }
2120
+ break;
2121
+ case 'focus':
2122
+ if (this.element.focusShow) {
2123
+
2124
+ /*
2125
+ This needs to better handle clicking that gives focus -
2126
+ currently it shows and then immediately hides the bib
2127
+ */
2128
+ this.showBib();
2129
+ }
2130
+ break;
2131
+ case 'blur':
2132
+ // send this task 100ms later queue to
2133
+ // wait a frame in case focus moves within the floating element/bib
2134
+ setTimeout(() => this.handleFocusLoss(), 0);
2135
+ break;
2136
+ case 'click':
2137
+ if (document.activeElement === document.body) {
2138
+ event.currentTarget.focus();
2139
+ }
2140
+ this.handleClick();
2141
+ break;
2142
+ // Do nothing
2143
+ }
2144
+ }
2145
+ }
2146
+
2147
+ /**
2148
+ * Manages the tabIndex of the trigger element based on its focusability.
2149
+ *
2150
+ * If the trigger element or any of its children are inherently focusable, the tabIndex of the component is set to -1.
2151
+ * This prevents the component itself from being focusable when the trigger element already handles focus.
2152
+ */
2153
+ handleTriggerTabIndex() {
2154
+ const focusableElementSelectors = [
2155
+ 'a',
2156
+ 'button',
2157
+ 'input:not([type="hidden"])',
2158
+ 'select',
2159
+ 'textarea',
2160
+ '[tabindex]:not([tabindex="-1"])',
2161
+ 'auro-button',
2162
+ 'auro-input',
2163
+ 'auro-hyperlink'
2164
+ ];
2165
+
2166
+ const triggerNode = this.element.querySelectorAll('[slot="trigger"]')[0];
2167
+ if (!triggerNode) {
2168
+ return;
2169
+ }
2170
+ const triggerNodeTagName = triggerNode.tagName.toLowerCase();
2171
+
2172
+ focusableElementSelectors.forEach((selector) => {
2173
+ // Check if the trigger node element is focusable
2174
+ if (triggerNodeTagName === selector) {
2175
+ this.element.tabIndex = -1;
2176
+ return;
2177
+ }
2178
+
2179
+ // Check if any child is focusable
2180
+ if (triggerNode.querySelector(selector)) {
2181
+ this.element.tabIndex = -1;
2182
+ }
2183
+ });
2184
+ }
2185
+
2186
+ /**
2187
+ *
2188
+ * @param {*} eventPrefix
2189
+ */
2190
+ regenerateBibId() {
2191
+ this.id = this.element.getAttribute('id');
2192
+ if (!this.id) {
2193
+ this.id = window.crypto.randomUUID();
2194
+ this.element.setAttribute('id', this.id);
2195
+ }
2196
+
2197
+ this.element.bib.setAttribute("id", `${this.id}-floater-bib`);
2198
+ }
2199
+
2200
+ configure(elem, eventPrefix) {
2201
+ AuroFloatingUI.setupMousePressChecker();
2202
+
2203
+ this.eventPrefix = eventPrefix;
2204
+ if (this.element !== elem) {
2205
+ this.element = elem;
2206
+ }
2207
+
2208
+ if (this.behavior !== this.element.behavior) {
2209
+ this.behavior = this.element.behavior;
2210
+ }
2211
+
2212
+ if (this.element.trigger) {
2213
+ this.disconnect();
2214
+ }
2215
+ this.element.trigger = this.element.triggerElement || this.element.shadowRoot.querySelector('#trigger') || this.element.trigger;
2216
+ this.element.bib = this.element.shadowRoot.querySelector('#bib') || this.element.bib;
2217
+ this.element.bibSizer = this.element.shadowRoot.querySelector('#bibSizer');
2218
+ this.element.triggerChevron = this.element.shadowRoot.querySelector('#showStateIcon');
2219
+
2220
+
2221
+ if (this.element.floaterConfig) {
2222
+ this.element.hoverToggle = this.element.floaterConfig.hoverToggle;
2223
+ }
2224
+
2225
+ document.body.append(this.element.bib);
2226
+
2227
+ this.regenerateBibId();
2228
+ this.handleTriggerTabIndex();
2229
+
2230
+ this.handleEvent = this.handleEvent.bind(this);
2231
+ if (this.element.trigger) {
2232
+ this.element.trigger.addEventListener('keydown', this.handleEvent);
2233
+ this.element.trigger.addEventListener('click', this.handleEvent);
2234
+ this.element.trigger.addEventListener('mouseenter', this.handleEvent);
2235
+ this.element.trigger.addEventListener('mouseleave', this.handleEvent);
2236
+ this.element.trigger.addEventListener('focus', this.handleEvent);
2237
+ this.element.trigger.addEventListener('blur', this.handleEvent);
2238
+ }
2239
+ }
2240
+
2241
+ disconnect() {
2242
+ this.cleanupHideHandlers();
2243
+ if (this.element) {
2244
+ this.element.cleanup?.();
2245
+
2246
+ if (this.element.bib) {
2247
+ this.element.shadowRoot.append(this.element.bib);
2248
+ }
2249
+
2250
+ // Remove event & keyboard listeners
2251
+ if (this.element?.trigger) {
2252
+ this.element.trigger.removeEventListener('keydown', this.handleEvent);
2253
+ this.element.trigger.removeEventListener('click', this.handleEvent);
2254
+ this.element.trigger.removeEventListener('mouseenter', this.handleEvent);
2255
+ this.element.trigger.removeEventListener('mouseleave', this.handleEvent);
2256
+ this.element.trigger.removeEventListener('focus', this.handleEvent);
2257
+ this.element.trigger.removeEventListener('blur', this.handleEvent);
2258
+ }
2259
+ }
2260
+ }
2261
+ }
2262
+
2263
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2264
+ // See LICENSE in the project root for license information.
2265
+
2266
+
2267
+ class AuroDependencyVersioning {
2268
+
2269
+ /**
2270
+ * Generates a unique string to be used for child auro element naming.
2271
+ * @private
2272
+ * @param {string} baseName - Defines the first part of the unique element name.
2273
+ * @param {string} version - Version of the component that will be appended to the baseName.
2274
+ * @returns {string} - Unique string to be used for naming.
2275
+ */
2276
+ generateElementName(baseName, version) {
2277
+ let result = baseName;
2278
+
2279
+ result += '-';
2280
+ result += version.replace(/[.]/g, '_');
2281
+
2282
+ return result;
2283
+ }
2284
+
2285
+ /**
2286
+ * Generates a unique string to be used for child auro element naming.
2287
+ * @param {string} baseName - Defines the first part of the unique element name.
2288
+ * @param {string} version - Version of the component that will be appended to the baseName.
2289
+ * @returns {string} - Unique string to be used for naming.
2290
+ */
2291
+ generateTag(baseName, version, tagClass) {
2292
+ const elementName = this.generateElementName(baseName, version);
2293
+ const tag = i$4`${s$2(elementName)}`;
2294
+
2295
+ if (!customElements.get(elementName)) {
2296
+ customElements.define(elementName, class extends tagClass {});
2297
+ }
2298
+
2299
+ return tag;
2300
+ }
2301
+ }
2302
+
2303
+ /**
2304
+ * @license
2305
+ * Copyright 2017 Google LLC
2306
+ * SPDX-License-Identifier: BSD-3-Clause
2307
+ */
2308
+ const t={ATTRIBUTE:1},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
2309
+
2310
+ /**
2311
+ * @license
2312
+ * Copyright 2018 Google LLC
2313
+ * SPDX-License-Identifier: BSD-3-Clause
2314
+ */const e=e$1(class extends i{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}});
2315
+
2316
+ /**
2317
+ * @license
2318
+ * Copyright 2018 Google LLC
2319
+ * SPDX-License-Identifier: BSD-3-Clause
2320
+ */const o=o=>o??E;
2321
+
2322
+ // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2323
+ // See LICENSE in the project root for license information.
2324
+
2325
+
2326
+ /**
2327
+ * @attr {Boolean} hidden - If present, the component will be hidden both visually and from screen readers
2328
+ * @attr {Boolean} hiddenVisually - If present, the component will be hidden visually, but still read by screen readers
2329
+ * @attr {Boolean} hiddenAudible - If present, the component will be hidden from screen readers, but seen visually
2330
+ */
2331
+
2332
+ class AuroElement extends i$1 {
2333
+
2334
+ // function to define props used within the scope of this component
2335
+ static get properties() {
2336
+ return {
2337
+ hidden: { type: Boolean,
2338
+ reflect: true },
2339
+ hiddenVisually: { type: Boolean,
2340
+ reflect: true },
2341
+ hiddenAudible: { type: Boolean,
2342
+ reflect: true },
2343
+ };
2344
+ }
2345
+
2346
+ /**
2347
+ * @private Function that determines state of aria-hidden
2348
+ */
2349
+ hideAudible(value) {
2350
+ if (value) {
2351
+ return 'true'
2352
+ }
2353
+
2354
+ return 'false'
2355
+ }
2356
+ }
2357
+
2358
+ var error = {"svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"error__desc\" class=\"ico_squareLarge\" data-deprecated=\"true\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title/><desc id=\"error__desc\">Error alert indicator.</desc><path d=\"m13.047 5.599 6.786 11.586A1.207 1.207 0 0 1 18.786 19H5.214a1.207 1.207 0 0 1-1.047-1.815l6.786-11.586a1.214 1.214 0 0 1 2.094 0m-1.165.87a.23.23 0 0 0-.085.085L5.419 17.442a.232.232 0 0 0 .203.35h12.756a.234.234 0 0 0 .203-.35L12.203 6.554a.236.236 0 0 0-.321-.084M12 15.5a.75.75 0 1 1 0 1.5.75.75 0 0 1 0-1.5m-.024-6.22c.325 0 .589.261.589.583v4.434a.586.586 0 0 1-.589.583.586.586 0 0 1-.588-.583V9.863c0-.322.264-.583.588-.583\"/></svg>"};
2359
+
2360
+ /* eslint-disable no-underscore-dangle, jsdoc/no-undefined-types, jsdoc/require-param-description */
2361
+
2362
+ const _fetchMap = new Map();
2363
+
2364
+ /**
2365
+ * A callback to parse Response body.
2366
+ *
2367
+ * @callback ResponseParser
2368
+ * @param {Fetch.Response} response
2369
+ * @returns {Promise}
2370
+ */
2371
+
2372
+ /**
2373
+ * A minimal in-memory map to de-duplicate Fetch API media requests.
2374
+ *
2375
+ * @param {String} uri
2376
+ * @param {Object} [options={}]
2377
+ * @param {ResponseParser} [options.responseParser=(response) => response.text()]
2378
+ * @returns {Promise}
2379
+ */
2380
+ const cacheFetch = (uri, options = {}) => {
2381
+ const responseParser = options.responseParser || ((response) => response.text());
2382
+ if (!_fetchMap.has(uri)) {
2383
+ _fetchMap.set(uri, fetch(uri).then(responseParser));
2384
+ }
2385
+ return _fetchMap.get(uri);
2386
+ };
2387
+
2388
+ var styleCss$3 = i$3`:focus:not(:focus-visible){outline:3px solid transparent}.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}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.componentWrapper{display:flex}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, 0.25rem);line-height:1.8}`;
2389
+
2390
+ // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2391
+ // See LICENSE in the project root for license information.
2392
+
2393
+
2394
+ // See https://git.io/JJ6SJ for "How to document your components using JSDoc"
2395
+ /**
2396
+ * @slot - Hidden from visibility, used for a11y if icon description is needed
2397
+ */
2398
+
2399
+ // build the component class
2400
+ class BaseIcon extends AuroElement {
2401
+ constructor() {
2402
+ super();
2403
+ this.onDark = false;
2404
+ }
2405
+
2406
+ // function to define props used within the scope of this component
2407
+ static get properties() {
2408
+ return {
2409
+ ...super.properties,
2410
+
2411
+ /**
2412
+ * Set value for on-dark version of auro-icon.
2413
+ */
2414
+ onDark: {
2415
+ type: Boolean,
2416
+ reflect: true
2417
+ },
2418
+
2419
+ /**
2420
+ * @private
2421
+ */
2422
+ svg: {
2423
+ attribute: false,
2424
+ reflect: true
2425
+ }
2426
+ };
2427
+ }
2428
+
2429
+ static get styles() {
2430
+ return i$3`
2431
+ ${styleCss$3}
2432
+ `;
2433
+ }
2434
+
2435
+ /**
2436
+ * Async function to fetch requested icon from npm CDN.
2437
+ * @private
2438
+ * @param {string} category - Icon category.
2439
+ * @param {string} name - Icon name.
2440
+ * @returns {SVGElement} DOM - Ready HTML to be appended.
2441
+ */
2442
+ async fetchIcon(category, name) {
2443
+ let iconHTML = '';
2444
+
2445
+ if (category === 'logos') {
2446
+ iconHTML = await cacheFetch(`${this.uri}/${category}/${name}.svg`);
2447
+ } else {
2448
+ iconHTML = await cacheFetch(`${this.uri}/icons/${category}/${name}.svg`);
2449
+ }
2450
+
2451
+ const dom = new DOMParser().parseFromString(iconHTML, 'text/html');
2452
+
2453
+ return dom.body.querySelector('svg');
2454
+ }
2455
+
2456
+ // lifecycle function
2457
+ async firstUpdated() {
2458
+ if (!this.customSvg) {
2459
+ const svg = await this.fetchIcon(this.category, this.name);
2460
+
2461
+ if (svg) {
2462
+ this.svg = svg;
2463
+ } else if (!svg) {
2464
+ const penDOM = new DOMParser().parseFromString(error.svg, 'text/html');
2465
+
2466
+ this.svg = penDOM.body.firstChild;
2467
+ }
2468
+ }
2469
+ }
2470
+ }
2471
+
2472
+ var tokensCss$2 = i$3`: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)}`;
2473
+
2474
+ var colorCss$3 = i$3`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]){--ds-auro-icon-color:var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]){--ds-auro-icon-color:var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]){--ds-auro-icon-color:var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]){--ds-auro-icon-color:var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]){--ds-auro-icon-color:var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]){--ds-auro-icon-color:var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]){--ds-auro-icon-color:var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]){--ds-auro-icon-color:var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}`;
2475
+
2476
+ // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2477
+ // See LICENSE in the project root for license information.
2478
+
2479
+
2480
+ class AuroIcon extends BaseIcon {
2481
+ constructor() {
2482
+ super();
2483
+
2484
+ this.variant = undefined;
2485
+ this.privateDefaults();
2486
+ }
2487
+
2488
+ /**
2489
+ * Internal Defaults.
2490
+ * @private
2491
+ * @returns {void}
2492
+ */
2493
+ privateDefaults() {
2494
+ this.uri = 'https://cdn.jsdelivr.net/npm/@alaskaairux/icons@latest/dist';
2495
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
2496
+ }
2497
+
2498
+ // function to define props used within the scope of this component
2499
+ static get properties() {
2500
+ return {
2501
+ ...super.properties,
2502
+
2503
+ /**
2504
+ * Set aria-hidden value. Default is `true`. Option is `false`.
2505
+ */
2506
+ ariaHidden: {
2507
+ type: String,
2508
+ reflect: true
2509
+ },
2510
+
2511
+ /**
2512
+ * The category of the icon you are looking for. See https://auro.alaskaair.com/icons/usage.
2513
+ */
2514
+ category: {
2515
+ type: String,
2516
+ reflect: true
2517
+ },
2518
+
2519
+ /**
2520
+ * Allows custom color to be set.
2521
+ */
2522
+ customColor: {
2523
+ type: Boolean
2524
+ },
2525
+
2526
+ /**
2527
+ * When true, auro-icon will render a custom SVG inside the default slot.
2528
+ */
2529
+ customSvg: {
2530
+ type: Boolean
2531
+ },
2532
+
2533
+ /**
2534
+ * Exposes content in slot as icon label.
2535
+ */
2536
+ label: {
2537
+ type: Boolean,
2538
+ reflect: true
2539
+ },
2540
+
2541
+ /**
2542
+ * The name of the icon you are looking for without the file extension. See https://auro.alaskaair.com/icons/usage.
2543
+ */
2544
+ name: {
2545
+ type: String,
2546
+ reflect: true
2547
+ },
2548
+
2549
+ /**
2550
+ * The style of the icon. The accepted variants are `accent1`, `disabled`, `muted`, `statusDefault`, `statusInfo`, `statusSuccess`, `statusWarning`, `statusError`, `statusInfoSubtle`, `statusSuccessSubtle`, `statusWarningSubtle`, `statusErrorSubtle`, `fareBasicEconomy`, `fareBusiness`, `fareEconomy`, `fareFirst`, `farePremiumEconomy`, `tierOneWorldEmerald`, `tierOneWorldSapphire`, `tierOneWorldRuby`.
2551
+ */
2552
+ variant: {
2553
+ type: String,
2554
+ reflect: true
2555
+ }
2556
+ };
2557
+ }
2558
+
2559
+ static get styles() {
2560
+ return [
2561
+ super.styles,
2562
+ i$3`${tokensCss$2}`,
2563
+ i$3`${styleCss$3}`,
2564
+ i$3`${colorCss$3}`
2565
+ ];
2566
+ }
2567
+
2568
+ /**
2569
+ * This will register this element with the browser.
2570
+ * @param {string} [name="auro-icon"] - The name of element that you want to register to.
2571
+ *
2572
+ * @example
2573
+ * AuroIcon.register("custom-icon") // this will register this element to <custom-icon/>
2574
+ *
2575
+ */
2576
+ static register(name = "auro-icon") {
2577
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroIcon);
2578
+ }
2579
+
2580
+ connectedCallback() {
2581
+ super.connectedCallback();
2582
+
2583
+ // Add the tag name as an attribute if it is different than the component name
2584
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-icon');
2585
+ }
2586
+
2587
+ /**
2588
+ * @private
2589
+ * @returns {void} Exposes CSS parts for styling from parent components.
2590
+ */
2591
+ exposeCssParts() {
2592
+ this.setAttribute('exportparts', 'svg:iconSvg');
2593
+ }
2594
+
2595
+ async firstUpdated() {
2596
+ await super.firstUpdated();
2597
+
2598
+ // Removes the SVG description for screenreader if ariaHidden is set to true
2599
+ if (!this.hasAttribute('ariaHidden') && this.svg) {
2600
+ const svgDesc = this.svg.querySelector('desc');
2601
+
2602
+ if (svgDesc) {
2603
+ svgDesc.remove();
2604
+ this.svg.removeAttribute('aria-labelledby');
2605
+ }
2606
+ }
2607
+ }
2608
+
2609
+ // function that renders the HTML and CSS into the scope of the component
2610
+ render() {
2611
+ const labelClasses = {
2612
+ 'labelWrapper': true,
2613
+ 'util_displayHiddenVisually': !this.label
2614
+ };
2615
+
2616
+ const svgClasses = {
2617
+ 'svgWrapper': true,
2618
+ };
2619
+
2620
+ return x`
2621
+ <div class="componentWrapper">
2622
+ <div
2623
+ class="${e(svgClasses)}"
2624
+ title="${o(this.title || undefined)}">
2625
+ <span aria-hidden="${o(this.ariaHidden || true)}" part="svg">
2626
+ ${this.customSvg ? x`
2627
+ <slot name="svg"></slot>
2628
+ ` : x`
2629
+ ${this.svg}
2630
+ `
2631
+ }
2632
+ </span>
2633
+ </div>
2634
+
2635
+ <div class="${e(labelClasses)}">
2636
+ <slot></slot>
2637
+ </div>
2638
+ </div>
2639
+ `;
2640
+ }
2641
+ }
2642
+
2643
+ var iconVersion = '6.1.2';
2644
+
2645
+ var styleCss$2 = i$3`:host{position:absolute;z-index:var(--depth-tooltip, 400);display:none}.container{display:inline-block;overflow:auto;box-sizing:border-box;margin:var(--ds-size-50, 0.25rem) 0}:host([isfullscreen]){position:fixed;top:0;left:0}:host([isfullscreen]) .container{width:100dvw;max-width:none;height:100dvh;max-height:none;border-radius:unset;margin-top:0;box-shadow:unset;overscroll-behavior:contain}:host([data-show]){display:flex}:host([common]:not([isfullscreen])) .container,:host([rounded]:not([isfullscreen])) .container{border-radius:var(--ds-border-radius, 0.375rem)}:host([common][isfullscreen]) .container,:host([rounded][isfullscreen]) .container{border-radius:unset;box-shadow:unset}`;
2646
+
2647
+ var colorCss$2 = i$3`.container{background-color:var(--ds-auro-dropdownbib-container-color);box-shadow:var(--ds-auro-dropdownbib-boxshadow-color);color:var(--ds-auro-dropdownbib-text-color)}`;
2648
+
2649
+ var tokensCss$1 = i$3`:host{--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-muted, #676767);--ds-auro-dropdown-trigger-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdown-trigger-border-color: transparent;--ds-auro-dropdown-trigger-outline-color: transparent;--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-dropdownbib-boxshadow-color: var(--ds-elevation-200, 0px 0px 10px rgba(0, 0, 0, 0.15));--ds-auro-dropdownbib-container-color: var(--ds-basic-color-surface-default, #ffffff);--ds-auro-dropdownbib-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
2650
+
2651
+ // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2652
+ // See LICENSE in the project root for license information.
2653
+
2654
+
2655
+
2656
+ const DESIGN_TOKEN_BREAKPOINT_PREFIX = '--ds-grid-breakpoint-';
2657
+ const DESIGN_TOKEN_BREAKPOINT_OPTIONS = [
2658
+ 'xl',
2659
+ 'lg',
2660
+ 'md',
2661
+ 'sm',
2662
+ 'xs',
2663
+ ];
2664
+
2665
+ /**
2666
+ * @prop { String } fullscreenBreakpoint - Defines the screen size breakpoint (`lg`, `md`, `sm`, or `xs`) at which the dropdown switches to fullscreen mode on mobile. When expanded, the dropdown will automatically display in fullscreen mode if the screen size is equal to or smaller than the selected breakpoint.
2667
+ * @csspart bibContainer - Apply css to the bib container.
2668
+ */
2669
+
2670
+ class AuroDropdownBib extends i$1 {
2671
+
2672
+ constructor() {
2673
+ super();
2674
+
2675
+ /**
2676
+ * @private
2677
+ */
2678
+ this._mobileBreakpointValue = undefined;
2679
+
2680
+ AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-dropdownbib');
2681
+ }
2682
+
2683
+ static get styles() {
2684
+ return [
2685
+ styleCss$2,
2686
+ colorCss$2,
2687
+ tokensCss$1
2688
+ ];
2689
+ }
2690
+
2691
+ static get properties() {
2692
+ return {
2693
+
2694
+ /**
2695
+ * If declared, will take the fullscreen when the bib is displayed.
2696
+ */
2697
+ isFullscreen: {
2698
+ type: Boolean,
2699
+ reflect: true
2700
+ },
2701
+
2702
+ /**
2703
+ * If declared, will apply all styles for the common theme.
2704
+ */
2705
+ common: {
2706
+ type: Boolean,
2707
+ reflect: true
2708
+ },
2709
+
2710
+ /**
2711
+ * If declared, will apply extra padding to bib content.
2712
+ */
2713
+ inset: {
2714
+ type: Boolean,
2715
+ reflect: true
2716
+ },
2717
+
2718
+ /**
2719
+ * If declared, will apply border-radius to the bib.
2720
+ */
2721
+ rounded: {
2722
+ type: Boolean,
2723
+ reflect: true
2724
+ },
2725
+ };
2726
+ }
2727
+
2728
+ set mobileFullscreenBreakpoint(value) {
2729
+ // verify the defined breakpoint is valid and exit out if not
2730
+ // 'disabled' is a design token breakpoint so it acts as our "undefined" value
2731
+ const validatedValue = DESIGN_TOKEN_BREAKPOINT_OPTIONS.includes(value) ? value : undefined;
2732
+ if (!validatedValue) {
2733
+ this._mobileBreakpointValue = undefined;
2734
+ } else {
2735
+ // get the pixel value for the defined breakpoint
2736
+ const docStyle = getComputedStyle(document.documentElement);
2737
+ this._mobileBreakpointValue = docStyle.getPropertyValue(DESIGN_TOKEN_BREAKPOINT_PREFIX + value);
2738
+ }
2739
+ }
2740
+
2741
+ get mobileFullscreenBreakpoint() {
2742
+ return this._mobileBreakpointValue;
2743
+ }
2744
+
2745
+ updated(changedProperties) {
2746
+ if (changedProperties.has('isFullscreen')) {
2747
+ this.childNodes.forEach((child) => {
2748
+ // skip any text that is not in an HTMLElement on setting `isFullscreen` attr.
2749
+ if (child.nodeName !== '#text') {
2750
+ if (this.isFullscreen) {
2751
+ child.setAttribute('isFullscreen', 'true');
2752
+ } else {
2753
+ child.removeAttribute('isFullscreen');
2754
+ }
2755
+ }
2756
+ });
2757
+ }
2758
+ }
2759
+
2760
+ // function that renders the HTML and CSS into the scope of the component
2761
+ render() {
2762
+ return u$1`
2763
+ <div class="container" part="bibContainer">
2764
+ <slot></slot>
2765
+ </div>
2766
+ `;
2767
+ }
2768
+ }
2769
+
2770
+ var dropdownVersion = '3.0.0';
2771
+
2772
+ var styleCss$1 = i$3`:host{position:relative;display:inline-block;max-width:100%}:host([fluid]){display:block}#bibSizer{position:absolute;z-index:-1;opacity:0;pointer-events:none}.label{font-size:var(--ds-basic-text-body-xs-font-size, 12px);font-weight:var(--ds-basic-text-body-xs-font-weight, 450);letter-spacing:var(--ds-basic-text-body-xs-letter-spacing, 0);line-height:var(--ds-basic-text-body-xs-line-height, 16px);transition:font-size .3s cubic-bezier(0.215, 0.61, 0.355, 1);white-space:normal}.label[hasTrigger=false]{font-size:var(--ds-basic-text-body-default-font-size, 16px);font-weight:var(--ds-basic-text-body-default-font-weight, 450);letter-spacing:var(--ds-basic-text-body-default-letter-spacing, 0);line-height:var(--ds-basic-text-body-default-line-height, 24px)}.trigger{position:relative;display:flex;align-items:center}.trigger[showBorder]{border-width:1px;border-style:solid;cursor:pointer;outline-style:solid;outline-width:1px}@media(hover: hover){.trigger:hover{cursor:pointer}}.triggerContentWrapper{overflow:hidden;flex:1;text-overflow:ellipsis;white-space:nowrap}#showStateIcon{display:flex;overflow:hidden;height:100%;align-items:center;margin-left:var(--ds-size-100, 0.5rem)}#showStateIcon [auro-icon]{height:var(--ds-size-300, 1.5rem);line-height:var(--ds-size-300, 1.5rem)}#showStateIcon[data-expanded=true] [auro-icon]{transform:rotate(-180deg)}:host([matchwidth]) #bibSizer{width:100%}:host([disabled]){pointer-events:none}:host([inset]) .trigger{padding:var(--ds-size-150, 0.75rem) var(--ds-size-200, 1rem)}:host([common]) .trigger,:host([inset][bordered]) .trigger{padding:var(--ds-size-200, 1rem) var(--ds-size-150, 0.75rem)}:host([inset][bordered][labeled]) .trigger{padding:var(--ds-size-100, 0.5rem) var(--ds-size-150, 0.75rem)}:host([common]) .trigger,:host([rounded]) .trigger{border-radius:var(--ds-border-radius, 0.375rem)}`;
2773
+
2774
+ var colorCss$1 = i$3`.label{color:var(--ds-auro-dropdown-label-text-color)}.trigger{border-color:var(--ds-auro-dropdown-trigger-border-color);background-color:var(--ds-auro-dropdown-trigger-container-color);color:var(--ds-auro-dropdown-trigger-text-color);outline-color:var(--ds-auro-dropdown-trigger-outline-color)}.trigger:focus-within,.trigger:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host([disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host([common]),:host([bordered]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-bold, #585e67)}:host([common]) .trigger:active,:host([common]) .trigger:focus-within,:host([bordered]) .trigger:active,:host([bordered]) .trigger:focus-within{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a)}:host([error]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-status-error, #e31f26)}:host([error]) .trigger{outline:solid 1px var(--ds-auro-dropdown-trigger-border-color)}:host([error]) .trigger:focus-within,:host([error]) .trigger:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused, #01426a);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused, #01426a)}:host([disabled][common]),:host([disabled][bordered]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-subtle, #dddddd)}:host([onDark]){--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db);--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse, rgba(255, 255, 255, 0.15));--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark]):focus-within,:host([onDark]):active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][disabled]){--ds-auro-dropdown-trigger-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894);--ds-auro-dropdown-label-text-color: var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][common]),:host([onDark][bordered]){--ds-auro-dropdown-trigger-border-color: var(--ds-basic-color-border-inverse, #ffffff)}:host([onDark][common]) .trigger:focus-within,:host([onDark][common]) .trigger:active,:host([onDark][bordered]) .trigger:focus-within,:host([onDark][bordered]) .trigger:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][error]){--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}:host([onDark][error]) .trigger{outline:solid 1px var(--ds-auro-dropdown-trigger-border-color)}:host([onDark][error]) .trigger:focus-within,:host([onDark][error]) .trigger:active{--ds-auro-dropdown-trigger-border-color: var(--ds-advanced-color-state-focused-inverse, #ffffff);--ds-auro-dropdown-trigger-outline-color: var(--ds-advanced-color-state-focused-inverse, #ffffff)}:host([onDark][disabled][common]),:host([onDark][disabled][bordered]){--ds-auro-dropdown-trigger-container-color: var(--ds-advanced-color-shared-background-inverse-disabled, rgba(255, 255, 255, 0.1))}`;
2775
+
2776
+ var colorCss = i$3`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
2777
+
2778
+ var styleCss = i$3`.helptext-wrapper{display:none;font-size:var(--ds-basic-text-body-xs-font-size, 12px);font-weight:var(--ds-basic-text-body-xs-font-weight, 450);letter-spacing:var(--ds-basic-text-body-xs-letter-spacing, 0);line-height:var(--ds-basic-text-body-xs-line-height, 16px)}:host([large]) .helptext-wrapper{font-size:var(--ds-basic-text-body-default-font-size, 16px);font-weight:var(--ds-basic-text-body-default-font-weight, 450);letter-spacing:var(--ds-basic-text-body-default-letter-spacing, 0);line-height:var(--ds-basic-text-body-default-line-height, 24px)}.helptext-wrapper[visible]{display:block}::slotted(*:not(:empty)){margin-top:var(--ds-size-50, 0.25rem);margin-bottom:0}::slotted(p){margin-block:0}`;
2779
+
2780
+ var tokensCss = i$3`:host{--ds-auro-helptext-color: var(--ds-basic-color-texticon-muted, #676767)}`;
2781
+
2782
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
2783
+ // See LICENSE in the project root for license information.
2784
+
2785
+ // ---------------------------------------------------------------------
2786
+
2787
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
2788
+
2789
+ class AuroLibraryRuntimeUtils {
2790
+
2791
+ /* eslint-disable jsdoc/require-param */
2792
+
2793
+ /**
2794
+ * This will register a new custom element with the browser.
2795
+ * @param {String} name - The name of the custom element.
2796
+ * @param {Object} componentClass - The class to register as a custom element.
2797
+ * @returns {void}
2798
+ */
2799
+ registerComponent(name, componentClass) {
2800
+ if (!customElements.get(name)) {
2801
+ customElements.define(name, class extends componentClass {});
2802
+ }
2803
+ }
2804
+
2805
+ /**
2806
+ * Finds and returns the closest HTML Element based on a selector.
2807
+ * @returns {void}
2808
+ */
2809
+ closestElement(
2810
+ selector, // selector like in .closest()
2811
+ base = this, // extra functionality to skip a parent
2812
+ __Closest = (el, found = el && el.closest(selector)) =>
2813
+ !el || el === document || el === window
2814
+ ? null // standard .closest() returns null for non-found selectors also
2815
+ : found
2816
+ ? found // found a selector INside this element
2817
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
2818
+ ) {
2819
+ return __Closest(base);
2820
+ }
2821
+ /* eslint-enable jsdoc/require-param */
2822
+
2823
+ /**
2824
+ * If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
2825
+ * @param {Object} elem - The element to check.
2826
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
2827
+ * @returns {void}
2828
+ */
2829
+ handleComponentTagRename(elem, tagName) {
2830
+ const tag = tagName.toLowerCase();
2831
+ const elemTag = elem.tagName.toLowerCase();
2832
+
2833
+ if (elemTag !== tag) {
2834
+ elem.setAttribute(tag, true);
2835
+ }
2836
+ }
2837
+
2838
+ /**
2839
+ * Validates if an element is a specific Auro component.
2840
+ * @param {Object} elem - The element to validate.
2841
+ * @param {String} tagName - The name of the Auro component to check against.
2842
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
2843
+ */
2844
+ elementMatch(elem, tagName) {
2845
+ const tag = tagName.toLowerCase();
2846
+ const elemTag = elem.tagName.toLowerCase();
2847
+
2848
+ return elemTag === tag || elem.hasAttribute(tag);
2849
+ }
2850
+ }
2851
+
2852
+ // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2853
+ // See LICENSE in the project root for license information.
2854
+
2855
+
2856
+ /**
2857
+ * Displays help text or error messages within form elements - Internal Use Only.
2858
+ *
2859
+ * @attr { Boolean } large - If declared, make font-size to 1rem(16px).
2860
+ */
2861
+ class AuroHelpText extends i$1 {
2862
+
2863
+ constructor() {
2864
+ super();
2865
+
2866
+ this.error = false;
2867
+ this.onDark = false;
2868
+ this.hasTextContent = false;
2869
+
2870
+ AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-helptext');
2871
+ }
2872
+
2873
+ static get styles() {
2874
+ return [
2875
+ colorCss,
2876
+ styleCss,
2877
+ tokensCss
2878
+ ];
2879
+ }
2880
+
2881
+ // function to define props used within the scope of this component
2882
+ static get properties() {
2883
+ return {
2884
+
2885
+ /**
2886
+ * @private
2887
+ */
2888
+ slotNodes: {
2889
+ type: Boolean,
2890
+ },
2891
+
2892
+ /**
2893
+ * @private
2894
+ */
2895
+ hasTextContent: {
2896
+ type: Boolean,
2897
+ },
2898
+
2899
+ /**
2900
+ * If declared, make font color red.
2901
+ */
2902
+ error: {
2903
+ type: Boolean,
2904
+ reflect: true,
2905
+ },
2906
+
2907
+ /**
2908
+ * If declared, will apply onDark styles.
2909
+ */
2910
+ onDark: {
2911
+ type: Boolean,
2912
+ reflect: true
2913
+ }
2914
+ };
2915
+ }
2916
+
2917
+ /**
2918
+ * This will register this element with the browser.
2919
+ * @param {string} [name="auro-helptext"] - The name of element that you want to register to.
2920
+ *
2921
+ * @example
2922
+ * AuroCheckbox.register("custom-helptext") // this will register this element to <custom-helptext/>
2923
+ *
2924
+ */
2925
+ static register(name = "auro-helptext") {
2926
+ AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHelpText);
2927
+ }
2928
+
2929
+ updated() {
2930
+ this.handleSlotChange();
2931
+ }
2932
+
2933
+ handleSlotChange(event) {
2934
+ if (event) {
2935
+ this.slotNodes = event.target.assignedNodes();
2936
+ }
2937
+
2938
+ this.hasTextContent = this.checkSlotsForContent(this.slotNodes);
2939
+ }
2940
+
2941
+ /**
2942
+ * Checks if any of the provided nodes or their nested slot nodes contain non-empty text content.
2943
+ *
2944
+ * @param {NodeList|Array} nodes - The list of nodes to check for content.
2945
+ * @returns {boolean} - Returns true if any node or nested slot node contains non-empty text content, otherwise false.
2946
+ * @private
2947
+ */
2948
+ checkSlotsForContent(nodes) {
2949
+ if (!nodes) {
2950
+ return false;
2951
+ }
2952
+
2953
+ return nodes.some((node) => {
2954
+ if (node.textContent.trim()) {
2955
+ return true;
2956
+ }
2957
+
2958
+ if (!node.querySelector) {
2959
+ return false;
2960
+ }
2961
+
2962
+ const nestedSlot = node.tagName === 'SLOT' ? node : node.querySelector('slot');
2963
+ if (!nestedSlot) {
2964
+ return false;
2965
+ }
2966
+
2967
+ const nestedSlotNodes = nestedSlot.assignedNodes();
2968
+ return this.checkSlotsForContent(nestedSlotNodes);
2969
+ });
2970
+ }
2971
+
2972
+ // function that renders the HTML and CSS into the scope of the component
2973
+ render() {
2974
+ return x`
2975
+ <div class="helptext-wrapper" ?visible="${this.hasTextContent}">
2976
+ <slot @slotchange=${this.handleSlotChange}></slot>
2977
+ </div>
2978
+ `;
2979
+ }
2980
+ }
2981
+
2982
+ var helpTextVersion = '1.0.0';
2983
+
2984
+ // Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
2985
+ // See LICENSE in the project root for license information.
2986
+
2987
+
2988
+ /**
2989
+ * @attr { Boolean } disableEventShow - If declared, the dropdown will only show by calling the API .show() public method.
2990
+ * @slot - Default slot for the popover content.
2991
+ * @slot label - Defines the content of the label.
2992
+ * @slot helpText - Defines the content of the helpText.
2993
+ * @slot trigger - Defines the content of the trigger.
2994
+ * @csspart trigger - The trigger content container.
2995
+ * @csspart chevron - The collapsed/expanded state icon container.
2996
+ * @csspart helpText - The helpText content container.
2997
+ * @event auroDropdown-triggerClick - Notifies that the trigger has been clicked.
2998
+ * @event auroDropdown-toggled - Notifies that the visibility of the dropdown bib has changed.
2999
+ * @event auroDropdown-idAdded - Notifies consumers that the unique ID for the dropdown bib has been generated.
3000
+ */
3001
+ class AuroDropdown extends i$1 {
3002
+ constructor() {
3003
+ super();
3004
+
3005
+ this.isPopoverVisible = false;
3006
+ this.isBibFullscreen = false;
3007
+ this.matchWidth = false;
3008
+ this.noHideOnThisFocusLoss = false;
3009
+
3010
+ this.privateDefaults();
3011
+
3012
+ /**
3013
+ * @private
3014
+ * @property {boolean} delegatesFocus - Whether the shadow root delegates focus.
3015
+ */
3016
+ this.constructor.shadowRootOptions = {
3017
+ ...i$1.shadowRootOptions,
3018
+ delegatesFocus: true,
3019
+ };
3020
+
3021
+ /**
3022
+ * @private
3023
+ */
3024
+ this.triggerContentFocusable = false;
3025
+
3026
+ /**
3027
+ * @private
3028
+ */
3029
+ this.showTriggerBorders = true;
3030
+ }
3031
+
3032
+ /**
3033
+ * @private
3034
+ * @returns {void} Internal defaults.
3035
+ */
3036
+ privateDefaults() {
3037
+ this.bordered = false;
3038
+ this.chevron = false;
3039
+ this.disabled = false;
3040
+ this.error = false;
3041
+ this.inset = false;
3042
+ this.rounded = false;
3043
+ this.tabIndex = 0;
3044
+ this.noToggle = false;
3045
+ this.a11yAutocomplete = 'none';
3046
+ this.labeled = true;
3047
+ this.a11yRole = 'combobox';
3048
+ this.onDark = false;
3049
+
3050
+ // floaterConfig
3051
+ this.placement = 'bottom-start';
3052
+ this.offset = 0;
3053
+ this.noFlip = false;
3054
+ this.autoPlacement = false;
3055
+
3056
+ /**
3057
+ * @private
3058
+ */
3059
+ this.hasTriggerContent = false;
3060
+
3061
+ /**
3062
+ * @private
3063
+ */
3064
+ this.triggerContentSlot = undefined;
3065
+
3066
+ /**
3067
+ * @private
3068
+ */
3069
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
3070
+
3071
+ /**
3072
+ * @private
3073
+ */
3074
+ this.floater = new AuroFloatingUI();
3075
+
3076
+ /**
3077
+ * Generate unique names for dependency components.
3078
+ */
3079
+ const versioning = new AuroDependencyVersioning();
3080
+
3081
+ /**
3082
+ * @private
3083
+ */
3084
+ this.iconTag = versioning.generateTag('auro-formkit-dropdown-icon', iconVersion, AuroIcon);
3085
+
3086
+ /**
3087
+ * @private
3088
+ */
3089
+ this.dropdownBibTag = versioning.generateTag('auro-formkit-dropdown-dropdownbib', dropdownVersion, AuroDropdownBib);
3090
+
3091
+ /**
3092
+ * @private
3093
+ */
3094
+ this.helpTextTag = versioning.generateTag('auro-formkit-dropdown-helptext', helpTextVersion, AuroHelpText);
3095
+
3096
+ /**
3097
+ * @private
3098
+ */
3099
+ this.bindFocusEventToTrigger = this.bindFocusEventToTrigger.bind(this);
3100
+ }
3101
+
3102
+ /**
3103
+ * @ignore
3104
+ */
3105
+ get floaterConfig() {
3106
+ return {
3107
+ placement: this.placement,
3108
+ flip: !this.noFlip,
3109
+ autoPlacement: this.autoPlacement,
3110
+ offset: this.offset,
3111
+ };
3112
+ }
3113
+
3114
+ /**
3115
+ * Public method to hide the dropdown.
3116
+ * @returns {void}
3117
+ */
3118
+ hide() {
3119
+ this.floater.hideBib();
3120
+ }
3121
+
3122
+ /**
3123
+ * Public method to show the dropdown.
3124
+ * @returns {void}
3125
+ */
3126
+ show() {
3127
+ this.floater.showBib();
3128
+ }
3129
+
3130
+ // function to define props used within the scope of this component
3131
+ static get properties() {
3132
+ return {
3133
+
3134
+ /**
3135
+ * If declared, bib's position will be automatically calculated where to appear.
3136
+ * @default false
3137
+ */
3138
+ autoPlacement: {
3139
+ type: Boolean,
3140
+ reflect: true
3141
+ },
3142
+
3143
+ /**
3144
+ * If declared, applies a border around the trigger slot.
3145
+ */
3146
+ bordered: {
3147
+ type: Boolean,
3148
+ reflect: true
3149
+ },
3150
+
3151
+ /**
3152
+ * If declared, the dropdown displays a chevron on the right.
3153
+ * @attr {Boolean} chevron
3154
+ */
3155
+ chevron: {
3156
+ type: Boolean,
3157
+ reflect: true
3158
+ },
3159
+
3160
+ /**
3161
+ * If declared, the dropdown will be styled with the common theme.
3162
+ */
3163
+ common: {
3164
+ type: Boolean,
3165
+ reflect: true
3166
+ },
3167
+
3168
+ /**
3169
+ * If declared, the dropdown is not interactive.
3170
+ */
3171
+ disabled: {
3172
+ type: Boolean,
3173
+ reflect: true
3174
+ },
3175
+
3176
+ /**
3177
+ * @private
3178
+ */
3179
+ dropdownWidth: {
3180
+ type: Number
3181
+ },
3182
+
3183
+ /**
3184
+ * The unique ID for the dropdown bib element.
3185
+ * @private
3186
+ */
3187
+ dropdownId: {
3188
+ type: String,
3189
+ reflect: false,
3190
+ attribute: false
3191
+ },
3192
+
3193
+ /**
3194
+ * If declared in combination with `bordered` property or `helpText` slot content, will apply red color to both.
3195
+ */
3196
+ error: {
3197
+ type: Boolean,
3198
+ reflect: true
3199
+ },
3200
+
3201
+ /**
3202
+ * If declared, the bib will display when focus is applied to the trigger.
3203
+ */
3204
+ focusShow: {
3205
+ type: Boolean,
3206
+ reflect: true
3207
+ },
3208
+
3209
+ /**
3210
+ * Makes the trigger to be full width of its parent container.
3211
+ */
3212
+ fluid: {
3213
+ type: Boolean,
3214
+ reflect: true
3215
+ },
3216
+
3217
+ /**
3218
+ * If declared, will apply padding around trigger slot content.
3219
+ */
3220
+ inset: {
3221
+ type: Boolean,
3222
+ reflect: true
3223
+ },
3224
+
3225
+ /**
3226
+ * If true, the dropdown bib is displayed.
3227
+ */
3228
+ isPopoverVisible: {
3229
+ type: Boolean
3230
+ },
3231
+
3232
+ /**
3233
+ * If true, the dropdown bib is taking the fullscreen when it's open.
3234
+ */
3235
+ isBibFullscreen: {
3236
+ type: Boolean,
3237
+ reflect: true
3238
+ },
3239
+
3240
+ /**
3241
+ * If declared, the trigger will toggle the dropdown on mouseover/mouseout.
3242
+ */
3243
+ hoverToggle: {
3244
+ type: Boolean,
3245
+ reflect: true
3246
+ },
3247
+
3248
+ /**
3249
+ * @private
3250
+ */
3251
+ hasTriggerContent: {
3252
+ type: Boolean
3253
+ },
3254
+
3255
+ /**
3256
+ * Defines the screen size breakpoint (`xs`, `sm`, `md`, `lg`, `xl`, `disabled`)
3257
+ * at which the dropdown switches to fullscreen mode on mobile. `disabled` indicates a dropdown should _never_ enter fullscreen.
3258
+ *
3259
+ * When expanded, the dropdown will automatically display in fullscreen mode
3260
+ * if the screen size is equal to or smaller than the selected breakpoint.
3261
+ * @default sm
3262
+ */
3263
+ fullscreenBreakpoint: {
3264
+ type: String,
3265
+ reflect: true
3266
+ },
3267
+
3268
+ /**
3269
+ * Defines if there is a label preset.
3270
+ * @private
3271
+ */
3272
+ labeled: {
3273
+ type: Boolean,
3274
+ reflect: true
3275
+ },
3276
+
3277
+ /**
3278
+ * If declared, the popover and trigger will be set to the same width.
3279
+ */
3280
+ matchWidth: {
3281
+ type: Boolean,
3282
+ reflect: true
3283
+ },
3284
+
3285
+ /**
3286
+ * If declared, the bib will NOT flip to an alternate position
3287
+ * when there isn't enough space in the specified `placement`.
3288
+ * @default false
3289
+ */
3290
+ noFlip: {
3291
+ type: Boolean,
3292
+ reflect: true
3293
+ },
3294
+
3295
+ /**
3296
+ * If declared, the dropdown will not hide when moving focus outside the element.
3297
+ */
3298
+ noHideOnThisFocusLoss: {
3299
+ type: Boolean,
3300
+ reflect: true
3301
+ },
3302
+
3303
+ /**
3304
+ * If declared, the trigger will only show the dropdown bib.
3305
+ */
3306
+ noToggle: {
3307
+ type: Boolean,
3308
+ reflect: true
3309
+ },
3310
+
3311
+ /**
3312
+ * Gap between the trigger element and bib.
3313
+ * @default 0
3314
+ */
3315
+ offset: {
3316
+ type: Number,
3317
+ reflect: true
3318
+ },
3319
+
3320
+ /**
3321
+ * If declared, onDark styles will be applied.
3322
+ */
3323
+ onDark: {
3324
+ type: Boolean,
3325
+ reflect: true
3326
+ },
3327
+
3328
+ onSlotChange: {
3329
+ type: Function,
3330
+ reflect: false
3331
+ },
3332
+
3333
+ /**
3334
+ * Position where the bib should appear relative to the trigger.
3335
+ * Accepted values:
3336
+ * "top" | "right" | "bottom" | "left" |
3337
+ * "bottom-start" | "top-start" | "top-end" |
3338
+ * "right-start" | "right-end" | "bottom-end" |
3339
+ * "left-start" | "left-end"
3340
+ * @default bottom-start
3341
+ */
3342
+ placement: {
3343
+ type: String,
3344
+ reflect: true
3345
+ },
3346
+
3347
+ /**
3348
+ * If declared, will apply border-radius to trigger and default slots.
3349
+ */
3350
+ rounded: {
3351
+ type: Boolean,
3352
+ reflect: true
3353
+ },
3354
+
3355
+ /**
3356
+ * @private
3357
+ */
3358
+ tabIndex: {
3359
+ type: Number
3360
+ },
3361
+
3362
+ /**
3363
+ * The value for the role attribute of the trigger element.
3364
+ */
3365
+ a11yRole: {
3366
+ type: String || undefined,
3367
+ attribute: false,
3368
+ reflect: false
3369
+ },
3370
+
3371
+ /**
3372
+ * The value for the aria-autocomplete attribute of the trigger element.
3373
+ */
3374
+ a11yAutocomplete: {
3375
+ type: String,
3376
+ attribute: false,
3377
+ }
3378
+ };
3379
+ }
3380
+
3381
+ static get styles() {
3382
+ return [
3383
+ colorCss$1,
3384
+ styleCss$1,
3385
+ tokensCss$1
3386
+ ];
3387
+ }
3388
+
3389
+ /**
3390
+ * This will register this element with the browser.
3391
+ * @param {string} [name="auro-dropdown"] - The name of element that you want to register to.
3392
+ *
3393
+ * @example
3394
+ * AuroDropdown.register("custom-dropdown") // this will register this element to <custom-dropdown/>
3395
+ *
3396
+ */
3397
+ static register(name = "auro-dropdown") {
3398
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroDropdown);
3399
+ }
3400
+
3401
+ /**
3402
+ * Accessor for reusing the focusable entity query string.
3403
+ * @private
3404
+ * @returns {string}
3405
+ */
3406
+ get focusableEntityQuery () {
3407
+ return 'auro-input, [auro-input], auro-button, [auro-button], button, input';
3408
+ }
3409
+
3410
+ connectedCallback() {
3411
+ super.connectedCallback();
3412
+ }
3413
+
3414
+ disconnectedCallback() {
3415
+ super.disconnectedCallback();
3416
+ this.floater.disconnect();
3417
+ this.clearTriggerFocusEventBinding();
3418
+ }
3419
+
3420
+ updated(changedProperties) {
3421
+ this.floater.handleUpdate(changedProperties);
3422
+
3423
+ // Note: `disabled` is not a breakpoint (it is not a screen size),
3424
+ // so it looks like we never consume this - however, dropdownBib handles this in the setter as "undefined"
3425
+ if (changedProperties.has('fullscreenBreakpoint')) {
3426
+ this.bibContent.mobileFullscreenBreakpoint = this.fullscreenBreakpoint;
3427
+ }
3428
+
3429
+ // when trigger's content is changed without any attribute or node change,
3430
+ // `requestUpdate` needs to be called to update hasTriggerContnet
3431
+ if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3432
+ this.handleTriggerContentSlotChange();
3433
+ }
3434
+
3435
+ }
3436
+
3437
+ firstUpdated() {
3438
+
3439
+ // Configure the floater to, this will generate the ID for the bib
3440
+ this.floater.configure(this, 'auroDropdown');
3441
+
3442
+ /**
3443
+ * @description Let subscribers know that the dropdown ID ha been generated and added.
3444
+ * @event auroDropdown-idAdded
3445
+ * @type {Object<key: 'id', value: string>} - The ID of the dropdown bib element.
3446
+ */
3447
+ this.dispatchEvent(new CustomEvent('auroDropdown-idAdded', {detail: {id: this.floater.element.id}}));
3448
+
3449
+ // Set the bib ID locally if the user hasn't provided a focusable trigger
3450
+ if (!this.triggerContentFocusable) {
3451
+ this.dropdownId = this.floater.element.id;
3452
+ }
3453
+
3454
+ this.bibContent = this.floater.element.bib;
3455
+
3456
+ // Add the tag name as an attribute if it is different than the component name
3457
+ this.runtimeUtils.handleComponentTagRename(this, 'auro-dropdown');
3458
+ }
3459
+
3460
+ /**
3461
+ * Exposes CSS parts for styling from parent components.
3462
+ * @returns {void}
3463
+ */
3464
+ exposeCssParts() {
3465
+ this.setAttribute('exportparts', 'trigger:dropdownTrigger, chevron:dropdownChevron, helpText:dropdownHelpText, size:dropdownSize');
3466
+ }
3467
+
3468
+ /**
3469
+ * Determines if content is within a custom slot.
3470
+ * @private
3471
+ * @param {HTMLElement} element - The element to check.
3472
+ * @returns {Boolean}
3473
+ */
3474
+ isCustomSlotContent(element) {
3475
+ let currentElement = element;
3476
+
3477
+ let inCustomSlot = false;
3478
+
3479
+ while (currentElement) {
3480
+ currentElement = currentElement.parentElement;
3481
+
3482
+ if (currentElement && currentElement.hasAttribute('slot')) {
3483
+ inCustomSlot = true;
3484
+ break;
3485
+ }
3486
+ }
3487
+
3488
+ return inCustomSlot;
3489
+ }
3490
+
3491
+ /**
3492
+ * Determines if the element or any children are focusable.
3493
+ * @private
3494
+ * @param {HTMLElement} element - Element to check.
3495
+ * @returns {Boolean} - True if the element or any children are focusable.
3496
+ */
3497
+ containsFocusableElement(element) {
3498
+ this.showTriggerBorders = true;
3499
+
3500
+ const nodes = [
3501
+ element,
3502
+ ...element.children
3503
+ ];
3504
+
3505
+ const focusableElements = [
3506
+ 'a',
3507
+ 'auro-hyperlink',
3508
+ 'button',
3509
+ 'auro-button',
3510
+ 'input',
3511
+ 'auro-input',
3512
+ ];
3513
+
3514
+ const focusableElementsThatNeedBorders = ['auro-input'];
3515
+
3516
+ const result = nodes.some((node) => {
3517
+ const tagName = node.tagName.toLowerCase();
3518
+
3519
+ if (node.tabIndex > -1) {
3520
+ return true;
3521
+ }
3522
+
3523
+ if (focusableElements.includes(tagName)) {
3524
+ if ((tagName === 'a' || tagName === 'auro-hyperlink' || node.hasAttribute('auro-hyperlink')) && node.hasAttribute('href')) {
3525
+ return true;
3526
+ }
3527
+ if (!node.hasAttribute('disabled')) {
3528
+ return true;
3529
+ }
3530
+ }
3531
+
3532
+ if (focusableElements.some((focusableElement) => focusableElement.startsWith('auro-') && (focusableElement === tagName || node.hasAttribute(focusableElement)))) {
3533
+ return true;
3534
+ }
3535
+
3536
+ return false;
3537
+ });
3538
+
3539
+ if (result) {
3540
+ this.showTriggerBorders = !nodes.some((node) => {
3541
+ const tagName = node.tagName.toLowerCase();
3542
+ return focusableElements.includes(tagName) && !focusableElementsThatNeedBorders.includes(tagName);
3543
+ });
3544
+ }
3545
+
3546
+ return result;
3547
+ }
3548
+
3549
+ /**
3550
+ * @private
3551
+ * Creates and dispatches a duplicate focus event on the trigger element.
3552
+ * @param {Event} event - The original focus event.
3553
+ */
3554
+ bindFocusEventToTrigger(event) {
3555
+ const dupEvent = new FocusEvent(event.type, {
3556
+ bubbles: false,
3557
+ cancelable: false,
3558
+ composed: true,
3559
+ });
3560
+ this.trigger.dispatchEvent(dupEvent);
3561
+ }
3562
+
3563
+ /**
3564
+ * @private
3565
+ * Sets up event listeners to deliver focus and blur events from nested Auro components within the trigger slot to trigger.
3566
+ * This ensures that focus/blur events originating from within these components are propagated to the trigger element itself.
3567
+ */
3568
+ setupTriggerFocusEventBinding() {
3569
+ if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
3570
+ return;
3571
+ }
3572
+
3573
+ this.triggerContentSlot.forEach((node) => {
3574
+ if (node.querySelectorAll) {
3575
+ const auroElements = node.querySelectorAll(this.focusableEntityQuery);
3576
+ auroElements.forEach((auroEl) => {
3577
+ auroEl.addEventListener('focus', this.bindFocusEventToTrigger);
3578
+ auroEl.addEventListener('blur', this.bindFocusEventToTrigger);
3579
+ });
3580
+ }
3581
+ });
3582
+ }
3583
+
3584
+ /**
3585
+ * Clears focus and blur event listeners from nested Auro components within the trigger slot.
3586
+ * @private
3587
+ * @returns {void}
3588
+ */
3589
+ clearTriggerFocusEventBinding() {
3590
+ if (!this.triggerContentSlot || this.triggerContentSlot.length === 0) {
3591
+ return;
3592
+ }
3593
+
3594
+ this.triggerContentSlot.forEach((node) => {
3595
+ if (node.querySelectorAll) {
3596
+ const auroElements = node.querySelectorAll(this.focusableEntityQuery);
3597
+ auroElements.forEach((auroEl) => {
3598
+ auroEl.removeEventListener('focus', this.bindFocusEventToTrigger);
3599
+ auroEl.removeEventListener('blur', this.bindFocusEventToTrigger);
3600
+ });
3601
+ }
3602
+ });
3603
+ }
3604
+
3605
+ /*
3606
+ * Sets aria attributes for the trigger element if a custom one is passed in.
3607
+ * @private
3608
+ * @method setTriggerAriaAttributes
3609
+ * @param { HTMLElement } triggerElement - The custom trigger element.
3610
+ */
3611
+ clearTriggerA11yAttributes(triggerElement) {
3612
+
3613
+ if (!triggerElement || !triggerElement.removeAttribute) {
3614
+ return;
3615
+ }
3616
+
3617
+ // Reset appropriate attributes for a11y
3618
+ triggerElement.removeAttribute('aria-labelledby');
3619
+ if (triggerElement.getAttribute('id') === `${this.id}-trigger-element`) {
3620
+ triggerElement.removeAttribute('id');
3621
+ }
3622
+ triggerElement.removeAttribute('role');
3623
+ triggerElement.removeAttribute('aria-expanded');
3624
+
3625
+ triggerElement.removeAttribute('aria-controls');
3626
+ triggerElement.removeAttribute('aria-autocomplete');
3627
+ }
3628
+
3629
+ /**
3630
+ * Handles changes to the trigger content slot and updates related properties.
3631
+ *
3632
+ * It first updates the floater settings
3633
+ * Then, it retrieves the assigned nodes from the event target and checks if any of
3634
+ * the nodes contain non-empty text content, updating the `hasTriggerContent` property accordingly.
3635
+ *
3636
+ * @private
3637
+ * @method handleTriggerContentSlotChange
3638
+ * @param {Event} event - Native slotchange event.
3639
+ * @returns {void}
3640
+ */
3641
+ handleTriggerContentSlotChange(event) {
3642
+
3643
+ this.floater.handleTriggerTabIndex();
3644
+
3645
+ // Get the trigger
3646
+ const trigger = this.shadowRoot.querySelector('#trigger');
3647
+
3648
+ // Get the trigger slot
3649
+ const triggerSlot = this.shadowRoot.querySelector('.triggerContent slot');
3650
+
3651
+ // If there's a trigger slot
3652
+ if (triggerSlot) {
3653
+
3654
+ // Get the content nodes to see if there are any children
3655
+ const triggerContentNodes = triggerSlot.assignedNodes();
3656
+
3657
+ // If there are children
3658
+ if (triggerContentNodes) {
3659
+
3660
+ // See if any of them are focusable elemeents
3661
+ this.triggerContentFocusable = triggerContentNodes.some((node) => this.containsFocusableElement(node));
3662
+
3663
+ // If any of them are focusable elements
3664
+ if (this.triggerContentFocusable) {
3665
+
3666
+ // Assume the consumer will be providing their own a11y in whatever they passed in
3667
+ this.clearTriggerA11yAttributes(trigger);
3668
+
3669
+ // Remove the tabindex from the trigger so it doesn't interrupt focus flow
3670
+ trigger.removeAttribute('tabindex');
3671
+ } else {
3672
+
3673
+ // Add the tabindex to the trigger so that it's in the focus flow
3674
+ trigger.setAttribute('tabindex', '0');
3675
+ }
3676
+ }
3677
+ }
3678
+
3679
+ if (event) {
3680
+ this.triggerNode = event.target;
3681
+ this.triggerContentSlot = event.target.assignedNodes();
3682
+ }
3683
+
3684
+ if (this.triggerContentSlot) {
3685
+ this.setupTriggerFocusEventBinding();
3686
+
3687
+ this.hasTriggerContent = this.triggerContentSlot.some((slot) => {
3688
+ if (slot.textContent.trim()) {
3689
+ return true;
3690
+ }
3691
+ const slotInSlot = slot.querySelector('slot');
3692
+ if (!slotInSlot) {
3693
+ return false;
3694
+ }
3695
+ const slotsInSlotNodes = slotInSlot.assignedNodes();
3696
+ return slotsInSlotNodes.some((ss) => Boolean(ss.textContent.trim()));
3697
+ });
3698
+ } else {
3699
+ this.hasTriggerContent = false;
3700
+ }
3701
+ }
3702
+
3703
+ /**
3704
+ * Handles the default slot change event and updates the content.
3705
+ *
3706
+ * This method retrieves all nodes assigned to the default slot of the event target and appends them
3707
+ * to the `bibContent` element. If a callback function `onSlotChange` is defined, it is invoked to
3708
+ * notify about the slot change.
3709
+ *
3710
+ * @private
3711
+ * @method handleDefaultSlot
3712
+ * @param {Event} event - The event object representing the slot change.
3713
+ * @fires Function#onSlotChange - Optional callback invoked when the slot content changes.
3714
+ */
3715
+ handleDefaultSlot(event) {
3716
+ [...event.target.assignedNodes()].forEach((node) => this.bibContent.append(node));
3717
+
3718
+ if (this.onSlotChange) {
3719
+ this.onSlotChange();
3720
+ }
3721
+ }
3722
+
3723
+ /**
3724
+ * @private
3725
+ * @method handleLabelSlotChange
3726
+ * @param {event} event - The event object representing the slot change.
3727
+ * @description Handles the slot change event for the label slot.
3728
+ */
3729
+ handleLabelSlotChange (event) {
3730
+
3731
+ // Get the nodes from the event
3732
+ const nodes = event.target.assignedNodes();
3733
+
3734
+ // Guard clause for no nodes
3735
+ if (!nodes) {
3736
+ return;
3737
+ }
3738
+
3739
+ // Convert the nodes to a measurable array so we can get the length
3740
+ const nodesArr = Array.from(nodes);
3741
+
3742
+ // If the nodes array has a length, the dropdown is labeled
3743
+ this.labeled = nodesArr.length > 0;
3744
+ }
3745
+
3746
+ // function that renders the HTML and CSS into the scope of the component
3747
+ render() {
3748
+ return u$1`
3749
+ <div>
3750
+ <div
3751
+ id="trigger"
3752
+ class="trigger"
3753
+ part="trigger"
3754
+ tabindex="${this.tabIndex}"
3755
+ ?showBorder="${this.showTriggerBorders}"
3756
+ role="${o(this.triggerContentFocusable ? undefined : this.a11yRole)}"
3757
+ aria-expanded="${o(this.triggerContentFocusable ? undefined : this.isPopoverVisible)}"
3758
+ aria-controls="${o(this.triggerContentFocusable ? undefined : this.dropdownId)}"
3759
+ aria-labelledby="${o(this.triggerContentFocusable ? undefined : 'triggerLabel')}"
3760
+ >
3761
+ <div class="triggerContentWrapper">
3762
+ <label class="label" id="triggerLabel" hasTrigger=${this.hasTriggerContent}>
3763
+ <slot name="label" @slotchange="${this.handleLabelSlotChange}"></slot>
3764
+ </label>
3765
+ <div class="triggerContent">
3766
+ <slot
3767
+ name="trigger"
3768
+ @slotchange="${this.handleTriggerContentSlotChange}"></slot>
3769
+ </div>
3770
+ </div>
3771
+ ${this.chevron || this.common ? u$1`
3772
+ <div
3773
+ id="showStateIcon"
3774
+ part="chevron">
3775
+ <${this.iconTag}
3776
+ category="interface"
3777
+ name="chevron-down"
3778
+ ?onDark="${this.onDark}"
3779
+ variant="${this.disabled ? 'disabled' : 'muted'}">
3780
+ >
3781
+ </${this.iconTag}>
3782
+ </div>
3783
+ ` : undefined }
3784
+ </div>
3785
+ <${this.helpTextTag} part="helpText" ?onDark=${this.onDark} ?error="${this.error}">
3786
+ <slot name="helpText"></slot>
3787
+ </${this.helpTextTag}>
3788
+ <div class="slotContent">
3789
+ <slot @slotchange="${this.handleDefaultSlot}"></slot>
3790
+ </div>
3791
+ <div id="bibSizer" part="size"></div>
3792
+ <${this.dropdownBibTag}
3793
+ id="bib"
3794
+ ?data-show="${this.isPopoverVisible}"
3795
+ ?isfullscreen="${this.isBibFullscreen}"
3796
+ ?common="${this.common}"
3797
+ ?rounded="${this.common || this.rounded}"
3798
+ ?inset="${this.common || this.inset}"
3799
+ >
3800
+ </${this.dropdownBibTag}>
3801
+ </div>
3802
+ `;
3803
+ }
3804
+ }
3805
+
3806
+ AuroDropdown.register();
3807
+
3808
+ /* eslint-disable jsdoc/require-jsdoc, no-magic-numbers */
3809
+
3810
+ function initExamples(initialCount = 0) {
3811
+ try {
3812
+ // javascript example function calls to be added here upon creation to test examples
3813
+ showExample();
3814
+ hideExample();
3815
+ inDialogExample();
3816
+ } catch (err) {
3817
+ if (initialCount <= 20) {
3818
+ // setTimeout handles issue where content is sometimes loaded after the functions get called
3819
+ setTimeout(() => {
3820
+ initExamples(initialCount + 1);
3821
+ }, 100);
3822
+ }
3823
+ }
3824
+ }
3825
+
3826
+ export { initExamples };