@odx/foundation 1.0.0-beta.9 → 1.0.0-beta.91

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 (235) hide show
  1. package/README.md +7 -8
  2. package/dist/_virtual_class-decorator-runtime.js +13 -0
  3. package/dist/components/accordion/accordion.d.ts +11 -1
  4. package/dist/components/accordion-item/accordion-item.d.ts +16 -0
  5. package/dist/components/action-button/action-button.d.ts +27 -0
  6. package/dist/components/anchor-navigation/anchor-navigation.d.ts +3 -3
  7. package/dist/components/area-header/area-header.d.ts +11 -4
  8. package/dist/components/avatar/avatar.d.ts +28 -6
  9. package/dist/components/avatar-group/avatar-group.d.ts +3 -3
  10. package/dist/components/badge/badge.d.ts +14 -5
  11. package/dist/components/breadcrumbs/breadcrumbs-item.d.ts +1 -1
  12. package/dist/components/breadcrumbs/breadcrumbs.d.ts +1 -2
  13. package/dist/components/breadcrumbs/index.d.ts +1 -1
  14. package/dist/components/button/button.d.ts +31 -20
  15. package/dist/components/button-group/button-group.d.ts +7 -0
  16. package/dist/components/card/card.d.ts +3 -1
  17. package/dist/components/checkbox/checkbox.d.ts +2 -2
  18. package/dist/components/checkbox-group/checkbox-group.d.ts +8 -3
  19. package/dist/components/chip/chip.d.ts +14 -5
  20. package/dist/components/circular-progress-bar/circular-progress-bar.d.ts +12 -5
  21. package/dist/components/combobox/autocomplete.d.ts +23 -0
  22. package/dist/components/dropdown/dropdown.d.ts +10 -9
  23. package/dist/components/format/format-bytes.d.ts +1 -1
  24. package/dist/components/format/format-number.d.ts +1 -1
  25. package/dist/components/format/relative-time.d.ts +2 -2
  26. package/dist/components/header/index.d.ts +1 -1
  27. package/dist/components/headline/headline.d.ts +14 -5
  28. package/dist/components/highlight/highlight.d.ts +14 -5
  29. package/dist/components/icon-button/icon-button.d.ts +4 -15
  30. package/dist/components/image/image.d.ts +4 -4
  31. package/dist/components/inline-message/inline-message.d.ts +15 -5
  32. package/dist/components/input/input.d.ts +15 -8
  33. package/dist/components/kpi/kpi.d.ts +36 -0
  34. package/dist/components/line-clamp/line-clamp.d.ts +2 -2
  35. package/dist/components/link/link.d.ts +3 -3
  36. package/dist/components/list/list.d.ts +3 -0
  37. package/dist/components/{list → list-item}/list-item.d.ts +7 -6
  38. package/dist/components/loader.d.ts +2 -0
  39. package/dist/components/loading-overlay/loading-overlay.d.ts +2 -3
  40. package/dist/components/loading-spinner/loading-spinner.d.ts +1 -2
  41. package/dist/components/logo/logo.d.ts +11 -3
  42. package/dist/components/main-menu/index.d.ts +1 -1
  43. package/dist/components/main-menu/main-menu-link.d.ts +2 -2
  44. package/dist/components/main-menu/main-menu.d.ts +0 -1
  45. package/dist/components/main.d.ts +62 -54
  46. package/dist/components/menu/index.d.ts +1 -1
  47. package/dist/components/menu/menu.d.ts +4 -7
  48. package/dist/components/menu-item/menu-item.d.ts +5 -6
  49. package/dist/components/modal/modal.d.ts +8 -6
  50. package/dist/components/navigation-item/navigation-item.d.ts +15 -7
  51. package/dist/components/option/option.d.ts +0 -1
  52. package/dist/components/page/page.d.ts +16 -6
  53. package/dist/components/popover/popover-host.d.ts +34 -0
  54. package/dist/components/popover/popover-observer.d.ts +11 -0
  55. package/dist/{cdk → components}/popover/popover.d.ts +1 -0
  56. package/dist/components/progress-bar/progress-bar.d.ts +12 -6
  57. package/dist/components/radio-group/radio-group.d.ts +8 -3
  58. package/dist/components/search-bar/index.d.ts +0 -1
  59. package/dist/components/search-bar/search-bar.d.ts +9 -3
  60. package/dist/components/select/select.d.ts +13 -7
  61. package/dist/components/separator/separator.d.ts +9 -4
  62. package/dist/components/skeleton/skeleton.d.ts +21 -6
  63. package/dist/components/slider/index.d.ts +2 -2
  64. package/dist/components/slider/slider-handle.d.ts +5 -6
  65. package/dist/components/slider/slider-marks.d.ts +1 -1
  66. package/dist/components/slider/slider.d.ts +2 -3
  67. package/dist/components/slider/slider.models.d.ts +3 -2
  68. package/dist/components/spinbox/spinbox.d.ts +13 -11
  69. package/dist/components/stack/stack.d.ts +26 -6
  70. package/dist/components/status/status.d.ts +23 -0
  71. package/dist/components/table/index.d.ts +3 -3
  72. package/dist/components/table/table-header.d.ts +1 -1
  73. package/dist/components/table/table-row.d.ts +1 -1
  74. package/dist/components/text/text.d.ts +23 -4
  75. package/dist/components/title/title.d.ts +14 -5
  76. package/dist/components/toast/toast.d.ts +14 -3
  77. package/dist/components/toggle-button/toggle-button.d.ts +1 -4
  78. package/dist/components/toggle-button-group/toggle-button-group.d.ts +10 -0
  79. package/dist/components/toggle-content/toggle-content.d.ts +2 -2
  80. package/dist/components/tooltip/tooltip.d.ts +24 -8
  81. package/dist/components.js +2895 -3612
  82. package/dist/i18n/{lib/is-localized.d.ts → is-localized.d.ts} +2 -2
  83. package/dist/i18n/{lib/localization.d.ts → localization.d.ts} +1 -1
  84. package/dist/i18n/main.d.ts +6 -6
  85. package/dist/i18n/{lib/translate.d.ts → translate.d.ts} +1 -1
  86. package/dist/i18n.js +11 -18
  87. package/dist/lib/{facade → control}/checkbox-form-control.d.ts +4 -4
  88. package/dist/lib/control/checkbox-group-form-control.d.ts +22 -0
  89. package/dist/lib/control/form-control.d.ts +29 -0
  90. package/dist/lib/control/listbox-form-control.d.ts +25 -0
  91. package/dist/lib/control/number-form-control.d.ts +12 -0
  92. package/dist/lib/control/option-control.d.ts +24 -0
  93. package/dist/lib/control/radio-group-form-control.d.ts +22 -0
  94. package/dist/lib/controllers/active-descendants-controller.d.ts +29 -0
  95. package/dist/{cdk/drag-drop → lib/controllers}/drag.controller.d.ts +2 -1
  96. package/dist/lib/controllers/expandable-controller.d.ts +1 -2
  97. package/dist/lib/custom-element.d.ts +12 -5
  98. package/dist/lib/interactive/interactive-element.d.ts +23 -0
  99. package/dist/lib/interactive/interactive-link.d.ts +21 -0
  100. package/dist/lib/main.d.ts +20 -25
  101. package/dist/lib/mixins/can-be-disabled.d.ts +1 -9
  102. package/dist/lib/mixins/can-be-expanded.d.ts +5 -7
  103. package/dist/lib/mixins/is-draggable.d.ts +16 -0
  104. package/dist/{cdk/drag-drop/drag-events.d.ts → lib/models/drag-event.d.ts} +1 -1
  105. package/dist/lib/models/placement.d.ts +17 -0
  106. package/dist/lib/models/shape.d.ts +7 -0
  107. package/dist/lib/models/size.d.ts +11 -0
  108. package/dist/lib/models/variant.d.ts +12 -0
  109. package/dist/lib/utils/compute-popover-placement.d.ts +14 -0
  110. package/dist/lib/utils/dom.d.ts +25 -15
  111. package/dist/lib/utils/get-unique-id.d.ts +6 -23
  112. package/dist/lib/utils/lit.d.ts +1 -3
  113. package/dist/lib/utils/shared-resize-observer.d.ts +0 -7
  114. package/dist/lib/utils/{a11y.d.ts → types.d.ts} +3 -6
  115. package/dist/loader.js +6 -11
  116. package/dist/main.js +906 -867
  117. package/dist/styles.css +1 -1
  118. package/dist/vendor.js +1982 -0
  119. package/package.json +47 -27
  120. package/dist/cdk/drag-drop/is-draggable.d.ts +0 -18
  121. package/dist/cdk/main.d.ts +0 -7
  122. package/dist/cdk/popover/popover-host.d.ts +0 -20
  123. package/dist/cdk/popover/popover.models.d.ts +0 -34
  124. package/dist/cdk/popover/popover.utils.d.ts +0 -5
  125. package/dist/cdk.js +0 -357
  126. package/dist/components/accordion/accordion-header.d.ts +0 -18
  127. package/dist/components/accordion/index.d.ts +0 -4
  128. package/dist/components/action-group/action-group.d.ts +0 -24
  129. package/dist/components/action-group/index.d.ts +0 -2
  130. package/dist/components/area-header/area-header.models.d.ts +0 -12
  131. package/dist/components/area-header/index.d.ts +0 -3
  132. package/dist/components/avatar/avatar.models.d.ts +0 -13
  133. package/dist/components/avatar/index.d.ts +0 -3
  134. package/dist/components/avatar-group/index.d.ts +0 -2
  135. package/dist/components/badge/badge.models.d.ts +0 -14
  136. package/dist/components/badge/index.d.ts +0 -3
  137. package/dist/components/button/base-button.d.ts +0 -30
  138. package/dist/components/button/button.models.d.ts +0 -26
  139. package/dist/components/button/index.d.ts +0 -4
  140. package/dist/components/button-group/index.d.ts +0 -2
  141. package/dist/components/card/index.d.ts +0 -2
  142. package/dist/components/checkbox/index.d.ts +0 -2
  143. package/dist/components/checkbox-group/checkbox-group.models.d.ts +0 -6
  144. package/dist/components/checkbox-group/index.d.ts +0 -3
  145. package/dist/components/chip/chip.models.d.ts +0 -10
  146. package/dist/components/chip/index.d.ts +0 -3
  147. package/dist/components/circular-progress-bar/circular-progress-bar.models.d.ts +0 -7
  148. package/dist/components/circular-progress-bar/index.d.ts +0 -3
  149. package/dist/components/content-box/content-box.models.d.ts +0 -2
  150. package/dist/components/content-box/index.d.ts +0 -2
  151. package/dist/components/dropdown/dropdown.models.d.ts +0 -6
  152. package/dist/components/dropdown/index.d.ts +0 -3
  153. package/dist/components/form-field/index.d.ts +0 -2
  154. package/dist/components/headline/headline.models.d.ts +0 -8
  155. package/dist/components/headline/index.d.ts +0 -3
  156. package/dist/components/highlight/index.d.ts +0 -2
  157. package/dist/components/icon-button/index.d.ts +0 -2
  158. package/dist/components/image/index.d.ts +0 -2
  159. package/dist/components/inline-message/index.d.ts +0 -3
  160. package/dist/components/inline-message/inline-message.models.d.ts +0 -12
  161. package/dist/components/input/index.d.ts +0 -3
  162. package/dist/components/input/input.models.d.ts +0 -7
  163. package/dist/components/line-clamp/index.d.ts +0 -2
  164. package/dist/components/link/base-link.d.ts +0 -15
  165. package/dist/components/link/index.d.ts +0 -3
  166. package/dist/components/list/index.d.ts +0 -3
  167. package/dist/components/loading-overlay/index.d.ts +0 -2
  168. package/dist/components/loading-spinner/index.d.ts +0 -2
  169. package/dist/components/logo/index.d.ts +0 -3
  170. package/dist/components/logo/logo.models.d.ts +0 -9
  171. package/dist/components/menu-item/index.d.ts +0 -2
  172. package/dist/components/modal/index.d.ts +0 -3
  173. package/dist/components/modal/modal.models.d.ts +0 -5
  174. package/dist/components/navigation-item/index.d.ts +0 -3
  175. package/dist/components/navigation-item/navigation-item.models.d.ts +0 -6
  176. package/dist/components/option/index.d.ts +0 -2
  177. package/dist/components/page/index.d.ts +0 -3
  178. package/dist/components/page/page.models.d.ts +0 -10
  179. package/dist/components/page-layout/index.d.ts +0 -2
  180. package/dist/components/pagination/index.d.ts +0 -2
  181. package/dist/components/progress-bar/index.d.ts +0 -3
  182. package/dist/components/progress-bar/progress-bar.models.d.ts +0 -7
  183. package/dist/components/radio-button/index.d.ts +0 -2
  184. package/dist/components/radio-group/index.d.ts +0 -3
  185. package/dist/components/radio-group/radio-group.models.d.ts +0 -6
  186. package/dist/components/rail-navigation/index.d.ts +0 -2
  187. package/dist/components/search-bar/search-bar.models.d.ts +0 -6
  188. package/dist/components/select/index.d.ts +0 -2
  189. package/dist/components/separator/index.d.ts +0 -3
  190. package/dist/components/separator/separator.models.d.ts +0 -6
  191. package/dist/components/skeleton/index.d.ts +0 -3
  192. package/dist/components/skeleton/skeleton.models.d.ts +0 -13
  193. package/dist/components/spacer/index.d.ts +0 -2
  194. package/dist/components/spacer/spacer.models.d.ts +0 -7
  195. package/dist/components/spinbox/index.d.ts +0 -2
  196. package/dist/components/stack/index.d.ts +0 -3
  197. package/dist/components/stack/stack.models.d.ts +0 -25
  198. package/dist/components/switch/index.d.ts +0 -2
  199. package/dist/components/text/index.d.ts +0 -3
  200. package/dist/components/text/text.models.d.ts +0 -14
  201. package/dist/components/title/index.d.ts +0 -3
  202. package/dist/components/title/title.models.d.ts +0 -10
  203. package/dist/components/toast/index.d.ts +0 -3
  204. package/dist/components/toast/toast.models.d.ts +0 -5
  205. package/dist/components/toggle-button/index.d.ts +0 -2
  206. package/dist/components/toggle-content/index.d.ts +0 -2
  207. package/dist/components/tooltip/index.d.ts +0 -3
  208. package/dist/components/tooltip/tooltip.models.d.ts +0 -8
  209. package/dist/components/translate/index.d.ts +0 -2
  210. package/dist/components/visually-hidden/index.d.ts +0 -2
  211. package/dist/lib/controllers/focus-trap.controller.d.ts +0 -14
  212. package/dist/lib/facade/checkbox-group-form-control.d.ts +0 -21
  213. package/dist/lib/facade/option-control.d.ts +0 -16
  214. package/dist/lib/facade/radio-group-form-control.d.ts +0 -22
  215. package/dist/lib/facade/select-form-control.d.ts +0 -19
  216. package/dist/lib/mixins/can-be-readonly.d.ts +0 -7
  217. package/dist/lib/mixins/can-be-required.d.ts +0 -7
  218. package/dist/lib/mixins/can-be-selected.d.ts +0 -9
  219. package/dist/lib/mixins/can-be-validated.d.ts +0 -12
  220. package/dist/lib/mixins/form-control.d.ts +0 -17
  221. package/dist/lib/mixins/number-control.d.ts +0 -12
  222. package/dist/lib/mixins/with-loading-state.d.ts +0 -8
  223. package/dist/lib/utils/date.d.ts +0 -2
  224. package/dist/lib/utils/dedupe-mixin.d.ts +0 -3
  225. package/dist/lib/utils/empty-slot-fallback-fix.d.ts +0 -8
  226. package/dist/lib/utils/keyboard-events.d.ts +0 -43
  227. package/dist/lib/utils/search-text-content.d.ts +0 -7
  228. package/dist/lib/utils/shared-intersection-observer.d.ts +0 -18
  229. package/dist/lib/utils/transformers.d.ts +0 -5
  230. package/dist/loader/main.d.ts +0 -2
  231. package/dist/vendor-dJxQG085.js +0 -138
  232. /package/dist/components/{accordion → accordion-panel}/accordion-panel.d.ts +0 -0
  233. /package/dist/i18n/{lib/config.d.ts → config.d.ts} +0 -0
  234. /package/dist/i18n/{lib/format.d.ts → format.d.ts} +0 -0
  235. /package/dist/i18n/{lib/models.d.ts → models.d.ts} +0 -0
