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