package/dist/vendor.js ADDED
@@ -0,0 +1,1982 @@
1
+ import { effect } from '@preact/signals-core';
2
+ import 'lit/html.js';
3
+ import { directive } from 'lit/directive.js';
4
+ import { AsyncDirective } from 'lit/async-directive.js';
5
+
6
+ function minBy(items, getValue) {
7
+ let minElement = items[0];
8
+ let min = Infinity;
9
+ for (let i = 0; i < items.length; i++) {
10
+ const element = items[i];
11
+ const value = getValue(element);
12
+ if (value < min) {
13
+ min = value;
14
+ minElement = element;
15
+ }
16
+ }
17
+ return minElement;
18
+ }
19
+
20
+ function uniqBy(arr, mapper) {
21
+ const map = new Map();
22
+ for (let i = 0; i < arr.length; i++) {
23
+ const item = arr[i];
24
+ const key = mapper(item);
25
+ if (!map.has(key)) {
26
+ map.set(key, item);
27
+ }
28
+ }
29
+ return Array.from(map.values());
30
+ }
31
+
32
+ function round$1(value, precision = 0) {
33
+ if (!Number.isInteger(precision)) {
34
+ throw new Error('Precision must be an integer.');
35
+ }
36
+ const multiplier = Math.pow(10, precision);
37
+ return Math.round(value * multiplier) / multiplier;
38
+ }
39
+
40
+ function o(r,e,t){return typeof r===e?()=>r:typeof r=="function"?r:t}class FocusGroupController{constructor(e,{hostDelegatesFocus:t,direction:n,elementEnterAction:s,elements:i,focusInIndex:h,isFocusableElement:c,listenerScope:l}={elements:()=>[]}){this._currentIndex=-1;this.prevIndex=-1;this._direction=()=>"both";this.directionLength=5;this.hostDelegatesFocus=false;this.elementEnterAction=e=>{};this._focused=false;this._focusInIndex=e=>0;this.isFocusableElement=e=>true;this._listenerScope=()=>this.host;this.offset=0;this.recentlyConnected=false;this.handleFocusin=e=>{if(!this.isEventWithinListenerScope(e))return;const t=e.composedPath();let n=-1;t.find(s=>(n=this.elements.indexOf(s),n!==-1)),this.prevIndex=this.currentIndex,this.currentIndex=n>-1?n:this.currentIndex,this.isRelatedTargetOrContainAnElement(e)&&this.hostContainsFocus();};this.handleClick=()=>{var n;const e=this.elements;if(!e.length)return;let t=e[this.currentIndex];this.currentIndex<0||((!t||!this.isFocusableElement(t))&&(this.setCurrentIndexCircularly(1),t=e[this.currentIndex]),t&&this.isFocusableElement(t)&&((n=e[this.prevIndex])==null||n.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0")));};this.handleFocusout=e=>{this.isRelatedTargetOrContainAnElement(e)&&this.hostNoLongerContainsFocus();};this.handleKeydown=e=>{if(!this.acceptsEventKey(e.key)||e.defaultPrevented)return;let t=0;switch(this.prevIndex=this.currentIndex,e.key){case "ArrowRight":t+=1;break;case "ArrowDown":t+=this.direction==="grid"?this.directionLength:1;break;case "ArrowLeft":t-=1;break;case "ArrowUp":t-=this.direction==="grid"?this.directionLength:1;break;case "End":this.currentIndex=0,t-=1;break;case "Home":this.currentIndex=this.elements.length-1,t+=1;break}e.preventDefault(),this.direction==="grid"&&this.currentIndex+t<0?this.currentIndex=0:this.direction==="grid"&&this.currentIndex+t>this.elements.length-1?this.currentIndex=this.elements.length-1:this.setCurrentIndexCircularly(t),this.elementEnterAction(this.elements[this.currentIndex]),this.focus();};this.mutationObserver=new MutationObserver(()=>{this.handleItemMutation();}),this.hostDelegatesFocus=t||false,this.host=e,this.host.addController(this),this._elements=i,this.isFocusableElement=c||this.isFocusableElement,this._direction=o(n,"string",this._direction),this.elementEnterAction=s||this.elementEnterAction,this._focusInIndex=o(h,"number",this._focusInIndex),this._listenerScope=o(l,"object",this._listenerScope);}get currentIndex(){return this._currentIndex===-1&&(this._currentIndex=this.focusInIndex),this._currentIndex-this.offset}set currentIndex(e){this._currentIndex=e+this.offset;}get direction(){return this._direction()}get elements(){return this.cachedElements||(this.cachedElements=this._elements()),this.cachedElements}set focused(e){e!==this.focused&&(this._focused=e);}get focused(){return this._focused}get focusInElement(){return this.elements[this.focusInIndex]}get focusInIndex(){return this._focusInIndex(this.elements)}isEventWithinListenerScope(e){return this._listenerScope()===this.host?true:e.composedPath().includes(this._listenerScope())}handleItemMutation(){if(this._currentIndex==-1||this.elements.length<=this._elements().length)return;const e=this.elements[this.currentIndex];if(this.clearElementCache(),this.elements.includes(e))return;const t=this.currentIndex!==this.elements.length,n=t?1:-1;t&&this.setCurrentIndexCircularly(-1),this.setCurrentIndexCircularly(n),this.focus();}update({elements:e}={elements:()=>[]}){this.unmanage(),this._elements=e,this.clearElementCache(),this.manage();}reset(){var n;const e=this.elements;if(!e.length)return;this.setCurrentIndexCircularly(this.focusInIndex-this.currentIndex);let t=e[this.currentIndex];this.currentIndex<0||((!t||!this.isFocusableElement(t))&&(this.setCurrentIndexCircularly(1),t=e[this.currentIndex]),t&&this.isFocusableElement(t)&&((n=e[this.prevIndex])==null||n.setAttribute("tabindex","-1"),t.setAttribute("tabindex","0")));}focusOnItem(e,t){var i;const n=this.elements||[],s=!e||!this.isFocusableElement(e)?-1:n.indexOf(e);s>-1&&(this.currentIndex=s,(i=n[this.prevIndex])==null||i.setAttribute("tabindex","-1")),this.focus(t);}focus(e){var s;const t=this.elements;if(!t.length)return;let n=t[this.currentIndex];(!n||!this.isFocusableElement(n))&&(this.setCurrentIndexCircularly(1),n=t[this.currentIndex]),n&&this.isFocusableElement(n)&&((!this.hostDelegatesFocus||t[this.prevIndex]!==n)&&((s=t[this.prevIndex])==null||s.setAttribute("tabindex","-1")),n.tabIndex=0,n.focus(e),this.hostDelegatesFocus&&!this.focused&&this.hostContainsFocus());}clearElementCache(e=0){this.mutationObserver.disconnect(),delete this.cachedElements,this.offset=e,requestAnimationFrame(()=>{this.elements.forEach(t=>{this.mutationObserver.observe(t,{attributes:true});});});}setCurrentIndexCircularly(e){const{length:t}=this.elements;let n=t;this.prevIndex=this.currentIndex;let s=(t+this.currentIndex+e)%t;for(;n&&this.elements[s]&&!this.isFocusableElement(this.elements[s]);)s=(t+s+e)%t,n-=1;this.currentIndex=s;}hostContainsFocus(){this.host.addEventListener("focusout",this.handleFocusout),this.host.addEventListener("keydown",this.handleKeydown),this.focused=true;}hostNoLongerContainsFocus(){this.host.addEventListener("focusin",this.handleFocusin),this.host.removeEventListener("focusout",this.handleFocusout),this.host.removeEventListener("keydown",this.handleKeydown),this.focused=false;}isRelatedTargetOrContainAnElement(e){const t=e.relatedTarget,n=this.elements.includes(t),s=this.elements.some(i=>i.contains(t));return !(n||s)}acceptsEventKey(e){if(e==="End"||e==="Home")return true;switch(this.direction){case "horizontal":return e==="ArrowLeft"||e==="ArrowRight";case "vertical":return e==="ArrowUp"||e==="ArrowDown";case "both":case "grid":return e.startsWith("Arrow")}}manage(){this.addEventListeners();}unmanage(){this.removeEventListeners();}addEventListeners(){this.host.addEventListener("focusin",this.handleFocusin),this.host.addEventListener("click",this.handleClick);}removeEventListeners(){this.host.removeEventListener("focusin",this.handleFocusin),this.host.removeEventListener("focusout",this.handleFocusout),this.host.removeEventListener("keydown",this.handleKeydown),this.host.removeEventListener("click",this.handleClick);}hostConnected(){this.recentlyConnected=true,this.addEventListeners();}hostDisconnected(){this.mutationObserver.disconnect(),this.removeEventListeners();}hostUpdated(){this.recentlyConnected&&(this.recentlyConnected=false,this.elements.forEach(e=>{this.mutationObserver.observe(e,{attributes:true});}));}}
41
+
42
+ class RovingTabindexController extends FocusGroupController{constructor(){super(...arguments);this.managed=true;this.manageIndexesAnimationFrame=0;}set focused(e){e!==this.focused&&(super.focused=e,this.manageTabindexes());}get focused(){return super.focused}clearElementCache(e=0){cancelAnimationFrame(this.manageIndexesAnimationFrame),super.clearElementCache(e),this.managed&&(this.manageIndexesAnimationFrame=requestAnimationFrame(()=>this.manageTabindexes()));}manageTabindexes(){this.focused&&!this.hostDelegatesFocus?this.updateTabindexes(()=>({tabIndex:-1})):this.updateTabindexes(e=>({removeTabIndex:e.contains(this.focusInElement)&&e!==this.focusInElement,tabIndex:e===this.focusInElement?0:-1}));}updateTabindexes(e){this.elements.forEach(a=>{const{tabIndex:n,removeTabIndex:s}=e(a);if(!s){this.focused?a!==this.elements[this.currentIndex]&&(a.tabIndex=n):a.tabIndex=n;return}const t=a;t.requestUpdate&&t.requestUpdate();});}manage(){this.managed=true,this.manageTabindexes(),super.manage();}unmanage(){this.managed=false,this.updateTabindexes(()=>({tabIndex:0})),super.unmanage();}hostUpdated(){super.hostUpdated(),this.host.hasUpdated||this.manageTabindexes();}}
43
+
44
+ /**
45
+ * Custom positioning reference element.
46
+ * @see https://floating-ui.com/docs/virtual-elements
47
+ */
48
+
49
+ const sides = ['top', 'right', 'bottom', 'left'];
50
+ const min = Math.min;
51
+ const max = Math.max;
52
+ const round = Math.round;
53
+ const floor = Math.floor;
54
+ const createCoords = v => ({
55
+ x: v,
56
+ y: v
57
+ });
58
+ const oppositeSideMap = {
59
+ left: 'right',
60
+ right: 'left',
61
+ bottom: 'top',
62
+ top: 'bottom'
63
+ };
64
+ const oppositeAlignmentMap = {
65
+ start: 'end',
66
+ end: 'start'
67
+ };
68
+ function clamp(start, value, end) {
69
+ return max(start, min(value, end));
70
+ }
71
+ function evaluate(value, param) {
72
+ return typeof value === 'function' ? value(param) : value;
73
+ }
74
+ function getSide(placement) {
75
+ return placement.split('-')[0];
76
+ }
77
+ function getAlignment(placement) {
78
+ return placement.split('-')[1];
79
+ }
80
+ function getOppositeAxis(axis) {
81
+ return axis === 'x' ? 'y' : 'x';
82
+ }
83
+ function getAxisLength(axis) {
84
+ return axis === 'y' ? 'height' : 'width';
85
+ }
86
+ function getSideAxis(placement) {
87
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
88
+ }
89
+ function getAlignmentAxis(placement) {
90
+ return getOppositeAxis(getSideAxis(placement));
91
+ }
92
+ function getAlignmentSides(placement, rects, rtl) {
93
+ if (rtl === void 0) {
94
+ rtl = false;
95
+ }
96
+ const alignment = getAlignment(placement);
97
+ const alignmentAxis = getAlignmentAxis(placement);
98
+ const length = getAxisLength(alignmentAxis);
99
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
100
+ if (rects.reference[length] > rects.floating[length]) {
101
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
102
+ }
103
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
104
+ }
105
+ function getExpandedPlacements(placement) {
106
+ const oppositePlacement = getOppositePlacement(placement);
107
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
108
+ }
109
+ function getOppositeAlignmentPlacement(placement) {
110
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
111
+ }
112
+ function getSideList(side, isStart, rtl) {
113
+ const lr = ['left', 'right'];
114
+ const rl = ['right', 'left'];
115
+ const tb = ['top', 'bottom'];
116
+ const bt = ['bottom', 'top'];
117
+ switch (side) {
118
+ case 'top':
119
+ case 'bottom':
120
+ if (rtl) return isStart ? rl : lr;
121
+ return isStart ? lr : rl;
122
+ case 'left':
123
+ case 'right':
124
+ return isStart ? tb : bt;
125
+ default:
126
+ return [];
127
+ }
128
+ }
129
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
130
+ const alignment = getAlignment(placement);
131
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
132
+ if (alignment) {
133
+ list = list.map(side => side + "-" + alignment);
134
+ if (flipAlignment) {
135
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
136
+ }
137
+ }
138
+ return list;
139
+ }
140
+ function getOppositePlacement(placement) {
141
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
142
+ }
143
+ function expandPaddingObject(padding) {
144
+ return {
145
+ top: 0,
146
+ right: 0,
147
+ bottom: 0,
148
+ left: 0,
149
+ ...padding
150
+ };
151
+ }
152
+ function getPaddingObject(padding) {
153
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
154
+ top: padding,
155
+ right: padding,
156
+ bottom: padding,
157
+ left: padding
158
+ };
159
+ }
160
+ function rectToClientRect(rect) {
161
+ const {
162
+ x,
163
+ y,
164
+ width,
165
+ height
166
+ } = rect;
167
+ return {
168
+ width,
169
+ height,
170
+ top: y,
171
+ left: x,
172
+ right: x + width,
173
+ bottom: y + height,
174
+ x,
175
+ y
176
+ };
177
+ }
178
+
179
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
180
+ let {
181
+ reference,
182
+ floating
183
+ } = _ref;
184
+ const sideAxis = getSideAxis(placement);
185
+ const alignmentAxis = getAlignmentAxis(placement);
186
+ const alignLength = getAxisLength(alignmentAxis);
187
+ const side = getSide(placement);
188
+ const isVertical = sideAxis === 'y';
189
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
190
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
191
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
192
+ let coords;
193
+ switch (side) {
194
+ case 'top':
195
+ coords = {
196
+ x: commonX,
197
+ y: reference.y - floating.height
198
+ };
199
+ break;
200
+ case 'bottom':
201
+ coords = {
202
+ x: commonX,
203
+ y: reference.y + reference.height
204
+ };
205
+ break;
206
+ case 'right':
207
+ coords = {
208
+ x: reference.x + reference.width,
209
+ y: commonY
210
+ };
211
+ break;
212
+ case 'left':
213
+ coords = {
214
+ x: reference.x - floating.width,
215
+ y: commonY
216
+ };
217
+ break;
218
+ default:
219
+ coords = {
220
+ x: reference.x,
221
+ y: reference.y
222
+ };
223
+ }
224
+ switch (getAlignment(placement)) {
225
+ case 'start':
226
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
227
+ break;
228
+ case 'end':
229
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
230
+ break;
231
+ }
232
+ return coords;
233
+ }
234
+
235
+ /**
236
+ * Computes the `x` and `y` coordinates that will place the floating element
237
+ * next to a given reference element.
238
+ *
239
+ * This export does not have any `platform` interface logic. You will need to
240
+ * write one for the platform you are using Floating UI with.
241
+ */
242
+ const computePosition$1 = async (reference, floating, config) => {
243
+ const {
244
+ placement = 'bottom',
245
+ strategy = 'absolute',
246
+ middleware = [],
247
+ platform
248
+ } = config;
249
+ const validMiddleware = middleware.filter(Boolean);
250
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
251
+ let rects = await platform.getElementRects({
252
+ reference,
253
+ floating,
254
+ strategy
255
+ });
256
+ let {
257
+ x,
258
+ y
259
+ } = computeCoordsFromPlacement(rects, placement, rtl);
260
+ let statefulPlacement = placement;
261
+ let middlewareData = {};
262
+ let resetCount = 0;
263
+ for (let i = 0; i < validMiddleware.length; i++) {
264
+ const {
265
+ name,
266
+ fn
267
+ } = validMiddleware[i];
268
+ const {
269
+ x: nextX,
270
+ y: nextY,
271
+ data,
272
+ reset
273
+ } = await fn({
274
+ x,
275
+ y,
276
+ initialPlacement: placement,
277
+ placement: statefulPlacement,
278
+ strategy,
279
+ middlewareData,
280
+ rects,
281
+ platform,
282
+ elements: {
283
+ reference,
284
+ floating
285
+ }
286
+ });
287
+ x = nextX != null ? nextX : x;
288
+ y = nextY != null ? nextY : y;
289
+ middlewareData = {
290
+ ...middlewareData,
291
+ [name]: {
292
+ ...middlewareData[name],
293
+ ...data
294
+ }
295
+ };
296
+ if (reset && resetCount <= 50) {
297
+ resetCount++;
298
+ if (typeof reset === 'object') {
299
+ if (reset.placement) {
300
+ statefulPlacement = reset.placement;
301
+ }
302
+ if (reset.rects) {
303
+ rects = reset.rects === true ? await platform.getElementRects({
304
+ reference,
305
+ floating,
306
+ strategy
307
+ }) : reset.rects;
308
+ }
309
+ ({
310
+ x,
311
+ y
312
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
313
+ }
314
+ i = -1;
315
+ }
316
+ }
317
+ return {
318
+ x,
319
+ y,
320
+ placement: statefulPlacement,
321
+ strategy,
322
+ middlewareData
323
+ };
324
+ };
325
+
326
+ /**
327
+ * Resolves with an object of overflow side offsets that determine how much the
328
+ * element is overflowing a given clipping boundary on each side.
329
+ * - positive = overflowing the boundary by that number of pixels
330
+ * - negative = how many pixels left before it will overflow
331
+ * - 0 = lies flush with the boundary
332
+ * @see https://floating-ui.com/docs/detectOverflow
333
+ */
334
+ async function detectOverflow(state, options) {
335
+ var _await$platform$isEle;
336
+ if (options === void 0) {
337
+ options = {};
338
+ }
339
+ const {
340
+ x,
341
+ y,
342
+ platform,
343
+ rects,
344
+ elements,
345
+ strategy
346
+ } = state;
347
+ const {
348
+ boundary = 'clippingAncestors',
349
+ rootBoundary = 'viewport',
350
+ elementContext = 'floating',
351
+ altBoundary = false,
352
+ padding = 0
353
+ } = evaluate(options, state);
354
+ const paddingObject = getPaddingObject(padding);
355
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
356
+ const element = elements[altBoundary ? altContext : elementContext];
357
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
358
+ 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))),
359
+ boundary,
360
+ rootBoundary,
361
+ strategy
362
+ }));
363
+ const rect = elementContext === 'floating' ? {
364
+ x,
365
+ y,
366
+ width: rects.floating.width,
367
+ height: rects.floating.height
368
+ } : rects.reference;
369
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
370
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
371
+ x: 1,
372
+ y: 1
373
+ } : {
374
+ x: 1,
375
+ y: 1
376
+ };
377
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
378
+ elements,
379
+ rect,
380
+ offsetParent,
381
+ strategy
382
+ }) : rect);
383
+ return {
384
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
385
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
386
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
387
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
388
+ };
389
+ }
390
+
391
+ /**
392
+ * Provides data to position an inner element of the floating element so that it
393
+ * appears centered to the reference element.
394
+ * @see https://floating-ui.com/docs/arrow
395
+ */
396
+ const arrow$1 = options => ({
397
+ name: 'arrow',
398
+ options,
399
+ async fn(state) {
400
+ const {
401
+ x,
402
+ y,
403
+ placement,
404
+ rects,
405
+ platform,
406
+ elements,
407
+ middlewareData
408
+ } = state;
409
+ // Since `element` is required, we don't Partial<> the type.
410
+ const {
411
+ element,
412
+ padding = 0
413
+ } = evaluate(options, state) || {};
414
+ if (element == null) {
415
+ return {};
416
+ }
417
+ const paddingObject = getPaddingObject(padding);
418
+ const coords = {
419
+ x,
420
+ y
421
+ };
422
+ const axis = getAlignmentAxis(placement);
423
+ const length = getAxisLength(axis);
424
+ const arrowDimensions = await platform.getDimensions(element);
425
+ const isYAxis = axis === 'y';
426
+ const minProp = isYAxis ? 'top' : 'left';
427
+ const maxProp = isYAxis ? 'bottom' : 'right';
428
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
429
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
430
+ const startDiff = coords[axis] - rects.reference[axis];
431
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
432
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
433
+
434
+ // DOM platform can return `window` as the `offsetParent`.
435
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
436
+ clientSize = elements.floating[clientProp] || rects.floating[length];
437
+ }
438
+ const centerToReference = endDiff / 2 - startDiff / 2;
439
+
440
+ // If the padding is large enough that it causes the arrow to no longer be
441
+ // centered, modify the padding so that it is centered.
442
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
443
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
444
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
445
+
446
+ // Make sure the arrow doesn't overflow the floating element if the center
447
+ // point is outside the floating element's bounds.
448
+ const min$1 = minPadding;
449
+ const max = clientSize - arrowDimensions[length] - maxPadding;
450
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
451
+ const offset = clamp(min$1, center, max);
452
+
453
+ // If the reference is small enough that the arrow's padding causes it to
454
+ // to point to nothing for an aligned placement, adjust the offset of the
455
+ // floating element itself. To ensure `shift()` continues to take action,
456
+ // a single reset is performed when this is true.
457
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
458
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
459
+ return {
460
+ [axis]: coords[axis] + alignmentOffset,
461
+ data: {
462
+ [axis]: offset,
463
+ centerOffset: center - offset - alignmentOffset,
464
+ ...(shouldAddOffset && {
465
+ alignmentOffset
466
+ })
467
+ },
468
+ reset: shouldAddOffset
469
+ };
470
+ }
471
+ });
472
+
473
+ /**
474
+ * Optimizes the visibility of the floating element by flipping the `placement`
475
+ * in order to keep it in view when the preferred placement(s) will overflow the
476
+ * clipping boundary. Alternative to `autoPlacement`.
477
+ * @see https://floating-ui.com/docs/flip
478
+ */
479
+ const flip$1 = function (options) {
480
+ if (options === void 0) {
481
+ options = {};
482
+ }
483
+ return {
484
+ name: 'flip',
485
+ options,
486
+ async fn(state) {
487
+ var _middlewareData$arrow, _middlewareData$flip;
488
+ const {
489
+ placement,
490
+ middlewareData,
491
+ rects,
492
+ initialPlacement,
493
+ platform,
494
+ elements
495
+ } = state;
496
+ const {
497
+ mainAxis: checkMainAxis = true,
498
+ crossAxis: checkCrossAxis = true,
499
+ fallbackPlacements: specifiedFallbackPlacements,
500
+ fallbackStrategy = 'bestFit',
501
+ fallbackAxisSideDirection = 'none',
502
+ flipAlignment = true,
503
+ ...detectOverflowOptions
504
+ } = evaluate(options, state);
505
+
506
+ // If a reset by the arrow was caused due to an alignment offset being
507
+ // added, we should skip any logic now since `flip()` has already done its
508
+ // work.
509
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
510
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
511
+ return {};
512
+ }
513
+ const side = getSide(placement);
514
+ const initialSideAxis = getSideAxis(initialPlacement);
515
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
516
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
517
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
518
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
519
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
520
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
521
+ }
522
+ const placements = [initialPlacement, ...fallbackPlacements];
523
+ const overflow = await detectOverflow(state, detectOverflowOptions);
524
+ const overflows = [];
525
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
526
+ if (checkMainAxis) {
527
+ overflows.push(overflow[side]);
528
+ }
529
+ if (checkCrossAxis) {
530
+ const sides = getAlignmentSides(placement, rects, rtl);
531
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
532
+ }
533
+ overflowsData = [...overflowsData, {
534
+ placement,
535
+ overflows
536
+ }];
537
+
538
+ // One or more sides is overflowing.
539
+ if (!overflows.every(side => side <= 0)) {
540
+ var _middlewareData$flip2, _overflowsData$filter;
541
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
542
+ const nextPlacement = placements[nextIndex];
543
+ if (nextPlacement) {
544
+ var _overflowsData$;
545
+ const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
546
+ const hasInitialMainAxisOverflow = ((_overflowsData$ = overflowsData[0]) == null ? void 0 : _overflowsData$.overflows[0]) > 0;
547
+ if (!ignoreCrossAxisOverflow || hasInitialMainAxisOverflow) {
548
+ // Try next placement and re-run the lifecycle.
549
+ return {
550
+ data: {
551
+ index: nextIndex,
552
+ overflows: overflowsData
553
+ },
554
+ reset: {
555
+ placement: nextPlacement
556
+ }
557
+ };
558
+ }
559
+ }
560
+
561
+ // First, find the candidates that fit on the mainAxis side of overflow,
562
+ // then find the placement that fits the best on the main crossAxis side.
563
+ 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;
564
+
565
+ // Otherwise fallback.
566
+ if (!resetPlacement) {
567
+ switch (fallbackStrategy) {
568
+ case 'bestFit':
569
+ {
570
+ var _overflowsData$filter2;
571
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
572
+ if (hasFallbackAxisSideDirection) {
573
+ const currentSideAxis = getSideAxis(d.placement);
574
+ return currentSideAxis === initialSideAxis ||
575
+ // Create a bias to the `y` side axis due to horizontal
576
+ // reading directions favoring greater width.
577
+ currentSideAxis === 'y';
578
+ }
579
+ return true;
580
+ }).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];
581
+ if (placement) {
582
+ resetPlacement = placement;
583
+ }
584
+ break;
585
+ }
586
+ case 'initialPlacement':
587
+ resetPlacement = initialPlacement;
588
+ break;
589
+ }
590
+ }
591
+ if (placement !== resetPlacement) {
592
+ return {
593
+ reset: {
594
+ placement: resetPlacement
595
+ }
596
+ };
597
+ }
598
+ }
599
+ return {};
600
+ }
601
+ };
602
+ };
603
+
604
+ function getSideOffsets(overflow, rect) {
605
+ return {
606
+ top: overflow.top - rect.height,
607
+ right: overflow.right - rect.width,
608
+ bottom: overflow.bottom - rect.height,
609
+ left: overflow.left - rect.width
610
+ };
611
+ }
612
+ function isAnySideFullyClipped(overflow) {
613
+ return sides.some(side => overflow[side] >= 0);
614
+ }
615
+ /**
616
+ * Provides data to hide the floating element in applicable situations, such as
617
+ * when it is not in the same clipping context as the reference element.
618
+ * @see https://floating-ui.com/docs/hide
619
+ */
620
+ const hide$1 = function (options) {
621
+ if (options === void 0) {
622
+ options = {};
623
+ }
624
+ return {
625
+ name: 'hide',
626
+ options,
627
+ async fn(state) {
628
+ const {
629
+ rects
630
+ } = state;
631
+ const {
632
+ strategy = 'referenceHidden',
633
+ ...detectOverflowOptions
634
+ } = evaluate(options, state);
635
+ switch (strategy) {
636
+ case 'referenceHidden':
637
+ {
638
+ const overflow = await detectOverflow(state, {
639
+ ...detectOverflowOptions,
640
+ elementContext: 'reference'
641
+ });
642
+ const offsets = getSideOffsets(overflow, rects.reference);
643
+ return {
644
+ data: {
645
+ referenceHiddenOffsets: offsets,
646
+ referenceHidden: isAnySideFullyClipped(offsets)
647
+ }
648
+ };
649
+ }
650
+ case 'escaped':
651
+ {
652
+ const overflow = await detectOverflow(state, {
653
+ ...detectOverflowOptions,
654
+ altBoundary: true
655
+ });
656
+ const offsets = getSideOffsets(overflow, rects.floating);
657
+ return {
658
+ data: {
659
+ escapedOffsets: offsets,
660
+ escaped: isAnySideFullyClipped(offsets)
661
+ }
662
+ };
663
+ }
664
+ default:
665
+ {
666
+ return {};
667
+ }
668
+ }
669
+ }
670
+ };
671
+ };
672
+
673
+ // For type backwards-compatibility, the `OffsetOptions` type was also
674
+ // Derivable.
675
+
676
+ async function convertValueToCoords(state, options) {
677
+ const {
678
+ placement,
679
+ platform,
680
+ elements
681
+ } = state;
682
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
683
+ const side = getSide(placement);
684
+ const alignment = getAlignment(placement);
685
+ const isVertical = getSideAxis(placement) === 'y';
686
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
687
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
688
+ const rawValue = evaluate(options, state);
689
+
690
+ // eslint-disable-next-line prefer-const
691
+ let {
692
+ mainAxis,
693
+ crossAxis,
694
+ alignmentAxis
695
+ } = typeof rawValue === 'number' ? {
696
+ mainAxis: rawValue,
697
+ crossAxis: 0,
698
+ alignmentAxis: null
699
+ } : {
700
+ mainAxis: rawValue.mainAxis || 0,
701
+ crossAxis: rawValue.crossAxis || 0,
702
+ alignmentAxis: rawValue.alignmentAxis
703
+ };
704
+ if (alignment && typeof alignmentAxis === 'number') {
705
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
706
+ }
707
+ return isVertical ? {
708
+ x: crossAxis * crossAxisMulti,
709
+ y: mainAxis * mainAxisMulti
710
+ } : {
711
+ x: mainAxis * mainAxisMulti,
712
+ y: crossAxis * crossAxisMulti
713
+ };
714
+ }
715
+
716
+ /**
717
+ * Modifies the placement by translating the floating element along the
718
+ * specified axes.
719
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
720
+ * object may be passed.
721
+ * @see https://floating-ui.com/docs/offset
722
+ */
723
+ const offset$1 = function (options) {
724
+ if (options === void 0) {
725
+ options = 0;
726
+ }
727
+ return {
728
+ name: 'offset',
729
+ options,
730
+ async fn(state) {
731
+ var _middlewareData$offse, _middlewareData$arrow;
732
+ const {
733
+ x,
734
+ y,
735
+ placement,
736
+ middlewareData
737
+ } = state;
738
+ const diffCoords = await convertValueToCoords(state, options);
739
+
740
+ // If the placement is the same and the arrow caused an alignment offset
741
+ // then we don't need to change the positioning coordinates.
742
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
743
+ return {};
744
+ }
745
+ return {
746
+ x: x + diffCoords.x,
747
+ y: y + diffCoords.y,
748
+ data: {
749
+ ...diffCoords,
750
+ placement
751
+ }
752
+ };
753
+ }
754
+ };
755
+ };
756
+
757
+ /**
758
+ * Optimizes the visibility of the floating element by shifting it in order to
759
+ * keep it in view when it will overflow the clipping boundary.
760
+ * @see https://floating-ui.com/docs/shift
761
+ */
762
+ const shift$1 = function (options) {
763
+ if (options === void 0) {
764
+ options = {};
765
+ }
766
+ return {
767
+ name: 'shift',
768
+ options,
769
+ async fn(state) {
770
+ const {
771
+ x,
772
+ y,
773
+ placement
774
+ } = state;
775
+ const {
776
+ mainAxis: checkMainAxis = true,
777
+ crossAxis: checkCrossAxis = false,
778
+ limiter = {
779
+ fn: _ref => {
780
+ let {
781
+ x,
782
+ y
783
+ } = _ref;
784
+ return {
785
+ x,
786
+ y
787
+ };
788
+ }
789
+ },
790
+ ...detectOverflowOptions
791
+ } = evaluate(options, state);
792
+ const coords = {
793
+ x,
794
+ y
795
+ };
796
+ const overflow = await detectOverflow(state, detectOverflowOptions);
797
+ const crossAxis = getSideAxis(getSide(placement));
798
+ const mainAxis = getOppositeAxis(crossAxis);
799
+ let mainAxisCoord = coords[mainAxis];
800
+ let crossAxisCoord = coords[crossAxis];
801
+ if (checkMainAxis) {
802
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
803
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
804
+ const min = mainAxisCoord + overflow[minSide];
805
+ const max = mainAxisCoord - overflow[maxSide];
806
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
807
+ }
808
+ if (checkCrossAxis) {
809
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
810
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
811
+ const min = crossAxisCoord + overflow[minSide];
812
+ const max = crossAxisCoord - overflow[maxSide];
813
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
814
+ }
815
+ const limitedCoords = limiter.fn({
816
+ ...state,
817
+ [mainAxis]: mainAxisCoord,
818
+ [crossAxis]: crossAxisCoord
819
+ });
820
+ return {
821
+ ...limitedCoords,
822
+ data: {
823
+ x: limitedCoords.x - x,
824
+ y: limitedCoords.y - y,
825
+ enabled: {
826
+ [mainAxis]: checkMainAxis,
827
+ [crossAxis]: checkCrossAxis
828
+ }
829
+ }
830
+ };
831
+ }
832
+ };
833
+ };
834
+
835
+ /**
836
+ * Provides data that allows you to change the size of the floating element —
837
+ * for instance, prevent it from overflowing the clipping boundary or match the
838
+ * width of the reference element.
839
+ * @see https://floating-ui.com/docs/size
840
+ */
841
+ const size$1 = function (options) {
842
+ if (options === void 0) {
843
+ options = {};
844
+ }
845
+ return {
846
+ name: 'size',
847
+ options,
848
+ async fn(state) {
849
+ var _state$middlewareData, _state$middlewareData2;
850
+ const {
851
+ placement,
852
+ rects,
853
+ platform,
854
+ elements
855
+ } = state;
856
+ const {
857
+ apply = () => {},
858
+ ...detectOverflowOptions
859
+ } = evaluate(options, state);
860
+ const overflow = await detectOverflow(state, detectOverflowOptions);
861
+ const side = getSide(placement);
862
+ const alignment = getAlignment(placement);
863
+ const isYAxis = getSideAxis(placement) === 'y';
864
+ const {
865
+ width,
866
+ height
867
+ } = rects.floating;
868
+ let heightSide;
869
+ let widthSide;
870
+ if (side === 'top' || side === 'bottom') {
871
+ heightSide = side;
872
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
873
+ } else {
874
+ widthSide = side;
875
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
876
+ }
877
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
878
+ const maximumClippingWidth = width - overflow.left - overflow.right;
879
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
880
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
881
+ const noShift = !state.middlewareData.shift;
882
+ let availableHeight = overflowAvailableHeight;
883
+ let availableWidth = overflowAvailableWidth;
884
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
885
+ availableWidth = maximumClippingWidth;
886
+ }
887
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
888
+ availableHeight = maximumClippingHeight;
889
+ }
890
+ if (noShift && !alignment) {
891
+ const xMin = max(overflow.left, 0);
892
+ const xMax = max(overflow.right, 0);
893
+ const yMin = max(overflow.top, 0);
894
+ const yMax = max(overflow.bottom, 0);
895
+ if (isYAxis) {
896
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
897
+ } else {
898
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
899
+ }
900
+ }
901
+ await apply({
902
+ ...state,
903
+ availableWidth,
904
+ availableHeight
905
+ });
906
+ const nextDimensions = await platform.getDimensions(elements.floating);
907
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
908
+ return {
909
+ reset: {
910
+ rects: true
911
+ }
912
+ };
913
+ }
914
+ return {};
915
+ }
916
+ };
917
+ };
918
+
919
+ function hasWindow() {
920
+ return typeof window !== 'undefined';
921
+ }
922
+ function getNodeName(node) {
923
+ if (isNode(node)) {
924
+ return (node.nodeName || '').toLowerCase();
925
+ }
926
+ // Mocked nodes in testing environments may not be instances of Node. By
927
+ // returning `#document` an infinite loop won't occur.
928
+ // https://github.com/floating-ui/floating-ui/issues/2317
929
+ return '#document';
930
+ }
931
+ function getWindow(node) {
932
+ var _node$ownerDocument;
933
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
934
+ }
935
+ function getDocumentElement(node) {
936
+ var _ref;
937
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
938
+ }
939
+ function isNode(value) {
940
+ if (!hasWindow()) {
941
+ return false;
942
+ }
943
+ return value instanceof Node || value instanceof getWindow(value).Node;
944
+ }
945
+ function isElement(value) {
946
+ if (!hasWindow()) {
947
+ return false;
948
+ }
949
+ return value instanceof Element || value instanceof getWindow(value).Element;
950
+ }
951
+ function isHTMLElement(value) {
952
+ if (!hasWindow()) {
953
+ return false;
954
+ }
955
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
956
+ }
957
+ function isShadowRoot(value) {
958
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
959
+ return false;
960
+ }
961
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
962
+ }
963
+ function isOverflowElement(element) {
964
+ const {
965
+ overflow,
966
+ overflowX,
967
+ overflowY,
968
+ display
969
+ } = getComputedStyle(element);
970
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
971
+ }
972
+ function isTableElement(element) {
973
+ return ['table', 'td', 'th'].includes(getNodeName(element));
974
+ }
975
+ function isTopLayer(element) {
976
+ return [':popover-open', ':modal'].some(selector => {
977
+ try {
978
+ return element.matches(selector);
979
+ } catch (e) {
980
+ return false;
981
+ }
982
+ });
983
+ }
984
+ function isContainingBlock(elementOrCss) {
985
+ const webkit = isWebKit();
986
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
987
+
988
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
989
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
990
+ 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));
991
+ }
992
+ function getContainingBlock(element) {
993
+ let currentNode = getParentNode(element);
994
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
995
+ if (isContainingBlock(currentNode)) {
996
+ return currentNode;
997
+ } else if (isTopLayer(currentNode)) {
998
+ return null;
999
+ }
1000
+ currentNode = getParentNode(currentNode);
1001
+ }
1002
+ return null;
1003
+ }
1004
+ function isWebKit() {
1005
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
1006
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1007
+ }
1008
+ function isLastTraversableNode(node) {
1009
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1010
+ }
1011
+ function getComputedStyle(element) {
1012
+ return getWindow(element).getComputedStyle(element);
1013
+ }
1014
+ function getNodeScroll(element) {
1015
+ if (isElement(element)) {
1016
+ return {
1017
+ scrollLeft: element.scrollLeft,
1018
+ scrollTop: element.scrollTop
1019
+ };
1020
+ }
1021
+ return {
1022
+ scrollLeft: element.scrollX,
1023
+ scrollTop: element.scrollY
1024
+ };
1025
+ }
1026
+ function getParentNode(node) {
1027
+ if (getNodeName(node) === 'html') {
1028
+ return node;
1029
+ }
1030
+ const result =
1031
+ // Step into the shadow DOM of the parent of a slotted node.
1032
+ node.assignedSlot ||
1033
+ // DOM Element detected.
1034
+ node.parentNode ||
1035
+ // ShadowRoot detected.
1036
+ isShadowRoot(node) && node.host ||
1037
+ // Fallback.
1038
+ getDocumentElement(node);
1039
+ return isShadowRoot(result) ? result.host : result;
1040
+ }
1041
+ function getNearestOverflowAncestor(node) {
1042
+ const parentNode = getParentNode(node);
1043
+ if (isLastTraversableNode(parentNode)) {
1044
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1045
+ }
1046
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1047
+ return parentNode;
1048
+ }
1049
+ return getNearestOverflowAncestor(parentNode);
1050
+ }
1051
+ function getOverflowAncestors(node, list, traverseIframes) {
1052
+ var _node$ownerDocument2;
1053
+ if (list === void 0) {
1054
+ list = [];
1055
+ }
1056
+ if (traverseIframes === void 0) {
1057
+ traverseIframes = true;
1058
+ }
1059
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1060
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1061
+ const win = getWindow(scrollableAncestor);
1062
+ if (isBody) {
1063
+ const frameElement = getFrameElement(win);
1064
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1065
+ }
1066
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1067
+ }
1068
+ function getFrameElement(win) {
1069
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1070
+ }
1071
+
1072
+ function getCssDimensions(element) {
1073
+ const css = getComputedStyle(element);
1074
+ // In testing environments, the `width` and `height` properties are empty
1075
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1076
+ let width = parseFloat(css.width) || 0;
1077
+ let height = parseFloat(css.height) || 0;
1078
+ const hasOffset = isHTMLElement(element);
1079
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1080
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1081
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1082
+ if (shouldFallback) {
1083
+ width = offsetWidth;
1084
+ height = offsetHeight;
1085
+ }
1086
+ return {
1087
+ width,
1088
+ height,
1089
+ $: shouldFallback
1090
+ };
1091
+ }
1092
+
1093
+ function unwrapElement(element) {
1094
+ return !isElement(element) ? element.contextElement : element;
1095
+ }
1096
+
1097
+ function getScale(element) {
1098
+ const domElement = unwrapElement(element);
1099
+ if (!isHTMLElement(domElement)) {
1100
+ return createCoords(1);
1101
+ }
1102
+ const rect = domElement.getBoundingClientRect();
1103
+ const {
1104
+ width,
1105
+ height,
1106
+ $
1107
+ } = getCssDimensions(domElement);
1108
+ let x = ($ ? round(rect.width) : rect.width) / width;
1109
+ let y = ($ ? round(rect.height) : rect.height) / height;
1110
+
1111
+ // 0, NaN, or Infinity should always fallback to 1.
1112
+
1113
+ if (!x || !Number.isFinite(x)) {
1114
+ x = 1;
1115
+ }
1116
+ if (!y || !Number.isFinite(y)) {
1117
+ y = 1;
1118
+ }
1119
+ return {
1120
+ x,
1121
+ y
1122
+ };
1123
+ }
1124
+
1125
+ const noOffsets = /*#__PURE__*/createCoords(0);
1126
+ function getVisualOffsets(element) {
1127
+ const win = getWindow(element);
1128
+ if (!isWebKit() || !win.visualViewport) {
1129
+ return noOffsets;
1130
+ }
1131
+ return {
1132
+ x: win.visualViewport.offsetLeft,
1133
+ y: win.visualViewport.offsetTop
1134
+ };
1135
+ }
1136
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1137
+ if (isFixed === void 0) {
1138
+ isFixed = false;
1139
+ }
1140
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1141
+ return false;
1142
+ }
1143
+ return isFixed;
1144
+ }
1145
+
1146
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1147
+ if (includeScale === void 0) {
1148
+ includeScale = false;
1149
+ }
1150
+ if (isFixedStrategy === void 0) {
1151
+ isFixedStrategy = false;
1152
+ }
1153
+ const clientRect = element.getBoundingClientRect();
1154
+ const domElement = unwrapElement(element);
1155
+ let scale = createCoords(1);
1156
+ if (includeScale) {
1157
+ if (offsetParent) {
1158
+ if (isElement(offsetParent)) {
1159
+ scale = getScale(offsetParent);
1160
+ }
1161
+ } else {
1162
+ scale = getScale(element);
1163
+ }
1164
+ }
1165
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1166
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1167
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1168
+ let width = clientRect.width / scale.x;
1169
+ let height = clientRect.height / scale.y;
1170
+ if (domElement) {
1171
+ const win = getWindow(domElement);
1172
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1173
+ let currentWin = win;
1174
+ let currentIFrame = getFrameElement(currentWin);
1175
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1176
+ const iframeScale = getScale(currentIFrame);
1177
+ const iframeRect = currentIFrame.getBoundingClientRect();
1178
+ const css = getComputedStyle(currentIFrame);
1179
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1180
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1181
+ x *= iframeScale.x;
1182
+ y *= iframeScale.y;
1183
+ width *= iframeScale.x;
1184
+ height *= iframeScale.y;
1185
+ x += left;
1186
+ y += top;
1187
+ currentWin = getWindow(currentIFrame);
1188
+ currentIFrame = getFrameElement(currentWin);
1189
+ }
1190
+ }
1191
+ return rectToClientRect({
1192
+ width,
1193
+ height,
1194
+ x,
1195
+ y
1196
+ });
1197
+ }
1198
+
1199
+ // If <html> has a CSS width greater than the viewport, then this will be
1200
+ // incorrect for RTL.
1201
+ function getWindowScrollBarX(element, rect) {
1202
+ const leftScroll = getNodeScroll(element).scrollLeft;
1203
+ if (!rect) {
1204
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1205
+ }
1206
+ return rect.left + leftScroll;
1207
+ }
1208
+
1209
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1210
+ if (ignoreScrollbarX === void 0) {
1211
+ ignoreScrollbarX = false;
1212
+ }
1213
+ const htmlRect = documentElement.getBoundingClientRect();
1214
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1215
+ // RTL <body> scrollbar.
1216
+ getWindowScrollBarX(documentElement, htmlRect));
1217
+ const y = htmlRect.top + scroll.scrollTop;
1218
+ return {
1219
+ x,
1220
+ y
1221
+ };
1222
+ }
1223
+
1224
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1225
+ let {
1226
+ elements,
1227
+ rect,
1228
+ offsetParent,
1229
+ strategy
1230
+ } = _ref;
1231
+ const isFixed = strategy === 'fixed';
1232
+ const documentElement = getDocumentElement(offsetParent);
1233
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1234
+ if (offsetParent === documentElement || topLayer && isFixed) {
1235
+ return rect;
1236
+ }
1237
+ let scroll = {
1238
+ scrollLeft: 0,
1239
+ scrollTop: 0
1240
+ };
1241
+ let scale = createCoords(1);
1242
+ const offsets = createCoords(0);
1243
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1244
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1245
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1246
+ scroll = getNodeScroll(offsetParent);
1247
+ }
1248
+ if (isHTMLElement(offsetParent)) {
1249
+ const offsetRect = getBoundingClientRect(offsetParent);
1250
+ scale = getScale(offsetParent);
1251
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1252
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1253
+ }
1254
+ }
1255
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1256
+ return {
1257
+ width: rect.width * scale.x,
1258
+ height: rect.height * scale.y,
1259
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1260
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1261
+ };
1262
+ }
1263
+
1264
+ function getClientRects(element) {
1265
+ return Array.from(element.getClientRects());
1266
+ }
1267
+
1268
+ // Gets the entire size of the scrollable document area, even extending outside
1269
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1270
+ function getDocumentRect(element) {
1271
+ const html = getDocumentElement(element);
1272
+ const scroll = getNodeScroll(element);
1273
+ const body = element.ownerDocument.body;
1274
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1275
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1276
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1277
+ const y = -scroll.scrollTop;
1278
+ if (getComputedStyle(body).direction === 'rtl') {
1279
+ x += max(html.clientWidth, body.clientWidth) - width;
1280
+ }
1281
+ return {
1282
+ width,
1283
+ height,
1284
+ x,
1285
+ y
1286
+ };
1287
+ }
1288
+
1289
+ function getViewportRect(element, strategy) {
1290
+ const win = getWindow(element);
1291
+ const html = getDocumentElement(element);
1292
+ const visualViewport = win.visualViewport;
1293
+ let width = html.clientWidth;
1294
+ let height = html.clientHeight;
1295
+ let x = 0;
1296
+ let y = 0;
1297
+ if (visualViewport) {
1298
+ width = visualViewport.width;
1299
+ height = visualViewport.height;
1300
+ const visualViewportBased = isWebKit();
1301
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1302
+ x = visualViewport.offsetLeft;
1303
+ y = visualViewport.offsetTop;
1304
+ }
1305
+ }
1306
+ return {
1307
+ width,
1308
+ height,
1309
+ x,
1310
+ y
1311
+ };
1312
+ }
1313
+
1314
+ // Returns the inner client rect, subtracting scrollbars if present.
1315
+ function getInnerBoundingClientRect(element, strategy) {
1316
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1317
+ const top = clientRect.top + element.clientTop;
1318
+ const left = clientRect.left + element.clientLeft;
1319
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1320
+ const width = element.clientWidth * scale.x;
1321
+ const height = element.clientHeight * scale.y;
1322
+ const x = left * scale.x;
1323
+ const y = top * scale.y;
1324
+ return {
1325
+ width,
1326
+ height,
1327
+ x,
1328
+ y
1329
+ };
1330
+ }
1331
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1332
+ let rect;
1333
+ if (clippingAncestor === 'viewport') {
1334
+ rect = getViewportRect(element, strategy);
1335
+ } else if (clippingAncestor === 'document') {
1336
+ rect = getDocumentRect(getDocumentElement(element));
1337
+ } else if (isElement(clippingAncestor)) {
1338
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1339
+ } else {
1340
+ const visualOffsets = getVisualOffsets(element);
1341
+ rect = {
1342
+ x: clippingAncestor.x - visualOffsets.x,
1343
+ y: clippingAncestor.y - visualOffsets.y,
1344
+ width: clippingAncestor.width,
1345
+ height: clippingAncestor.height
1346
+ };
1347
+ }
1348
+ return rectToClientRect(rect);
1349
+ }
1350
+ function hasFixedPositionAncestor(element, stopNode) {
1351
+ const parentNode = getParentNode(element);
1352
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1353
+ return false;
1354
+ }
1355
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1356
+ }
1357
+
1358
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1359
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1360
+ // of the given element up the tree.
1361
+ function getClippingElementAncestors(element, cache) {
1362
+ const cachedResult = cache.get(element);
1363
+ if (cachedResult) {
1364
+ return cachedResult;
1365
+ }
1366
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1367
+ let currentContainingBlockComputedStyle = null;
1368
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1369
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1370
+
1371
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1372
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1373
+ const computedStyle = getComputedStyle(currentNode);
1374
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1375
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1376
+ currentContainingBlockComputedStyle = null;
1377
+ }
1378
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1379
+ if (shouldDropCurrentNode) {
1380
+ // Drop non-containing blocks.
1381
+ result = result.filter(ancestor => ancestor !== currentNode);
1382
+ } else {
1383
+ // Record last containing block for next iteration.
1384
+ currentContainingBlockComputedStyle = computedStyle;
1385
+ }
1386
+ currentNode = getParentNode(currentNode);
1387
+ }
1388
+ cache.set(element, result);
1389
+ return result;
1390
+ }
1391
+
1392
+ // Gets the maximum area that the element is visible in due to any number of
1393
+ // clipping ancestors.
1394
+ function getClippingRect(_ref) {
1395
+ let {
1396
+ element,
1397
+ boundary,
1398
+ rootBoundary,
1399
+ strategy
1400
+ } = _ref;
1401
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1402
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1403
+ const firstClippingAncestor = clippingAncestors[0];
1404
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1405
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1406
+ accRect.top = max(rect.top, accRect.top);
1407
+ accRect.right = min(rect.right, accRect.right);
1408
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1409
+ accRect.left = max(rect.left, accRect.left);
1410
+ return accRect;
1411
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1412
+ return {
1413
+ width: clippingRect.right - clippingRect.left,
1414
+ height: clippingRect.bottom - clippingRect.top,
1415
+ x: clippingRect.left,
1416
+ y: clippingRect.top
1417
+ };
1418
+ }
1419
+
1420
+ function getDimensions(element) {
1421
+ const {
1422
+ width,
1423
+ height
1424
+ } = getCssDimensions(element);
1425
+ return {
1426
+ width,
1427
+ height
1428
+ };
1429
+ }
1430
+
1431
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1432
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1433
+ const documentElement = getDocumentElement(offsetParent);
1434
+ const isFixed = strategy === 'fixed';
1435
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1436
+ let scroll = {
1437
+ scrollLeft: 0,
1438
+ scrollTop: 0
1439
+ };
1440
+ const offsets = createCoords(0);
1441
+
1442
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1443
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1444
+ function setLeftRTLScrollbarOffset() {
1445
+ offsets.x = getWindowScrollBarX(documentElement);
1446
+ }
1447
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1448
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1449
+ scroll = getNodeScroll(offsetParent);
1450
+ }
1451
+ if (isOffsetParentAnElement) {
1452
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1453
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1454
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1455
+ } else if (documentElement) {
1456
+ setLeftRTLScrollbarOffset();
1457
+ }
1458
+ }
1459
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1460
+ setLeftRTLScrollbarOffset();
1461
+ }
1462
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1463
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1464
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1465
+ return {
1466
+ x,
1467
+ y,
1468
+ width: rect.width,
1469
+ height: rect.height
1470
+ };
1471
+ }
1472
+
1473
+ function isStaticPositioned(element) {
1474
+ return getComputedStyle(element).position === 'static';
1475
+ }
1476
+
1477
+ function getTrueOffsetParent(element, polyfill) {
1478
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1479
+ return null;
1480
+ }
1481
+ if (polyfill) {
1482
+ return polyfill(element);
1483
+ }
1484
+ let rawOffsetParent = element.offsetParent;
1485
+
1486
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1487
+ // while Chrome and Safari return the <body> element. The <body> element must
1488
+ // be used to perform the correct calculations even if the <html> element is
1489
+ // non-static.
1490
+ if (getDocumentElement(element) === rawOffsetParent) {
1491
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1492
+ }
1493
+ return rawOffsetParent;
1494
+ }
1495
+
1496
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1497
+ // such as table ancestors and cross browser bugs.
1498
+ function getOffsetParent(element, polyfill) {
1499
+ const win = getWindow(element);
1500
+ if (isTopLayer(element)) {
1501
+ return win;
1502
+ }
1503
+ if (!isHTMLElement(element)) {
1504
+ let svgOffsetParent = getParentNode(element);
1505
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1506
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1507
+ return svgOffsetParent;
1508
+ }
1509
+ svgOffsetParent = getParentNode(svgOffsetParent);
1510
+ }
1511
+ return win;
1512
+ }
1513
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1514
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1515
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1516
+ }
1517
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1518
+ return win;
1519
+ }
1520
+ return offsetParent || getContainingBlock(element) || win;
1521
+ }
1522
+
1523
+ const getElementRects = async function (data) {
1524
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1525
+ const getDimensionsFn = this.getDimensions;
1526
+ const floatingDimensions = await getDimensionsFn(data.floating);
1527
+ return {
1528
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1529
+ floating: {
1530
+ x: 0,
1531
+ y: 0,
1532
+ width: floatingDimensions.width,
1533
+ height: floatingDimensions.height
1534
+ }
1535
+ };
1536
+ };
1537
+
1538
+ function isRTL(element) {
1539
+ return getComputedStyle(element).direction === 'rtl';
1540
+ }
1541
+
1542
+ const platform = {
1543
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1544
+ getDocumentElement,
1545
+ getClippingRect,
1546
+ getOffsetParent,
1547
+ getElementRects,
1548
+ getClientRects,
1549
+ getDimensions,
1550
+ getScale,
1551
+ isElement,
1552
+ isRTL
1553
+ };
1554
+
1555
+ function rectsAreEqual(a, b) {
1556
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1557
+ }
1558
+
1559
+ // https://samthor.au/2021/observing-dom/
1560
+ function observeMove(element, onMove) {
1561
+ let io = null;
1562
+ let timeoutId;
1563
+ const root = getDocumentElement(element);
1564
+ function cleanup() {
1565
+ var _io;
1566
+ clearTimeout(timeoutId);
1567
+ (_io = io) == null || _io.disconnect();
1568
+ io = null;
1569
+ }
1570
+ function refresh(skip, threshold) {
1571
+ if (skip === void 0) {
1572
+ skip = false;
1573
+ }
1574
+ if (threshold === void 0) {
1575
+ threshold = 1;
1576
+ }
1577
+ cleanup();
1578
+ const elementRectForRootMargin = element.getBoundingClientRect();
1579
+ const {
1580
+ left,
1581
+ top,
1582
+ width,
1583
+ height
1584
+ } = elementRectForRootMargin;
1585
+ if (!skip) {
1586
+ onMove();
1587
+ }
1588
+ if (!width || !height) {
1589
+ return;
1590
+ }
1591
+ const insetTop = floor(top);
1592
+ const insetRight = floor(root.clientWidth - (left + width));
1593
+ const insetBottom = floor(root.clientHeight - (top + height));
1594
+ const insetLeft = floor(left);
1595
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1596
+ const options = {
1597
+ rootMargin,
1598
+ threshold: max(0, min(1, threshold)) || 1
1599
+ };
1600
+ let isFirstUpdate = true;
1601
+ function handleObserve(entries) {
1602
+ const ratio = entries[0].intersectionRatio;
1603
+ if (ratio !== threshold) {
1604
+ if (!isFirstUpdate) {
1605
+ return refresh();
1606
+ }
1607
+ if (!ratio) {
1608
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
1609
+ // to prevent an infinite loop of updates.
1610
+ timeoutId = setTimeout(() => {
1611
+ refresh(false, 1e-7);
1612
+ }, 1000);
1613
+ } else {
1614
+ refresh(false, ratio);
1615
+ }
1616
+ }
1617
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1618
+ // It's possible that even though the ratio is reported as 1, the
1619
+ // element is not actually fully within the IntersectionObserver's root
1620
+ // area anymore. This can happen under performance constraints. This may
1621
+ // be a bug in the browser's IntersectionObserver implementation. To
1622
+ // work around this, we compare the element's bounding rect now with
1623
+ // what it was at the time we created the IntersectionObserver. If they
1624
+ // are not equal then the element moved, so we refresh.
1625
+ refresh();
1626
+ }
1627
+ isFirstUpdate = false;
1628
+ }
1629
+
1630
+ // Older browsers don't support a `document` as the root and will throw an
1631
+ // error.
1632
+ try {
1633
+ io = new IntersectionObserver(handleObserve, {
1634
+ ...options,
1635
+ // Handle <iframe>s
1636
+ root: root.ownerDocument
1637
+ });
1638
+ } catch (_e) {
1639
+ io = new IntersectionObserver(handleObserve, options);
1640
+ }
1641
+ io.observe(element);
1642
+ }
1643
+ refresh(true);
1644
+ return cleanup;
1645
+ }
1646
+
1647
+ /**
1648
+ * Automatically updates the position of the floating element when necessary.
1649
+ * Should only be called when the floating element is mounted on the DOM or
1650
+ * visible on the screen.
1651
+ * @returns cleanup function that should be invoked when the floating element is
1652
+ * removed from the DOM or hidden from the screen.
1653
+ * @see https://floating-ui.com/docs/autoUpdate
1654
+ */
1655
+ function autoUpdate(reference, floating, update, options) {
1656
+ if (options === void 0) {
1657
+ options = {};
1658
+ }
1659
+ const {
1660
+ ancestorScroll = true,
1661
+ ancestorResize = true,
1662
+ elementResize = typeof ResizeObserver === 'function',
1663
+ layoutShift = typeof IntersectionObserver === 'function',
1664
+ animationFrame = false
1665
+ } = options;
1666
+ const referenceEl = unwrapElement(reference);
1667
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1668
+ ancestors.forEach(ancestor => {
1669
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1670
+ passive: true
1671
+ });
1672
+ ancestorResize && ancestor.addEventListener('resize', update);
1673
+ });
1674
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1675
+ let reobserveFrame = -1;
1676
+ let resizeObserver = null;
1677
+ if (elementResize) {
1678
+ resizeObserver = new ResizeObserver(_ref => {
1679
+ let [firstEntry] = _ref;
1680
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1681
+ // Prevent update loops when using the `size` middleware.
1682
+ // https://github.com/floating-ui/floating-ui/issues/1740
1683
+ resizeObserver.unobserve(floating);
1684
+ cancelAnimationFrame(reobserveFrame);
1685
+ reobserveFrame = requestAnimationFrame(() => {
1686
+ var _resizeObserver;
1687
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1688
+ });
1689
+ }
1690
+ update();
1691
+ });
1692
+ if (referenceEl && !animationFrame) {
1693
+ resizeObserver.observe(referenceEl);
1694
+ }
1695
+ resizeObserver.observe(floating);
1696
+ }
1697
+ let frameId;
1698
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1699
+ if (animationFrame) {
1700
+ frameLoop();
1701
+ }
1702
+ function frameLoop() {
1703
+ const nextRefRect = getBoundingClientRect(reference);
1704
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1705
+ update();
1706
+ }
1707
+ prevRefRect = nextRefRect;
1708
+ frameId = requestAnimationFrame(frameLoop);
1709
+ }
1710
+ update();
1711
+ return () => {
1712
+ var _resizeObserver2;
1713
+ ancestors.forEach(ancestor => {
1714
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1715
+ ancestorResize && ancestor.removeEventListener('resize', update);
1716
+ });
1717
+ cleanupIo == null || cleanupIo();
1718
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1719
+ resizeObserver = null;
1720
+ if (animationFrame) {
1721
+ cancelAnimationFrame(frameId);
1722
+ }
1723
+ };
1724
+ }
1725
+
1726
+ /**
1727
+ * Modifies the placement by translating the floating element along the
1728
+ * specified axes.
1729
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1730
+ * object may be passed.
1731
+ * @see https://floating-ui.com/docs/offset
1732
+ */
1733
+ const offset = offset$1;
1734
+
1735
+ /**
1736
+ * Optimizes the visibility of the floating element by shifting it in order to
1737
+ * keep it in view when it will overflow the clipping boundary.
1738
+ * @see https://floating-ui.com/docs/shift
1739
+ */
1740
+ const shift = shift$1;
1741
+
1742
+ /**
1743
+ * Optimizes the visibility of the floating element by flipping the `placement`
1744
+ * in order to keep it in view when the preferred placement(s) will overflow the
1745
+ * clipping boundary. Alternative to `autoPlacement`.
1746
+ * @see https://floating-ui.com/docs/flip
1747
+ */
1748
+ const flip = flip$1;
1749
+
1750
+ /**
1751
+ * Provides data that allows you to change the size of the floating element —
1752
+ * for instance, prevent it from overflowing the clipping boundary or match the
1753
+ * width of the reference element.
1754
+ * @see https://floating-ui.com/docs/size
1755
+ */
1756
+ const size = size$1;
1757
+
1758
+ /**
1759
+ * Provides data to hide the floating element in applicable situations, such as
1760
+ * when it is not in the same clipping context as the reference element.
1761
+ * @see https://floating-ui.com/docs/hide
1762
+ */
1763
+ const hide = hide$1;
1764
+
1765
+ /**
1766
+ * Provides data to position an inner element of the floating element so that it
1767
+ * appears centered to the reference element.
1768
+ * @see https://floating-ui.com/docs/arrow
1769
+ */
1770
+ const arrow = arrow$1;
1771
+
1772
+ /**
1773
+ * Computes the `x` and `y` coordinates that will place the floating element
1774
+ * next to a given reference element.
1775
+ */
1776
+ const computePosition = (reference, floating, options) => {
1777
+ // This caches the expensive `getClippingElementAncestors` function so that
1778
+ // multiple lifecycle resets re-use the same result. It only lives for a
1779
+ // single call. If other functions become expensive, we can add them as well.
1780
+ const cache = new Map();
1781
+ const mergedOptions = {
1782
+ platform,
1783
+ ...options
1784
+ };
1785
+ const platformWithCache = {
1786
+ ...mergedOptions.platform,
1787
+ _c: cache
1788
+ };
1789
+ return computePosition$1(reference, floating, {
1790
+ ...mergedOptions,
1791
+ platform: platformWithCache
1792
+ });
1793
+ };
1794
+
1795
+ function debounce(func, debounceMs, { signal, edges } = {}) {
1796
+ let pendingThis = undefined;
1797
+ let pendingArgs = null;
1798
+ const leading = edges != null && edges.includes('leading');
1799
+ const trailing = edges == null || edges.includes('trailing');
1800
+ const invoke = () => {
1801
+ if (pendingArgs !== null) {
1802
+ func.apply(pendingThis, pendingArgs);
1803
+ pendingThis = undefined;
1804
+ pendingArgs = null;
1805
+ }
1806
+ };
1807
+ const onTimerEnd = () => {
1808
+ if (trailing) {
1809
+ invoke();
1810
+ }
1811
+ cancel();
1812
+ };
1813
+ let timeoutId = null;
1814
+ const schedule = () => {
1815
+ if (timeoutId != null) {
1816
+ clearTimeout(timeoutId);
1817
+ }
1818
+ timeoutId = setTimeout(() => {
1819
+ timeoutId = null;
1820
+ onTimerEnd();
1821
+ }, debounceMs);
1822
+ };
1823
+ const cancelTimer = () => {
1824
+ if (timeoutId !== null) {
1825
+ clearTimeout(timeoutId);
1826
+ timeoutId = null;
1827
+ }
1828
+ };
1829
+ const cancel = () => {
1830
+ cancelTimer();
1831
+ pendingThis = undefined;
1832
+ pendingArgs = null;
1833
+ };
1834
+ const flush = () => {
1835
+ cancelTimer();
1836
+ invoke();
1837
+ };
1838
+ const debounced = function (...args) {
1839
+ if (signal?.aborted) {
1840
+ return;
1841
+ }
1842
+ pendingThis = this;
1843
+ pendingArgs = args;
1844
+ const isFirstCall = timeoutId == null;
1845
+ schedule();
1846
+ if (leading && isFirstCall) {
1847
+ invoke();
1848
+ }
1849
+ };
1850
+ debounced.schedule = schedule;
1851
+ debounced.cancel = cancel;
1852
+ debounced.flush = flush;
1853
+ signal?.addEventListener('abort', cancel, { once: true });
1854
+ return debounced;
1855
+ }
1856
+
1857
+ function throttle(func, throttleMs, { signal, edges = ['leading', 'trailing'] } = {}) {
1858
+ let pendingAt = null;
1859
+ const debounced = debounce(func, throttleMs, { signal, edges });
1860
+ const throttled = function (...args) {
1861
+ if (pendingAt == null) {
1862
+ pendingAt = Date.now();
1863
+ }
1864
+ else {
1865
+ if (Date.now() - pendingAt >= throttleMs) {
1866
+ pendingAt = Date.now();
1867
+ debounced.cancel();
1868
+ }
1869
+ }
1870
+ debounced(...args);
1871
+ };
1872
+ throttled.cancel = debounced.cancel;
1873
+ throttled.flush = debounced.flush;
1874
+ return throttled;
1875
+ }
1876
+
1877
+ function isPlainObject(value) {
1878
+ if (!value || typeof value !== 'object') {
1879
+ return false;
1880
+ }
1881
+ const proto = Object.getPrototypeOf(value);
1882
+ const hasObjectPrototype = proto === null ||
1883
+ proto === Object.prototype ||
1884
+ Object.getPrototypeOf(proto) === null;
1885
+ if (!hasObjectPrototype) {
1886
+ return false;
1887
+ }
1888
+ return Object.prototype.toString.call(value) === '[object Object]';
1889
+ }
1890
+
1891
+ function flattenObject(object, { delimiter = '.' } = {}) {
1892
+ return flattenObjectImpl(object, '', delimiter);
1893
+ }
1894
+ function flattenObjectImpl(object, prefix = '', delimiter = '.') {
1895
+ const result = {};
1896
+ const keys = Object.keys(object);
1897
+ for (let i = 0; i < keys.length; i++) {
1898
+ const key = keys[i];
1899
+ const value = object[key];
1900
+ const prefixedKey = prefix ? `${prefix}${delimiter}${key}` : key;
1901
+ if (isPlainObject(value) && Object.keys(value).length > 0) {
1902
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
1903
+ continue;
1904
+ }
1905
+ if (Array.isArray(value)) {
1906
+ Object.assign(result, flattenObjectImpl(value, prefixedKey, delimiter));
1907
+ continue;
1908
+ }
1909
+ result[prefixedKey] = value;
1910
+ }
1911
+ return result;
1912
+ }
1913
+
1914
+ function pick(obj, keys) {
1915
+ const result = {};
1916
+ for (let i = 0; i < keys.length; i++) {
1917
+ const key = keys[i];
1918
+ if (Object.hasOwn(obj, key)) {
1919
+ result[key] = obj[key];
1920
+ }
1921
+ }
1922
+ return result;
1923
+ }
1924
+
1925
+ /**
1926
+ * @license
1927
+ * Copyright 2023 Google LLC
1928
+ * SPDX-License-Identifier: BSD-3-Clause
1929
+ */function e$2(e){return class extends e{performUpdate(){var e;if(false===this.isUpdatePending)return;null===(e=this._$Oo)||void 0===e||e.call(this);let s=true;this._$Oo=effect((()=>{s?(s=false,super.performUpdate()):this.requestUpdate();}));}connectedCallback(){super.connectedCallback(),this.requestUpdate();}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Oo)||void 0===t||t.call(this);}}}
1930
+
1931
+ /**
1932
+ * @license
1933
+ * Copyright 2023 Google LLC
1934
+ * SPDX-License-Identifier: BSD-3-Clause
1935
+ */directive(class extends AsyncDirective{render(i){var t;if(i!==this._$Oi){null===(t=this._$Oo)||void 0===t||t.call(this),this._$Oi=i;let s=true;this._$Oo=i.subscribe((i=>{ false===s&&this.setValue(i);})),s=false;}return i.peek()}disconnected(){var i;null===(i=this._$Oo)||void 0===i||i.call(this);}reconnected(){var i;this._$Oo=null===(i=this._$Oi)||void 0===i?void 0:i.subscribe((i=>{this.setValue(i);}));}});
1936
+
1937
+ /**
1938
+ * @license
1939
+ * Copyright 2021 Google LLC
1940
+ * SPDX-License-Identifier: BSD-3-Clause
1941
+ */
1942
+ let s$2 = class s extends Event{constructor(s,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=s,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};
1943
+
1944
+ /**
1945
+ * @license
1946
+ * Copyright 2021 Google LLC
1947
+ * SPDX-License-Identifier: BSD-3-Clause
1948
+ */
1949
+ function n(n){return n}
1950
+
1951
+ /**
1952
+ * @license
1953
+ * Copyright 2021 Google LLC
1954
+ * SPDX-License-Identifier: BSD-3-Clause
1955
+ */let s$1 = class s{constructor(t,s,i,h){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(t,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(t,s)),this.unsubscribe=s;},this.host=t,void 0!==s.context){const t=s;this.context=t.context,this.callback=t.callback,this.subscribe=t.subscribe??false;}else this.context=s,this.callback=i,this.subscribe=h??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new s$2(this.context,this.host,this.t,this.subscribe));}};
1956
+
1957
+ /**
1958
+ * @license
1959
+ * Copyright 2021 Google LLC
1960
+ * SPDX-License-Identifier: BSD-3-Clause
1961
+ */
1962
+ class s{get value(){return this.o}set value(s){this.setValue(s);}setValue(s,t=false){const i=t||!Object.is(s,this.o);this.o=s,i&&this.updateObservers();}constructor(s){this.subscriptions=new Map,this.updateObservers=()=>{for(const[s,{disposer:t}]of this.subscriptions)s(this.o,t);},void 0!==s&&(this.value=s);}addCallback(s,t,i){if(!i)return void s(this.value);this.subscriptions.has(s)||this.subscriptions.set(s,{disposer:()=>{this.subscriptions.delete(s);},consumerHost:t});const{disposer:h}=this.subscriptions.get(s);s(this.value,h);}clearCallbacks(){this.subscriptions.clear();}}
1963
+
1964
+ /**
1965
+ * @license
1966
+ * Copyright 2021 Google LLC
1967
+ * SPDX-License-Identifier: BSD-3-Clause
1968
+ */let e$1 = class e extends Event{constructor(t,s){super("context-provider",{bubbles:true,composed:true}),this.context=t,this.contextTarget=s;}};class i extends s{constructor(s,e,i){super(void 0!==e.context?e.initialValue:i),this.onContextRequest=t=>{if(t.context!==this.context)return;const s=t.contextTarget??t.composedPath()[0];s!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,s,t.subscribe));},this.onProviderRequest=s=>{if(s.context!==this.context)return;if((s.contextTarget??s.composedPath()[0])===this.host)return;const e=new Set;for(const[s,{consumerHost:i}]of this.subscriptions)e.has(s)||(e.add(s),i.dispatchEvent(new s$2(this.context,i,s,true)));s.stopPropagation();},this.host=s,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new e$1(this.context,this.host));}}
1969
+
1970
+ /**
1971
+ * @license
1972
+ * Copyright 2017 Google LLC
1973
+ * SPDX-License-Identifier: BSD-3-Clause
1974
+ */function e({context:e}){return (n,i$1)=>{const r=new WeakMap;if("object"==typeof i$1)return {get(){return n.get.call(this)},set(t){return r.get(this).setValue(t),n.set.call(this,t)},init(n){return r.set(this,new i(this,{context:e,initialValue:n})),n}};{n.constructor.addInitializer((n=>{r.set(n,new i(n,{context:e}));}));const o=Object.getOwnPropertyDescriptor(n,i$1);let s;if(void 0===o){const t=new WeakMap;s={get(){return t.get(this)},set(e){r.get(this).setValue(e),t.set(this,e);},configurable:true,enumerable:true};}else {const t=o.set;s={...o,set(e){r.get(this).setValue(e),t?.call(this,e);}};}return void Object.defineProperty(n,i$1,s)}}}
1975
+
1976
+ /**
1977
+ * @license
1978
+ * Copyright 2022 Google LLC
1979
+ * SPDX-License-Identifier: BSD-3-Clause
1980
+ */function c({context:c,subscribe:e}){return (o,n)=>{"object"==typeof n?n.addInitializer((function(){new s$1(this,{context:c,callback:t=>{o.set.call(this,t);},subscribe:e});})):o.constructor.addInitializer((o=>{new s$1(o,{context:c,callback:t=>{o[n]=t;},subscribe:e});}));}}
1981
+
1982
+ export { RovingTabindexController as R, autoUpdate as a, size as b, computePosition as c, arrow as d, e$2 as e, flip as f, debounce as g, hide as h, c as i, e as j, flattenObject as k, minBy as m, n, offset as o, pick as p, round$1 as r, shift as s, throttle as t, uniqBy as u };