@pixpilot/shadcn-ui 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/dist/AbsoluteFill.cjs +24 -1
  2. package/dist/AbsoluteFill.d.ts +2 -2
  3. package/dist/AbsoluteFill.js +21 -1
  4. package/dist/Alert.cjs +81 -1
  5. package/dist/Alert.js +77 -1
  6. package/dist/Button.cjs +84 -1
  7. package/dist/Button.d.ts +1 -1
  8. package/dist/Button.js +79 -1
  9. package/dist/CloseButtonAbsolute.cjs +20 -1
  10. package/dist/CloseButtonAbsolute.js +16 -1
  11. package/dist/CloseButtonRounded.cjs +22 -1
  12. package/dist/CloseButtonRounded.js +17 -1
  13. package/dist/Combobox.cjs +53 -1
  14. package/dist/Combobox.js +48 -1
  15. package/dist/CommandOptionList.cjs +29 -1
  16. package/dist/CommandOptionList.js +25 -1
  17. package/dist/ContentCard.cjs +27 -1
  18. package/dist/ContentCard.js +23 -1
  19. package/dist/DatePicker.cjs +38 -1
  20. package/dist/DatePicker.d.ts +2 -2
  21. package/dist/DatePicker.js +33 -1
  22. package/dist/LoadingOverlay.cjs +65 -1
  23. package/dist/LoadingOverlay.js +60 -1
  24. package/dist/Select.cjs +27 -1
  25. package/dist/Select.js +23 -1
  26. package/dist/Slider.cjs +19 -1
  27. package/dist/Slider.js +15 -1
  28. package/dist/ThemeToggle.cjs +98 -1
  29. package/dist/ThemeToggle.js +94 -1
  30. package/dist/_virtual/rolldown_runtime.cjs +44 -1
  31. package/dist/_virtual/rolldown_runtime.js +43 -1
  32. package/dist/confirmation-dialog/ConfirmationDialog.cjs +47 -1
  33. package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
  34. package/dist/confirmation-dialog/ConfirmationDialog.js +43 -1
  35. package/dist/confirmation-dialog/DialogProvider.cjs +16 -1
  36. package/dist/confirmation-dialog/DialogProvider.js +12 -1
  37. package/dist/confirmation-dialog/confirmation-dialogs.cjs +14 -1
  38. package/dist/confirmation-dialog/confirmation-dialogs.js +12 -1
  39. package/dist/confirmation-dialog/index.cjs +7 -1
  40. package/dist/confirmation-dialog/index.js +6 -1
  41. package/dist/file-upload/FileUpload.cjs +68 -1
  42. package/dist/file-upload/FileUpload.js +63 -1
  43. package/dist/file-upload/FileUploadItems.cjs +36 -1
  44. package/dist/file-upload/FileUploadItems.js +32 -1
  45. package/dist/file-upload/FileUploadListItem.cjs +89 -1
  46. package/dist/file-upload/FileUploadListItem.js +83 -1
  47. package/dist/file-upload/hooks/index.cjs +4 -1
  48. package/dist/file-upload/hooks/index.d.cts +2 -0
  49. package/dist/file-upload/hooks/index.js +3 -1
  50. package/dist/file-upload/hooks/use-file-error.cjs +15 -1
  51. package/dist/file-upload/hooks/use-file-error.js +14 -1
  52. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.cjs +34 -1
  53. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.d.cts +1 -0
  54. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.js +32 -1
  55. package/dist/file-upload/hooks/use-file-upload-store.cjs +77 -1
  56. package/dist/file-upload/hooks/use-file-upload-store.d.cts +2 -0
  57. package/dist/file-upload/hooks/use-file-upload-store.js +75 -1
  58. package/dist/file-upload/index.cjs +6 -1
  59. package/dist/file-upload/index.d.cts +2 -1
  60. package/dist/file-upload/index.js +5 -1
  61. package/dist/file-upload/utils/create-placeholder-file.cjs +12 -1
  62. package/dist/file-upload/utils/create-placeholder-file.js +10 -1
  63. package/dist/file-upload/utils/get-file-key.cjs +9 -1
  64. package/dist/file-upload/utils/get-file-key.d.cts +1 -0
  65. package/dist/file-upload/utils/get-file-key.js +7 -1
  66. package/dist/file-upload/utils/get-file-meta.cjs +24 -1
  67. package/dist/file-upload/utils/get-file-meta.d.cts +1 -0
  68. package/dist/file-upload/utils/get-file-meta.js +21 -1
  69. package/dist/file-upload/utils/index.d.cts +4 -0
  70. package/dist/file-upload/utils/is-file-equal.cjs +10 -1
  71. package/dist/file-upload/utils/is-file-equal.d.cts +1 -0
  72. package/dist/file-upload/utils/is-file-equal.js +8 -1
  73. package/dist/file-upload/utils/merge-file-metadata.cjs +27 -1
  74. package/dist/file-upload/utils/merge-file-metadata.d.cts +1 -0
  75. package/dist/file-upload/utils/merge-file-metadata.js +26 -1
  76. package/dist/file-upload-inline/FileUploadInline.cjs +71 -1
  77. package/dist/file-upload-inline/FileUploadInline.js +66 -1
  78. package/dist/file-upload-inline/FileUploadInlineItem.cjs +96 -1
  79. package/dist/file-upload-inline/FileUploadInlineItem.js +90 -1
  80. package/dist/file-upload-inline/defaults.cjs +12 -1
  81. package/dist/file-upload-inline/defaults.js +10 -1
  82. package/dist/file-upload-inline/index.cjs +2 -1
  83. package/dist/file-upload-inline/index.js +1 -1
  84. package/dist/file-upload-inline/utils.cjs +37 -1
  85. package/dist/file-upload-inline/utils.js +34 -1
  86. package/dist/hooks/index.cjs +2 -1
  87. package/dist/hooks/index.js +1 -1
  88. package/dist/hooks/use-media-query.cjs +9 -1
  89. package/dist/hooks/use-media-query.js +7 -1
  90. package/dist/icon-selector/IconPicker.cjs +93 -1
  91. package/dist/icon-selector/IconPicker.js +88 -1
  92. package/dist/icon-selector/constants.cjs +7 -1
  93. package/dist/icon-selector/constants.js +5 -0
  94. package/dist/icon-selector/icon-picker-container.cjs +35 -1
  95. package/dist/icon-selector/icon-picker-container.js +32 -1
  96. package/dist/icon-selector/icon-picker-content.cjs +146 -1
  97. package/dist/icon-selector/icon-picker-content.js +141 -1
  98. package/dist/icon-selector/index.cjs +2 -1
  99. package/dist/icon-selector/index.js +1 -1
  100. package/dist/icon-selector/use-async-providers.cjs +69 -1
  101. package/dist/icon-selector/use-async-providers.js +67 -1
  102. package/dist/icon-selector/utils/is-valid-provider.cjs +12 -1
  103. package/dist/icon-selector/utils/is-valid-provider.js +10 -1
  104. package/dist/icon-selector/virtualized-icon-grid.cjs +137 -1
  105. package/dist/icon-selector/virtualized-icon-grid.js +132 -1
  106. package/dist/index.cjs +76 -1
  107. package/dist/index.js +37 -1
  108. package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.cjs +558 -1
  109. package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.js +555 -1
  110. package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.cjs +566 -1
  111. package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.js +565 -1
  112. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +695 -1
  113. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +679 -1
  114. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +521 -1
  115. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +503 -1
  116. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +282 -1
  117. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +266 -1
  118. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.cjs +3767 -1
  119. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js +3747 -1
  120. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.cjs +426 -1
  121. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +379 -1
  122. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +165 -1
  123. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +175 -1
  124. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +151 -1
  125. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +138 -1
  126. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.cjs +13 -0
  127. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  128. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +33 -0
  129. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.js +30 -0
  130. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +92 -0
  131. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.js +88 -0
  132. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_4f1d9653b0e2175502748f45fd432185/node_modules/@radix-ui/react-dialog/dist/index.cjs +310 -0
  133. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_4f1d9653b0e2175502748f45fd432185/node_modules/@radix-ui/react-dialog/dist/index.js +299 -0
  134. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +190 -0
  135. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +187 -0
  136. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +34 -0
  137. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.js +32 -0
  138. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +203 -0
  139. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9/node_modules/@radix-ui/react-focus-scope/dist/index.js +200 -0
  140. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.cjs +18 -0
  141. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.js +16 -0
  142. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9/node_modules/@radix-ui/react-portal/dist/index.cjs +29 -0
  143. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9/node_modules/@radix-ui/react-portal/dist/index.js +25 -0
  144. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.cjs +110 -0
  145. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.js +108 -0
  146. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.cjs +52 -0
  147. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.js +47 -0
  148. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs +92 -0
  149. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js +89 -0
  150. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.4_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs +103 -0
  151. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.4_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js +100 -0
  152. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +15 -0
  153. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
  154. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +64 -0
  155. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +62 -0
  156. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +19 -0
  157. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +17 -0
  158. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +9 -0
  159. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  160. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js +108 -0
  161. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es5/index.cjs +155 -0
  162. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs +19 -0
  163. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
  164. package/dist/node_modules/.pnpm/detect-node-es@1.1.0/node_modules/detect-node-es/es5/node.cjs +14 -0
  165. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js +9 -0
  166. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es5/index.cjs +22 -0
  167. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js +46 -0
  168. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +12 -0
  169. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/index.js +3 -0
  170. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +37 -0
  171. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/component.cjs +61 -0
  172. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/constants.cjs +23 -0
  173. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/index.cjs +57 -0
  174. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/utils.cjs +49 -0
  175. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +17 -0
  176. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +163 -0
  177. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/UI.js +64 -0
  178. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  179. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +85 -0
  180. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/medium.js +7 -0
  181. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +9 -0
  182. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/Combination.cjs +29 -0
  183. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/SideEffect.cjs +179 -0
  184. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/UI.cjs +79 -0
  185. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/aggresiveCapture.cjs +27 -0
  186. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/handleScroll.cjs +98 -0
  187. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/index.cjs +19 -0
  188. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/medium.cjs +18 -0
  189. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/sidecar.cjs +21 -0
  190. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/component.js +21 -0
  191. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/hook.js +27 -0
  192. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/index.js +3 -0
  193. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/singleton.js +43 -0
  194. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/component.cjs +33 -0
  195. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/hook.cjs +40 -0
  196. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/index.cjs +39 -0
  197. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/singleton.cjs +55 -0
  198. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.cjs +347 -1
  199. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js +268 -1
  200. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1895 -0
  201. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
  202. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.cjs +557 -0
  203. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +31 -0
  204. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.js +22 -0
  205. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +47 -0
  206. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
  207. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/assignRef.cjs +34 -0
  208. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/createRef.cjs +39 -0
  209. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/index.cjs +85 -0
  210. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/mergeRef.cjs +40 -0
  211. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/refToCallback.cjs +59 -0
  212. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/transformRef.cjs +34 -0
  213. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useMergeRef.cjs +61 -0
  214. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useRef.cjs +53 -0
  215. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useTransformRef.cjs +38 -0
  216. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/exports.js +19 -0
  217. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/medium.js +84 -0
  218. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/config.cjs +22 -0
  219. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/env.cjs +21 -0
  220. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/exports.cjs +31 -0
  221. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/hoc.cjs +31 -0
  222. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/hook.cjs +60 -0
  223. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/index.cjs +69 -0
  224. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/medium.cjs +101 -0
  225. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/renderProp.cjs +58 -0
  226. package/dist/packages/shadcn/src/components/index.cjs +6 -1
  227. package/dist/packages/shadcn/src/components/index.js +5 -1
  228. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.cjs +6 -1
  229. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.js +3 -1
  230. package/dist/packages/shadcn/src/components/ui/alert-dialog.cjs +10 -1
  231. package/dist/packages/shadcn/src/components/ui/alert-dialog.js +6 -1
  232. package/dist/packages/shadcn/src/components/ui/alert.cjs +44 -1
  233. package/dist/packages/shadcn/src/components/ui/alert.js +38 -1
  234. package/dist/packages/shadcn/src/components/ui/avatar.cjs +5 -1
  235. package/dist/packages/shadcn/src/components/ui/avatar.js +2 -1
  236. package/dist/packages/shadcn/src/components/ui/badge.cjs +20 -1
  237. package/dist/packages/shadcn/src/components/ui/badge.js +16 -1
  238. package/dist/packages/shadcn/src/components/ui/button.cjs +50 -1
  239. package/dist/packages/shadcn/src/components/ui/button.js +45 -1
  240. package/dist/packages/shadcn/src/components/ui/calendar.cjs +8 -1
  241. package/dist/packages/shadcn/src/components/ui/calendar.js +4 -1
  242. package/dist/packages/shadcn/src/components/ui/card.cjs +5 -1
  243. package/dist/packages/shadcn/src/components/ui/card.js +2 -1
  244. package/dist/packages/shadcn/src/components/ui/checkbox.cjs +10 -1
  245. package/dist/packages/shadcn/src/components/ui/checkbox.js +6 -1
  246. package/dist/packages/shadcn/src/components/ui/command.cjs +11 -1
  247. package/dist/packages/shadcn/src/components/ui/command.js +7 -1
  248. package/dist/packages/shadcn/src/components/ui/dialog.cjs +93 -1
  249. package/dist/packages/shadcn/src/components/ui/dialog.js +81 -1
  250. package/dist/packages/shadcn/src/components/ui/dropdown-menu.cjs +7 -1
  251. package/dist/packages/shadcn/src/components/ui/dropdown-menu.js +3 -1
  252. package/dist/packages/shadcn/src/components/ui/file-upload.cjs +49 -1
  253. package/dist/packages/shadcn/src/components/ui/file-upload.js +45 -1
  254. package/dist/packages/shadcn/src/components/ui/form.cjs +12 -1
  255. package/dist/packages/shadcn/src/components/ui/form.js +9 -1
  256. package/dist/packages/shadcn/src/components/ui/index.cjs +30 -1
  257. package/dist/packages/shadcn/src/components/ui/index.js +29 -1
  258. package/dist/packages/shadcn/src/components/ui/input.cjs +5 -1
  259. package/dist/packages/shadcn/src/components/ui/input.js +2 -1
  260. package/dist/packages/shadcn/src/components/ui/label.cjs +5 -1
  261. package/dist/packages/shadcn/src/components/ui/label.js +2 -1
  262. package/dist/packages/shadcn/src/components/ui/pagination.cjs +9 -1
  263. package/dist/packages/shadcn/src/components/ui/pagination.js +4 -1
  264. package/dist/packages/shadcn/src/components/ui/popover.cjs +5 -1
  265. package/dist/packages/shadcn/src/components/ui/popover.js +2 -1
  266. package/dist/packages/shadcn/src/components/ui/radio-group.cjs +7 -1
  267. package/dist/packages/shadcn/src/components/ui/radio-group.js +3 -1
  268. package/dist/packages/shadcn/src/components/ui/select.cjs +10 -1
  269. package/dist/packages/shadcn/src/components/ui/select.js +6 -1
  270. package/dist/packages/shadcn/src/components/ui/separator.cjs +5 -1
  271. package/dist/packages/shadcn/src/components/ui/separator.js +2 -1
  272. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.cjs +26 -1
  273. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.js +22 -1
  274. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.cjs +6 -1
  275. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.js +3 -1
  276. package/dist/packages/shadcn/src/components/ui/sheet.cjs +7 -1
  277. package/dist/packages/shadcn/src/components/ui/sheet.js +3 -1
  278. package/dist/packages/shadcn/src/components/ui/slider.cjs +5 -1
  279. package/dist/packages/shadcn/src/components/ui/slider.js +2 -1
  280. package/dist/packages/shadcn/src/components/ui/switch.cjs +8 -1
  281. package/dist/packages/shadcn/src/components/ui/switch.js +5 -1
  282. package/dist/packages/shadcn/src/components/ui/tabs.cjs +5 -1
  283. package/dist/packages/shadcn/src/components/ui/tabs.js +2 -1
  284. package/dist/packages/shadcn/src/components/ui/textarea.cjs +5 -1
  285. package/dist/packages/shadcn/src/components/ui/textarea.js +2 -1
  286. package/dist/packages/shadcn/src/components/ui/tooltip.cjs +5 -1
  287. package/dist/packages/shadcn/src/components/ui/tooltip.js +2 -1
  288. package/dist/packages/shadcn/src/lib/utils.cjs +11 -1
  289. package/dist/packages/shadcn/src/lib/utils.js +10 -1
  290. package/dist/pagination/Pagination.cjs +156 -1
  291. package/dist/pagination/Pagination.js +151 -1
  292. package/dist/pagination/index.cjs +2 -1
  293. package/dist/pagination/index.js +1 -1
  294. package/dist/rich-text-editor/RichTextEditor.cjs +132 -1
  295. package/dist/rich-text-editor/RichTextEditor.js +126 -1
  296. package/dist/rich-text-editor/index.cjs +2 -1
  297. package/dist/rich-text-editor/index.js +1 -1
  298. package/dist/rich-text-editor/predefined-toolbar-options.cjs +84 -1
  299. package/dist/rich-text-editor/predefined-toolbar-options.js +81 -1
  300. package/dist/spinner/index.cjs +2 -1
  301. package/dist/spinner/index.js +1 -1
  302. package/dist/spinner/spinner.cjs +73 -6
  303. package/dist/spinner/spinner.js +70 -6
  304. package/dist/spinner/styles.cjs +25 -12
  305. package/dist/spinner/styles.js +23 -12
  306. package/dist/tags-input.cjs +226 -1
  307. package/dist/tags-input.js +222 -1
  308. package/dist/theme-provider/ThemeProvider.cjs +27 -1
  309. package/dist/theme-provider/ThemeProvider.js +23 -1
  310. package/dist/theme-provider/index.cjs +4 -1
  311. package/dist/theme-provider/index.js +4 -1
  312. package/dist/toast/AlertToast.cjs +36 -1
  313. package/dist/toast/AlertToast.js +31 -1
  314. package/dist/toast/index.cjs +2 -1
  315. package/dist/toast/index.js +1 -1
  316. package/dist/toast/toast.cjs +75 -1
  317. package/dist/toast/toast.js +66 -1
  318. package/package.json +3 -3
  319. package/dist/packages/shadcn/src/lib/index.cjs +0 -1
  320. package/dist/packages/shadcn/src/lib/index.js +0 -1
@@ -1 +1,3747 @@
1
- import{__esmMin as e,__export as t}from"../../../../../../../_virtual/rolldown_runtime.js";import{getComputedStyle as n,getNodeName as r,getOverflowAncestors as i,getParentNode as a,getWindow as o,init_floating_ui_utils_dom as s,isElement as c,isHTMLElement as l,isLastTraversableNode as u,isNode as d,isShadowRoot as f,isWebKit as p}from"../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";import{evaluate as m,init_floating_ui_utils as h,max as g,min as _,round as v}from"../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js";import{focusable as y,init_index_esm as b,isTabbable as x,tabbable as S}from"../../../../../tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js";import{activeElement as C,contains as w,createGridCellMap as T,disableFocusInside as E,enableFocusInside as D,findNonDisabledListIndex as O,getDeepestNode as k,getDocument as A,getFloatingFocusElement as j,getGridCellIndexOfCorner as M,getGridCellIndices as N,getGridNavigatedIndex as P,getMaxListIndex as F,getMinListIndex as I,getNextTabbable as L,getNodeAncestors as ee,getNodeChildren as te,getPlatform as R,getPreviousTabbable as ne,getTabbableOptions as z,getTarget as B,getUserAgent as re,index as V,init_floating_ui_react_utils as H,isEventTargetWithin as U,isIndexOutOfListBounds as ie,isListIndexDisabled as ae,isMac as W,isMouseLikePointerType as G,isOutsideEvent as oe,isReactEvent as K,isRootElement as se,isSafari as q,isTypeableCombobox as ce,isTypeableElement as le,isVirtualClick as ue,isVirtualPointerEvent as de,matchesFocusVisible as fe,stopEvent as J,useEffectEvent as Y,useLatestRef as X}from"./floating-ui.react.utils.js";import{autoUpdate as pe,computePosition as me,detectOverflow as he,platform as ge}from"../../../../../@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js";import{arrow as _e,autoPlacement as ve,flip as ye,hide as be,init_floating_ui_react_dom as xe,inline as Se,limitShift as Ce,offset as we,shift as Te,size as Ee,useFloating as De}from"../../../../../@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";import*as Z from"react";import{Fragment as Oe,jsx as Q,jsxs as ke}from"react/jsx-runtime";import*as Ae from"react-dom";var je=t({Composite:()=>rn,CompositeItem:()=>an,FloatingArrow:()=>dn,FloatingDelayGroup:()=>Ke,FloatingFocusManager:()=>dt,FloatingList:()=>Pe,FloatingNode:()=>Be,FloatingOverlay:()=>Bn,FloatingPortal:()=>it,FloatingTree:()=>Ve,NextFloatingDelayGroup:()=>Je,arrow:()=>_e,autoPlacement:()=>ve,autoUpdate:()=>pe,computePosition:()=>me,detectOverflow:()=>he,flip:()=>ye,getOverflowAncestors:()=>i,hide:()=>be,inline:()=>Se,inner:()=>qn,limitShift:()=>Ce,offset:()=>we,platform:()=>ge,safePolygon:()=>Wt,shift:()=>Te,size:()=>Ee,useClick:()=>gt,useClientPoint:()=>yt,useDelayGroup:()=>qe,useDelayGroupContext:()=>yn,useDismiss:()=>bt,useFloating:()=>St,useFloatingNodeId:()=>ze,useFloatingParentNodeId:()=>mn,useFloatingPortalNode:()=>rt,useFloatingRootContext:()=>xt,useFloatingTree:()=>hn,useFocus:()=>wt,useHover:()=>Ge,useId:()=>un,useInnerOffset:()=>Bt,useInteractions:()=>Et,useListItem:()=>Fe,useListNavigation:()=>Mt,useMergeRefs:()=>Me,useNextDelayGroup:()=>Ye,useRole:()=>Nt,useTransitionStatus:()=>It,useTransitionStyles:()=>Lt,useTypeahead:()=>Rt});function Me(e){let t=Z.useRef(void 0),n=Z.useCallback(t=>{let n=e.map(e=>{if(e!=null){if(typeof e==`function`){let n=e,r=n(t);return typeof r==`function`?r:()=>{n(null)}}return e.current=t,()=>{e.current=null}}});return()=>{n.forEach(e=>e?.())}},e);return Z.useMemo(()=>e.every(e=>e==null)?null:e=>{t.current&&=(t.current(),void 0),e!=null&&(t.current=n(e))},e)}function Ne(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function Pe(e){let{children:t,elementsRef:n,labelsRef:r}=e,[i,a]=Z.useState(()=>new Set),o=Z.useCallback(e=>{a(t=>new Set(t).add(e))},[]),s=Z.useCallback(e=>{a(t=>{let n=new Set(t);return n.delete(e),n})},[]),c=Z.useMemo(()=>{let e=new Map;return Array.from(i.keys()).sort(Ne).forEach((t,n)=>{e.set(t,n)}),e},[i]);return Q(Gt.Provider,{value:Z.useMemo(()=>({register:o,unregister:s,map:c,elementsRef:n,labelsRef:r}),[o,s,c,n,r]),children:t})}function Fe(e){e===void 0&&(e={});let{label:t}=e,{register:n,unregister:r,map:i,elementsRef:a,labelsRef:o}=Z.useContext(Gt),[s,c]=Z.useState(null),l=Z.useRef(null),u=Z.useCallback(e=>{if(l.current=e,s!==null&&(a.current[s]=e,o)){let n=t!==void 0;o.current[s]=n?t:e?.textContent??null}},[s,a,o,t]);return V(()=>{let e=l.current;if(e)return n(e),()=>{r(e)}},[n,r]),V(()=>{let e=l.current?i.get(l.current):null;e!=null&&c(e)},[i]),Z.useMemo(()=>({ref:u,index:s??-1}),[s,u])}function Ie(e,t){return typeof e==`function`?e(t):e?Z.cloneElement(e,t):Q(`div`,{...t})}function Le(){let[e,t]=Z.useState(()=>sn?ln():void 0);return V(()=>{e??t(ln())},[]),Z.useEffect(()=>{sn=!0},[]),e}function Re(){let e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}function ze(e){let t=un(),n=hn(),r=mn(),i=e||r;return V(()=>{if(!t)return;let e={id:t,parentId:i};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,i]),t}function Be(e){let{children:t,id:n}=e,r=mn();return Q(fn.Provider,{value:Z.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Ve(e){let{children:t}=e,n=Z.useRef([]),r=Z.useCallback(e=>{n.current=[...n.current,e]},[]),i=Z.useCallback(e=>{n.current=n.current.filter(t=>t!==e)},[]),[a]=Z.useState(()=>Re());return Q(pn.Provider,{value:Z.useMemo(()=>({nodesRef:n,addNode:r,removeNode:i,events:a}),[r,i,a]),children:t})}function He(e){return`data-floating-ui-`+e}function $(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}function Ue(e,t,n){if(n&&!G(n))return 0;if(typeof e==`number`)return e;if(typeof e==`function`){let n=e();return typeof n==`number`?n:n?.[t]}return e?.[t]}function We(e){return typeof e==`function`?e():e}function Ge(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,events:a,elements:o}=e,{enabled:s=!0,delay:l=0,handleClose:u=null,mouseOnly:d=!1,restMs:f=0,move:p=!0}=t,m=hn(),h=mn(),g=X(u),_=X(l),v=X(n),y=X(f),b=Z.useRef(),x=Z.useRef(-1),S=Z.useRef(),C=Z.useRef(-1),T=Z.useRef(!0),E=Z.useRef(!1),D=Z.useRef(()=>{}),O=Z.useRef(!1),k=Y(()=>{let e=i.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`});Z.useEffect(()=>{if(!s)return;function e(e){let{open:t}=e;t||($(x),$(C),T.current=!0,O.current=!1)}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[s,a]),Z.useEffect(()=>{if(!s||!g.current||!n)return;function e(e){k()&&r(!1,e,`hover`)}let t=A(o.floating).documentElement;return t.addEventListener(`mouseleave`,e),()=>{t.removeEventListener(`mouseleave`,e)}},[o.floating,n,r,s,g,k]);let j=Z.useCallback(function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=`hover`);let i=Ue(_.current,`close`,b.current);i&&!S.current?($(x),x.current=window.setTimeout(()=>r(!1,e,n),i)):t&&($(x),r(!1,e,n))},[_,r]),M=Y(()=>{D.current(),S.current=void 0}),N=Y(()=>{if(E.current){let e=A(o.floating).body;e.style.pointerEvents=``,e.removeAttribute(gn),E.current=!1}}),P=Y(()=>i.current.openEvent?[`click`,`mousedown`].includes(i.current.openEvent.type):!1);Z.useEffect(()=>{if(!s)return;function e(e){if($(x),T.current=!1,d&&!G(b.current)||We(y.current)>0&&!Ue(_.current,`open`))return;let t=Ue(_.current,`open`,b.current);t?x.current=window.setTimeout(()=>{v.current||r(!0,e,`hover`)},t):n||r(!0,e,`hover`)}function t(e){if(P()){N();return}D.current();let t=A(o.floating);if($(C),O.current=!1,g.current&&i.current.floatingContext){n||$(x),S.current=g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){N(),M(),P()||j(e,!0,`safe-polygon`)}});let r=S.current;t.addEventListener(`mousemove`,r),D.current=()=>{t.removeEventListener(`mousemove`,r)};return}(b.current!==`touch`||!w(o.floating,e.relatedTarget))&&j(e)}function a(e){P()||i.current.floatingContext&&(g.current==null||g.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){N(),M(),P()||j(e)}})(e))}function l(){$(x)}function u(e){P()||j(e,!1)}if(c(o.domReference)){let r=o.domReference,i=o.floating;return n&&r.addEventListener(`mouseleave`,a),p&&r.addEventListener(`mousemove`,e,{once:!0}),r.addEventListener(`mouseenter`,e),r.addEventListener(`mouseleave`,t),i&&(i.addEventListener(`mouseleave`,a),i.addEventListener(`mouseenter`,l),i.addEventListener(`mouseleave`,u)),()=>{n&&r.removeEventListener(`mouseleave`,a),p&&r.removeEventListener(`mousemove`,e),r.removeEventListener(`mouseenter`,e),r.removeEventListener(`mouseleave`,t),i&&(i.removeEventListener(`mouseleave`,a),i.removeEventListener(`mouseenter`,l),i.removeEventListener(`mouseleave`,u))}}},[o,s,e,d,p,j,M,N,r,n,v,m,_,g,i,P,y]),V(()=>{var e;if(s&&n&&(e=g.current)!=null&&(e=e.__options)!=null&&e.blockPointerEvents&&k()){E.current=!0;let e=o.floating;if(c(o.domReference)&&e){var t;let n=A(o.floating).body;n.setAttribute(gn,``);let r=o.domReference,i=m==null||(t=m.nodesRef.current.find(e=>e.id===h))==null||(t=t.context)==null?void 0:t.elements.floating;return i&&(i.style.pointerEvents=``),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,e.style.pointerEvents=`auto`,()=>{n.style.pointerEvents=``,r.style.pointerEvents=``,e.style.pointerEvents=``}}}},[s,n,h,o,m,g,k]),V(()=>{n||(b.current=void 0,O.current=!1,M(),N())},[n,M,N]),Z.useEffect(()=>()=>{M(),$(x),$(C),N()},[s,o.domReference,M,N]);let F=Z.useMemo(()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e;function i(){!T.current&&!v.current&&r(!0,t,`hover`)}d&&!G(b.current)||n||We(y.current)===0||O.current&&e.movementX**2+e.movementY**2<2||($(C),b.current===`touch`?i():(O.current=!0,C.current=window.setTimeout(i,We(y.current))))}}},[d,r,n,v,y]);return Z.useMemo(()=>s?{reference:F}:{},[s,F])}function Ke(e){let{children:t,delay:n,timeoutMs:r=0}=e,[i,a]=Z.useReducer((e,t)=>({...e,...t}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=Z.useRef(null),s=Z.useCallback(e=>{a({currentId:e})},[]);return V(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||a({isInstantPhase:!0}):(i.isInstantPhase&&a({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),Q(vn.Provider,{value:Z.useMemo(()=>({...i,setState:a,setCurrentId:s}),[i,s]),children:t})}function qe(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{id:a,enabled:o=!0}=t,s=a??i,c=yn(),{currentId:l,setCurrentId:u,initialDelay:d,setState:f,timeoutMs:p}=c;return V(()=>{o&&l&&(f({delay:{open:1,close:Ue(d,`close`)}}),l!==s&&r(!1))},[o,s,r,f,l,d]),V(()=>{function e(){r(!1),f({delay:d,currentId:null})}if(o&&l&&!n&&l===s){if(p){let t=window.setTimeout(e,p);return()=>{clearTimeout(t)}}e()}},[o,n,f,l,s,r,d,p]),V(()=>{o&&(u===_n||!n||u(s))},[o,n,u,s]),c}function Je(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Z.useRef(n),a=Z.useRef(n),o=Z.useRef(null),s=Z.useRef(null),c=Z.useRef(-1);return Q(bn.Provider,{value:Z.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeoutIdRef:c}),[r]),children:t})}function Ye(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,floatingId:i}=e,{enabled:a=!0}=t,{currentIdRef:o,delayRef:s,timeoutMs:c,initialDelayRef:l,currentContextRef:u,hasProvider:d,timeoutIdRef:f}=Z.useContext(bn),[p,m]=Z.useState(!1);return V(()=>{function e(){var e;m(!1),(e=u.current)==null||e.setIsInstantPhase(!1),o.current=null,u.current=null,s.current=l.current}if(a&&o.current&&!n&&o.current===i){if(m(!1),c)return f.current=window.setTimeout(e,c),()=>{clearTimeout(f.current)};e()}},[a,n,i,o,s,c,l,u,f]),V(()=>{if(!a||!n)return;let e=u.current,t=o.current;u.current={onOpenChange:r,setIsInstantPhase:m},o.current=i,s.current={open:0,close:Ue(l.current,`close`)},t!==null&&t!==i?($(f),m(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1)):(m(!1),e?.setIsInstantPhase(!1))},[a,n,i,r,o,s,c,l,u,f]),V(()=>()=>{u.current=null},[u]),Z.useMemo(()=>({hasProvider:d,delayRef:s,isInstantPhase:p}),[d,s,p])}function Xe(e,t){t===void 0&&(t={});let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(xn);let a=()=>e?.focus({preventScroll:n});i?a():xn=requestAnimationFrame(a)}function Ze(e,t){if(!e||!t)return!1;let n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&f(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Qe(e){return`composedPath`in e?e.composedPath()[0]:e.target}function $e(e){return e?.ownerDocument||document}function et(e){return e===`inert`?Sn.inert:e===`aria-hidden`?Sn[`aria-hidden`]:Sn.none}function tt(e,t,n,i){let a=`data-floating-ui-inert`,o=i?`inert`:n?`aria-hidden`:null,s=On(t,e),c=new Set,l=new Set(s),u=[];wn[a]||(wn[a]=new WeakMap);let d=wn[a];s.forEach(f),p(t),c.clear();function f(e){!e||c.has(e)||(c.add(e),e.parentNode&&f(e.parentNode))}function p(e){!e||l.has(e)||[].forEach.call(e.children,e=>{if(r(e)!==`script`)if(c.has(e))p(e);else{let t=o?e.getAttribute(o):null,n=t!==null&&t!==`false`,r=et(o),i=(r.get(e)||0)+1,s=(d.get(e)||0)+1;r.set(e,i),d.set(e,s),u.push(e),i===1&&n&&Cn.add(e),s===1&&e.setAttribute(a,``),!n&&o&&e.setAttribute(o,o===`inert`?``:`true`)}})}return Tn++,()=>{u.forEach(e=>{let t=et(o),n=(t.get(e)||0)-1,r=(d.get(e)||0)-1;t.set(e,n),d.set(e,r),n||(!Cn.has(e)&&o&&e.removeAttribute(o),Cn.delete(e)),r||e.removeAttribute(a)}),Tn--,Tn||(Sn.inert=new WeakMap,Sn[`aria-hidden`]=new WeakMap,Sn.none=new WeakMap,Cn=new WeakSet,wn={})}}function nt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);let r=$e(e[0]).body;return tt(e.concat(Array.from(r.querySelectorAll(`[aria-live],[role="status"],output`))),r,t,n)}function rt(e){e===void 0&&(e={});let{id:t,root:n}=e,r=un(),i=Nn(),[a,o]=Z.useState(null),s=Z.useRef(null);return V(()=>()=>{a?.remove(),queueMicrotask(()=>{s.current=null})},[a]),V(()=>{if(!r||s.current)return;let e=t?document.getElementById(t):null;if(!e)return;let n=document.createElement(`div`);n.id=r,n.setAttribute(Mn,``),e.appendChild(n),s.current=n,o(n)},[t,r]),V(()=>{if(n===null||!r||s.current)return;let e=n||i?.portalNode;e&&!d(e)&&(e=e.current),e||=document.body;let a=null;t&&(a=document.createElement(`div`),a.id=t,e.appendChild(a));let c=document.createElement(`div`);c.id=r,c.setAttribute(Mn,``),e=a||e,e.appendChild(c),s.current=c,o(c)},[t,n,r,i]),a}function it(e){let{children:t,id:n,root:r,preserveTabOrder:i=!0}=e,a=rt({id:n,root:r}),[o,s]=Z.useState(null),c=Z.useRef(null),l=Z.useRef(null),u=Z.useRef(null),d=Z.useRef(null),f=o?.modal,p=o?.open,m=!!o&&!o.modal&&o.open&&i&&!!(r||a);return Z.useEffect(()=>{if(!a||!i||f)return;function e(e){a&&oe(e)&&(e.type===`focusin`?D:E)(a)}return a.addEventListener(`focusin`,e,!0),a.addEventListener(`focusout`,e,!0),()=>{a.removeEventListener(`focusin`,e,!0),a.removeEventListener(`focusout`,e,!0)}},[a,i,f]),Z.useEffect(()=>{a&&(p||D(a))},[p,a]),ke(jn.Provider,{value:Z.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:l,beforeInsideRef:u,afterInsideRef:d,portalNode:a,setFocusManagerState:s}),[i,a]),children:[m&&a&&Q(An,{"data-type":`outside`,ref:c,onFocus:e=>{if(oe(e,a)){var t;(t=u.current)==null||t.focus()}else ne(o?o.domReference:null)?.focus()}}),m&&a&&Q(`span`,{"aria-owns":a.id,style:kn}),a&&Ae.createPortal(t,a),m&&a&&Q(An,{"data-type":`outside`,ref:l,onFocus:e=>{if(oe(e,a)){var t;(t=d.current)==null||t.focus()}else L(o?o.domReference:null)?.focus(),o!=null&&o.closeOnFocusOut&&o?.onOpenChange(!1,e.nativeEvent,`focus-out`)}})]})}function at(e){return Z.useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}function ot(){Fn=Fn.filter(e=>e.isConnected)}function st(e){ot(),e&&r(e)!==`body`&&(Fn.push(e),Fn.length>Pn&&(Fn=Fn.slice(-20)))}function ct(){return ot(),Fn[Fn.length-1]}function lt(e){let t=z();return x(e,t)?e:S(e,t)[0]||e}function ut(e,t){var n;if(!t.current.includes(`floating`)&&!((n=e.getAttribute(`role`))!=null&&n.includes(`dialog`)))return;let r=z(),i=y(e,r).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return x(e,r)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),a=e.getAttribute(`tabindex`);t.current.includes(`floating`)||i.length===0?a!==`0`&&e.setAttribute(`tabindex`,`0`):(a!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function dt(e){let{context:t,children:n,disabled:r=!1,order:i=[`content`],guards:a=!0,initialFocus:o=0,returnFocus:s=!0,restoreFocus:c=!1,modal:u=!0,visuallyHiddenDismiss:d=!1,closeOnFocusOut:f=!0,outsideElementsInert:p=!1,getInsideElements:m=()=>[]}=e,{open:h,onOpenChange:g,events:_,dataRef:v,elements:{domReference:y,floating:b}}=t,x=Y(()=>v.current.floatingContext?.nodeId),T=Y(m),E=typeof o==`number`&&o<0,D=ce(y)&&E,O=En(),k=O?a:!0,M=!k||O&&p,N=X(i),P=X(o),F=X(s),I=hn(),R=Nn(),re=Z.useRef(null),H=Z.useRef(null),U=Z.useRef(!1),ie=Z.useRef(!1),ae=Z.useRef(-1),W=Z.useRef(-1),G=R!=null,K=j(b),se=Y(function(e){return e===void 0&&(e=K),e?S(e,z()):[]}),q=Y(e=>{let t=se(e);return N.current.map(e=>y&&e===`reference`?y:K&&e===`floating`?K:t).filter(Boolean).flat()});Z.useEffect(()=>{if(r||!u)return;function e(e){if(e.key===`Tab`){w(K,C(A(K)))&&se().length===0&&!D&&J(e);let t=q(),n=B(e);N.current[0]===`reference`&&n===y&&(J(e),e.shiftKey?Xe(t[t.length-1]):Xe(t[1])),N.current[1]===`floating`&&n===K&&e.shiftKey&&(J(e),Xe(t[0]))}}let t=A(K);return t.addEventListener(`keydown`,e),()=>{t.removeEventListener(`keydown`,e)}},[r,y,K,u,N,D,se,q]),Z.useEffect(()=>{if(r||!b)return;function e(e){let t=B(e),n=se().indexOf(t);n!==-1&&(ae.current=n)}return b.addEventListener(`focusin`,e),()=>{b.removeEventListener(`focusin`,e)}},[r,b,se]),Z.useEffect(()=>{if(r||!f)return;function e(){ie.current=!0,setTimeout(()=>{ie.current=!1})}function t(e){let t=e.relatedTarget,n=e.currentTarget,r=B(e);queueMicrotask(()=>{let i=x(),a=!(w(y,t)||w(b,t)||w(t,b)||w(R?.portalNode,t)||t!=null&&t.hasAttribute(He(`focus-guard`))||I&&(te(I.nodesRef.current,i).find(e=>w(e.context?.elements.floating,t)||w(e.context?.elements.domReference,t))||ee(I.nodesRef.current,i).find(e=>[e.context?.elements.floating,j(e.context?.elements.floating)].includes(t)||e.context?.elements.domReference===t)));if(n===y&&K&&ut(K,N),c&&n!==y&&!(r!=null&&r.isConnected)&&C(A(K))===A(K).body){l(K)&&K.focus();let e=ae.current,t=se(),n=t[e]||t[t.length-1]||K;l(n)&&n.focus()}if(v.current.insideReactTree){v.current.insideReactTree=!1;return}(D||!u)&&t&&a&&!ie.current&&t!==ct()&&(U.current=!0,g(!1,e,`focus-out`))})}let n=!!(!I&&R);function i(){$(W),v.current.insideReactTree=!0,W.current=window.setTimeout(()=>{v.current.insideReactTree=!1})}if(b&&l(y))return y.addEventListener(`focusout`,t),y.addEventListener(`pointerdown`,e),b.addEventListener(`focusout`,t),n&&b.addEventListener(`focusout`,i,!0),()=>{y.removeEventListener(`focusout`,t),y.removeEventListener(`pointerdown`,e),b.removeEventListener(`focusout`,t),n&&b.removeEventListener(`focusout`,i,!0)}},[r,y,b,K,u,I,R,g,f,c,se,D,x,N,v]);let le=Z.useRef(null),fe=Z.useRef(null),pe=at([le,R?.beforeInsideRef]),me=at([fe,R?.afterInsideRef]);Z.useEffect(()=>{var e,t;if(r||!b)return;let n=Array.from((R==null||(e=R.portalNode)==null?void 0:e.querySelectorAll(`[`+He(`portal`)+`]`))||[]),i=[b,(t=(I?ee(I.nodesRef.current,x()):[]).find(e=>ce(e.context?.elements.domReference||null)))==null||(t=t.context)==null?void 0:t.elements.domReference,...n,...T(),re.current,H.current,le.current,fe.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,N.current.includes(`reference`)||D?y:null].filter(e=>e!=null),a=u||D?nt(i,!M,M):nt(i);return()=>{a()}},[r,y,b,u,N,R,D,k,M,I,x,T]),V(()=>{if(r||!l(K))return;let e=C(A(K));queueMicrotask(()=>{let t=q(K),n=P.current,r=(typeof n==`number`?t[n]:n.current)||K,i=w(K,e);!E&&!i&&h&&Xe(r,{preventScroll:r===K})})},[r,h,K,E,q,P]),V(()=>{if(r||!K)return;let e=A(K);st(C(e));function t(e){let{reason:t,event:n,nested:r}=e;if([`hover`,`safe-polygon`].includes(t)&&n.type===`mouseleave`&&(U.current=!0),t===`outside-press`)if(r)U.current=!1;else if(ue(n)||de(n))U.current=!1;else{let e=!1;document.createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?U.current=!1:U.current=!0}}_.on(`openchange`,t);let n=e.createElement(`span`);n.setAttribute(`tabindex`,`-1`),n.setAttribute(`aria-hidden`,`true`),Object.assign(n.style,kn),G&&y&&y.insertAdjacentElement(`afterend`,n);function i(){if(typeof F.current==`boolean`){let e=y||ct();return e&&e.isConnected?e:n}return F.current.current||n}return()=>{_.off(`openchange`,t);let r=C(e),a=w(b,r)||I&&te(I.nodesRef.current,x(),!1).some(e=>w(e.context?.elements.floating,r)),o=i();queueMicrotask(()=>{let t=lt(o);F.current&&!U.current&&l(t)&&(!(t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),n.remove()})}},[r,b,K,F,v,_,I,G,y,x]),Z.useEffect(()=>(queueMicrotask(()=>{U.current=!1}),()=>{queueMicrotask(ot)}),[r]),V(()=>{if(!r&&R)return R.setFocusManagerState({modal:u,closeOnFocusOut:f,open:h,onOpenChange:g,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,h,g,f,y]),V(()=>{r||K&&ut(K,N)},[r,K,N]);function he(e){return r||!d||!u?null:Q(In,{ref:e===`start`?re:H,onClick:e=>g(!1,e.nativeEvent),children:typeof d==`string`?d:`Dismiss`})}let ge=!r&&k&&(u?!D:!0)&&(G||u);return ke(Oe,{children:[ge&&Q(An,{"data-type":`inside`,ref:pe,onFocus:e=>{if(u){let e=q();Xe(i[0]===`reference`?e[0]:e[e.length-1])}else if(R!=null&&R.preserveTabOrder&&R.portalNode)if(U.current=!1,oe(e,R.portalNode))L(y)?.focus();else{var t;(t=R.beforeOutsideRef.current)==null||t.focus()}}}),!D&&he(`start`),n,he(`end`),ge&&Q(An,{"data-type":`inside`,ref:me,onFocus:e=>{if(u)Xe(q()[0]);else if(R!=null&&R.preserveTabOrder&&R.portalNode)if(f&&(U.current=!0),oe(e,R.portalNode))ne(y)?.focus();else{var t;(t=R.afterOutsideRef.current)==null||t.focus()}}})]})}function ft(){let e=R(),t=/iP(hone|ad|od)|iOS/.test(e)||e===`MacIntel`&&navigator.maxTouchPoints>1,n=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?`paddingLeft`:`paddingRight`,i=window.innerWidth-document.documentElement.clientWidth,a=n.left?parseFloat(n.left):window.scrollX,o=n.top?parseFloat(n.top):window.scrollY;if(n.overflow=`hidden`,n.setProperty(Rn,i+`px`),i&&(n[r]=i+`px`),t){let e=window.visualViewport?.offsetLeft||0,t=window.visualViewport?.offsetTop||0;Object.assign(n,{position:`fixed`,top:-(o-Math.floor(t))+`px`,left:-(a-Math.floor(e))+`px`,right:`0`})}return()=>{Object.assign(n,{overflow:``,[r]:``}),n.removeProperty(Rn),t&&(Object.assign(n,{position:``,top:``,left:``,right:``}),window.scrollTo(a,o))}}function pt(e){return l(e.target)&&e.target.tagName===`BUTTON`}function mt(e){return l(e.target)&&e.target.tagName===`A`}function ht(e){return le(e)}function gt(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,dataRef:i,elements:{domReference:a}}=e,{enabled:o=!0,event:s=`click`,toggle:c=!0,ignoreMouse:l=!1,keyboardHandlers:u=!0,stickIfOpen:d=!0}=t,f=Z.useRef(),p=Z.useRef(!1),m=Z.useMemo(()=>({onPointerDown(e){f.current=e.pointerType},onMouseDown(e){let t=f.current;e.button===0&&s!==`click`&&(G(t,!0)&&l||(n&&c&&(!(i.current.openEvent&&d)||i.current.openEvent.type===`mousedown`)?r(!1,e.nativeEvent,`click`):(e.preventDefault(),r(!0,e.nativeEvent,`click`))))},onClick(e){let t=f.current;if(s===`mousedown`&&f.current){f.current=void 0;return}G(t,!0)&&l||(n&&c&&(!(i.current.openEvent&&d)||i.current.openEvent.type===`click`)?r(!1,e.nativeEvent,`click`):r(!0,e.nativeEvent,`click`))},onKeyDown(e){f.current=void 0,!(e.defaultPrevented||!u||pt(e))&&(e.key===` `&&!ht(a)&&(e.preventDefault(),p.current=!0),!mt(e)&&e.key===`Enter`&&r(!(n&&c),e.nativeEvent,`click`))},onKeyUp(e){e.defaultPrevented||!u||pt(e)||ht(a)||e.key===` `&&p.current&&(p.current=!1,r(!(n&&c),e.nativeEvent,`click`))}}),[i,a,s,l,u,r,n,d,c]);return Z.useMemo(()=>o?{reference:m}:{},[o,m])}function _t(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function vt(e){return e!=null&&e.clientX!=null}function yt(e,t){t===void 0&&(t={});let{open:n,dataRef:r,elements:{floating:i,domReference:a},refs:s}=e,{enabled:c=!0,axis:l=`both`,x:u=null,y:d=null}=t,f=Z.useRef(!1),p=Z.useRef(null),[m,h]=Z.useState(),[g,_]=Z.useState([]),v=Y((e,t)=>{f.current||r.current.openEvent&&!vt(r.current.openEvent)||s.setPositionReference(_t(a,{x:e,y:t,axis:l,dataRef:r,pointerType:m}))}),y=Y(e=>{u!=null||d!=null||(n?p.current||_([]):v(e.clientX,e.clientY))}),b=G(m)?i:n,x=Z.useCallback(()=>{if(!b||!c||u!=null||d!=null)return;let e=o(i);function t(n){w(i,B(n))?(e.removeEventListener(`mousemove`,t),p.current=null):v(n.clientX,n.clientY)}if(!r.current.openEvent||vt(r.current.openEvent)){e.addEventListener(`mousemove`,t);let n=()=>{e.removeEventListener(`mousemove`,t),p.current=null};return p.current=n,n}s.setPositionReference(a)},[b,c,u,d,i,r,s,a,v]);Z.useEffect(()=>x(),[x,g]),Z.useEffect(()=>{c&&!i&&(f.current=!1)},[c,i]),Z.useEffect(()=>{!c&&n&&(f.current=!0)},[c,n]),V(()=>{c&&(u!=null||d!=null)&&(f.current=!1,v(u,d))},[c,u,d,v]);let S=Z.useMemo(()=>{function e(e){let{pointerType:t}=e;h(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}},[y]);return Z.useMemo(()=>c?{reference:S}:{},[c,S])}function bt(e,t){t===void 0&&(t={});let{open:r,onOpenChange:o,elements:s,dataRef:d}=e,{enabled:f=!0,escapeKey:m=!0,outsidePress:h=!0,outsidePressEvent:g=`pointerdown`,referencePress:_=!1,referencePressEvent:v=`pointerdown`,ancestorScroll:y=!1,bubbles:b,capture:x}=t,S=hn(),C=Y(typeof h==`function`?h:()=>!1),T=typeof h==`function`?C:h,E=Z.useRef(!1),{escapeKey:D,outsidePress:O}=Un(b),{escapeKey:k,outsidePress:j}=Un(x),M=Z.useRef(!1),N=Y(e=>{if(!r||!f||!m||e.key!==`Escape`||M.current)return;let t=d.current.floatingContext?.nodeId,n=S?te(S.nodesRef.current,t):[];if(!D&&(e.stopPropagation(),n.length>0)){let e=!0;if(n.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__escapeKeyBubbles){e=!1;return}}),!e)return}o(!1,K(e)?e.nativeEvent:e,`escape-key`)}),P=Y(e=>{var t;let n=()=>{var t;N(e),(t=B(e))==null||t.removeEventListener(`keydown`,n)};(t=B(e))==null||t.addEventListener(`keydown`,n)}),F=Y(e=>{let t=d.current.insideReactTree;d.current.insideReactTree=!1;let r=E.current;if(E.current=!1,g===`click`&&r||t||typeof T==`function`&&!T(e))return;let i=B(e),f=`[`+He(`inert`)+`]`,p=A(s.floating).querySelectorAll(f),m=c(i)?i:null;for(;m&&!u(m);){let e=a(m);if(u(e)||!c(e))break;m=e}if(p.length&&c(i)&&!se(i)&&!w(i,s.floating)&&Array.from(p).every(e=>!w(m,e)))return;if(l(i)&&ee){let t=u(i),r=n(i),a=/auto|scroll/,o=t||a.test(r.overflowX),s=t||a.test(r.overflowY),c=o&&i.clientWidth>0&&i.scrollWidth>i.clientWidth,l=s&&i.clientHeight>0&&i.scrollHeight>i.clientHeight,d=r.direction===`rtl`,f=l&&(d?e.offsetX<=i.offsetWidth-i.clientWidth:e.offsetX>i.clientWidth),p=c&&e.offsetY>i.clientHeight;if(f||p)return}let h=d.current.floatingContext?.nodeId,_=S&&te(S.nodesRef.current,h).some(t=>U(e,t.context?.elements.floating));if(U(e,s.floating)||U(e,s.domReference)||_)return;let v=S?te(S.nodesRef.current,h):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;if((n=t.context)!=null&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}o(!1,e,`outside-press`)}),I=Y(e=>{var t;let n=()=>{var t;F(e),(t=B(e))==null||t.removeEventListener(g,n)};(t=B(e))==null||t.addEventListener(g,n)});Z.useEffect(()=>{if(!r||!f)return;d.current.__escapeKeyBubbles=D,d.current.__outsidePressBubbles=O;let e=-1;function t(e){o(!1,e,`ancestor-scroll`)}function n(){window.clearTimeout(e),M.current=!0}function a(){e=window.setTimeout(()=>{M.current=!1},p()?5:0)}let l=A(s.floating);m&&(l.addEventListener(`keydown`,k?P:N,k),l.addEventListener(`compositionstart`,n),l.addEventListener(`compositionend`,a)),T&&l.addEventListener(g,j?I:F,j);let u=[];return y&&(c(s.domReference)&&(u=i(s.domReference)),c(s.floating)&&(u=u.concat(i(s.floating))),!c(s.reference)&&s.reference&&s.reference.contextElement&&(u=u.concat(i(s.reference.contextElement)))),u=u.filter(e=>e!==l.defaultView?.visualViewport),u.forEach(e=>{e.addEventListener(`scroll`,t,{passive:!0})}),()=>{m&&(l.removeEventListener(`keydown`,k?P:N,k),l.removeEventListener(`compositionstart`,n),l.removeEventListener(`compositionend`,a)),T&&l.removeEventListener(g,j?I:F,j),u.forEach(e=>{e.removeEventListener(`scroll`,t)}),window.clearTimeout(e)}},[d,s,m,T,g,r,o,y,f,D,O,N,k,P,F,j,I]),Z.useEffect(()=>{d.current.insideReactTree=!1},[d,T,g]);let L=Z.useMemo(()=>({onKeyDown:N,..._&&{[Vn[v]]:e=>{o(!1,e.nativeEvent,`reference-press`)},...v!==`click`&&{onClick(e){o(!1,e.nativeEvent,`reference-press`)}}}}),[N,o,_,v]),ee=Z.useMemo(()=>({onKeyDown:N,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[Hn[g]]:()=>{d.current.insideReactTree=!0}}),[N,g,d]);return Z.useMemo(()=>f?{reference:L,floating:ee}:{},[f,L,ee])}function xt(e){let{open:t=!1,onOpenChange:n,elements:r}=e,i=un(),a=Z.useRef({}),[o]=Z.useState(()=>Re()),s=mn()!=null,[c,l]=Z.useState(r.reference),u=Y((e,t,r)=>{a.current.openEvent=e?t:void 0,o.emit(`openchange`,{open:e,event:t,reason:r,nested:s}),n?.(e,t,r)}),d=Z.useMemo(()=>({setPositionReference:l}),[]),f=Z.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return Z.useMemo(()=>({dataRef:a,open:t,onOpenChange:u,elements:f,events:o,floatingId:i,refs:d}),[t,u,f,o,i,d])}function St(e){e===void 0&&(e={});let{nodeId:t}=e,n=xt({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[a,o]=Z.useState(null),[s,l]=Z.useState(null),u=i?.domReference||a,d=Z.useRef(null),f=hn();V(()=>{u&&(d.current=u)},[u]);let p=De({...e,elements:{...i,...s&&{reference:s}}}),m=Z.useCallback(e=>{let t=c(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;l(t),p.refs.setReference(t)},[p.refs]),h=Z.useCallback(e=>{(c(e)||e===null)&&(d.current=e,o(e)),(c(p.refs.reference.current)||p.refs.reference.current===null||e!==null&&!c(e))&&p.refs.setReference(e)},[p.refs]),g=Z.useMemo(()=>({...p.refs,setReference:h,setPositionReference:m,domReference:d}),[p.refs,h,m]),_=Z.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=Z.useMemo(()=>({...p,...r,refs:g,elements:_,nodeId:t}),[p,g,_,t,r]);return V(()=>{r.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),Z.useMemo(()=>({...p,context:v,refs:g,elements:_}),[p,g,_,v])}function Ct(){return W()&&q()}function wt(e,t){t===void 0&&(t={});let{open:n,onOpenChange:r,events:i,dataRef:a,elements:s}=e,{enabled:u=!0,visibleOnly:d=!0}=t,f=Z.useRef(!1),p=Z.useRef(-1),m=Z.useRef(!0);Z.useEffect(()=>{if(!u)return;let e=o(s.domReference);function t(){!n&&l(s.domReference)&&s.domReference===C(A(s.domReference))&&(f.current=!0)}function r(){m.current=!0}function i(){m.current=!1}return e.addEventListener(`blur`,t),Ct()&&(e.addEventListener(`keydown`,r,!0),e.addEventListener(`pointerdown`,i,!0)),()=>{e.removeEventListener(`blur`,t),Ct()&&(e.removeEventListener(`keydown`,r,!0),e.removeEventListener(`pointerdown`,i,!0))}},[s.domReference,n,u]),Z.useEffect(()=>{if(!u)return;function e(e){let{reason:t}=e;(t===`reference-press`||t===`escape-key`)&&(f.current=!0)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[i,u]),Z.useEffect(()=>()=>{$(p)},[]);let h=Z.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(e){if(f.current)return;let t=B(e.nativeEvent);if(d&&c(t)){if(Ct()&&!e.relatedTarget){if(!m.current&&!le(t))return}else if(!fe(t))return}r(!0,e.nativeEvent,`focus`)},onBlur(e){f.current=!1;let t=e.relatedTarget,n=e.nativeEvent,i=c(t)&&t.hasAttribute(He(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;p.current=window.setTimeout(()=>{let e=C(s.domReference?s.domReference.ownerDocument:document);!t&&e===s.domReference||w(a.current.floatingContext?.refs.floating.current,e)||w(s.domReference,e)||i||r(!1,n,`focus`)})}}),[a,s.domReference,r,d]);return Z.useMemo(()=>u?{reference:h}:{},[u,h])}function Tt(e,t,n){let r=new Map,i=n===`item`,a=e;if(i&&e){let{[qt]:t,[Jt]:n,...r}=e;a=r}return{...n===`floating`&&{tabIndex:-1,[Kt]:``},...a,...t.map(t=>{let r=t?t[n]:null;return typeof r==`function`?e?r(e):null:r}).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,a]=t;if(!(i&&[qt,Jt].includes(n)))if(n.indexOf(`on`)===0){if(r.has(n)||r.set(n,[]),typeof a==`function`){var o;(o=r.get(n))==null||o.push(a),e[n]=function(){var e=[...arguments];return r.get(n)?.map(t=>t(...e)).find(e=>e!==void 0)}}}else e[n]=a}),e),{})}}function Et(e){e===void 0&&(e=[]);let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=Z.useCallback(t=>Tt(t,e,`reference`),t),a=Z.useCallback(t=>Tt(t,e,`floating`),n),o=Z.useCallback(t=>Tt(t,e,`item`),r);return Z.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o}),[i,a,o])}function Dt(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ot(e,t){return Dt(t,e===Zt||e===Qt,e===Yt||e===Xt)}function kt(e,t,n){return Dt(t,e===Qt,n?e===Yt:e===Xt)||e===`Enter`||e===` `||e===``}function At(e,t,n){return Dt(t,n?e===Yt:e===Xt,e===Qt)}function jt(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Wn:Dt(t,n?e===Xt:e===Yt,e===Zt)}function Mt(e,t){let{open:n,onOpenChange:r,elements:i,floatingId:a}=e,{listRef:o,activeIndex:s,onNavigate:c=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loop:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:b=void 0,orientation:x=`vertical`,parentOrientation:S,cols:E=1,scrollItemIntoView:D=!0,virtualItemRef:L,itemSizes:ee,dense:te=!1}=t,R=X(j(i.floating)),ne=mn(),z=hn();V(()=>{e.dataRef.current.orientation=x},[e,x]);let B=Y(()=>{c(U.current===-1?null:U.current)}),re=ce(i.domReference),H=Z.useRef(_),U=Z.useRef(d??-1),W=Z.useRef(null),G=Z.useRef(!0),oe=Z.useRef(B),K=Z.useRef(!!i.floating),se=Z.useRef(n),q=Z.useRef(!1),le=Z.useRef(!1),fe=X(b),pe=X(n),me=X(D),he=X(d),[ge,_e]=Z.useState(),[ve,ye]=Z.useState(),be=Y(()=>{function e(e){if(g){var t;(t=e.id)!=null&&t.endsWith(`-fui-option`)&&(e.id=a+`-`+Math.random().toString(16).slice(2,10)),_e(e.id),z?.events.emit(`virtualfocus`,e),L&&(L.current=e)}else Xe(e,{sync:q.current,preventScroll:!0})}let t=o.current[U.current],n=le.current;t&&e(t),(q.current?e=>e():requestAnimationFrame)(()=>{let r=o.current[U.current]||t;if(!r)return;t||e(r);let i=me.current;i&&Se&&(n||!G.current)&&(r.scrollIntoView==null||r.scrollIntoView(typeof i==`boolean`?{block:`nearest`,inline:`nearest`}:i))})});V(()=>{u&&(n&&i.floating?H.current&&d!=null&&(le.current=!0,U.current=d,B()):K.current&&(U.current=-1,oe.current()))},[u,n,i.floating,d,B]),V(()=>{if(u&&n&&i.floating)if(s==null){if(q.current=!1,he.current!=null)return;if(K.current&&(U.current=-1,be()),(!se.current||!K.current)&&H.current&&(W.current!=null||H.current===!0&&W.current==null)){let e=0,t=()=>{o.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e++):(U.current=W.current==null||kt(W.current,x,h)||m?I(o,fe.current):F(o,fe.current),W.current=null,B())};t()}}else ie(o,s)||(U.current=s,be(),le.current=!1)},[u,n,i.floating,s,he,m,o,x,h,B,be,fe]),V(()=>{var e;if(!u||i.floating||!z||g||!K.current)return;let t=z.nodesRef.current,n=(e=t.find(e=>e.id===ne))==null||(e=e.context)==null?void 0:e.elements.floating,r=C(A(i.floating)),a=t.some(e=>e.context&&w(e.context.elements.floating,r));n&&!a&&G.current&&n.focus({preventScroll:!0})},[u,i.floating,z,ne,g]),V(()=>{if(!u||!z||!g||ne)return;function e(e){ye(e.id),L&&(L.current=e)}return z.events.on(`virtualfocus`,e),()=>{z.events.off(`virtualfocus`,e)}},[u,z,g,ne,L]),V(()=>{oe.current=B,se.current=n,K.current=!!i.floating}),V(()=>{n||(W.current=null,H.current=_)},[n,_]);let xe=s!=null,Se=Z.useMemo(()=>{function e(e){if(!pe.current)return;let t=o.current.indexOf(e);t!==-1&&U.current!==t&&(U.current=t,B())}return{onFocus(t){let{currentTarget:n}=t;q.current=!0,e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},onMouseMove(t){let{currentTarget:n}=t;q.current=!0,le.current=!1,v&&e(n)},onPointerLeave(e){let{pointerType:t}=e;if(!(!G.current||t===`touch`)&&(q.current=!0,v&&(U.current=-1,B(),!g))){var n;(n=R.current)==null||n.focus({preventScroll:!0})}}}},[pe,R,v,o,B,g]),Ce=Z.useCallback(()=>{var e;return S??(z==null||(e=z.nodesRef.current.find(e=>e.id===ne))==null||(e=e.context)==null||(e=e.dataRef)==null?void 0:e.current.orientation)},[ne,z,S]),we=Y(e=>{if(G.current=!1,q.current=!0,e.which===229||!pe.current&&e.currentTarget===R.current)return;if(m&&jt(e.key,x,h,E)){Ot(e.key,Ce())||J(e),r(!1,e.nativeEvent,`list-navigation`),l(i.domReference)&&(g?z?.events.emit(`virtualfocus`,i.domReference):i.domReference.focus());return}let t=U.current,a=I(o,b),s=F(o,b);if(re||(e.key===`Home`&&(J(e),U.current=a,B()),e.key===`End`&&(J(e),U.current=s,B())),E>1){let t=ee||Array.from({length:o.current.length},()=>({width:1,height:1})),n=T(t,E,te),r=n.findIndex(e=>e!=null&&!ae(o,e,b)),i=n.reduce((e,t,n)=>t!=null&&!ae(o,t,b)?n:e,-1),c=n[P({current:n.map(e=>e==null?null:o.current[e])},{event:e,orientation:x,loop:p,rtl:h,cols:E,disabledIndices:N([...(typeof b==`function`?null:b)||o.current.map((e,t)=>ae(o,t,b)?t:void 0),void 0],n),minIndex:r,maxIndex:i,prevIndex:M(U.current>s?a:U.current,t,n,E,e.key===Qt?`bl`:e.key===(h?Yt:Xt)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(U.current=c,B()),x===`both`)return}if(Ot(e.key,x)){if(J(e),n&&!g&&C(e.currentTarget.ownerDocument)===e.currentTarget){U.current=kt(e.key,x,h)?a:s,B();return}kt(e.key,x,h)?p?U.current=t>=s?f&&t!==o.current.length?-1:a:O(o,{startingIndex:t,disabledIndices:b}):U.current=Math.min(s,O(o,{startingIndex:t,disabledIndices:b})):p?U.current=t<=a?f&&t!==-1?o.current.length:s:O(o,{startingIndex:t,decrement:!0,disabledIndices:b}):U.current=Math.max(a,O(o,{startingIndex:t,decrement:!0,disabledIndices:b})),ie(o,U.current)&&(U.current=-1),B()}}),Te=Z.useMemo(()=>g&&n&&xe&&{"aria-activedescendant":ve||ge},[g,n,xe,ve,ge]),Ee=Z.useMemo(()=>({"aria-orientation":x===`both`?void 0:x,...re?{}:Te,onKeyDown:we,onPointerMove(){G.current=!0}}),[Te,we,x,re]),De=Z.useMemo(()=>{function e(e){_===`auto`&&ue(e.nativeEvent)&&(H.current=!0)}function t(e){H.current=_,_===`auto`&&de(e.nativeEvent)&&(H.current=!0)}return{...Te,onKeyDown(e){G.current=!1;let t=e.key.startsWith(`Arrow`),i=[`Home`,`End`].includes(e.key),a=t||i,s=At(e.key,x,h),c=jt(e.key,x,h,E),l=At(e.key,Ce(),h),u=Ot(e.key,x),f=(m?l:u)||e.key===`Enter`||e.key.trim()===``;if(g&&n){let t=z?.nodesRef.current.find(e=>e.parentId==null),n=z&&t?k(z.nodesRef.current,t.id):null;if(a&&n&&L){let t=new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0});if(s||c){let r=n.context?.elements.domReference===e.currentTarget,i=c&&!r?n.context?.elements.domReference:s?o.current.find(e=>e?.id===ge):null;i&&(J(e),i.dispatchEvent(t),ye(void 0))}if((u||i)&&n.context&&n.context.open&&n.parentId&&e.currentTarget!==n.context.elements.domReference){var p;J(e),(p=n.context.elements.domReference)==null||p.dispatchEvent(t);return}}return we(e)}if(!(!n&&!y&&t)){if(f){let t=Ot(e.key,Ce());W.current=m&&t?null:e.key}if(m){l&&(J(e),n?(U.current=I(o,fe.current),B()):r(!0,e.nativeEvent,`list-navigation`));return}u&&(d!=null&&(U.current=d),J(e),!n&&y?r(!0,e.nativeEvent,`list-navigation`):we(e),n&&B())}},onFocus(){n&&!g&&(U.current=-1,B())},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[ge,Te,E,we,fe,_,o,m,B,r,n,y,x,Ce,h,d,z,g,L]);return Z.useMemo(()=>u?{reference:De,floating:Ee,item:Se}:{},[u,De,Ee,Se])}function Nt(e,t){t===void 0&&(t={});let{open:n,elements:r,floatingId:i}=e,{enabled:a=!0,role:o=`dialog`}=t,s=un(),c=r.domReference?.id||s,l=Z.useMemo(()=>j(r.floating)?.id||i,[r.floating,i]),u=Gn.get(o)??o,d=mn()!=null,f=Z.useMemo(()=>u===`tooltip`||o===`label`?{[`aria-`+(o===`label`?`labelledby`:`describedby`)]:n?l:void 0}:{"aria-expanded":n?`true`:`false`,"aria-haspopup":u===`alertdialog`?`dialog`:u,"aria-controls":n?l:void 0,...u===`listbox`&&{role:`combobox`},...u===`menu`&&{id:c},...u===`menu`&&d&&{role:`menuitem`},...o===`select`&&{"aria-autocomplete":`none`},...o===`combobox`&&{"aria-autocomplete":`list`}},[u,l,d,n,c,o]),p=Z.useMemo(()=>{let e={id:l,...u&&{role:u}};return u===`tooltip`||o===`label`?e:{...e,...u===`menu`&&{"aria-labelledby":c}}},[u,l,c,o]),m=Z.useCallback(e=>{let{active:t,selected:n}=e,r={role:`option`,...t&&{id:l+`-fui-option`}};switch(o){case`select`:case`combobox`:return{...r,"aria-selected":n}}return{}},[l,o]);return Z.useMemo(()=>a?{reference:f,floating:p,item:m}:{},[a,f,p,m])}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e,t){let[n,r]=Z.useState(e);return e&&!n&&r(!0),Z.useEffect(()=>{if(!e&&n){let e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}function It(e,t){t===void 0&&(t={});let{open:n,elements:{floating:r}}=e,{duration:i=250}=t,a=(typeof i==`number`?i:i.close)||0,[o,s]=Z.useState(`unmounted`),c=Ft(n,a);return!c&&o===`close`&&s(`unmounted`),V(()=>{if(r){if(n){s(`initial`);let e=requestAnimationFrame(()=>{Ae.flushSync(()=>{s(`open`)})});return()=>{cancelAnimationFrame(e)}}s(`close`)}},[n,r]),{isMounted:c,status:o}}function Lt(e,t){t===void 0&&(t={});let{initial:n={opacity:0},open:r,close:i,common:a,duration:o=250}=t,s=e.placement,c=s.split(`-`)[0],l=Z.useMemo(()=>({side:c,placement:s}),[c,s]),u=typeof o==`number`,d=(u?o:o.open)||0,f=(u?o:o.close)||0,[p,m]=Z.useState(()=>({...Pt(a,l),...Pt(n,l)})),{isMounted:h,status:g}=It(e,{duration:o}),_=X(n),v=X(r),y=X(i),b=X(a);return V(()=>{let e=Pt(_.current,l),t=Pt(y.current,l),n=Pt(b.current,l),r=Pt(v.current,l)||Object.keys(e).reduce((e,t)=>(e[t]=``,e),{});if(g===`initial`&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),g===`open`&&m({transitionProperty:Object.keys(r).map(Kn).join(`,`),transitionDuration:d+`ms`,...n,...r}),g===`close`){let r=t||e;m({transitionProperty:Object.keys(r).map(Kn).join(`,`),transitionDuration:f+`ms`,...n,...r})}},[f,y,_,v,b,d,g,l]),{isMounted:h,styles:p}}function Rt(e,t){let{open:n,dataRef:r}=e,{listRef:i,activeIndex:a,onMatch:o,onTypingChange:s,enabled:c=!0,findMatch:l=null,resetMs:u=750,ignoreKeys:d=[],selectedIndex:f=null}=t,p=Z.useRef(-1),m=Z.useRef(``),h=Z.useRef(f??a??-1),g=Z.useRef(null),_=Y(o),v=Y(s),y=X(l),b=X(d);V(()=>{n&&($(p),g.current=null,m.current=``)},[n]),V(()=>{n&&m.current===``&&(h.current=f??a??-1)},[n,f,a]);let x=Y(e=>{e?r.current.typing||(r.current.typing=e,v(e)):r.current.typing&&(r.current.typing=e,v(e))}),S=Y(e=>{function t(e,t,n){let r=y.current?y.current(t,n):t.find(e=>e?.toLocaleLowerCase().indexOf(n.toLocaleLowerCase())===0);return r?e.indexOf(r):-1}let r=i.current;if(m.current.length>0&&m.current[0]!==` `&&(t(r,r,m.current)===-1?x(!1):e.key===` `&&J(e)),r==null||b.current.includes(e.key)||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;n&&e.key!==` `&&(J(e),x(!0)),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,$(p),p.current=window.setTimeout(()=>{m.current=``,h.current=g.current,x(!1)},u);let a=h.current,o=t(r,[...r.slice((a||0)+1),...r.slice(0,(a||0)+1)],m.current);o===-1?e.key!==` `&&(m.current=``,x(!1)):(_(o),g.current=o)}),C=Z.useMemo(()=>({onKeyDown:S}),[S]),w=Z.useMemo(()=>({onKeyDown:S,onKeyUp(e){e.key===` `&&x(!1)}}),[S,x]);return Z.useMemo(()=>c?{reference:C,floating:w}:{},[c,C,w])}function zt(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}function Bt(e,t){let{open:n,elements:r}=e,{enabled:i=!0,overflowRef:a,scrollRef:o,onChange:s}=t,c=Y(s),l=Z.useRef(!1),u=Z.useRef(null),d=Z.useRef(null);Z.useEffect(()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||a.current==null)return;let n=e.deltaY,r=a.current.top>=-.5,i=a.current.bottom>=-.5,o=t.scrollHeight-t.clientHeight,s=n<0?-1:1,l=n<0?`max`:`min`;t.scrollHeight<=t.clientHeight||(!r&&n>0||!i&&n<0?(e.preventDefault(),Ae.flushSync(()=>{c(e=>e+Math[l](n,o*s))})):/firefox/i.test(re())&&(t.scrollTop+=n))}let t=o?.current||r.floating;if(n&&t)return t.addEventListener(`wheel`,e),requestAnimationFrame(()=>{u.current=t.scrollTop,a.current!=null&&(d.current={...a.current})}),()=>{u.current=null,d.current=null,t.removeEventListener(`wheel`,e)}},[i,n,r.floating,a,o,c]);let f=Z.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){let e=o?.current||r.floating;if(!(!a.current||!e||!l.current)){if(u.current!==null){let t=e.scrollTop-u.current;(a.current.bottom<-.5&&t<-1||a.current.top<-.5&&t>1)&&Ae.flushSync(()=>c(e=>e+t))}requestAnimationFrame(()=>{u.current=e.scrollTop})}}}),[r.floating,c,a,o]);return Z.useMemo(()=>i?{floating:f}:{},[i,f])}function Vt(e,t,n){return n===void 0&&(n=!0),e.filter(e=>e.parentId===t&&(!n||e.context?.open)).flatMap(t=>[t,...Vt(e,t.id,n)])}function Ht(e,t){let[n,r]=e,i=!1,a=t.length;for(let e=0,o=a-1;e<a;o=e++){let[a,s]=t[e]||[0,0],[c,l]=t[o]||[0,0];s>=r!=l>=r&&n<=(c-a)*(r-s)/(l-s)+a&&(i=!i)}return i}function Ut(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Wt(e){e===void 0&&(e={});let{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,i={current:-1},a=!1,o=null,s=null,l=typeof performance<`u`?performance.now():0;function u(e,t){let n=performance.now(),r=n-l;if(o===null||s===null||r===0)return o=e,s=t,l=n,null;let i=e-o,a=t-s,c=Math.sqrt(i*i+a*a)/r;return o=e,s=t,l=n,c}let d=e=>{let{x:n,y:o,placement:s,elements:l,onClose:d,nodeId:f,tree:p}=e;return function(e){function m(){$(i),d()}if($(i),!l.domReference||!l.floating||s==null||n==null||o==null)return;let{clientX:h,clientY:g}=e,_=[h,g],v=Qe(e),y=e.type===`mouseleave`,b=Ze(l.floating,v),x=Ze(l.domReference,v),S=l.domReference.getBoundingClientRect(),C=l.floating.getBoundingClientRect(),w=s.split(`-`)[0],T=n>C.right-C.width/2,E=o>C.bottom-C.height/2,D=Ut(_,S),O=C.width>S.width,k=C.height>S.height,A=(O?S:C).left,j=(O?S:C).right,M=(k?S:C).top,N=(k?S:C).bottom;if(b&&(a=!0,!y))return;if(x&&(a=!1),x&&!y){a=!0;return}if(y&&c(e.relatedTarget)&&Ze(l.floating,e.relatedTarget)||p&&Vt(p.nodesRef.current,f).length)return;if(w===`top`&&o>=S.bottom-1||w===`bottom`&&o<=S.top+1||w===`left`&&n>=S.right-1||w===`right`&&n<=S.left+1)return m();let P=[];switch(w){case`top`:P=[[A,S.top+1],[A,C.bottom-1],[j,C.bottom-1],[j,S.top+1]];break;case`bottom`:P=[[A,C.top+1],[A,S.bottom-1],[j,S.bottom-1],[j,C.top+1]];break;case`left`:P=[[C.right-1,N],[C.right-1,M],[S.left+1,M],[S.left+1,N]];break;case`right`:P=[[S.right-1,N],[S.right-1,M],[C.left+1,M],[C.left+1,N]];break}function F(e){let[n,r]=e;switch(w){case`top`:return[[O?n+t/2:T?n+t*4:n-t*4,r+t+1],[O?n-t/2:T?n+t*4:n-t*4,r+t+1],...[[C.left,T||O?C.bottom-t:C.top],[C.right,T?O?C.bottom-t:C.top:C.bottom-t]]];case`bottom`:return[[O?n+t/2:T?n+t*4:n-t*4,r-t],[O?n-t/2:T?n+t*4:n-t*4,r-t],...[[C.left,T||O?C.top+t:C.bottom],[C.right,T?O?C.top+t:C.bottom:C.top+t]]];case`left`:{let e=[n+t+1,k?r+t/2:E?r+t*4:r-t*4],i=[n+t+1,k?r-t/2:E?r+t*4:r-t*4];return[...[[E||k?C.right-t:C.left,C.top],[E?k?C.right-t:C.left:C.right-t,C.bottom]],e,i]}case`right`:return[[n-t,k?r+t/2:E?r+t*4:r-t*4],[n-t,k?r-t/2:E?r+t*4:r-t*4],...[[E||k?C.left+t:C.right,C.top],[E?k?C.left+t:C.right:C.left+t,C.bottom]]]}}if(!Ht([h,g],P)){if(a&&!D)return m();if(!y&&r){let t=u(e.clientX,e.clientY);if(t!==null&&t<.1)return m()}Ht([h,g],F([n,o]))?!a&&r&&(i.current=window.setTimeout(m,40)):m()}}};return d.__options={blockPointerEvents:n},d}var Gt,Kt,qt,Jt,Yt,Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn=e((()=>{H(),s(),b(),xe(),h(),Gt=Z.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}}),Kt=`data-floating-ui-focusable`,qt=`active`,Jt=`selected`,Yt=`ArrowLeft`,Xt=`ArrowRight`,Zt=`ArrowUp`,Qt=`ArrowDown`,$t=Z.createContext({activeIndex:0,onNavigate:()=>{}}),en=[Yt,Xt],tn=[Zt,Qt],nn=[...en,...tn],rn=Z.forwardRef(function(e,t){let{render:n,orientation:r=`both`,loop:i=!0,rtl:a=!1,cols:o=1,disabledIndices:s,activeIndex:c,onNavigate:l,itemSizes:u,dense:d=!1,...f}=e,[p,m]=Z.useState(0),h=c??p,g=Y(l??m),_=Z.useRef([]),v=n&&typeof n!=`function`?n.props:{},y=Z.useMemo(()=>({activeIndex:h,onNavigate:g}),[h,g]),b=o>1;function x(e){if(!nn.includes(e.key))return;let t=h,n=I(_,s),c=F(_,s),l=a?Yt:Xt,f=a?Xt:Yt;if(b){let f=u||Array.from({length:_.current.length},()=>({width:1,height:1})),p=T(f,o,d),m=p.findIndex(e=>e!=null&&!ae(_,e,s)),g=p.reduce((e,t,n)=>t!=null&&!ae(_,t,s)?n:e,-1),v=p[P({current:p.map(e=>e?_.current[e]:null)},{event:e,orientation:r,loop:i,rtl:a,cols:o,disabledIndices:N([...(typeof s==`function`?null:s)||_.current.map((e,t)=>ae(_,t,s)?t:void 0),void 0],p),minIndex:m,maxIndex:g,prevIndex:M(h>c?n:h,f,p,o,e.key===Qt?`bl`:e.key===l?`tr`:`tl`)})];v!=null&&(t=v)}let p={horizontal:[l],vertical:[Qt],both:[l,Qt]}[r],m={horizontal:[f],vertical:[Zt],both:[f,Zt]}[r],v=b?nn:{horizontal:en,vertical:tn,both:nn}[r];if(t===h&&[...p,...m].includes(e.key)&&(t=i&&t===c&&p.includes(e.key)?n:i&&t===n&&m.includes(e.key)?c:O(_,{startingIndex:t,decrement:m.includes(e.key),disabledIndices:s})),t!==h&&!ie(_,t)){var y;e.stopPropagation(),v.includes(e.key)&&e.preventDefault(),g(t),(y=_.current[t])==null||y.focus()}}let S={...f,...v,ref:t,"aria-orientation":r===`both`?void 0:r,onKeyDown(e){f.onKeyDown==null||f.onKeyDown(e),v.onKeyDown==null||v.onKeyDown(e),x(e)}};return Q($t.Provider,{value:y,children:Q(Pe,{elementsRef:_,children:Ie(n,S)})})}),an=Z.forwardRef(function(e,t){let{render:n,...r}=e,i=n&&typeof n!=`function`?n.props:{},{activeIndex:a,onNavigate:o}=Z.useContext($t),{ref:s,index:c}=Fe(),l=Me([s,t,i.ref]),u=a===c;return Ie(n,{...r,...i,ref:l,tabIndex:u?0:-1,"data-active":u?``:void 0,onFocus(e){r.onFocus==null||r.onFocus(e),i.onFocus==null||i.onFocus(e),o(c)}})}),on={...Z},sn=!1,cn=0,ln=()=>`floating-ui-`+Math.random().toString(36).slice(2,6)+ cn++,un=on.useId||Le,dn=Z.forwardRef(function(e,t){let{context:{placement:r,elements:{floating:i},middlewareData:{arrow:a,shift:o}},width:s=14,height:c=7,tipRadius:l=0,strokeWidth:u=0,staticOffset:d,stroke:f,d:p,style:{transform:m,...h}={},...g}=e,_=un(),[v,y]=Z.useState(!1);if(V(()=>{i&&n(i).direction===`rtl`&&y(!0)},[i]),!i)return null;let[b,x]=r.split(`-`),S=b===`top`||b===`bottom`,C=d;(S&&o!=null&&o.x||!S&&o!=null&&o.y)&&(C=null);let w=u*2,T=w/2,E=s/2*(l/-8+1),D=c/2*l/4,O=!!p,k=C&&x===`end`?`bottom`:`top`,A=C&&x===`end`?`right`:`left`;C&&v&&(A=x===`end`?`left`:`right`);let j=a?.x==null?``:C||a.x,M=a?.y==null?``:C||a.y,N=p||`M0,0`+(` H`+s)+(` L`+(s-E)+`,`+(c-D))+(` Q`+s/2+`,`+c+` `+E+`,`+(c-D))+` Z`,P={top:O?`rotate(180deg)`:``,left:O?`rotate(90deg)`:`rotate(-90deg)`,bottom:O?``:`rotate(180deg)`,right:O?`rotate(-90deg)`:`rotate(90deg)`}[b];return ke(`svg`,{...g,"aria-hidden":!0,ref:t,width:O?s:s+w,height:s,viewBox:`0 0 `+s+` `+(c>s?c:s),style:{position:`absolute`,pointerEvents:`none`,[A]:j,[k]:M,[b]:S||O?`100%`:`calc(100% - `+w/2+`px)`,transform:[P,m].filter(e=>!!e).join(` `),...h},children:[w>0&&Q(`path`,{clipPath:`url(#`+_+`)`,fill:`none`,stroke:f,strokeWidth:w+(p?0:1),d:N}),Q(`path`,{stroke:w&&!p?g.fill:`none`,d:N}),Q(`clipPath`,{id:_,children:Q(`rect`,{x:-T,y:T*(O?-1:1),width:s+w,height:s})})]})}),fn=Z.createContext(null),pn=Z.createContext(null),mn=()=>Z.useContext(fn)?.id||null,hn=()=>Z.useContext(pn),gn=He(`safe-polygon`),_n=()=>{},vn=Z.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:_n,setState:_n,isInstantPhase:!1}),yn=()=>Z.useContext(vn),bn=Z.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeoutIdRef:{current:-1},currentIdRef:{current:null},currentContextRef:{current:null}}),xn=0,Sn={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap},Cn=new WeakSet,wn={},Tn=0,En=()=>typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype,Dn=e=>e&&(e.host||Dn(e.parentNode)),On=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Dn(t);return e.contains(n)?n:null}).filter(e=>e!=null),kn={border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`fixed`,whiteSpace:`nowrap`,width:`1px`,top:0,left:0},An=Z.forwardRef(function(e,t){let[n,r]=Z.useState();V(()=>{q()&&r(`button`)},[]);let i={ref:t,tabIndex:0,role:n,"aria-hidden":n?void 0:!0,[He(`focus-guard`)]:``,style:kn};return Q(`span`,{...e,...i})}),jn=Z.createContext(null),Mn=He(`portal`),Nn=()=>Z.useContext(jn),Pn=20,Fn=[],In=Z.forwardRef(function(e,t){return Q(`button`,{...e,type:`button`,ref:t,tabIndex:-1,style:kn})}),Ln=0,Rn=`--floating-ui-scrollbar-width`,zn=()=>{},Bn=Z.forwardRef(function(e,t){let{lockScroll:n=!1,...r}=e;return V(()=>{if(n)return Ln++,Ln===1&&(zn=ft()),()=>{Ln--,Ln===0&&zn()}},[n]),Q(`div`,{ref:t,...r,style:{position:`fixed`,overflow:`auto`,top:0,right:0,bottom:0,left:0,...r.style}})}),Vn={pointerdown:`onPointerDown`,mousedown:`onMouseDown`,click:`onClick`},Hn={pointerdown:`onPointerDownCapture`,mousedown:`onMouseDownCapture`,click:`onClickCapture`},Un=e=>({escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}),Wn=`Escape`,Gn=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]),Kn=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?`-`:``)+e.toLowerCase()),qn=e=>({name:`inner`,options:e,async fn(t){let{listRef:n,overflowRef:r,onFallbackChange:i,offset:a=0,index:o=0,minItemsVisible:s=4,referenceOverflowThreshold:c=0,scrollRef:l,...u}=m(e,t),{rects:d,elements:{floating:f}}=t,p=n.current[o],h=l?.current||f,y=f.clientTop||h.clientTop,b=f.clientTop!==0,x=h.clientTop!==0,S=f===h;if(!p)return{};let C={...t,...await we(-p.offsetTop-f.clientTop-d.reference.height/2-p.offsetHeight/2-a).fn(t)},w=await he(zt(C,h.scrollHeight+y+f.clientTop),u),T=await he(C,{...u,elementContext:`reference`}),E=g(0,w.top),D=C.y+E,O=(h.scrollHeight>h.clientHeight?e=>e:v)(g(0,h.scrollHeight+(b&&S||x?y*2:0)-E-g(0,w.bottom)));if(h.style.maxHeight=O+`px`,h.scrollTop=E,i){let e=h.offsetHeight<p.offsetHeight*_(s,n.current.length)-1||T.top>=-c||T.bottom>=-c;Ae.flushSync(()=>i(e))}return r&&(r.current=await he(zt({...C,y:D},h.offsetHeight+y+f.clientTop),u)),{y:D}}})}));Jn();export{je as floating_ui_react_esm_exports,Jn as init_floating_ui_react_esm};
1
+ import { __esm, __export } from "../../../../../../../_virtual/rolldown_runtime.js";
2
+ import { evaluate, init_floating_ui_utils, max, min, round } from "../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js";
3
+ import { getComputedStyle, getNodeName, getOverflowAncestors, getParentNode, getWindow, init_floating_ui_utils_dom, isElement, isHTMLElement, isLastTraversableNode, isNode, isShadowRoot, isWebKit } from "../../../../../@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js";
4
+ import { autoUpdate, computePosition, detectOverflow, platform } from "../../../../../@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
5
+ import { arrow, autoPlacement, flip, hide, init_floating_ui_react_dom, inline, limitShift, offset, shift, size, useFloating } from "../../../../../@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
6
+ import { focusable, init_index_esm, isTabbable, tabbable } from "../../../../../tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js";
7
+ import { activeElement, contains, createGridCellMap, disableFocusInside, enableFocusInside, findNonDisabledListIndex, getDeepestNode, getDocument, getFloatingFocusElement, getGridCellIndexOfCorner, getGridCellIndices, getGridNavigatedIndex, getMaxListIndex, getMinListIndex, getNextTabbable, getNodeAncestors, getNodeChildren, getPlatform, getPreviousTabbable, getTabbableOptions, getTarget, getUserAgent, index, init_floating_ui_react_utils, isEventTargetWithin, isIndexOutOfListBounds, isListIndexDisabled, isMac, isMouseLikePointerType, isOutsideEvent, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, matchesFocusVisible, stopEvent, useEffectEvent, useLatestRef } from "./floating-ui.react.utils.js";
8
+ import * as React$1 from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import * as ReactDOM$1 from "react-dom";
11
+
12
+ //#region ../../node_modules/.pnpm/@floating-ui+react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js
13
+ var floating_ui_react_esm_exports = /* @__PURE__ */ __export({
14
+ Composite: () => Composite,
15
+ CompositeItem: () => CompositeItem,
16
+ FloatingArrow: () => FloatingArrow,
17
+ FloatingDelayGroup: () => FloatingDelayGroup,
18
+ FloatingFocusManager: () => FloatingFocusManager,
19
+ FloatingList: () => FloatingList,
20
+ FloatingNode: () => FloatingNode,
21
+ FloatingOverlay: () => FloatingOverlay,
22
+ FloatingPortal: () => FloatingPortal,
23
+ FloatingTree: () => FloatingTree,
24
+ NextFloatingDelayGroup: () => NextFloatingDelayGroup,
25
+ arrow: () => arrow,
26
+ autoPlacement: () => autoPlacement,
27
+ autoUpdate: () => autoUpdate,
28
+ computePosition: () => computePosition,
29
+ detectOverflow: () => detectOverflow,
30
+ flip: () => flip,
31
+ getOverflowAncestors: () => getOverflowAncestors,
32
+ hide: () => hide,
33
+ inline: () => inline,
34
+ inner: () => inner,
35
+ limitShift: () => limitShift,
36
+ offset: () => offset,
37
+ platform: () => platform,
38
+ safePolygon: () => safePolygon,
39
+ shift: () => shift,
40
+ size: () => size,
41
+ useClick: () => useClick,
42
+ useClientPoint: () => useClientPoint,
43
+ useDelayGroup: () => useDelayGroup,
44
+ useDelayGroupContext: () => useDelayGroupContext,
45
+ useDismiss: () => useDismiss,
46
+ useFloating: () => useFloating$1,
47
+ useFloatingNodeId: () => useFloatingNodeId,
48
+ useFloatingParentNodeId: () => useFloatingParentNodeId,
49
+ useFloatingPortalNode: () => useFloatingPortalNode,
50
+ useFloatingRootContext: () => useFloatingRootContext,
51
+ useFloatingTree: () => useFloatingTree,
52
+ useFocus: () => useFocus,
53
+ useHover: () => useHover,
54
+ useId: () => useId,
55
+ useInnerOffset: () => useInnerOffset,
56
+ useInteractions: () => useInteractions,
57
+ useListItem: () => useListItem,
58
+ useListNavigation: () => useListNavigation,
59
+ useMergeRefs: () => useMergeRefs,
60
+ useNextDelayGroup: () => useNextDelayGroup,
61
+ useRole: () => useRole,
62
+ useTransitionStatus: () => useTransitionStatus,
63
+ useTransitionStyles: () => useTransitionStyles,
64
+ useTypeahead: () => useTypeahead
65
+ });
66
+ /**
67
+ * Merges an array of refs into a single memoized callback ref or `null`.
68
+ * @see https://floating-ui.com/docs/react-utils#usemergerefs
69
+ */
70
+ function useMergeRefs(refs) {
71
+ const cleanupRef = React$1.useRef(void 0);
72
+ const refEffect = React$1.useCallback((instance) => {
73
+ const cleanups = refs.map((ref) => {
74
+ if (ref == null) return;
75
+ if (typeof ref === "function") {
76
+ const refCallback = ref;
77
+ const refCleanup = refCallback(instance);
78
+ return typeof refCleanup === "function" ? refCleanup : () => {
79
+ refCallback(null);
80
+ };
81
+ }
82
+ ref.current = instance;
83
+ return () => {
84
+ ref.current = null;
85
+ };
86
+ });
87
+ return () => {
88
+ cleanups.forEach((refCleanup) => refCleanup == null ? void 0 : refCleanup());
89
+ };
90
+ }, refs);
91
+ return React$1.useMemo(() => {
92
+ if (refs.every((ref) => ref == null)) return null;
93
+ return (value) => {
94
+ if (cleanupRef.current) {
95
+ cleanupRef.current();
96
+ cleanupRef.current = void 0;
97
+ }
98
+ if (value != null) cleanupRef.current = refEffect(value);
99
+ };
100
+ }, refs);
101
+ }
102
+ function sortByDocumentPosition(a, b) {
103
+ const position = a.compareDocumentPosition(b);
104
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) return -1;
105
+ if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) return 1;
106
+ return 0;
107
+ }
108
+ /**
109
+ * Provides context for a list of items within the floating element.
110
+ * @see https://floating-ui.com/docs/FloatingList
111
+ */
112
+ function FloatingList(props) {
113
+ const { children, elementsRef, labelsRef } = props;
114
+ const [nodes, setNodes] = React$1.useState(() => /* @__PURE__ */ new Set());
115
+ const register = React$1.useCallback((node) => {
116
+ setNodes((prevSet) => new Set(prevSet).add(node));
117
+ }, []);
118
+ const unregister = React$1.useCallback((node) => {
119
+ setNodes((prevSet) => {
120
+ const set = new Set(prevSet);
121
+ set.delete(node);
122
+ return set;
123
+ });
124
+ }, []);
125
+ const map = React$1.useMemo(() => {
126
+ const newMap = /* @__PURE__ */ new Map();
127
+ Array.from(nodes.keys()).sort(sortByDocumentPosition).forEach((node, index$1) => {
128
+ newMap.set(node, index$1);
129
+ });
130
+ return newMap;
131
+ }, [nodes]);
132
+ return /* @__PURE__ */ jsx(FloatingListContext.Provider, {
133
+ value: React$1.useMemo(() => ({
134
+ register,
135
+ unregister,
136
+ map,
137
+ elementsRef,
138
+ labelsRef
139
+ }), [
140
+ register,
141
+ unregister,
142
+ map,
143
+ elementsRef,
144
+ labelsRef
145
+ ]),
146
+ children
147
+ });
148
+ }
149
+ /**
150
+ * Used to register a list item and its index (DOM position) in the
151
+ * `FloatingList`.
152
+ * @see https://floating-ui.com/docs/FloatingList#uselistitem
153
+ */
154
+ function useListItem(props) {
155
+ if (props === void 0) props = {};
156
+ const { label } = props;
157
+ const { register, unregister, map, elementsRef, labelsRef } = React$1.useContext(FloatingListContext);
158
+ const [index$1, setIndex] = React$1.useState(null);
159
+ const componentRef = React$1.useRef(null);
160
+ const ref = React$1.useCallback((node) => {
161
+ componentRef.current = node;
162
+ if (index$1 !== null) {
163
+ elementsRef.current[index$1] = node;
164
+ if (labelsRef) {
165
+ var _node$textContent;
166
+ const isLabelDefined = label !== void 0;
167
+ labelsRef.current[index$1] = isLabelDefined ? label : (_node$textContent = node == null ? void 0 : node.textContent) != null ? _node$textContent : null;
168
+ }
169
+ }
170
+ }, [
171
+ index$1,
172
+ elementsRef,
173
+ labelsRef,
174
+ label
175
+ ]);
176
+ index(() => {
177
+ const node = componentRef.current;
178
+ if (node) {
179
+ register(node);
180
+ return () => {
181
+ unregister(node);
182
+ };
183
+ }
184
+ }, [register, unregister]);
185
+ index(() => {
186
+ const index$2 = componentRef.current ? map.get(componentRef.current) : null;
187
+ if (index$2 != null) setIndex(index$2);
188
+ }, [map]);
189
+ return React$1.useMemo(() => ({
190
+ ref,
191
+ index: index$1 == null ? -1 : index$1
192
+ }), [index$1, ref]);
193
+ }
194
+ function renderJsx(render, computedProps) {
195
+ if (typeof render === "function") return render(computedProps);
196
+ if (render) return /* @__PURE__ */ React$1.cloneElement(render, computedProps);
197
+ return /* @__PURE__ */ jsx("div", { ...computedProps });
198
+ }
199
+ function useFloatingId() {
200
+ const [id, setId] = React$1.useState(() => serverHandoffComplete ? genId() : void 0);
201
+ index(() => {
202
+ if (id == null) setId(genId());
203
+ }, []);
204
+ React$1.useEffect(() => {
205
+ serverHandoffComplete = true;
206
+ }, []);
207
+ return id;
208
+ }
209
+ function warn() {
210
+ var _devMessageSet;
211
+ for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) messages[_key] = arguments[_key];
212
+ const message = "Floating UI: " + messages.join(" ");
213
+ if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(message))) {
214
+ var _devMessageSet2;
215
+ (_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message);
216
+ console.warn(message);
217
+ }
218
+ }
219
+ function error() {
220
+ var _devMessageSet3;
221
+ for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) messages[_key2] = arguments[_key2];
222
+ const message = "Floating UI: " + messages.join(" ");
223
+ if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
224
+ var _devMessageSet4;
225
+ (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
226
+ console.error(message);
227
+ }
228
+ }
229
+ function createEventEmitter() {
230
+ const map = /* @__PURE__ */ new Map();
231
+ return {
232
+ emit(event, data) {
233
+ var _map$get;
234
+ (_map$get = map.get(event)) == null || _map$get.forEach((listener) => listener(data));
235
+ },
236
+ on(event, listener) {
237
+ if (!map.has(event)) map.set(event, /* @__PURE__ */ new Set());
238
+ map.get(event).add(listener);
239
+ },
240
+ off(event, listener) {
241
+ var _map$get2;
242
+ (_map$get2 = map.get(event)) == null || _map$get2.delete(listener);
243
+ }
244
+ };
245
+ }
246
+ /**
247
+ * Registers a node into the `FloatingTree`, returning its id.
248
+ * @see https://floating-ui.com/docs/FloatingTree
249
+ */
250
+ function useFloatingNodeId(customParentId) {
251
+ const id = useId();
252
+ const tree = useFloatingTree();
253
+ const reactParentId = useFloatingParentNodeId();
254
+ const parentId = customParentId || reactParentId;
255
+ index(() => {
256
+ if (!id) return;
257
+ const node = {
258
+ id,
259
+ parentId
260
+ };
261
+ tree?.addNode(node);
262
+ return () => {
263
+ tree?.removeNode(node);
264
+ };
265
+ }, [
266
+ tree,
267
+ id,
268
+ parentId
269
+ ]);
270
+ return id;
271
+ }
272
+ /**
273
+ * Provides parent node context for nested floating elements.
274
+ * @see https://floating-ui.com/docs/FloatingTree
275
+ */
276
+ function FloatingNode(props) {
277
+ const { children, id } = props;
278
+ const parentId = useFloatingParentNodeId();
279
+ return /* @__PURE__ */ jsx(FloatingNodeContext.Provider, {
280
+ value: React$1.useMemo(() => ({
281
+ id,
282
+ parentId
283
+ }), [id, parentId]),
284
+ children
285
+ });
286
+ }
287
+ /**
288
+ * Provides context for nested floating elements when they are not children of
289
+ * each other on the DOM.
290
+ * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:
291
+ * - The `bubbles` option in the `useDismiss()` Hook
292
+ * - Nested virtual list navigation
293
+ * - Nested floating elements that each open on hover
294
+ * - Custom communication between parent and child floating elements
295
+ * @see https://floating-ui.com/docs/FloatingTree
296
+ */
297
+ function FloatingTree(props) {
298
+ const { children } = props;
299
+ const nodesRef = React$1.useRef([]);
300
+ const addNode = React$1.useCallback((node) => {
301
+ nodesRef.current = [...nodesRef.current, node];
302
+ }, []);
303
+ const removeNode = React$1.useCallback((node) => {
304
+ nodesRef.current = nodesRef.current.filter((n) => n !== node);
305
+ }, []);
306
+ const [events] = React$1.useState(() => createEventEmitter());
307
+ return /* @__PURE__ */ jsx(FloatingTreeContext.Provider, {
308
+ value: React$1.useMemo(() => ({
309
+ nodesRef,
310
+ addNode,
311
+ removeNode,
312
+ events
313
+ }), [
314
+ addNode,
315
+ removeNode,
316
+ events
317
+ ]),
318
+ children
319
+ });
320
+ }
321
+ function createAttribute(name) {
322
+ return "data-floating-ui-" + name;
323
+ }
324
+ function clearTimeoutIfSet(timeoutRef) {
325
+ if (timeoutRef.current !== -1) {
326
+ clearTimeout(timeoutRef.current);
327
+ timeoutRef.current = -1;
328
+ }
329
+ }
330
+ function getDelay(value, prop, pointerType) {
331
+ if (pointerType && !isMouseLikePointerType(pointerType)) return 0;
332
+ if (typeof value === "number") return value;
333
+ if (typeof value === "function") {
334
+ const result = value();
335
+ if (typeof result === "number") return result;
336
+ return result == null ? void 0 : result[prop];
337
+ }
338
+ return value == null ? void 0 : value[prop];
339
+ }
340
+ function getRestMs(value) {
341
+ if (typeof value === "function") return value();
342
+ return value;
343
+ }
344
+ /**
345
+ * Opens the floating element while hovering over the reference element, like
346
+ * CSS `:hover`.
347
+ * @see https://floating-ui.com/docs/useHover
348
+ */
349
+ function useHover(context, props) {
350
+ if (props === void 0) props = {};
351
+ const { open, onOpenChange, dataRef, events, elements } = context;
352
+ const { enabled = true, delay = 0, handleClose = null, mouseOnly = false, restMs = 0, move = true } = props;
353
+ const tree = useFloatingTree();
354
+ const parentId = useFloatingParentNodeId();
355
+ const handleCloseRef = useLatestRef(handleClose);
356
+ const delayRef = useLatestRef(delay);
357
+ const openRef = useLatestRef(open);
358
+ const restMsRef = useLatestRef(restMs);
359
+ const pointerTypeRef = React$1.useRef();
360
+ const timeoutRef = React$1.useRef(-1);
361
+ const handlerRef = React$1.useRef();
362
+ const restTimeoutRef = React$1.useRef(-1);
363
+ const blockMouseMoveRef = React$1.useRef(true);
364
+ const performedPointerEventsMutationRef = React$1.useRef(false);
365
+ const unbindMouseMoveRef = React$1.useRef(() => {});
366
+ const restTimeoutPendingRef = React$1.useRef(false);
367
+ const isHoverOpen = useEffectEvent(() => {
368
+ var _dataRef$current$open;
369
+ const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type;
370
+ return (type == null ? void 0 : type.includes("mouse")) && type !== "mousedown";
371
+ });
372
+ React$1.useEffect(() => {
373
+ if (!enabled) return;
374
+ function onOpenChange$1(_ref) {
375
+ let { open: open$1 } = _ref;
376
+ if (!open$1) {
377
+ clearTimeoutIfSet(timeoutRef);
378
+ clearTimeoutIfSet(restTimeoutRef);
379
+ blockMouseMoveRef.current = true;
380
+ restTimeoutPendingRef.current = false;
381
+ }
382
+ }
383
+ events.on("openchange", onOpenChange$1);
384
+ return () => {
385
+ events.off("openchange", onOpenChange$1);
386
+ };
387
+ }, [enabled, events]);
388
+ React$1.useEffect(() => {
389
+ if (!enabled) return;
390
+ if (!handleCloseRef.current) return;
391
+ if (!open) return;
392
+ function onLeave(event) {
393
+ if (isHoverOpen()) onOpenChange(false, event, "hover");
394
+ }
395
+ const html = getDocument(elements.floating).documentElement;
396
+ html.addEventListener("mouseleave", onLeave);
397
+ return () => {
398
+ html.removeEventListener("mouseleave", onLeave);
399
+ };
400
+ }, [
401
+ elements.floating,
402
+ open,
403
+ onOpenChange,
404
+ enabled,
405
+ handleCloseRef,
406
+ isHoverOpen
407
+ ]);
408
+ const closeWithDelay = React$1.useCallback(function(event, runElseBranch, reason) {
409
+ if (runElseBranch === void 0) runElseBranch = true;
410
+ if (reason === void 0) reason = "hover";
411
+ const closeDelay = getDelay(delayRef.current, "close", pointerTypeRef.current);
412
+ if (closeDelay && !handlerRef.current) {
413
+ clearTimeoutIfSet(timeoutRef);
414
+ timeoutRef.current = window.setTimeout(() => onOpenChange(false, event, reason), closeDelay);
415
+ } else if (runElseBranch) {
416
+ clearTimeoutIfSet(timeoutRef);
417
+ onOpenChange(false, event, reason);
418
+ }
419
+ }, [delayRef, onOpenChange]);
420
+ const cleanupMouseMoveHandler = useEffectEvent(() => {
421
+ unbindMouseMoveRef.current();
422
+ handlerRef.current = void 0;
423
+ });
424
+ const clearPointerEvents = useEffectEvent(() => {
425
+ if (performedPointerEventsMutationRef.current) {
426
+ const body = getDocument(elements.floating).body;
427
+ body.style.pointerEvents = "";
428
+ body.removeAttribute(safePolygonIdentifier);
429
+ performedPointerEventsMutationRef.current = false;
430
+ }
431
+ });
432
+ const isClickLikeOpenEvent = useEffectEvent(() => {
433
+ return dataRef.current.openEvent ? ["click", "mousedown"].includes(dataRef.current.openEvent.type) : false;
434
+ });
435
+ React$1.useEffect(() => {
436
+ if (!enabled) return;
437
+ function onReferenceMouseEnter(event) {
438
+ clearTimeoutIfSet(timeoutRef);
439
+ blockMouseMoveRef.current = false;
440
+ if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current) || getRestMs(restMsRef.current) > 0 && !getDelay(delayRef.current, "open")) return;
441
+ const openDelay = getDelay(delayRef.current, "open", pointerTypeRef.current);
442
+ if (openDelay) timeoutRef.current = window.setTimeout(() => {
443
+ if (!openRef.current) onOpenChange(true, event, "hover");
444
+ }, openDelay);
445
+ else if (!open) onOpenChange(true, event, "hover");
446
+ }
447
+ function onReferenceMouseLeave(event) {
448
+ if (isClickLikeOpenEvent()) {
449
+ clearPointerEvents();
450
+ return;
451
+ }
452
+ unbindMouseMoveRef.current();
453
+ const doc = getDocument(elements.floating);
454
+ clearTimeoutIfSet(restTimeoutRef);
455
+ restTimeoutPendingRef.current = false;
456
+ if (handleCloseRef.current && dataRef.current.floatingContext) {
457
+ if (!open) clearTimeoutIfSet(timeoutRef);
458
+ handlerRef.current = handleCloseRef.current({
459
+ ...dataRef.current.floatingContext,
460
+ tree,
461
+ x: event.clientX,
462
+ y: event.clientY,
463
+ onClose() {
464
+ clearPointerEvents();
465
+ cleanupMouseMoveHandler();
466
+ if (!isClickLikeOpenEvent()) closeWithDelay(event, true, "safe-polygon");
467
+ }
468
+ });
469
+ const handler = handlerRef.current;
470
+ doc.addEventListener("mousemove", handler);
471
+ unbindMouseMoveRef.current = () => {
472
+ doc.removeEventListener("mousemove", handler);
473
+ };
474
+ return;
475
+ }
476
+ if (pointerTypeRef.current === "touch" ? !contains(elements.floating, event.relatedTarget) : true) closeWithDelay(event);
477
+ }
478
+ function onScrollMouseLeave(event) {
479
+ if (isClickLikeOpenEvent()) return;
480
+ if (!dataRef.current.floatingContext) return;
481
+ handleCloseRef.current == null || handleCloseRef.current({
482
+ ...dataRef.current.floatingContext,
483
+ tree,
484
+ x: event.clientX,
485
+ y: event.clientY,
486
+ onClose() {
487
+ clearPointerEvents();
488
+ cleanupMouseMoveHandler();
489
+ if (!isClickLikeOpenEvent()) closeWithDelay(event);
490
+ }
491
+ })(event);
492
+ }
493
+ function onFloatingMouseEnter() {
494
+ clearTimeoutIfSet(timeoutRef);
495
+ }
496
+ function onFloatingMouseLeave(event) {
497
+ if (!isClickLikeOpenEvent()) closeWithDelay(event, false);
498
+ }
499
+ if (isElement(elements.domReference)) {
500
+ const reference$1 = elements.domReference;
501
+ const floating = elements.floating;
502
+ if (open) reference$1.addEventListener("mouseleave", onScrollMouseLeave);
503
+ if (move) reference$1.addEventListener("mousemove", onReferenceMouseEnter, { once: true });
504
+ reference$1.addEventListener("mouseenter", onReferenceMouseEnter);
505
+ reference$1.addEventListener("mouseleave", onReferenceMouseLeave);
506
+ if (floating) {
507
+ floating.addEventListener("mouseleave", onScrollMouseLeave);
508
+ floating.addEventListener("mouseenter", onFloatingMouseEnter);
509
+ floating.addEventListener("mouseleave", onFloatingMouseLeave);
510
+ }
511
+ return () => {
512
+ if (open) reference$1.removeEventListener("mouseleave", onScrollMouseLeave);
513
+ if (move) reference$1.removeEventListener("mousemove", onReferenceMouseEnter);
514
+ reference$1.removeEventListener("mouseenter", onReferenceMouseEnter);
515
+ reference$1.removeEventListener("mouseleave", onReferenceMouseLeave);
516
+ if (floating) {
517
+ floating.removeEventListener("mouseleave", onScrollMouseLeave);
518
+ floating.removeEventListener("mouseenter", onFloatingMouseEnter);
519
+ floating.removeEventListener("mouseleave", onFloatingMouseLeave);
520
+ }
521
+ };
522
+ }
523
+ }, [
524
+ elements,
525
+ enabled,
526
+ context,
527
+ mouseOnly,
528
+ move,
529
+ closeWithDelay,
530
+ cleanupMouseMoveHandler,
531
+ clearPointerEvents,
532
+ onOpenChange,
533
+ open,
534
+ openRef,
535
+ tree,
536
+ delayRef,
537
+ handleCloseRef,
538
+ dataRef,
539
+ isClickLikeOpenEvent,
540
+ restMsRef
541
+ ]);
542
+ index(() => {
543
+ var _handleCloseRef$curre;
544
+ if (!enabled) return;
545
+ if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && (_handleCloseRef$curre = _handleCloseRef$curre.__options) != null && _handleCloseRef$curre.blockPointerEvents && isHoverOpen()) {
546
+ performedPointerEventsMutationRef.current = true;
547
+ const floatingEl = elements.floating;
548
+ if (isElement(elements.domReference) && floatingEl) {
549
+ var _tree$nodesRef$curren;
550
+ const body = getDocument(elements.floating).body;
551
+ body.setAttribute(safePolygonIdentifier, "");
552
+ const ref = elements.domReference;
553
+ const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node) => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
554
+ if (parentFloating) parentFloating.style.pointerEvents = "";
555
+ body.style.pointerEvents = "none";
556
+ ref.style.pointerEvents = "auto";
557
+ floatingEl.style.pointerEvents = "auto";
558
+ return () => {
559
+ body.style.pointerEvents = "";
560
+ ref.style.pointerEvents = "";
561
+ floatingEl.style.pointerEvents = "";
562
+ };
563
+ }
564
+ }
565
+ }, [
566
+ enabled,
567
+ open,
568
+ parentId,
569
+ elements,
570
+ tree,
571
+ handleCloseRef,
572
+ isHoverOpen
573
+ ]);
574
+ index(() => {
575
+ if (!open) {
576
+ pointerTypeRef.current = void 0;
577
+ restTimeoutPendingRef.current = false;
578
+ cleanupMouseMoveHandler();
579
+ clearPointerEvents();
580
+ }
581
+ }, [
582
+ open,
583
+ cleanupMouseMoveHandler,
584
+ clearPointerEvents
585
+ ]);
586
+ React$1.useEffect(() => {
587
+ return () => {
588
+ cleanupMouseMoveHandler();
589
+ clearTimeoutIfSet(timeoutRef);
590
+ clearTimeoutIfSet(restTimeoutRef);
591
+ clearPointerEvents();
592
+ };
593
+ }, [
594
+ enabled,
595
+ elements.domReference,
596
+ cleanupMouseMoveHandler,
597
+ clearPointerEvents
598
+ ]);
599
+ const reference = React$1.useMemo(() => {
600
+ function setPointerRef(event) {
601
+ pointerTypeRef.current = event.pointerType;
602
+ }
603
+ return {
604
+ onPointerDown: setPointerRef,
605
+ onPointerEnter: setPointerRef,
606
+ onMouseMove(event) {
607
+ const { nativeEvent } = event;
608
+ function handleMouseMove() {
609
+ if (!blockMouseMoveRef.current && !openRef.current) onOpenChange(true, nativeEvent, "hover");
610
+ }
611
+ if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current)) return;
612
+ if (open || getRestMs(restMsRef.current) === 0) return;
613
+ if (restTimeoutPendingRef.current && event.movementX ** 2 + event.movementY ** 2 < 2) return;
614
+ clearTimeoutIfSet(restTimeoutRef);
615
+ if (pointerTypeRef.current === "touch") handleMouseMove();
616
+ else {
617
+ restTimeoutPendingRef.current = true;
618
+ restTimeoutRef.current = window.setTimeout(handleMouseMove, getRestMs(restMsRef.current));
619
+ }
620
+ }
621
+ };
622
+ }, [
623
+ mouseOnly,
624
+ onOpenChange,
625
+ open,
626
+ openRef,
627
+ restMsRef
628
+ ]);
629
+ return React$1.useMemo(() => enabled ? { reference } : {}, [enabled, reference]);
630
+ }
631
+ /**
632
+ * Provides context for a group of floating elements that should share a
633
+ * `delay`.
634
+ * @see https://floating-ui.com/docs/FloatingDelayGroup
635
+ */
636
+ function FloatingDelayGroup(props) {
637
+ const { children, delay, timeoutMs = 0 } = props;
638
+ const [state, setState] = React$1.useReducer((prev, next) => ({
639
+ ...prev,
640
+ ...next
641
+ }), {
642
+ delay,
643
+ timeoutMs,
644
+ initialDelay: delay,
645
+ currentId: null,
646
+ isInstantPhase: false
647
+ });
648
+ const initialCurrentIdRef = React$1.useRef(null);
649
+ const setCurrentId = React$1.useCallback((currentId) => {
650
+ setState({ currentId });
651
+ }, []);
652
+ index(() => {
653
+ if (state.currentId) {
654
+ if (initialCurrentIdRef.current === null) initialCurrentIdRef.current = state.currentId;
655
+ else if (!state.isInstantPhase) setState({ isInstantPhase: true });
656
+ } else {
657
+ if (state.isInstantPhase) setState({ isInstantPhase: false });
658
+ initialCurrentIdRef.current = null;
659
+ }
660
+ }, [state.currentId, state.isInstantPhase]);
661
+ return /* @__PURE__ */ jsx(FloatingDelayGroupContext.Provider, {
662
+ value: React$1.useMemo(() => ({
663
+ ...state,
664
+ setState,
665
+ setCurrentId
666
+ }), [state, setCurrentId]),
667
+ children
668
+ });
669
+ }
670
+ /**
671
+ * Enables grouping when called inside a component that's a child of a
672
+ * `FloatingDelayGroup`.
673
+ * @see https://floating-ui.com/docs/FloatingDelayGroup
674
+ */
675
+ function useDelayGroup(context, options) {
676
+ if (options === void 0) options = {};
677
+ const { open, onOpenChange, floatingId } = context;
678
+ const { id: optionId, enabled = true } = options;
679
+ const id = optionId != null ? optionId : floatingId;
680
+ const groupContext = useDelayGroupContext();
681
+ const { currentId, setCurrentId, initialDelay, setState, timeoutMs } = groupContext;
682
+ index(() => {
683
+ if (!enabled) return;
684
+ if (!currentId) return;
685
+ setState({ delay: {
686
+ open: 1,
687
+ close: getDelay(initialDelay, "close")
688
+ } });
689
+ if (currentId !== id) onOpenChange(false);
690
+ }, [
691
+ enabled,
692
+ id,
693
+ onOpenChange,
694
+ setState,
695
+ currentId,
696
+ initialDelay
697
+ ]);
698
+ index(() => {
699
+ function unset() {
700
+ onOpenChange(false);
701
+ setState({
702
+ delay: initialDelay,
703
+ currentId: null
704
+ });
705
+ }
706
+ if (!enabled) return;
707
+ if (!currentId) return;
708
+ if (!open && currentId === id) {
709
+ if (timeoutMs) {
710
+ const timeout = window.setTimeout(unset, timeoutMs);
711
+ return () => {
712
+ clearTimeout(timeout);
713
+ };
714
+ }
715
+ unset();
716
+ }
717
+ }, [
718
+ enabled,
719
+ open,
720
+ setState,
721
+ currentId,
722
+ id,
723
+ onOpenChange,
724
+ initialDelay,
725
+ timeoutMs
726
+ ]);
727
+ index(() => {
728
+ if (!enabled) return;
729
+ if (setCurrentId === NOOP || !open) return;
730
+ setCurrentId(id);
731
+ }, [
732
+ enabled,
733
+ open,
734
+ setCurrentId,
735
+ id
736
+ ]);
737
+ return groupContext;
738
+ }
739
+ /**
740
+ * Experimental next version of `FloatingDelayGroup` to become the default
741
+ * in the future. This component is not yet stable.
742
+ * Provides context for a group of floating elements that should share a
743
+ * `delay`. Unlike `FloatingDelayGroup`, `useNextDelayGroup` with this
744
+ * component does not cause a re-render of unrelated consumers of the
745
+ * context when the delay changes.
746
+ * @see https://floating-ui.com/docs/FloatingDelayGroup
747
+ */
748
+ function NextFloatingDelayGroup(props) {
749
+ const { children, delay, timeoutMs = 0 } = props;
750
+ const delayRef = React$1.useRef(delay);
751
+ const initialDelayRef = React$1.useRef(delay);
752
+ const currentIdRef = React$1.useRef(null);
753
+ const currentContextRef = React$1.useRef(null);
754
+ const timeoutIdRef = React$1.useRef(-1);
755
+ return /* @__PURE__ */ jsx(NextFloatingDelayGroupContext.Provider, {
756
+ value: React$1.useMemo(() => ({
757
+ hasProvider: true,
758
+ delayRef,
759
+ initialDelayRef,
760
+ currentIdRef,
761
+ timeoutMs,
762
+ currentContextRef,
763
+ timeoutIdRef
764
+ }), [timeoutMs]),
765
+ children
766
+ });
767
+ }
768
+ /**
769
+ * Enables grouping when called inside a component that's a child of a
770
+ * `NextFloatingDelayGroup`.
771
+ * @see https://floating-ui.com/docs/FloatingDelayGroup
772
+ */
773
+ function useNextDelayGroup(context, options) {
774
+ if (options === void 0) options = {};
775
+ const { open, onOpenChange, floatingId } = context;
776
+ const { enabled = true } = options;
777
+ const { currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, hasProvider, timeoutIdRef } = React$1.useContext(NextFloatingDelayGroupContext);
778
+ const [isInstantPhase, setIsInstantPhase] = React$1.useState(false);
779
+ index(() => {
780
+ function unset() {
781
+ var _currentContextRef$cu;
782
+ setIsInstantPhase(false);
783
+ (_currentContextRef$cu = currentContextRef.current) == null || _currentContextRef$cu.setIsInstantPhase(false);
784
+ currentIdRef.current = null;
785
+ currentContextRef.current = null;
786
+ delayRef.current = initialDelayRef.current;
787
+ }
788
+ if (!enabled) return;
789
+ if (!currentIdRef.current) return;
790
+ if (!open && currentIdRef.current === floatingId) {
791
+ setIsInstantPhase(false);
792
+ if (timeoutMs) {
793
+ timeoutIdRef.current = window.setTimeout(unset, timeoutMs);
794
+ return () => {
795
+ clearTimeout(timeoutIdRef.current);
796
+ };
797
+ }
798
+ unset();
799
+ }
800
+ }, [
801
+ enabled,
802
+ open,
803
+ floatingId,
804
+ currentIdRef,
805
+ delayRef,
806
+ timeoutMs,
807
+ initialDelayRef,
808
+ currentContextRef,
809
+ timeoutIdRef
810
+ ]);
811
+ index(() => {
812
+ if (!enabled) return;
813
+ if (!open) return;
814
+ const prevContext = currentContextRef.current;
815
+ const prevId = currentIdRef.current;
816
+ currentContextRef.current = {
817
+ onOpenChange,
818
+ setIsInstantPhase
819
+ };
820
+ currentIdRef.current = floatingId;
821
+ delayRef.current = {
822
+ open: 0,
823
+ close: getDelay(initialDelayRef.current, "close")
824
+ };
825
+ if (prevId !== null && prevId !== floatingId) {
826
+ clearTimeoutIfSet(timeoutIdRef);
827
+ setIsInstantPhase(true);
828
+ prevContext?.setIsInstantPhase(true);
829
+ prevContext?.onOpenChange(false);
830
+ } else {
831
+ setIsInstantPhase(false);
832
+ prevContext?.setIsInstantPhase(false);
833
+ }
834
+ }, [
835
+ enabled,
836
+ open,
837
+ floatingId,
838
+ onOpenChange,
839
+ currentIdRef,
840
+ delayRef,
841
+ timeoutMs,
842
+ initialDelayRef,
843
+ currentContextRef,
844
+ timeoutIdRef
845
+ ]);
846
+ index(() => {
847
+ return () => {
848
+ currentContextRef.current = null;
849
+ };
850
+ }, [currentContextRef]);
851
+ return React$1.useMemo(() => ({
852
+ hasProvider,
853
+ delayRef,
854
+ isInstantPhase
855
+ }), [
856
+ hasProvider,
857
+ delayRef,
858
+ isInstantPhase
859
+ ]);
860
+ }
861
+ function enqueueFocus(el, options) {
862
+ if (options === void 0) options = {};
863
+ const { preventScroll = false, cancelPrevious = true, sync = false } = options;
864
+ cancelPrevious && cancelAnimationFrame(rafId);
865
+ const exec = () => el == null ? void 0 : el.focus({ preventScroll });
866
+ if (sync) exec();
867
+ else rafId = requestAnimationFrame(exec);
868
+ }
869
+ function contains$1(parent, child) {
870
+ if (!parent || !child) return false;
871
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
872
+ if (parent.contains(child)) return true;
873
+ if (rootNode && isShadowRoot(rootNode)) {
874
+ let next = child;
875
+ while (next) {
876
+ if (parent === next) return true;
877
+ next = next.parentNode || next.host;
878
+ }
879
+ }
880
+ return false;
881
+ }
882
+ function getTarget$1(event) {
883
+ if ("composedPath" in event) return event.composedPath()[0];
884
+ return event.target;
885
+ }
886
+ function getDocument$1(node) {
887
+ return (node == null ? void 0 : node.ownerDocument) || document;
888
+ }
889
+ function getCounterMap(control) {
890
+ if (control === "inert") return counters.inert;
891
+ if (control === "aria-hidden") return counters["aria-hidden"];
892
+ return counters.none;
893
+ }
894
+ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert) {
895
+ const markerName = "data-floating-ui-inert";
896
+ const controlAttribute = inert ? "inert" : ariaHidden ? "aria-hidden" : null;
897
+ const avoidElements = correctElements(body, uncorrectedAvoidElements);
898
+ const elementsToKeep = /* @__PURE__ */ new Set();
899
+ const elementsToStop = new Set(avoidElements);
900
+ const hiddenElements = [];
901
+ if (!markerMap[markerName]) markerMap[markerName] = /* @__PURE__ */ new WeakMap();
902
+ const markerCounter = markerMap[markerName];
903
+ avoidElements.forEach(keep);
904
+ deep(body);
905
+ elementsToKeep.clear();
906
+ function keep(el) {
907
+ if (!el || elementsToKeep.has(el)) return;
908
+ elementsToKeep.add(el);
909
+ el.parentNode && keep(el.parentNode);
910
+ }
911
+ function deep(parent) {
912
+ if (!parent || elementsToStop.has(parent)) return;
913
+ [].forEach.call(parent.children, (node) => {
914
+ if (getNodeName(node) === "script") return;
915
+ if (elementsToKeep.has(node)) deep(node);
916
+ else {
917
+ const attr$1 = controlAttribute ? node.getAttribute(controlAttribute) : null;
918
+ const alreadyHidden = attr$1 !== null && attr$1 !== "false";
919
+ const counterMap = getCounterMap(controlAttribute);
920
+ const counterValue = (counterMap.get(node) || 0) + 1;
921
+ const markerValue = (markerCounter.get(node) || 0) + 1;
922
+ counterMap.set(node, counterValue);
923
+ markerCounter.set(node, markerValue);
924
+ hiddenElements.push(node);
925
+ if (counterValue === 1 && alreadyHidden) uncontrolledElementsSet.add(node);
926
+ if (markerValue === 1) node.setAttribute(markerName, "");
927
+ if (!alreadyHidden && controlAttribute) node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true");
928
+ }
929
+ });
930
+ }
931
+ lockCount$1++;
932
+ return () => {
933
+ hiddenElements.forEach((element) => {
934
+ const counterMap = getCounterMap(controlAttribute);
935
+ const counterValue = (counterMap.get(element) || 0) - 1;
936
+ const markerValue = (markerCounter.get(element) || 0) - 1;
937
+ counterMap.set(element, counterValue);
938
+ markerCounter.set(element, markerValue);
939
+ if (!counterValue) {
940
+ if (!uncontrolledElementsSet.has(element) && controlAttribute) element.removeAttribute(controlAttribute);
941
+ uncontrolledElementsSet.delete(element);
942
+ }
943
+ if (!markerValue) element.removeAttribute(markerName);
944
+ });
945
+ lockCount$1--;
946
+ if (!lockCount$1) {
947
+ counters.inert = /* @__PURE__ */ new WeakMap();
948
+ counters["aria-hidden"] = /* @__PURE__ */ new WeakMap();
949
+ counters.none = /* @__PURE__ */ new WeakMap();
950
+ uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
951
+ markerMap = {};
952
+ }
953
+ };
954
+ }
955
+ function markOthers(avoidElements, ariaHidden, inert) {
956
+ if (ariaHidden === void 0) ariaHidden = false;
957
+ if (inert === void 0) inert = false;
958
+ const body = getDocument$1(avoidElements[0]).body;
959
+ return applyAttributeToOthers(avoidElements.concat(Array.from(body.querySelectorAll("[aria-live],[role=\"status\"],output"))), body, ariaHidden, inert);
960
+ }
961
+ /**
962
+ * @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode
963
+ */
964
+ function useFloatingPortalNode(props) {
965
+ if (props === void 0) props = {};
966
+ const { id, root } = props;
967
+ const uniqueId = useId();
968
+ const portalContext = usePortalContext();
969
+ const [portalNode, setPortalNode] = React$1.useState(null);
970
+ const portalNodeRef = React$1.useRef(null);
971
+ index(() => {
972
+ return () => {
973
+ portalNode?.remove();
974
+ queueMicrotask(() => {
975
+ portalNodeRef.current = null;
976
+ });
977
+ };
978
+ }, [portalNode]);
979
+ index(() => {
980
+ if (!uniqueId) return;
981
+ if (portalNodeRef.current) return;
982
+ const existingIdRoot = id ? document.getElementById(id) : null;
983
+ if (!existingIdRoot) return;
984
+ const subRoot = document.createElement("div");
985
+ subRoot.id = uniqueId;
986
+ subRoot.setAttribute(attr, "");
987
+ existingIdRoot.appendChild(subRoot);
988
+ portalNodeRef.current = subRoot;
989
+ setPortalNode(subRoot);
990
+ }, [id, uniqueId]);
991
+ index(() => {
992
+ if (root === null) return;
993
+ if (!uniqueId) return;
994
+ if (portalNodeRef.current) return;
995
+ let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
996
+ if (container && !isNode(container)) container = container.current;
997
+ container = container || document.body;
998
+ let idWrapper = null;
999
+ if (id) {
1000
+ idWrapper = document.createElement("div");
1001
+ idWrapper.id = id;
1002
+ container.appendChild(idWrapper);
1003
+ }
1004
+ const subRoot = document.createElement("div");
1005
+ subRoot.id = uniqueId;
1006
+ subRoot.setAttribute(attr, "");
1007
+ container = idWrapper || container;
1008
+ container.appendChild(subRoot);
1009
+ portalNodeRef.current = subRoot;
1010
+ setPortalNode(subRoot);
1011
+ }, [
1012
+ id,
1013
+ root,
1014
+ uniqueId,
1015
+ portalContext
1016
+ ]);
1017
+ return portalNode;
1018
+ }
1019
+ /**
1020
+ * Portals the floating element into a given container element — by default,
1021
+ * outside of the app root and into the body.
1022
+ * This is necessary to ensure the floating element can appear outside any
1023
+ * potential parent containers that cause clipping (such as `overflow: hidden`),
1024
+ * while retaining its location in the React tree.
1025
+ * @see https://floating-ui.com/docs/FloatingPortal
1026
+ */
1027
+ function FloatingPortal(props) {
1028
+ const { children, id, root, preserveTabOrder = true } = props;
1029
+ const portalNode = useFloatingPortalNode({
1030
+ id,
1031
+ root
1032
+ });
1033
+ const [focusManagerState, setFocusManagerState] = React$1.useState(null);
1034
+ const beforeOutsideRef = React$1.useRef(null);
1035
+ const afterOutsideRef = React$1.useRef(null);
1036
+ const beforeInsideRef = React$1.useRef(null);
1037
+ const afterInsideRef = React$1.useRef(null);
1038
+ const modal = focusManagerState == null ? void 0 : focusManagerState.modal;
1039
+ const open = focusManagerState == null ? void 0 : focusManagerState.open;
1040
+ const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && preserveTabOrder && !!(root || portalNode);
1041
+ React$1.useEffect(() => {
1042
+ if (!portalNode || !preserveTabOrder || modal) return;
1043
+ function onFocus(event) {
1044
+ if (portalNode && isOutsideEvent(event)) (event.type === "focusin" ? enableFocusInside : disableFocusInside)(portalNode);
1045
+ }
1046
+ portalNode.addEventListener("focusin", onFocus, true);
1047
+ portalNode.addEventListener("focusout", onFocus, true);
1048
+ return () => {
1049
+ portalNode.removeEventListener("focusin", onFocus, true);
1050
+ portalNode.removeEventListener("focusout", onFocus, true);
1051
+ };
1052
+ }, [
1053
+ portalNode,
1054
+ preserveTabOrder,
1055
+ modal
1056
+ ]);
1057
+ React$1.useEffect(() => {
1058
+ if (!portalNode) return;
1059
+ if (open) return;
1060
+ enableFocusInside(portalNode);
1061
+ }, [open, portalNode]);
1062
+ return /* @__PURE__ */ jsxs(PortalContext.Provider, {
1063
+ value: React$1.useMemo(() => ({
1064
+ preserveTabOrder,
1065
+ beforeOutsideRef,
1066
+ afterOutsideRef,
1067
+ beforeInsideRef,
1068
+ afterInsideRef,
1069
+ portalNode,
1070
+ setFocusManagerState
1071
+ }), [preserveTabOrder, portalNode]),
1072
+ children: [
1073
+ shouldRenderGuards && portalNode && /* @__PURE__ */ jsx(FocusGuard, {
1074
+ "data-type": "outside",
1075
+ ref: beforeOutsideRef,
1076
+ onFocus: (event) => {
1077
+ if (isOutsideEvent(event, portalNode)) {
1078
+ var _beforeInsideRef$curr;
1079
+ (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();
1080
+ } else getPreviousTabbable(focusManagerState ? focusManagerState.domReference : null)?.focus();
1081
+ }
1082
+ }),
1083
+ shouldRenderGuards && portalNode && /* @__PURE__ */ jsx("span", {
1084
+ "aria-owns": portalNode.id,
1085
+ style: HIDDEN_STYLES
1086
+ }),
1087
+ portalNode && /* @__PURE__ */ ReactDOM$1.createPortal(children, portalNode),
1088
+ shouldRenderGuards && portalNode && /* @__PURE__ */ jsx(FocusGuard, {
1089
+ "data-type": "outside",
1090
+ ref: afterOutsideRef,
1091
+ onFocus: (event) => {
1092
+ if (isOutsideEvent(event, portalNode)) {
1093
+ var _afterInsideRef$curre;
1094
+ (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();
1095
+ } else {
1096
+ getNextTabbable(focusManagerState ? focusManagerState.domReference : null)?.focus();
1097
+ focusManagerState != null && focusManagerState.closeOnFocusOut && focusManagerState?.onOpenChange(false, event.nativeEvent, "focus-out");
1098
+ }
1099
+ }
1100
+ })
1101
+ ]
1102
+ });
1103
+ }
1104
+ function useLiteMergeRefs(refs) {
1105
+ return React$1.useMemo(() => {
1106
+ return (value) => {
1107
+ refs.forEach((ref) => {
1108
+ if (ref) ref.current = value;
1109
+ });
1110
+ };
1111
+ }, refs);
1112
+ }
1113
+ function clearDisconnectedPreviouslyFocusedElements() {
1114
+ previouslyFocusedElements = previouslyFocusedElements.filter((el) => el.isConnected);
1115
+ }
1116
+ function addPreviouslyFocusedElement(element) {
1117
+ clearDisconnectedPreviouslyFocusedElements();
1118
+ if (element && getNodeName(element) !== "body") {
1119
+ previouslyFocusedElements.push(element);
1120
+ if (previouslyFocusedElements.length > LIST_LIMIT) previouslyFocusedElements = previouslyFocusedElements.slice(-20);
1121
+ }
1122
+ }
1123
+ function getPreviouslyFocusedElement() {
1124
+ clearDisconnectedPreviouslyFocusedElements();
1125
+ return previouslyFocusedElements[previouslyFocusedElements.length - 1];
1126
+ }
1127
+ function getFirstTabbableElement(container) {
1128
+ const tabbableOptions = getTabbableOptions();
1129
+ if (isTabbable(container, tabbableOptions)) return container;
1130
+ return tabbable(container, tabbableOptions)[0] || container;
1131
+ }
1132
+ function handleTabIndex(floatingFocusElement, orderRef) {
1133
+ var _floatingFocusElement;
1134
+ if (!orderRef.current.includes("floating") && !((_floatingFocusElement = floatingFocusElement.getAttribute("role")) != null && _floatingFocusElement.includes("dialog"))) return;
1135
+ const options = getTabbableOptions();
1136
+ const tabbableContent = focusable(floatingFocusElement, options).filter((element) => {
1137
+ const dataTabIndex = element.getAttribute("data-tabindex") || "";
1138
+ return isTabbable(element, options) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-");
1139
+ });
1140
+ const tabIndex = floatingFocusElement.getAttribute("tabindex");
1141
+ if (orderRef.current.includes("floating") || tabbableContent.length === 0) {
1142
+ if (tabIndex !== "0") floatingFocusElement.setAttribute("tabindex", "0");
1143
+ } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") {
1144
+ floatingFocusElement.setAttribute("tabindex", "-1");
1145
+ floatingFocusElement.setAttribute("data-tabindex", "-1");
1146
+ }
1147
+ }
1148
+ /**
1149
+ * Provides focus management for the floating element.
1150
+ * @see https://floating-ui.com/docs/FloatingFocusManager
1151
+ */
1152
+ function FloatingFocusManager(props) {
1153
+ const { context, children, disabled = false, order = ["content"], guards: _guards = true, initialFocus = 0, returnFocus = true, restoreFocus = false, modal = true, visuallyHiddenDismiss = false, closeOnFocusOut = true, outsideElementsInert = false, getInsideElements: _getInsideElements = () => [] } = props;
1154
+ const { open, onOpenChange, events, dataRef, elements: { domReference, floating } } = context;
1155
+ const getNodeId = useEffectEvent(() => {
1156
+ var _dataRef$current$floa;
1157
+ return (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
1158
+ });
1159
+ const getInsideElements = useEffectEvent(_getInsideElements);
1160
+ const ignoreInitialFocus = typeof initialFocus === "number" && initialFocus < 0;
1161
+ const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
1162
+ const inertSupported = supportsInert();
1163
+ const guards = inertSupported ? _guards : true;
1164
+ const useInert = !guards || inertSupported && outsideElementsInert;
1165
+ const orderRef = useLatestRef(order);
1166
+ const initialFocusRef = useLatestRef(initialFocus);
1167
+ const returnFocusRef = useLatestRef(returnFocus);
1168
+ const tree = useFloatingTree();
1169
+ const portalContext = usePortalContext();
1170
+ const startDismissButtonRef = React$1.useRef(null);
1171
+ const endDismissButtonRef = React$1.useRef(null);
1172
+ const preventReturnFocusRef = React$1.useRef(false);
1173
+ const isPointerDownRef = React$1.useRef(false);
1174
+ const tabbableIndexRef = React$1.useRef(-1);
1175
+ const blurTimeoutRef = React$1.useRef(-1);
1176
+ const isInsidePortal = portalContext != null;
1177
+ const floatingFocusElement = getFloatingFocusElement(floating);
1178
+ const getTabbableContent = useEffectEvent(function(container) {
1179
+ if (container === void 0) container = floatingFocusElement;
1180
+ return container ? tabbable(container, getTabbableOptions()) : [];
1181
+ });
1182
+ const getTabbableElements = useEffectEvent((container) => {
1183
+ const content = getTabbableContent(container);
1184
+ return orderRef.current.map((type) => {
1185
+ if (domReference && type === "reference") return domReference;
1186
+ if (floatingFocusElement && type === "floating") return floatingFocusElement;
1187
+ return content;
1188
+ }).filter(Boolean).flat();
1189
+ });
1190
+ React$1.useEffect(() => {
1191
+ if (disabled) return;
1192
+ if (!modal) return;
1193
+ function onKeyDown(event) {
1194
+ if (event.key === "Tab") {
1195
+ if (contains(floatingFocusElement, activeElement(getDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) stopEvent(event);
1196
+ const els = getTabbableElements();
1197
+ const target = getTarget(event);
1198
+ if (orderRef.current[0] === "reference" && target === domReference) {
1199
+ stopEvent(event);
1200
+ if (event.shiftKey) enqueueFocus(els[els.length - 1]);
1201
+ else enqueueFocus(els[1]);
1202
+ }
1203
+ if (orderRef.current[1] === "floating" && target === floatingFocusElement && event.shiftKey) {
1204
+ stopEvent(event);
1205
+ enqueueFocus(els[0]);
1206
+ }
1207
+ }
1208
+ }
1209
+ const doc = getDocument(floatingFocusElement);
1210
+ doc.addEventListener("keydown", onKeyDown);
1211
+ return () => {
1212
+ doc.removeEventListener("keydown", onKeyDown);
1213
+ };
1214
+ }, [
1215
+ disabled,
1216
+ domReference,
1217
+ floatingFocusElement,
1218
+ modal,
1219
+ orderRef,
1220
+ isUntrappedTypeableCombobox,
1221
+ getTabbableContent,
1222
+ getTabbableElements
1223
+ ]);
1224
+ React$1.useEffect(() => {
1225
+ if (disabled) return;
1226
+ if (!floating) return;
1227
+ function handleFocusIn(event) {
1228
+ const target = getTarget(event);
1229
+ const tabbableIndex = getTabbableContent().indexOf(target);
1230
+ if (tabbableIndex !== -1) tabbableIndexRef.current = tabbableIndex;
1231
+ }
1232
+ floating.addEventListener("focusin", handleFocusIn);
1233
+ return () => {
1234
+ floating.removeEventListener("focusin", handleFocusIn);
1235
+ };
1236
+ }, [
1237
+ disabled,
1238
+ floating,
1239
+ getTabbableContent
1240
+ ]);
1241
+ React$1.useEffect(() => {
1242
+ if (disabled) return;
1243
+ if (!closeOnFocusOut) return;
1244
+ function handlePointerDown() {
1245
+ isPointerDownRef.current = true;
1246
+ setTimeout(() => {
1247
+ isPointerDownRef.current = false;
1248
+ });
1249
+ }
1250
+ function handleFocusOutside(event) {
1251
+ const relatedTarget = event.relatedTarget;
1252
+ const currentTarget = event.currentTarget;
1253
+ const target = getTarget(event);
1254
+ queueMicrotask(() => {
1255
+ const nodeId = getNodeId();
1256
+ const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext == null ? void 0 : portalContext.portalNode, relatedTarget) || relatedTarget != null && relatedTarget.hasAttribute(createAttribute("focus-guard")) || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => {
1257
+ var _node$context, _node$context2;
1258
+ return contains((_node$context = node.context) == null ? void 0 : _node$context.elements.floating, relatedTarget) || contains((_node$context2 = node.context) == null ? void 0 : _node$context2.elements.domReference, relatedTarget);
1259
+ }) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => {
1260
+ var _node$context3, _node$context4, _node$context5;
1261
+ return [(_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating, getFloatingFocusElement((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.floating)].includes(relatedTarget) || ((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.domReference) === relatedTarget;
1262
+ })));
1263
+ if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement, orderRef);
1264
+ if (restoreFocus && currentTarget !== domReference && !(target != null && target.isConnected) && activeElement(getDocument(floatingFocusElement)) === getDocument(floatingFocusElement).body) {
1265
+ if (isHTMLElement(floatingFocusElement)) floatingFocusElement.focus();
1266
+ const prevTabbableIndex = tabbableIndexRef.current;
1267
+ const tabbableContent = getTabbableContent();
1268
+ const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;
1269
+ if (isHTMLElement(nodeToFocus)) nodeToFocus.focus();
1270
+ }
1271
+ if (dataRef.current.insideReactTree) {
1272
+ dataRef.current.insideReactTree = false;
1273
+ return;
1274
+ }
1275
+ if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && relatedTarget !== getPreviouslyFocusedElement()) {
1276
+ preventReturnFocusRef.current = true;
1277
+ onOpenChange(false, event, "focus-out");
1278
+ }
1279
+ });
1280
+ }
1281
+ const shouldHandleBlurCapture = Boolean(!tree && portalContext);
1282
+ function markInsideReactTree() {
1283
+ clearTimeoutIfSet(blurTimeoutRef);
1284
+ dataRef.current.insideReactTree = true;
1285
+ blurTimeoutRef.current = window.setTimeout(() => {
1286
+ dataRef.current.insideReactTree = false;
1287
+ });
1288
+ }
1289
+ if (floating && isHTMLElement(domReference)) {
1290
+ domReference.addEventListener("focusout", handleFocusOutside);
1291
+ domReference.addEventListener("pointerdown", handlePointerDown);
1292
+ floating.addEventListener("focusout", handleFocusOutside);
1293
+ if (shouldHandleBlurCapture) floating.addEventListener("focusout", markInsideReactTree, true);
1294
+ return () => {
1295
+ domReference.removeEventListener("focusout", handleFocusOutside);
1296
+ domReference.removeEventListener("pointerdown", handlePointerDown);
1297
+ floating.removeEventListener("focusout", handleFocusOutside);
1298
+ if (shouldHandleBlurCapture) floating.removeEventListener("focusout", markInsideReactTree, true);
1299
+ };
1300
+ }
1301
+ }, [
1302
+ disabled,
1303
+ domReference,
1304
+ floating,
1305
+ floatingFocusElement,
1306
+ modal,
1307
+ tree,
1308
+ portalContext,
1309
+ onOpenChange,
1310
+ closeOnFocusOut,
1311
+ restoreFocus,
1312
+ getTabbableContent,
1313
+ isUntrappedTypeableCombobox,
1314
+ getNodeId,
1315
+ orderRef,
1316
+ dataRef
1317
+ ]);
1318
+ const beforeGuardRef = React$1.useRef(null);
1319
+ const afterGuardRef = React$1.useRef(null);
1320
+ const mergedBeforeGuardRef = useLiteMergeRefs([beforeGuardRef, portalContext == null ? void 0 : portalContext.beforeInsideRef]);
1321
+ const mergedAfterGuardRef = useLiteMergeRefs([afterGuardRef, portalContext == null ? void 0 : portalContext.afterInsideRef]);
1322
+ React$1.useEffect(() => {
1323
+ var _portalContext$portal, _ancestors$find;
1324
+ if (disabled) return;
1325
+ if (!floating) return;
1326
+ const portalNodes = Array.from((portalContext == null || (_portalContext$portal = portalContext.portalNode) == null ? void 0 : _portalContext$portal.querySelectorAll("[" + createAttribute("portal") + "]")) || []);
1327
+ const insideElements = [
1328
+ floating,
1329
+ (_ancestors$find = (tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []).find((node) => {
1330
+ var _node$context6;
1331
+ return isTypeableCombobox(((_node$context6 = node.context) == null ? void 0 : _node$context6.elements.domReference) || null);
1332
+ })) == null || (_ancestors$find = _ancestors$find.context) == null ? void 0 : _ancestors$find.elements.domReference,
1333
+ ...portalNodes,
1334
+ ...getInsideElements(),
1335
+ startDismissButtonRef.current,
1336
+ endDismissButtonRef.current,
1337
+ beforeGuardRef.current,
1338
+ afterGuardRef.current,
1339
+ portalContext == null ? void 0 : portalContext.beforeOutsideRef.current,
1340
+ portalContext == null ? void 0 : portalContext.afterOutsideRef.current,
1341
+ orderRef.current.includes("reference") || isUntrappedTypeableCombobox ? domReference : null
1342
+ ].filter((x) => x != null);
1343
+ const cleanup$1 = modal || isUntrappedTypeableCombobox ? markOthers(insideElements, !useInert, useInert) : markOthers(insideElements);
1344
+ return () => {
1345
+ cleanup$1();
1346
+ };
1347
+ }, [
1348
+ disabled,
1349
+ domReference,
1350
+ floating,
1351
+ modal,
1352
+ orderRef,
1353
+ portalContext,
1354
+ isUntrappedTypeableCombobox,
1355
+ guards,
1356
+ useInert,
1357
+ tree,
1358
+ getNodeId,
1359
+ getInsideElements
1360
+ ]);
1361
+ index(() => {
1362
+ if (disabled || !isHTMLElement(floatingFocusElement)) return;
1363
+ const previouslyFocusedElement = activeElement(getDocument(floatingFocusElement));
1364
+ queueMicrotask(() => {
1365
+ const focusableElements = getTabbableElements(floatingFocusElement);
1366
+ const initialFocusValue = initialFocusRef.current;
1367
+ const elToFocus = (typeof initialFocusValue === "number" ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusElement;
1368
+ const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);
1369
+ if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) enqueueFocus(elToFocus, { preventScroll: elToFocus === floatingFocusElement });
1370
+ });
1371
+ }, [
1372
+ disabled,
1373
+ open,
1374
+ floatingFocusElement,
1375
+ ignoreInitialFocus,
1376
+ getTabbableElements,
1377
+ initialFocusRef
1378
+ ]);
1379
+ index(() => {
1380
+ if (disabled || !floatingFocusElement) return;
1381
+ const doc = getDocument(floatingFocusElement);
1382
+ addPreviouslyFocusedElement(activeElement(doc));
1383
+ function onOpenChange$1(_ref) {
1384
+ let { reason, event, nested } = _ref;
1385
+ if (["hover", "safe-polygon"].includes(reason) && event.type === "mouseleave") preventReturnFocusRef.current = true;
1386
+ if (reason !== "outside-press") return;
1387
+ if (nested) preventReturnFocusRef.current = false;
1388
+ else if (isVirtualClick(event) || isVirtualPointerEvent(event)) preventReturnFocusRef.current = false;
1389
+ else {
1390
+ let isPreventScrollSupported = false;
1391
+ document.createElement("div").focus({ get preventScroll() {
1392
+ isPreventScrollSupported = true;
1393
+ return false;
1394
+ } });
1395
+ if (isPreventScrollSupported) preventReturnFocusRef.current = false;
1396
+ else preventReturnFocusRef.current = true;
1397
+ }
1398
+ }
1399
+ events.on("openchange", onOpenChange$1);
1400
+ const fallbackEl = doc.createElement("span");
1401
+ fallbackEl.setAttribute("tabindex", "-1");
1402
+ fallbackEl.setAttribute("aria-hidden", "true");
1403
+ Object.assign(fallbackEl.style, HIDDEN_STYLES);
1404
+ if (isInsidePortal && domReference) domReference.insertAdjacentElement("afterend", fallbackEl);
1405
+ function getReturnElement() {
1406
+ if (typeof returnFocusRef.current === "boolean") {
1407
+ const el = domReference || getPreviouslyFocusedElement();
1408
+ return el && el.isConnected ? el : fallbackEl;
1409
+ }
1410
+ return returnFocusRef.current.current || fallbackEl;
1411
+ }
1412
+ return () => {
1413
+ events.off("openchange", onOpenChange$1);
1414
+ const activeEl = activeElement(doc);
1415
+ const isFocusInsideFloatingTree = contains(floating, activeEl) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => {
1416
+ var _node$context7;
1417
+ return contains((_node$context7 = node.context) == null ? void 0 : _node$context7.elements.floating, activeEl);
1418
+ });
1419
+ const returnElement = getReturnElement();
1420
+ queueMicrotask(() => {
1421
+ const tabbableReturnElement = getFirstTabbableElement(returnElement);
1422
+ if (returnFocusRef.current && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) tabbableReturnElement.focus({ preventScroll: true });
1423
+ fallbackEl.remove();
1424
+ });
1425
+ };
1426
+ }, [
1427
+ disabled,
1428
+ floating,
1429
+ floatingFocusElement,
1430
+ returnFocusRef,
1431
+ dataRef,
1432
+ events,
1433
+ tree,
1434
+ isInsidePortal,
1435
+ domReference,
1436
+ getNodeId
1437
+ ]);
1438
+ React$1.useEffect(() => {
1439
+ queueMicrotask(() => {
1440
+ preventReturnFocusRef.current = false;
1441
+ });
1442
+ return () => {
1443
+ queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
1444
+ };
1445
+ }, [disabled]);
1446
+ index(() => {
1447
+ if (disabled) return;
1448
+ if (!portalContext) return;
1449
+ portalContext.setFocusManagerState({
1450
+ modal,
1451
+ closeOnFocusOut,
1452
+ open,
1453
+ onOpenChange,
1454
+ domReference
1455
+ });
1456
+ return () => {
1457
+ portalContext.setFocusManagerState(null);
1458
+ };
1459
+ }, [
1460
+ disabled,
1461
+ portalContext,
1462
+ modal,
1463
+ open,
1464
+ onOpenChange,
1465
+ closeOnFocusOut,
1466
+ domReference
1467
+ ]);
1468
+ index(() => {
1469
+ if (disabled) return;
1470
+ if (!floatingFocusElement) return;
1471
+ handleTabIndex(floatingFocusElement, orderRef);
1472
+ }, [
1473
+ disabled,
1474
+ floatingFocusElement,
1475
+ orderRef
1476
+ ]);
1477
+ function renderDismissButton(location) {
1478
+ if (disabled || !visuallyHiddenDismiss || !modal) return null;
1479
+ return /* @__PURE__ */ jsx(VisuallyHiddenDismiss, {
1480
+ ref: location === "start" ? startDismissButtonRef : endDismissButtonRef,
1481
+ onClick: (event) => onOpenChange(false, event.nativeEvent),
1482
+ children: typeof visuallyHiddenDismiss === "string" ? visuallyHiddenDismiss : "Dismiss"
1483
+ });
1484
+ }
1485
+ const shouldRenderGuards = !disabled && guards && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
1486
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1487
+ shouldRenderGuards && /* @__PURE__ */ jsx(FocusGuard, {
1488
+ "data-type": "inside",
1489
+ ref: mergedBeforeGuardRef,
1490
+ onFocus: (event) => {
1491
+ if (modal) {
1492
+ const els = getTabbableElements();
1493
+ enqueueFocus(order[0] === "reference" ? els[0] : els[els.length - 1]);
1494
+ } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) {
1495
+ preventReturnFocusRef.current = false;
1496
+ if (isOutsideEvent(event, portalContext.portalNode)) getNextTabbable(domReference)?.focus();
1497
+ else {
1498
+ var _portalContext$before;
1499
+ (_portalContext$before = portalContext.beforeOutsideRef.current) == null || _portalContext$before.focus();
1500
+ }
1501
+ }
1502
+ }
1503
+ }),
1504
+ !isUntrappedTypeableCombobox && renderDismissButton("start"),
1505
+ children,
1506
+ renderDismissButton("end"),
1507
+ shouldRenderGuards && /* @__PURE__ */ jsx(FocusGuard, {
1508
+ "data-type": "inside",
1509
+ ref: mergedAfterGuardRef,
1510
+ onFocus: (event) => {
1511
+ if (modal) enqueueFocus(getTabbableElements()[0]);
1512
+ else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) {
1513
+ if (closeOnFocusOut) preventReturnFocusRef.current = true;
1514
+ if (isOutsideEvent(event, portalContext.portalNode)) getPreviousTabbable(domReference)?.focus();
1515
+ else {
1516
+ var _portalContext$afterO;
1517
+ (_portalContext$afterO = portalContext.afterOutsideRef.current) == null || _portalContext$afterO.focus();
1518
+ }
1519
+ }
1520
+ }
1521
+ })
1522
+ ] });
1523
+ }
1524
+ function enableScrollLock() {
1525
+ const platform$1 = getPlatform();
1526
+ const isIOS = /iP(hone|ad|od)|iOS/.test(platform$1) || platform$1 === "MacIntel" && navigator.maxTouchPoints > 1;
1527
+ const bodyStyle = document.body.style;
1528
+ const paddingProp = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft ? "paddingLeft" : "paddingRight";
1529
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
1530
+ const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.scrollX;
1531
+ const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.scrollY;
1532
+ bodyStyle.overflow = "hidden";
1533
+ bodyStyle.setProperty(scrollbarProperty, scrollbarWidth + "px");
1534
+ if (scrollbarWidth) bodyStyle[paddingProp] = scrollbarWidth + "px";
1535
+ if (isIOS) {
1536
+ var _window$visualViewpor, _window$visualViewpor2;
1537
+ const offsetLeft = ((_window$visualViewpor = window.visualViewport) == null ? void 0 : _window$visualViewpor.offsetLeft) || 0;
1538
+ const offsetTop = ((_window$visualViewpor2 = window.visualViewport) == null ? void 0 : _window$visualViewpor2.offsetTop) || 0;
1539
+ Object.assign(bodyStyle, {
1540
+ position: "fixed",
1541
+ top: -(scrollY - Math.floor(offsetTop)) + "px",
1542
+ left: -(scrollX - Math.floor(offsetLeft)) + "px",
1543
+ right: "0"
1544
+ });
1545
+ }
1546
+ return () => {
1547
+ Object.assign(bodyStyle, {
1548
+ overflow: "",
1549
+ [paddingProp]: ""
1550
+ });
1551
+ bodyStyle.removeProperty(scrollbarProperty);
1552
+ if (isIOS) {
1553
+ Object.assign(bodyStyle, {
1554
+ position: "",
1555
+ top: "",
1556
+ left: "",
1557
+ right: ""
1558
+ });
1559
+ window.scrollTo(scrollX, scrollY);
1560
+ }
1561
+ };
1562
+ }
1563
+ function isButtonTarget(event) {
1564
+ return isHTMLElement(event.target) && event.target.tagName === "BUTTON";
1565
+ }
1566
+ function isAnchorTarget(event) {
1567
+ return isHTMLElement(event.target) && event.target.tagName === "A";
1568
+ }
1569
+ function isSpaceIgnored(element) {
1570
+ return isTypeableElement(element);
1571
+ }
1572
+ /**
1573
+ * Opens or closes the floating element when clicking the reference element.
1574
+ * @see https://floating-ui.com/docs/useClick
1575
+ */
1576
+ function useClick(context, props) {
1577
+ if (props === void 0) props = {};
1578
+ const { open, onOpenChange, dataRef, elements: { domReference } } = context;
1579
+ const { enabled = true, event: eventOption = "click", toggle = true, ignoreMouse = false, keyboardHandlers = true, stickIfOpen = true } = props;
1580
+ const pointerTypeRef = React$1.useRef();
1581
+ const didKeyDownRef = React$1.useRef(false);
1582
+ const reference = React$1.useMemo(() => ({
1583
+ onPointerDown(event) {
1584
+ pointerTypeRef.current = event.pointerType;
1585
+ },
1586
+ onMouseDown(event) {
1587
+ const pointerType = pointerTypeRef.current;
1588
+ if (event.button !== 0) return;
1589
+ if (eventOption === "click") return;
1590
+ if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
1591
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === "mousedown" : true)) onOpenChange(false, event.nativeEvent, "click");
1592
+ else {
1593
+ event.preventDefault();
1594
+ onOpenChange(true, event.nativeEvent, "click");
1595
+ }
1596
+ },
1597
+ onClick(event) {
1598
+ const pointerType = pointerTypeRef.current;
1599
+ if (eventOption === "mousedown" && pointerTypeRef.current) {
1600
+ pointerTypeRef.current = void 0;
1601
+ return;
1602
+ }
1603
+ if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;
1604
+ if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === "click" : true)) onOpenChange(false, event.nativeEvent, "click");
1605
+ else onOpenChange(true, event.nativeEvent, "click");
1606
+ },
1607
+ onKeyDown(event) {
1608
+ pointerTypeRef.current = void 0;
1609
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) return;
1610
+ if (event.key === " " && !isSpaceIgnored(domReference)) {
1611
+ event.preventDefault();
1612
+ didKeyDownRef.current = true;
1613
+ }
1614
+ if (isAnchorTarget(event)) return;
1615
+ if (event.key === "Enter") if (open && toggle) onOpenChange(false, event.nativeEvent, "click");
1616
+ else onOpenChange(true, event.nativeEvent, "click");
1617
+ },
1618
+ onKeyUp(event) {
1619
+ if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) return;
1620
+ if (event.key === " " && didKeyDownRef.current) {
1621
+ didKeyDownRef.current = false;
1622
+ if (open && toggle) onOpenChange(false, event.nativeEvent, "click");
1623
+ else onOpenChange(true, event.nativeEvent, "click");
1624
+ }
1625
+ }
1626
+ }), [
1627
+ dataRef,
1628
+ domReference,
1629
+ eventOption,
1630
+ ignoreMouse,
1631
+ keyboardHandlers,
1632
+ onOpenChange,
1633
+ open,
1634
+ stickIfOpen,
1635
+ toggle
1636
+ ]);
1637
+ return React$1.useMemo(() => enabled ? { reference } : {}, [enabled, reference]);
1638
+ }
1639
+ function createVirtualElement(domElement, data) {
1640
+ let offsetX = null;
1641
+ let offsetY = null;
1642
+ let isAutoUpdateEvent = false;
1643
+ return {
1644
+ contextElement: domElement || void 0,
1645
+ getBoundingClientRect() {
1646
+ var _data$dataRef$current;
1647
+ const domRect = (domElement == null ? void 0 : domElement.getBoundingClientRect()) || {
1648
+ width: 0,
1649
+ height: 0,
1650
+ x: 0,
1651
+ y: 0
1652
+ };
1653
+ const isXAxis = data.axis === "x" || data.axis === "both";
1654
+ const isYAxis = data.axis === "y" || data.axis === "both";
1655
+ const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(((_data$dataRef$current = data.dataRef.current.openEvent) == null ? void 0 : _data$dataRef$current.type) || "") && data.pointerType !== "touch";
1656
+ let width = domRect.width;
1657
+ let height = domRect.height;
1658
+ let x = domRect.x;
1659
+ let y = domRect.y;
1660
+ if (offsetX == null && data.x && isXAxis) offsetX = domRect.x - data.x;
1661
+ if (offsetY == null && data.y && isYAxis) offsetY = domRect.y - data.y;
1662
+ x -= offsetX || 0;
1663
+ y -= offsetY || 0;
1664
+ width = 0;
1665
+ height = 0;
1666
+ if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
1667
+ width = data.axis === "y" ? domRect.width : 0;
1668
+ height = data.axis === "x" ? domRect.height : 0;
1669
+ x = isXAxis && data.x != null ? data.x : x;
1670
+ y = isYAxis && data.y != null ? data.y : y;
1671
+ } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
1672
+ height = data.axis === "x" ? domRect.height : height;
1673
+ width = data.axis === "y" ? domRect.width : width;
1674
+ }
1675
+ isAutoUpdateEvent = true;
1676
+ return {
1677
+ width,
1678
+ height,
1679
+ x,
1680
+ y,
1681
+ top: y,
1682
+ right: x + width,
1683
+ bottom: y + height,
1684
+ left: x
1685
+ };
1686
+ }
1687
+ };
1688
+ }
1689
+ function isMouseBasedEvent(event) {
1690
+ return event != null && event.clientX != null;
1691
+ }
1692
+ /**
1693
+ * Positions the floating element relative to a client point (in the viewport),
1694
+ * such as the mouse position. By default, it follows the mouse cursor.
1695
+ * @see https://floating-ui.com/docs/useClientPoint
1696
+ */
1697
+ function useClientPoint(context, props) {
1698
+ if (props === void 0) props = {};
1699
+ const { open, dataRef, elements: { floating, domReference }, refs } = context;
1700
+ const { enabled = true, axis = "both", x = null, y = null } = props;
1701
+ const initialRef = React$1.useRef(false);
1702
+ const cleanupListenerRef = React$1.useRef(null);
1703
+ const [pointerType, setPointerType] = React$1.useState();
1704
+ const [reactive, setReactive] = React$1.useState([]);
1705
+ const setReference = useEffectEvent((x$1, y$1) => {
1706
+ if (initialRef.current) return;
1707
+ if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) return;
1708
+ refs.setPositionReference(createVirtualElement(domReference, {
1709
+ x: x$1,
1710
+ y: y$1,
1711
+ axis,
1712
+ dataRef,
1713
+ pointerType
1714
+ }));
1715
+ });
1716
+ const handleReferenceEnterOrMove = useEffectEvent((event) => {
1717
+ if (x != null || y != null) return;
1718
+ if (!open) setReference(event.clientX, event.clientY);
1719
+ else if (!cleanupListenerRef.current) setReactive([]);
1720
+ });
1721
+ const openCheck = isMouseLikePointerType(pointerType) ? floating : open;
1722
+ const addListener = React$1.useCallback(() => {
1723
+ if (!openCheck || !enabled || x != null || y != null) return;
1724
+ const win = getWindow(floating);
1725
+ function handleMouseMove(event) {
1726
+ if (!contains(floating, getTarget(event))) setReference(event.clientX, event.clientY);
1727
+ else {
1728
+ win.removeEventListener("mousemove", handleMouseMove);
1729
+ cleanupListenerRef.current = null;
1730
+ }
1731
+ }
1732
+ if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {
1733
+ win.addEventListener("mousemove", handleMouseMove);
1734
+ const cleanup$1 = () => {
1735
+ win.removeEventListener("mousemove", handleMouseMove);
1736
+ cleanupListenerRef.current = null;
1737
+ };
1738
+ cleanupListenerRef.current = cleanup$1;
1739
+ return cleanup$1;
1740
+ }
1741
+ refs.setPositionReference(domReference);
1742
+ }, [
1743
+ openCheck,
1744
+ enabled,
1745
+ x,
1746
+ y,
1747
+ floating,
1748
+ dataRef,
1749
+ refs,
1750
+ domReference,
1751
+ setReference
1752
+ ]);
1753
+ React$1.useEffect(() => {
1754
+ return addListener();
1755
+ }, [addListener, reactive]);
1756
+ React$1.useEffect(() => {
1757
+ if (enabled && !floating) initialRef.current = false;
1758
+ }, [enabled, floating]);
1759
+ React$1.useEffect(() => {
1760
+ if (!enabled && open) initialRef.current = true;
1761
+ }, [enabled, open]);
1762
+ index(() => {
1763
+ if (enabled && (x != null || y != null)) {
1764
+ initialRef.current = false;
1765
+ setReference(x, y);
1766
+ }
1767
+ }, [
1768
+ enabled,
1769
+ x,
1770
+ y,
1771
+ setReference
1772
+ ]);
1773
+ const reference = React$1.useMemo(() => {
1774
+ function setPointerTypeRef(_ref) {
1775
+ let { pointerType: pointerType$1 } = _ref;
1776
+ setPointerType(pointerType$1);
1777
+ }
1778
+ return {
1779
+ onPointerDown: setPointerTypeRef,
1780
+ onPointerEnter: setPointerTypeRef,
1781
+ onMouseMove: handleReferenceEnterOrMove,
1782
+ onMouseEnter: handleReferenceEnterOrMove
1783
+ };
1784
+ }, [handleReferenceEnterOrMove]);
1785
+ return React$1.useMemo(() => enabled ? { reference } : {}, [enabled, reference]);
1786
+ }
1787
+ /**
1788
+ * Closes the floating element when a dismissal is requested — by default, when
1789
+ * the user presses the `escape` key or outside of the floating element.
1790
+ * @see https://floating-ui.com/docs/useDismiss
1791
+ */
1792
+ function useDismiss(context, props) {
1793
+ if (props === void 0) props = {};
1794
+ const { open, onOpenChange, elements, dataRef } = context;
1795
+ const { enabled = true, escapeKey = true, outsidePress: unstable_outsidePress = true, outsidePressEvent = "pointerdown", referencePress = false, referencePressEvent = "pointerdown", ancestorScroll = false, bubbles, capture } = props;
1796
+ const tree = useFloatingTree();
1797
+ const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === "function" ? unstable_outsidePress : () => false);
1798
+ const outsidePress = typeof unstable_outsidePress === "function" ? outsidePressFn : unstable_outsidePress;
1799
+ const endedOrStartedInsideRef = React$1.useRef(false);
1800
+ const { escapeKey: escapeKeyBubbles, outsidePress: outsidePressBubbles } = normalizeProp(bubbles);
1801
+ const { escapeKey: escapeKeyCapture, outsidePress: outsidePressCapture } = normalizeProp(capture);
1802
+ const isComposingRef = React$1.useRef(false);
1803
+ const closeOnEscapeKeyDown = useEffectEvent((event) => {
1804
+ var _dataRef$current$floa;
1805
+ if (!open || !enabled || !escapeKey || event.key !== "Escape") return;
1806
+ if (isComposingRef.current) return;
1807
+ const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
1808
+ const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
1809
+ if (!escapeKeyBubbles) {
1810
+ event.stopPropagation();
1811
+ if (children.length > 0) {
1812
+ let shouldDismiss = true;
1813
+ children.forEach((child) => {
1814
+ var _child$context;
1815
+ if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {
1816
+ shouldDismiss = false;
1817
+ return;
1818
+ }
1819
+ });
1820
+ if (!shouldDismiss) return;
1821
+ }
1822
+ }
1823
+ onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, "escape-key");
1824
+ });
1825
+ const closeOnEscapeKeyDownCapture = useEffectEvent((event) => {
1826
+ var _getTarget2;
1827
+ const callback = () => {
1828
+ var _getTarget;
1829
+ closeOnEscapeKeyDown(event);
1830
+ (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener("keydown", callback);
1831
+ };
1832
+ (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener("keydown", callback);
1833
+ });
1834
+ const closeOnPressOutside = useEffectEvent((event) => {
1835
+ var _dataRef$current$floa2;
1836
+ const insideReactTree = dataRef.current.insideReactTree;
1837
+ dataRef.current.insideReactTree = false;
1838
+ const endedOrStartedInside = endedOrStartedInsideRef.current;
1839
+ endedOrStartedInsideRef.current = false;
1840
+ if (outsidePressEvent === "click" && endedOrStartedInside) return;
1841
+ if (insideReactTree) return;
1842
+ if (typeof outsidePress === "function" && !outsidePress(event)) return;
1843
+ const target = getTarget(event);
1844
+ const inertSelector = "[" + createAttribute("inert") + "]";
1845
+ const markers = getDocument(elements.floating).querySelectorAll(inertSelector);
1846
+ let targetRootAncestor = isElement(target) ? target : null;
1847
+ while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {
1848
+ const nextParent = getParentNode(targetRootAncestor);
1849
+ if (isLastTraversableNode(nextParent) || !isElement(nextParent)) break;
1850
+ targetRootAncestor = nextParent;
1851
+ }
1852
+ if (markers.length && isElement(target) && !isRootElement(target) && !contains(target, elements.floating) && Array.from(markers).every((marker) => !contains(targetRootAncestor, marker))) return;
1853
+ if (isHTMLElement(target) && floating) {
1854
+ const lastTraversableNode = isLastTraversableNode(target);
1855
+ const style = getComputedStyle(target);
1856
+ const scrollRe = /auto|scroll/;
1857
+ const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
1858
+ const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
1859
+ const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
1860
+ const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
1861
+ const isRTL = style.direction === "rtl";
1862
+ const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
1863
+ const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
1864
+ if (pressedVerticalScrollbar || pressedHorizontalScrollbar) return;
1865
+ }
1866
+ const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;
1867
+ const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => {
1868
+ var _node$context;
1869
+ return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);
1870
+ });
1871
+ if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) return;
1872
+ const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
1873
+ if (children.length > 0) {
1874
+ let shouldDismiss = true;
1875
+ children.forEach((child) => {
1876
+ var _child$context2;
1877
+ if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {
1878
+ shouldDismiss = false;
1879
+ return;
1880
+ }
1881
+ });
1882
+ if (!shouldDismiss) return;
1883
+ }
1884
+ onOpenChange(false, event, "outside-press");
1885
+ });
1886
+ const closeOnPressOutsideCapture = useEffectEvent((event) => {
1887
+ var _getTarget4;
1888
+ const callback = () => {
1889
+ var _getTarget3;
1890
+ closeOnPressOutside(event);
1891
+ (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
1892
+ };
1893
+ (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
1894
+ });
1895
+ React$1.useEffect(() => {
1896
+ if (!open || !enabled) return;
1897
+ dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
1898
+ dataRef.current.__outsidePressBubbles = outsidePressBubbles;
1899
+ let compositionTimeout = -1;
1900
+ function onScroll(event) {
1901
+ onOpenChange(false, event, "ancestor-scroll");
1902
+ }
1903
+ function handleCompositionStart() {
1904
+ window.clearTimeout(compositionTimeout);
1905
+ isComposingRef.current = true;
1906
+ }
1907
+ function handleCompositionEnd() {
1908
+ compositionTimeout = window.setTimeout(() => {
1909
+ isComposingRef.current = false;
1910
+ }, isWebKit() ? 5 : 0);
1911
+ }
1912
+ const doc = getDocument(elements.floating);
1913
+ if (escapeKey) {
1914
+ doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
1915
+ doc.addEventListener("compositionstart", handleCompositionStart);
1916
+ doc.addEventListener("compositionend", handleCompositionEnd);
1917
+ }
1918
+ outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
1919
+ let ancestors = [];
1920
+ if (ancestorScroll) {
1921
+ if (isElement(elements.domReference)) ancestors = getOverflowAncestors(elements.domReference);
1922
+ if (isElement(elements.floating)) ancestors = ancestors.concat(getOverflowAncestors(elements.floating));
1923
+ if (!isElement(elements.reference) && elements.reference && elements.reference.contextElement) ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement));
1924
+ }
1925
+ ancestors = ancestors.filter((ancestor) => {
1926
+ var _doc$defaultView;
1927
+ return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
1928
+ });
1929
+ ancestors.forEach((ancestor) => {
1930
+ ancestor.addEventListener("scroll", onScroll, { passive: true });
1931
+ });
1932
+ return () => {
1933
+ if (escapeKey) {
1934
+ doc.removeEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
1935
+ doc.removeEventListener("compositionstart", handleCompositionStart);
1936
+ doc.removeEventListener("compositionend", handleCompositionEnd);
1937
+ }
1938
+ outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
1939
+ ancestors.forEach((ancestor) => {
1940
+ ancestor.removeEventListener("scroll", onScroll);
1941
+ });
1942
+ window.clearTimeout(compositionTimeout);
1943
+ };
1944
+ }, [
1945
+ dataRef,
1946
+ elements,
1947
+ escapeKey,
1948
+ outsidePress,
1949
+ outsidePressEvent,
1950
+ open,
1951
+ onOpenChange,
1952
+ ancestorScroll,
1953
+ enabled,
1954
+ escapeKeyBubbles,
1955
+ outsidePressBubbles,
1956
+ closeOnEscapeKeyDown,
1957
+ escapeKeyCapture,
1958
+ closeOnEscapeKeyDownCapture,
1959
+ closeOnPressOutside,
1960
+ outsidePressCapture,
1961
+ closeOnPressOutsideCapture
1962
+ ]);
1963
+ React$1.useEffect(() => {
1964
+ dataRef.current.insideReactTree = false;
1965
+ }, [
1966
+ dataRef,
1967
+ outsidePress,
1968
+ outsidePressEvent
1969
+ ]);
1970
+ const reference = React$1.useMemo(() => ({
1971
+ onKeyDown: closeOnEscapeKeyDown,
1972
+ ...referencePress && {
1973
+ [bubbleHandlerKeys[referencePressEvent]]: (event) => {
1974
+ onOpenChange(false, event.nativeEvent, "reference-press");
1975
+ },
1976
+ ...referencePressEvent !== "click" && { onClick(event) {
1977
+ onOpenChange(false, event.nativeEvent, "reference-press");
1978
+ } }
1979
+ }
1980
+ }), [
1981
+ closeOnEscapeKeyDown,
1982
+ onOpenChange,
1983
+ referencePress,
1984
+ referencePressEvent
1985
+ ]);
1986
+ const floating = React$1.useMemo(() => ({
1987
+ onKeyDown: closeOnEscapeKeyDown,
1988
+ onMouseDown() {
1989
+ endedOrStartedInsideRef.current = true;
1990
+ },
1991
+ onMouseUp() {
1992
+ endedOrStartedInsideRef.current = true;
1993
+ },
1994
+ [captureHandlerKeys[outsidePressEvent]]: () => {
1995
+ dataRef.current.insideReactTree = true;
1996
+ }
1997
+ }), [
1998
+ closeOnEscapeKeyDown,
1999
+ outsidePressEvent,
2000
+ dataRef
2001
+ ]);
2002
+ return React$1.useMemo(() => enabled ? {
2003
+ reference,
2004
+ floating
2005
+ } : {}, [
2006
+ enabled,
2007
+ reference,
2008
+ floating
2009
+ ]);
2010
+ }
2011
+ function useFloatingRootContext(options) {
2012
+ const { open = false, onOpenChange: onOpenChangeProp, elements: elementsProp } = options;
2013
+ const floatingId = useId();
2014
+ const dataRef = React$1.useRef({});
2015
+ const [events] = React$1.useState(() => createEventEmitter());
2016
+ const nested = useFloatingParentNodeId() != null;
2017
+ {
2018
+ const optionDomReference = elementsProp.reference;
2019
+ if (optionDomReference && !isElement(optionDomReference)) error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2020
+ }
2021
+ const [positionReference, setPositionReference] = React$1.useState(elementsProp.reference);
2022
+ const onOpenChange = useEffectEvent((open$1, event, reason) => {
2023
+ dataRef.current.openEvent = open$1 ? event : void 0;
2024
+ events.emit("openchange", {
2025
+ open: open$1,
2026
+ event,
2027
+ reason,
2028
+ nested
2029
+ });
2030
+ onOpenChangeProp?.(open$1, event, reason);
2031
+ });
2032
+ const refs = React$1.useMemo(() => ({ setPositionReference }), []);
2033
+ const elements = React$1.useMemo(() => ({
2034
+ reference: positionReference || elementsProp.reference || null,
2035
+ floating: elementsProp.floating || null,
2036
+ domReference: elementsProp.reference
2037
+ }), [
2038
+ positionReference,
2039
+ elementsProp.reference,
2040
+ elementsProp.floating
2041
+ ]);
2042
+ return React$1.useMemo(() => ({
2043
+ dataRef,
2044
+ open,
2045
+ onOpenChange,
2046
+ elements,
2047
+ events,
2048
+ floatingId,
2049
+ refs
2050
+ }), [
2051
+ open,
2052
+ onOpenChange,
2053
+ elements,
2054
+ events,
2055
+ floatingId,
2056
+ refs
2057
+ ]);
2058
+ }
2059
+ /**
2060
+ * Provides data to position a floating element and context to add interactions.
2061
+ * @see https://floating-ui.com/docs/useFloating
2062
+ */
2063
+ function useFloating$1(options) {
2064
+ if (options === void 0) options = {};
2065
+ const { nodeId } = options;
2066
+ const internalRootContext = useFloatingRootContext({
2067
+ ...options,
2068
+ elements: {
2069
+ reference: null,
2070
+ floating: null,
2071
+ ...options.elements
2072
+ }
2073
+ });
2074
+ const rootContext = options.rootContext || internalRootContext;
2075
+ const computedElements = rootContext.elements;
2076
+ const [_domReference, setDomReference] = React$1.useState(null);
2077
+ const [positionReference, _setPositionReference] = React$1.useState(null);
2078
+ const domReference = (computedElements == null ? void 0 : computedElements.domReference) || _domReference;
2079
+ const domReferenceRef = React$1.useRef(null);
2080
+ const tree = useFloatingTree();
2081
+ index(() => {
2082
+ if (domReference) domReferenceRef.current = domReference;
2083
+ }, [domReference]);
2084
+ const position = useFloating({
2085
+ ...options,
2086
+ elements: {
2087
+ ...computedElements,
2088
+ ...positionReference && { reference: positionReference }
2089
+ }
2090
+ });
2091
+ const setPositionReference = React$1.useCallback((node) => {
2092
+ const computedPositionReference = isElement(node) ? {
2093
+ getBoundingClientRect: () => node.getBoundingClientRect(),
2094
+ getClientRects: () => node.getClientRects(),
2095
+ contextElement: node
2096
+ } : node;
2097
+ _setPositionReference(computedPositionReference);
2098
+ position.refs.setReference(computedPositionReference);
2099
+ }, [position.refs]);
2100
+ const setReference = React$1.useCallback((node) => {
2101
+ if (isElement(node) || node === null) {
2102
+ domReferenceRef.current = node;
2103
+ setDomReference(node);
2104
+ }
2105
+ if (isElement(position.refs.reference.current) || position.refs.reference.current === null || node !== null && !isElement(node)) position.refs.setReference(node);
2106
+ }, [position.refs]);
2107
+ const refs = React$1.useMemo(() => ({
2108
+ ...position.refs,
2109
+ setReference,
2110
+ setPositionReference,
2111
+ domReference: domReferenceRef
2112
+ }), [
2113
+ position.refs,
2114
+ setReference,
2115
+ setPositionReference
2116
+ ]);
2117
+ const elements = React$1.useMemo(() => ({
2118
+ ...position.elements,
2119
+ domReference
2120
+ }), [position.elements, domReference]);
2121
+ const context = React$1.useMemo(() => ({
2122
+ ...position,
2123
+ ...rootContext,
2124
+ refs,
2125
+ elements,
2126
+ nodeId
2127
+ }), [
2128
+ position,
2129
+ refs,
2130
+ elements,
2131
+ nodeId,
2132
+ rootContext
2133
+ ]);
2134
+ index(() => {
2135
+ rootContext.dataRef.current.floatingContext = context;
2136
+ const node = tree == null ? void 0 : tree.nodesRef.current.find((node$1) => node$1.id === nodeId);
2137
+ if (node) node.context = context;
2138
+ });
2139
+ return React$1.useMemo(() => ({
2140
+ ...position,
2141
+ context,
2142
+ refs,
2143
+ elements
2144
+ }), [
2145
+ position,
2146
+ refs,
2147
+ elements,
2148
+ context
2149
+ ]);
2150
+ }
2151
+ function isMacSafari() {
2152
+ return isMac() && isSafari();
2153
+ }
2154
+ /**
2155
+ * Opens the floating element while the reference element has focus, like CSS
2156
+ * `:focus`.
2157
+ * @see https://floating-ui.com/docs/useFocus
2158
+ */
2159
+ function useFocus(context, props) {
2160
+ if (props === void 0) props = {};
2161
+ const { open, onOpenChange, events, dataRef, elements } = context;
2162
+ const { enabled = true, visibleOnly = true } = props;
2163
+ const blockFocusRef = React$1.useRef(false);
2164
+ const timeoutRef = React$1.useRef(-1);
2165
+ const keyboardModalityRef = React$1.useRef(true);
2166
+ React$1.useEffect(() => {
2167
+ if (!enabled) return;
2168
+ const win = getWindow(elements.domReference);
2169
+ function onBlur() {
2170
+ if (!open && isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference))) blockFocusRef.current = true;
2171
+ }
2172
+ function onKeyDown() {
2173
+ keyboardModalityRef.current = true;
2174
+ }
2175
+ function onPointerDown() {
2176
+ keyboardModalityRef.current = false;
2177
+ }
2178
+ win.addEventListener("blur", onBlur);
2179
+ if (isMacSafari()) {
2180
+ win.addEventListener("keydown", onKeyDown, true);
2181
+ win.addEventListener("pointerdown", onPointerDown, true);
2182
+ }
2183
+ return () => {
2184
+ win.removeEventListener("blur", onBlur);
2185
+ if (isMacSafari()) {
2186
+ win.removeEventListener("keydown", onKeyDown, true);
2187
+ win.removeEventListener("pointerdown", onPointerDown, true);
2188
+ }
2189
+ };
2190
+ }, [
2191
+ elements.domReference,
2192
+ open,
2193
+ enabled
2194
+ ]);
2195
+ React$1.useEffect(() => {
2196
+ if (!enabled) return;
2197
+ function onOpenChange$1(_ref) {
2198
+ let { reason } = _ref;
2199
+ if (reason === "reference-press" || reason === "escape-key") blockFocusRef.current = true;
2200
+ }
2201
+ events.on("openchange", onOpenChange$1);
2202
+ return () => {
2203
+ events.off("openchange", onOpenChange$1);
2204
+ };
2205
+ }, [events, enabled]);
2206
+ React$1.useEffect(() => {
2207
+ return () => {
2208
+ clearTimeoutIfSet(timeoutRef);
2209
+ };
2210
+ }, []);
2211
+ const reference = React$1.useMemo(() => ({
2212
+ onMouseLeave() {
2213
+ blockFocusRef.current = false;
2214
+ },
2215
+ onFocus(event) {
2216
+ if (blockFocusRef.current) return;
2217
+ const target = getTarget(event.nativeEvent);
2218
+ if (visibleOnly && isElement(target)) {
2219
+ if (isMacSafari() && !event.relatedTarget) {
2220
+ if (!keyboardModalityRef.current && !isTypeableElement(target)) return;
2221
+ } else if (!matchesFocusVisible(target)) return;
2222
+ }
2223
+ onOpenChange(true, event.nativeEvent, "focus");
2224
+ },
2225
+ onBlur(event) {
2226
+ blockFocusRef.current = false;
2227
+ const relatedTarget = event.relatedTarget;
2228
+ const nativeEvent = event.nativeEvent;
2229
+ const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
2230
+ timeoutRef.current = window.setTimeout(() => {
2231
+ var _dataRef$current$floa;
2232
+ const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
2233
+ if (!relatedTarget && activeEl === elements.domReference) return;
2234
+ if (contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains(elements.domReference, activeEl) || movedToFocusGuard) return;
2235
+ onOpenChange(false, nativeEvent, "focus");
2236
+ });
2237
+ }
2238
+ }), [
2239
+ dataRef,
2240
+ elements.domReference,
2241
+ onOpenChange,
2242
+ visibleOnly
2243
+ ]);
2244
+ return React$1.useMemo(() => enabled ? { reference } : {}, [enabled, reference]);
2245
+ }
2246
+ function mergeProps(userProps, propsList, elementKey) {
2247
+ const map = /* @__PURE__ */ new Map();
2248
+ const isItem = elementKey === "item";
2249
+ let domUserProps = userProps;
2250
+ if (isItem && userProps) {
2251
+ const { [ACTIVE_KEY]: _, [SELECTED_KEY]: __,...validProps } = userProps;
2252
+ domUserProps = validProps;
2253
+ }
2254
+ return {
2255
+ ...elementKey === "floating" && {
2256
+ tabIndex: -1,
2257
+ [FOCUSABLE_ATTRIBUTE]: ""
2258
+ },
2259
+ ...domUserProps,
2260
+ ...propsList.map((value) => {
2261
+ const propsOrGetProps = value ? value[elementKey] : null;
2262
+ if (typeof propsOrGetProps === "function") return userProps ? propsOrGetProps(userProps) : null;
2263
+ return propsOrGetProps;
2264
+ }).concat(userProps).reduce((acc, props) => {
2265
+ if (!props) return acc;
2266
+ Object.entries(props).forEach((_ref) => {
2267
+ let [key, value] = _ref;
2268
+ if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) return;
2269
+ if (key.indexOf("on") === 0) {
2270
+ if (!map.has(key)) map.set(key, []);
2271
+ if (typeof value === "function") {
2272
+ var _map$get;
2273
+ (_map$get = map.get(key)) == null || _map$get.push(value);
2274
+ acc[key] = function() {
2275
+ var _map$get2;
2276
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
2277
+ return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn) => fn(...args)).find((val) => val !== void 0);
2278
+ };
2279
+ }
2280
+ } else acc[key] = value;
2281
+ });
2282
+ return acc;
2283
+ }, {})
2284
+ };
2285
+ }
2286
+ /**
2287
+ * Merges an array of interaction hooks' props into prop getters, allowing
2288
+ * event handler functions to be composed together without overwriting one
2289
+ * another.
2290
+ * @see https://floating-ui.com/docs/useInteractions
2291
+ */
2292
+ function useInteractions(propsList) {
2293
+ if (propsList === void 0) propsList = [];
2294
+ const referenceDeps = propsList.map((key) => key == null ? void 0 : key.reference);
2295
+ const floatingDeps = propsList.map((key) => key == null ? void 0 : key.floating);
2296
+ const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
2297
+ const getReferenceProps = React$1.useCallback((userProps) => mergeProps(userProps, propsList, "reference"), referenceDeps);
2298
+ const getFloatingProps = React$1.useCallback((userProps) => mergeProps(userProps, propsList, "floating"), floatingDeps);
2299
+ const getItemProps = React$1.useCallback((userProps) => mergeProps(userProps, propsList, "item"), itemDeps);
2300
+ return React$1.useMemo(() => ({
2301
+ getReferenceProps,
2302
+ getFloatingProps,
2303
+ getItemProps
2304
+ }), [
2305
+ getReferenceProps,
2306
+ getFloatingProps,
2307
+ getItemProps
2308
+ ]);
2309
+ }
2310
+ function doSwitch(orientation, vertical, horizontal) {
2311
+ switch (orientation) {
2312
+ case "vertical": return vertical;
2313
+ case "horizontal": return horizontal;
2314
+ default: return vertical || horizontal;
2315
+ }
2316
+ }
2317
+ function isMainOrientationKey(key, orientation) {
2318
+ return doSwitch(orientation, key === ARROW_UP || key === ARROW_DOWN, key === ARROW_LEFT || key === ARROW_RIGHT);
2319
+ }
2320
+ function isMainOrientationToEndKey(key, orientation, rtl) {
2321
+ return doSwitch(orientation, key === ARROW_DOWN, rtl ? key === ARROW_LEFT : key === ARROW_RIGHT) || key === "Enter" || key === " " || key === "";
2322
+ }
2323
+ function isCrossOrientationOpenKey(key, orientation, rtl) {
2324
+ return doSwitch(orientation, rtl ? key === ARROW_LEFT : key === ARROW_RIGHT, key === ARROW_DOWN);
2325
+ }
2326
+ function isCrossOrientationCloseKey(key, orientation, rtl, cols) {
2327
+ const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;
2328
+ const horizontal = key === ARROW_UP;
2329
+ if (orientation === "both" || orientation === "horizontal" && cols && cols > 1) return key === ESCAPE;
2330
+ return doSwitch(orientation, vertical, horizontal);
2331
+ }
2332
+ /**
2333
+ * Adds arrow key-based navigation of a list of items, either using real DOM
2334
+ * focus or virtual focus.
2335
+ * @see https://floating-ui.com/docs/useListNavigation
2336
+ */
2337
+ function useListNavigation(context, props) {
2338
+ const { open, onOpenChange, elements, floatingId } = context;
2339
+ const { listRef, activeIndex, onNavigate: unstable_onNavigate = () => {}, enabled = true, selectedIndex = null, allowEscape = false, loop = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = "auto", focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = void 0, orientation = "vertical", parentOrientation, cols = 1, scrollItemIntoView = true, virtualItemRef, itemSizes, dense = false } = props;
2340
+ if (allowEscape) {
2341
+ if (!loop) warn("`useListNavigation` looping must be enabled to allow escaping.");
2342
+ if (!virtual) warn("`useListNavigation` must be virtual to allow escaping.");
2343
+ }
2344
+ if (orientation === "vertical" && cols > 1) warn("In grid list navigation mode (`cols` > 1), the `orientation` should", "be either \"horizontal\" or \"both\".");
2345
+ const floatingFocusElementRef = useLatestRef(getFloatingFocusElement(elements.floating));
2346
+ const parentId = useFloatingParentNodeId();
2347
+ const tree = useFloatingTree();
2348
+ index(() => {
2349
+ context.dataRef.current.orientation = orientation;
2350
+ }, [context, orientation]);
2351
+ const onNavigate = useEffectEvent(() => {
2352
+ unstable_onNavigate(indexRef.current === -1 ? null : indexRef.current);
2353
+ });
2354
+ const typeableComboboxReference = isTypeableCombobox(elements.domReference);
2355
+ const focusItemOnOpenRef = React$1.useRef(focusItemOnOpen);
2356
+ const indexRef = React$1.useRef(selectedIndex != null ? selectedIndex : -1);
2357
+ const keyRef = React$1.useRef(null);
2358
+ const isPointerModalityRef = React$1.useRef(true);
2359
+ const previousOnNavigateRef = React$1.useRef(onNavigate);
2360
+ const previousMountedRef = React$1.useRef(!!elements.floating);
2361
+ const previousOpenRef = React$1.useRef(open);
2362
+ const forceSyncFocusRef = React$1.useRef(false);
2363
+ const forceScrollIntoViewRef = React$1.useRef(false);
2364
+ const disabledIndicesRef = useLatestRef(disabledIndices);
2365
+ const latestOpenRef = useLatestRef(open);
2366
+ const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView);
2367
+ const selectedIndexRef = useLatestRef(selectedIndex);
2368
+ const [activeId, setActiveId] = React$1.useState();
2369
+ const [virtualId, setVirtualId] = React$1.useState();
2370
+ const focusItem = useEffectEvent(() => {
2371
+ function runFocus(item$1) {
2372
+ if (virtual) {
2373
+ var _item$id;
2374
+ if ((_item$id = item$1.id) != null && _item$id.endsWith("-fui-option")) item$1.id = floatingId + "-" + Math.random().toString(16).slice(2, 10);
2375
+ setActiveId(item$1.id);
2376
+ tree?.events.emit("virtualfocus", item$1);
2377
+ if (virtualItemRef) virtualItemRef.current = item$1;
2378
+ } else enqueueFocus(item$1, {
2379
+ sync: forceSyncFocusRef.current,
2380
+ preventScroll: true
2381
+ });
2382
+ }
2383
+ const initialItem = listRef.current[indexRef.current];
2384
+ const forceScrollIntoView = forceScrollIntoViewRef.current;
2385
+ if (initialItem) runFocus(initialItem);
2386
+ (forceSyncFocusRef.current ? (v) => v() : requestAnimationFrame)(() => {
2387
+ const waitedItem = listRef.current[indexRef.current] || initialItem;
2388
+ if (!waitedItem) return;
2389
+ if (!initialItem) runFocus(waitedItem);
2390
+ const scrollIntoViewOptions = scrollItemIntoViewRef.current;
2391
+ if (scrollIntoViewOptions && item && (forceScrollIntoView || !isPointerModalityRef.current)) waitedItem.scrollIntoView == null || waitedItem.scrollIntoView(typeof scrollIntoViewOptions === "boolean" ? {
2392
+ block: "nearest",
2393
+ inline: "nearest"
2394
+ } : scrollIntoViewOptions);
2395
+ });
2396
+ });
2397
+ index(() => {
2398
+ if (!enabled) return;
2399
+ if (open && elements.floating) {
2400
+ if (focusItemOnOpenRef.current && selectedIndex != null) {
2401
+ forceScrollIntoViewRef.current = true;
2402
+ indexRef.current = selectedIndex;
2403
+ onNavigate();
2404
+ }
2405
+ } else if (previousMountedRef.current) {
2406
+ indexRef.current = -1;
2407
+ previousOnNavigateRef.current();
2408
+ }
2409
+ }, [
2410
+ enabled,
2411
+ open,
2412
+ elements.floating,
2413
+ selectedIndex,
2414
+ onNavigate
2415
+ ]);
2416
+ index(() => {
2417
+ if (!enabled) return;
2418
+ if (!open) return;
2419
+ if (!elements.floating) return;
2420
+ if (activeIndex == null) {
2421
+ forceSyncFocusRef.current = false;
2422
+ if (selectedIndexRef.current != null) return;
2423
+ if (previousMountedRef.current) {
2424
+ indexRef.current = -1;
2425
+ focusItem();
2426
+ }
2427
+ if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {
2428
+ let runs = 0;
2429
+ const waitForListPopulated = () => {
2430
+ if (listRef.current[0] == null) {
2431
+ if (runs < 2) (runs ? requestAnimationFrame : queueMicrotask)(waitForListPopulated);
2432
+ runs++;
2433
+ } else {
2434
+ indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef, disabledIndicesRef.current) : getMaxListIndex(listRef, disabledIndicesRef.current);
2435
+ keyRef.current = null;
2436
+ onNavigate();
2437
+ }
2438
+ };
2439
+ waitForListPopulated();
2440
+ }
2441
+ } else if (!isIndexOutOfListBounds(listRef, activeIndex)) {
2442
+ indexRef.current = activeIndex;
2443
+ focusItem();
2444
+ forceScrollIntoViewRef.current = false;
2445
+ }
2446
+ }, [
2447
+ enabled,
2448
+ open,
2449
+ elements.floating,
2450
+ activeIndex,
2451
+ selectedIndexRef,
2452
+ nested,
2453
+ listRef,
2454
+ orientation,
2455
+ rtl,
2456
+ onNavigate,
2457
+ focusItem,
2458
+ disabledIndicesRef
2459
+ ]);
2460
+ index(() => {
2461
+ var _nodes$find;
2462
+ if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) return;
2463
+ const nodes = tree.nodesRef.current;
2464
+ const parent = (_nodes$find = nodes.find((node) => node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating;
2465
+ const activeEl = activeElement(getDocument(elements.floating));
2466
+ const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl));
2467
+ if (parent && !treeContainsActiveEl && isPointerModalityRef.current) parent.focus({ preventScroll: true });
2468
+ }, [
2469
+ enabled,
2470
+ elements.floating,
2471
+ tree,
2472
+ parentId,
2473
+ virtual
2474
+ ]);
2475
+ index(() => {
2476
+ if (!enabled) return;
2477
+ if (!tree) return;
2478
+ if (!virtual) return;
2479
+ if (parentId) return;
2480
+ function handleVirtualFocus(item$1) {
2481
+ setVirtualId(item$1.id);
2482
+ if (virtualItemRef) virtualItemRef.current = item$1;
2483
+ }
2484
+ tree.events.on("virtualfocus", handleVirtualFocus);
2485
+ return () => {
2486
+ tree.events.off("virtualfocus", handleVirtualFocus);
2487
+ };
2488
+ }, [
2489
+ enabled,
2490
+ tree,
2491
+ virtual,
2492
+ parentId,
2493
+ virtualItemRef
2494
+ ]);
2495
+ index(() => {
2496
+ previousOnNavigateRef.current = onNavigate;
2497
+ previousOpenRef.current = open;
2498
+ previousMountedRef.current = !!elements.floating;
2499
+ });
2500
+ index(() => {
2501
+ if (!open) {
2502
+ keyRef.current = null;
2503
+ focusItemOnOpenRef.current = focusItemOnOpen;
2504
+ }
2505
+ }, [open, focusItemOnOpen]);
2506
+ const hasActiveIndex = activeIndex != null;
2507
+ const item = React$1.useMemo(() => {
2508
+ function syncCurrentTarget(currentTarget) {
2509
+ if (!latestOpenRef.current) return;
2510
+ const index$1 = listRef.current.indexOf(currentTarget);
2511
+ if (index$1 !== -1 && indexRef.current !== index$1) {
2512
+ indexRef.current = index$1;
2513
+ onNavigate();
2514
+ }
2515
+ }
2516
+ return {
2517
+ onFocus(_ref) {
2518
+ let { currentTarget } = _ref;
2519
+ forceSyncFocusRef.current = true;
2520
+ syncCurrentTarget(currentTarget);
2521
+ },
2522
+ onClick: (_ref2) => {
2523
+ let { currentTarget } = _ref2;
2524
+ return currentTarget.focus({ preventScroll: true });
2525
+ },
2526
+ onMouseMove(_ref3) {
2527
+ let { currentTarget } = _ref3;
2528
+ forceSyncFocusRef.current = true;
2529
+ forceScrollIntoViewRef.current = false;
2530
+ if (focusItemOnHover) syncCurrentTarget(currentTarget);
2531
+ },
2532
+ onPointerLeave(_ref4) {
2533
+ let { pointerType } = _ref4;
2534
+ if (!isPointerModalityRef.current || pointerType === "touch") return;
2535
+ forceSyncFocusRef.current = true;
2536
+ if (!focusItemOnHover) return;
2537
+ indexRef.current = -1;
2538
+ onNavigate();
2539
+ if (!virtual) {
2540
+ var _floatingFocusElement;
2541
+ (_floatingFocusElement = floatingFocusElementRef.current) == null || _floatingFocusElement.focus({ preventScroll: true });
2542
+ }
2543
+ }
2544
+ };
2545
+ }, [
2546
+ latestOpenRef,
2547
+ floatingFocusElementRef,
2548
+ focusItemOnHover,
2549
+ listRef,
2550
+ onNavigate,
2551
+ virtual
2552
+ ]);
2553
+ const getParentOrientation = React$1.useCallback(() => {
2554
+ var _tree$nodesRef$curren;
2555
+ return parentOrientation != null ? parentOrientation : tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node) => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.dataRef) == null ? void 0 : _tree$nodesRef$curren.current.orientation;
2556
+ }, [
2557
+ parentId,
2558
+ tree,
2559
+ parentOrientation
2560
+ ]);
2561
+ const commonOnKeyDown = useEffectEvent((event) => {
2562
+ isPointerModalityRef.current = false;
2563
+ forceSyncFocusRef.current = true;
2564
+ if (event.which === 229) return;
2565
+ if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) return;
2566
+ if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, cols)) {
2567
+ if (!isMainOrientationKey(event.key, getParentOrientation())) stopEvent(event);
2568
+ onOpenChange(false, event.nativeEvent, "list-navigation");
2569
+ if (isHTMLElement(elements.domReference)) if (virtual) tree?.events.emit("virtualfocus", elements.domReference);
2570
+ else elements.domReference.focus();
2571
+ return;
2572
+ }
2573
+ const currentIndex = indexRef.current;
2574
+ const minIndex = getMinListIndex(listRef, disabledIndices);
2575
+ const maxIndex = getMaxListIndex(listRef, disabledIndices);
2576
+ if (!typeableComboboxReference) {
2577
+ if (event.key === "Home") {
2578
+ stopEvent(event);
2579
+ indexRef.current = minIndex;
2580
+ onNavigate();
2581
+ }
2582
+ if (event.key === "End") {
2583
+ stopEvent(event);
2584
+ indexRef.current = maxIndex;
2585
+ onNavigate();
2586
+ }
2587
+ }
2588
+ if (cols > 1) {
2589
+ const sizes = itemSizes || Array.from({ length: listRef.current.length }, () => ({
2590
+ width: 1,
2591
+ height: 1
2592
+ }));
2593
+ const cellMap = createGridCellMap(sizes, cols, dense);
2594
+ const minGridIndex = cellMap.findIndex((index$2) => index$2 != null && !isListIndexDisabled(listRef, index$2, disabledIndices));
2595
+ const maxGridIndex = cellMap.reduce((foundIndex, index$2, cellIndex) => index$2 != null && !isListIndexDisabled(listRef, index$2, disabledIndices) ? cellIndex : foundIndex, -1);
2596
+ const index$1 = cellMap[getGridNavigatedIndex({ current: cellMap.map((itemIndex) => itemIndex != null ? listRef.current[itemIndex] : null) }, {
2597
+ event,
2598
+ orientation,
2599
+ loop,
2600
+ rtl,
2601
+ cols,
2602
+ disabledIndices: getGridCellIndices([...(typeof disabledIndices !== "function" ? disabledIndices : null) || listRef.current.map((_, index$2) => isListIndexDisabled(listRef, index$2, disabledIndices) ? index$2 : void 0), void 0], cellMap),
2603
+ minIndex: minGridIndex,
2604
+ maxIndex: maxGridIndex,
2605
+ prevIndex: getGridCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols, event.key === ARROW_DOWN ? "bl" : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? "tr" : "tl"),
2606
+ stopEvent: true
2607
+ })];
2608
+ if (index$1 != null) {
2609
+ indexRef.current = index$1;
2610
+ onNavigate();
2611
+ }
2612
+ if (orientation === "both") return;
2613
+ }
2614
+ if (isMainOrientationKey(event.key, orientation)) {
2615
+ stopEvent(event);
2616
+ if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {
2617
+ indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
2618
+ onNavigate();
2619
+ return;
2620
+ }
2621
+ if (isMainOrientationToEndKey(event.key, orientation, rtl)) if (loop) indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledListIndex(listRef, {
2622
+ startingIndex: currentIndex,
2623
+ disabledIndices
2624
+ });
2625
+ else indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef, {
2626
+ startingIndex: currentIndex,
2627
+ disabledIndices
2628
+ }));
2629
+ else if (loop) indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledListIndex(listRef, {
2630
+ startingIndex: currentIndex,
2631
+ decrement: true,
2632
+ disabledIndices
2633
+ });
2634
+ else indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef, {
2635
+ startingIndex: currentIndex,
2636
+ decrement: true,
2637
+ disabledIndices
2638
+ }));
2639
+ if (isIndexOutOfListBounds(listRef, indexRef.current)) indexRef.current = -1;
2640
+ onNavigate();
2641
+ }
2642
+ });
2643
+ const ariaActiveDescendantProp = React$1.useMemo(() => {
2644
+ return virtual && open && hasActiveIndex && { "aria-activedescendant": virtualId || activeId };
2645
+ }, [
2646
+ virtual,
2647
+ open,
2648
+ hasActiveIndex,
2649
+ virtualId,
2650
+ activeId
2651
+ ]);
2652
+ const floating = React$1.useMemo(() => {
2653
+ return {
2654
+ "aria-orientation": orientation === "both" ? void 0 : orientation,
2655
+ ...!typeableComboboxReference ? ariaActiveDescendantProp : {},
2656
+ onKeyDown: commonOnKeyDown,
2657
+ onPointerMove() {
2658
+ isPointerModalityRef.current = true;
2659
+ }
2660
+ };
2661
+ }, [
2662
+ ariaActiveDescendantProp,
2663
+ commonOnKeyDown,
2664
+ orientation,
2665
+ typeableComboboxReference
2666
+ ]);
2667
+ const reference = React$1.useMemo(() => {
2668
+ function checkVirtualMouse(event) {
2669
+ if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) focusItemOnOpenRef.current = true;
2670
+ }
2671
+ function checkVirtualPointer(event) {
2672
+ focusItemOnOpenRef.current = focusItemOnOpen;
2673
+ if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) focusItemOnOpenRef.current = true;
2674
+ }
2675
+ return {
2676
+ ...ariaActiveDescendantProp,
2677
+ onKeyDown(event) {
2678
+ isPointerModalityRef.current = false;
2679
+ const isArrowKey = event.key.startsWith("Arrow");
2680
+ const isHomeOrEndKey = ["Home", "End"].includes(event.key);
2681
+ const isMoveKey = isArrowKey || isHomeOrEndKey;
2682
+ const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);
2683
+ const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl, cols);
2684
+ const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);
2685
+ const isMainKey = isMainOrientationKey(event.key, orientation);
2686
+ const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === "";
2687
+ if (virtual && open) {
2688
+ const rootNode = tree == null ? void 0 : tree.nodesRef.current.find((node) => node.parentId == null);
2689
+ const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null;
2690
+ if (isMoveKey && deepestNode && virtualItemRef) {
2691
+ const eventObject = new KeyboardEvent("keydown", {
2692
+ key: event.key,
2693
+ bubbles: true
2694
+ });
2695
+ if (isCrossOpenKey || isCrossCloseKey) {
2696
+ var _deepestNode$context, _deepestNode$context2;
2697
+ const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget;
2698
+ const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find((item$1) => (item$1 == null ? void 0 : item$1.id) === activeId) : null;
2699
+ if (dispatchItem) {
2700
+ stopEvent(event);
2701
+ dispatchItem.dispatchEvent(eventObject);
2702
+ setVirtualId(void 0);
2703
+ }
2704
+ }
2705
+ if ((isMainKey || isHomeOrEndKey) && deepestNode.context) {
2706
+ if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) {
2707
+ var _deepestNode$context$;
2708
+ stopEvent(event);
2709
+ (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject);
2710
+ return;
2711
+ }
2712
+ }
2713
+ }
2714
+ return commonOnKeyDown(event);
2715
+ }
2716
+ if (!open && !openOnArrowKeyDown && isArrowKey) return;
2717
+ if (isNavigationKey) {
2718
+ const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());
2719
+ keyRef.current = nested && isParentMainKey ? null : event.key;
2720
+ }
2721
+ if (nested) {
2722
+ if (isParentCrossOpenKey) {
2723
+ stopEvent(event);
2724
+ if (open) {
2725
+ indexRef.current = getMinListIndex(listRef, disabledIndicesRef.current);
2726
+ onNavigate();
2727
+ } else onOpenChange(true, event.nativeEvent, "list-navigation");
2728
+ }
2729
+ return;
2730
+ }
2731
+ if (isMainKey) {
2732
+ if (selectedIndex != null) indexRef.current = selectedIndex;
2733
+ stopEvent(event);
2734
+ if (!open && openOnArrowKeyDown) onOpenChange(true, event.nativeEvent, "list-navigation");
2735
+ else commonOnKeyDown(event);
2736
+ if (open) onNavigate();
2737
+ }
2738
+ },
2739
+ onFocus() {
2740
+ if (open && !virtual) {
2741
+ indexRef.current = -1;
2742
+ onNavigate();
2743
+ }
2744
+ },
2745
+ onPointerDown: checkVirtualPointer,
2746
+ onPointerEnter: checkVirtualPointer,
2747
+ onMouseDown: checkVirtualMouse,
2748
+ onClick: checkVirtualMouse
2749
+ };
2750
+ }, [
2751
+ activeId,
2752
+ ariaActiveDescendantProp,
2753
+ cols,
2754
+ commonOnKeyDown,
2755
+ disabledIndicesRef,
2756
+ focusItemOnOpen,
2757
+ listRef,
2758
+ nested,
2759
+ onNavigate,
2760
+ onOpenChange,
2761
+ open,
2762
+ openOnArrowKeyDown,
2763
+ orientation,
2764
+ getParentOrientation,
2765
+ rtl,
2766
+ selectedIndex,
2767
+ tree,
2768
+ virtual,
2769
+ virtualItemRef
2770
+ ]);
2771
+ return React$1.useMemo(() => enabled ? {
2772
+ reference,
2773
+ floating,
2774
+ item
2775
+ } : {}, [
2776
+ enabled,
2777
+ reference,
2778
+ floating,
2779
+ item
2780
+ ]);
2781
+ }
2782
+ /**
2783
+ * Adds base screen reader props to the reference and floating elements for a
2784
+ * given floating element `role`.
2785
+ * @see https://floating-ui.com/docs/useRole
2786
+ */
2787
+ function useRole(context, props) {
2788
+ var _elements$domReferenc, _componentRoleToAriaR;
2789
+ if (props === void 0) props = {};
2790
+ const { open, elements, floatingId: defaultFloatingId } = context;
2791
+ const { enabled = true, role = "dialog" } = props;
2792
+ const defaultReferenceId = useId();
2793
+ const referenceId = ((_elements$domReferenc = elements.domReference) == null ? void 0 : _elements$domReferenc.id) || defaultReferenceId;
2794
+ const floatingId = React$1.useMemo(() => {
2795
+ var _getFloatingFocusElem;
2796
+ return ((_getFloatingFocusElem = getFloatingFocusElement(elements.floating)) == null ? void 0 : _getFloatingFocusElem.id) || defaultFloatingId;
2797
+ }, [elements.floating, defaultFloatingId]);
2798
+ const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;
2799
+ const isNested = useFloatingParentNodeId() != null;
2800
+ const reference = React$1.useMemo(() => {
2801
+ if (ariaRole === "tooltip" || role === "label") return { ["aria-" + (role === "label" ? "labelledby" : "describedby")]: open ? floatingId : void 0 };
2802
+ return {
2803
+ "aria-expanded": open ? "true" : "false",
2804
+ "aria-haspopup": ariaRole === "alertdialog" ? "dialog" : ariaRole,
2805
+ "aria-controls": open ? floatingId : void 0,
2806
+ ...ariaRole === "listbox" && { role: "combobox" },
2807
+ ...ariaRole === "menu" && { id: referenceId },
2808
+ ...ariaRole === "menu" && isNested && { role: "menuitem" },
2809
+ ...role === "select" && { "aria-autocomplete": "none" },
2810
+ ...role === "combobox" && { "aria-autocomplete": "list" }
2811
+ };
2812
+ }, [
2813
+ ariaRole,
2814
+ floatingId,
2815
+ isNested,
2816
+ open,
2817
+ referenceId,
2818
+ role
2819
+ ]);
2820
+ const floating = React$1.useMemo(() => {
2821
+ const floatingProps = {
2822
+ id: floatingId,
2823
+ ...ariaRole && { role: ariaRole }
2824
+ };
2825
+ if (ariaRole === "tooltip" || role === "label") return floatingProps;
2826
+ return {
2827
+ ...floatingProps,
2828
+ ...ariaRole === "menu" && { "aria-labelledby": referenceId }
2829
+ };
2830
+ }, [
2831
+ ariaRole,
2832
+ floatingId,
2833
+ referenceId,
2834
+ role
2835
+ ]);
2836
+ const item = React$1.useCallback((_ref) => {
2837
+ let { active, selected } = _ref;
2838
+ const commonProps = {
2839
+ role: "option",
2840
+ ...active && { id: floatingId + "-fui-option" }
2841
+ };
2842
+ switch (role) {
2843
+ case "select":
2844
+ case "combobox": return {
2845
+ ...commonProps,
2846
+ "aria-selected": selected
2847
+ };
2848
+ }
2849
+ return {};
2850
+ }, [floatingId, role]);
2851
+ return React$1.useMemo(() => enabled ? {
2852
+ reference,
2853
+ floating,
2854
+ item
2855
+ } : {}, [
2856
+ enabled,
2857
+ reference,
2858
+ floating,
2859
+ item
2860
+ ]);
2861
+ }
2862
+ function execWithArgsOrReturn(valueOrFn, args) {
2863
+ return typeof valueOrFn === "function" ? valueOrFn(args) : valueOrFn;
2864
+ }
2865
+ function useDelayUnmount(open, durationMs) {
2866
+ const [isMounted, setIsMounted] = React$1.useState(open);
2867
+ if (open && !isMounted) setIsMounted(true);
2868
+ React$1.useEffect(() => {
2869
+ if (!open && isMounted) {
2870
+ const timeout = setTimeout(() => setIsMounted(false), durationMs);
2871
+ return () => clearTimeout(timeout);
2872
+ }
2873
+ }, [
2874
+ open,
2875
+ isMounted,
2876
+ durationMs
2877
+ ]);
2878
+ return isMounted;
2879
+ }
2880
+ /**
2881
+ * Provides a status string to apply CSS transitions to a floating element,
2882
+ * correctly handling placement-aware transitions.
2883
+ * @see https://floating-ui.com/docs/useTransition#usetransitionstatus
2884
+ */
2885
+ function useTransitionStatus(context, props) {
2886
+ if (props === void 0) props = {};
2887
+ const { open, elements: { floating } } = context;
2888
+ const { duration = 250 } = props;
2889
+ const closeDuration = (typeof duration === "number" ? duration : duration.close) || 0;
2890
+ const [status, setStatus] = React$1.useState("unmounted");
2891
+ const isMounted = useDelayUnmount(open, closeDuration);
2892
+ if (!isMounted && status === "close") setStatus("unmounted");
2893
+ index(() => {
2894
+ if (!floating) return;
2895
+ if (open) {
2896
+ setStatus("initial");
2897
+ const frame = requestAnimationFrame(() => {
2898
+ ReactDOM$1.flushSync(() => {
2899
+ setStatus("open");
2900
+ });
2901
+ });
2902
+ return () => {
2903
+ cancelAnimationFrame(frame);
2904
+ };
2905
+ }
2906
+ setStatus("close");
2907
+ }, [open, floating]);
2908
+ return {
2909
+ isMounted,
2910
+ status
2911
+ };
2912
+ }
2913
+ /**
2914
+ * Provides styles to apply CSS transitions to a floating element, correctly
2915
+ * handling placement-aware transitions. Wrapper around `useTransitionStatus`.
2916
+ * @see https://floating-ui.com/docs/useTransition#usetransitionstyles
2917
+ */
2918
+ function useTransitionStyles(context, props) {
2919
+ if (props === void 0) props = {};
2920
+ const { initial: unstable_initial = { opacity: 0 }, open: unstable_open, close: unstable_close, common: unstable_common, duration = 250 } = props;
2921
+ const placement = context.placement;
2922
+ const side = placement.split("-")[0];
2923
+ const fnArgs = React$1.useMemo(() => ({
2924
+ side,
2925
+ placement
2926
+ }), [side, placement]);
2927
+ const isNumberDuration = typeof duration === "number";
2928
+ const openDuration = (isNumberDuration ? duration : duration.open) || 0;
2929
+ const closeDuration = (isNumberDuration ? duration : duration.close) || 0;
2930
+ const [styles, setStyles] = React$1.useState(() => ({
2931
+ ...execWithArgsOrReturn(unstable_common, fnArgs),
2932
+ ...execWithArgsOrReturn(unstable_initial, fnArgs)
2933
+ }));
2934
+ const { isMounted, status } = useTransitionStatus(context, { duration });
2935
+ const initialRef = useLatestRef(unstable_initial);
2936
+ const openRef = useLatestRef(unstable_open);
2937
+ const closeRef = useLatestRef(unstable_close);
2938
+ const commonRef = useLatestRef(unstable_common);
2939
+ index(() => {
2940
+ const initialStyles = execWithArgsOrReturn(initialRef.current, fnArgs);
2941
+ const closeStyles = execWithArgsOrReturn(closeRef.current, fnArgs);
2942
+ const commonStyles = execWithArgsOrReturn(commonRef.current, fnArgs);
2943
+ const openStyles = execWithArgsOrReturn(openRef.current, fnArgs) || Object.keys(initialStyles).reduce((acc, key) => {
2944
+ acc[key] = "";
2945
+ return acc;
2946
+ }, {});
2947
+ if (status === "initial") setStyles((styles$1) => ({
2948
+ transitionProperty: styles$1.transitionProperty,
2949
+ ...commonStyles,
2950
+ ...initialStyles
2951
+ }));
2952
+ if (status === "open") setStyles({
2953
+ transitionProperty: Object.keys(openStyles).map(camelCaseToKebabCase).join(","),
2954
+ transitionDuration: openDuration + "ms",
2955
+ ...commonStyles,
2956
+ ...openStyles
2957
+ });
2958
+ if (status === "close") {
2959
+ const styles$1 = closeStyles || initialStyles;
2960
+ setStyles({
2961
+ transitionProperty: Object.keys(styles$1).map(camelCaseToKebabCase).join(","),
2962
+ transitionDuration: closeDuration + "ms",
2963
+ ...commonStyles,
2964
+ ...styles$1
2965
+ });
2966
+ }
2967
+ }, [
2968
+ closeDuration,
2969
+ closeRef,
2970
+ initialRef,
2971
+ openRef,
2972
+ commonRef,
2973
+ openDuration,
2974
+ status,
2975
+ fnArgs
2976
+ ]);
2977
+ return {
2978
+ isMounted,
2979
+ styles
2980
+ };
2981
+ }
2982
+ /**
2983
+ * Provides a matching callback that can be used to focus an item as the user
2984
+ * types, often used in tandem with `useListNavigation()`.
2985
+ * @see https://floating-ui.com/docs/useTypeahead
2986
+ */
2987
+ function useTypeahead(context, props) {
2988
+ var _ref;
2989
+ const { open, dataRef } = context;
2990
+ const { listRef, activeIndex, onMatch: unstable_onMatch, onTypingChange: unstable_onTypingChange, enabled = true, findMatch = null, resetMs = 750, ignoreKeys = [], selectedIndex = null } = props;
2991
+ const timeoutIdRef = React$1.useRef(-1);
2992
+ const stringRef = React$1.useRef("");
2993
+ const prevIndexRef = React$1.useRef((_ref = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref : -1);
2994
+ const matchIndexRef = React$1.useRef(null);
2995
+ const onMatch = useEffectEvent(unstable_onMatch);
2996
+ const onTypingChange = useEffectEvent(unstable_onTypingChange);
2997
+ const findMatchRef = useLatestRef(findMatch);
2998
+ const ignoreKeysRef = useLatestRef(ignoreKeys);
2999
+ index(() => {
3000
+ if (open) {
3001
+ clearTimeoutIfSet(timeoutIdRef);
3002
+ matchIndexRef.current = null;
3003
+ stringRef.current = "";
3004
+ }
3005
+ }, [open]);
3006
+ index(() => {
3007
+ if (open && stringRef.current === "") {
3008
+ var _ref2;
3009
+ prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1;
3010
+ }
3011
+ }, [
3012
+ open,
3013
+ selectedIndex,
3014
+ activeIndex
3015
+ ]);
3016
+ const setTypingChange = useEffectEvent((value) => {
3017
+ if (value) {
3018
+ if (!dataRef.current.typing) {
3019
+ dataRef.current.typing = value;
3020
+ onTypingChange(value);
3021
+ }
3022
+ } else if (dataRef.current.typing) {
3023
+ dataRef.current.typing = value;
3024
+ onTypingChange(value);
3025
+ }
3026
+ });
3027
+ const onKeyDown = useEffectEvent((event) => {
3028
+ function getMatchingIndex(list, orderedList, string) {
3029
+ const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find((text) => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0);
3030
+ return str ? list.indexOf(str) : -1;
3031
+ }
3032
+ const listContent = listRef.current;
3033
+ if (stringRef.current.length > 0 && stringRef.current[0] !== " ") {
3034
+ if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) setTypingChange(false);
3035
+ else if (event.key === " ") stopEvent(event);
3036
+ }
3037
+ if (listContent == null || ignoreKeysRef.current.includes(event.key) || event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) return;
3038
+ if (open && event.key !== " ") {
3039
+ stopEvent(event);
3040
+ setTypingChange(true);
3041
+ }
3042
+ if (listContent.every((text) => {
3043
+ var _text$, _text$2;
3044
+ return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true;
3045
+ }) && stringRef.current === event.key) {
3046
+ stringRef.current = "";
3047
+ prevIndexRef.current = matchIndexRef.current;
3048
+ }
3049
+ stringRef.current += event.key;
3050
+ clearTimeoutIfSet(timeoutIdRef);
3051
+ timeoutIdRef.current = window.setTimeout(() => {
3052
+ stringRef.current = "";
3053
+ prevIndexRef.current = matchIndexRef.current;
3054
+ setTypingChange(false);
3055
+ }, resetMs);
3056
+ const prevIndex = prevIndexRef.current;
3057
+ const index$1 = getMatchingIndex(listContent, [...listContent.slice((prevIndex || 0) + 1), ...listContent.slice(0, (prevIndex || 0) + 1)], stringRef.current);
3058
+ if (index$1 !== -1) {
3059
+ onMatch(index$1);
3060
+ matchIndexRef.current = index$1;
3061
+ } else if (event.key !== " ") {
3062
+ stringRef.current = "";
3063
+ setTypingChange(false);
3064
+ }
3065
+ });
3066
+ const reference = React$1.useMemo(() => ({ onKeyDown }), [onKeyDown]);
3067
+ const floating = React$1.useMemo(() => {
3068
+ return {
3069
+ onKeyDown,
3070
+ onKeyUp(event) {
3071
+ if (event.key === " ") setTypingChange(false);
3072
+ }
3073
+ };
3074
+ }, [onKeyDown, setTypingChange]);
3075
+ return React$1.useMemo(() => enabled ? {
3076
+ reference,
3077
+ floating
3078
+ } : {}, [
3079
+ enabled,
3080
+ reference,
3081
+ floating
3082
+ ]);
3083
+ }
3084
+ function getArgsWithCustomFloatingHeight(state, height) {
3085
+ return {
3086
+ ...state,
3087
+ rects: {
3088
+ ...state.rects,
3089
+ floating: {
3090
+ ...state.rects.floating,
3091
+ height
3092
+ }
3093
+ }
3094
+ };
3095
+ }
3096
+ /**
3097
+ * Changes the `inner` middleware's `offset` upon a `wheel` event to
3098
+ * expand the floating element's height, revealing more list items.
3099
+ * @see https://floating-ui.com/docs/inner
3100
+ * @deprecated
3101
+ */
3102
+ function useInnerOffset(context, props) {
3103
+ const { open, elements } = context;
3104
+ const { enabled = true, overflowRef, scrollRef, onChange: unstable_onChange } = props;
3105
+ const onChange = useEffectEvent(unstable_onChange);
3106
+ const controlledScrollingRef = React$1.useRef(false);
3107
+ const prevScrollTopRef = React$1.useRef(null);
3108
+ const initialOverflowRef = React$1.useRef(null);
3109
+ React$1.useEffect(() => {
3110
+ if (!enabled) return;
3111
+ function onWheel(e) {
3112
+ if (e.ctrlKey || !el || overflowRef.current == null) return;
3113
+ const dY = e.deltaY;
3114
+ const isAtTop = overflowRef.current.top >= -.5;
3115
+ const isAtBottom = overflowRef.current.bottom >= -.5;
3116
+ const remainingScroll = el.scrollHeight - el.clientHeight;
3117
+ const sign = dY < 0 ? -1 : 1;
3118
+ const method = dY < 0 ? "max" : "min";
3119
+ if (el.scrollHeight <= el.clientHeight) return;
3120
+ if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) {
3121
+ e.preventDefault();
3122
+ ReactDOM$1.flushSync(() => {
3123
+ onChange((d) => d + Math[method](dY, remainingScroll * sign));
3124
+ });
3125
+ } else if (/firefox/i.test(getUserAgent())) el.scrollTop += dY;
3126
+ }
3127
+ const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;
3128
+ if (open && el) {
3129
+ el.addEventListener("wheel", onWheel);
3130
+ requestAnimationFrame(() => {
3131
+ prevScrollTopRef.current = el.scrollTop;
3132
+ if (overflowRef.current != null) initialOverflowRef.current = { ...overflowRef.current };
3133
+ });
3134
+ return () => {
3135
+ prevScrollTopRef.current = null;
3136
+ initialOverflowRef.current = null;
3137
+ el.removeEventListener("wheel", onWheel);
3138
+ };
3139
+ }
3140
+ }, [
3141
+ enabled,
3142
+ open,
3143
+ elements.floating,
3144
+ overflowRef,
3145
+ scrollRef,
3146
+ onChange
3147
+ ]);
3148
+ const floating = React$1.useMemo(() => ({
3149
+ onKeyDown() {
3150
+ controlledScrollingRef.current = true;
3151
+ },
3152
+ onWheel() {
3153
+ controlledScrollingRef.current = false;
3154
+ },
3155
+ onPointerMove() {
3156
+ controlledScrollingRef.current = false;
3157
+ },
3158
+ onScroll() {
3159
+ const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;
3160
+ if (!overflowRef.current || !el || !controlledScrollingRef.current) return;
3161
+ if (prevScrollTopRef.current !== null) {
3162
+ const scrollDiff = el.scrollTop - prevScrollTopRef.current;
3163
+ if (overflowRef.current.bottom < -.5 && scrollDiff < -1 || overflowRef.current.top < -.5 && scrollDiff > 1) ReactDOM$1.flushSync(() => onChange((d) => d + scrollDiff));
3164
+ }
3165
+ requestAnimationFrame(() => {
3166
+ prevScrollTopRef.current = el.scrollTop;
3167
+ });
3168
+ }
3169
+ }), [
3170
+ elements.floating,
3171
+ onChange,
3172
+ overflowRef,
3173
+ scrollRef
3174
+ ]);
3175
+ return React$1.useMemo(() => enabled ? { floating } : {}, [enabled, floating]);
3176
+ }
3177
+ function getNodeChildren$1(nodes, id, onlyOpenChildren) {
3178
+ if (onlyOpenChildren === void 0) onlyOpenChildren = true;
3179
+ return nodes.filter((node) => {
3180
+ var _node$context;
3181
+ return node.parentId === id && (!onlyOpenChildren || ((_node$context = node.context) == null ? void 0 : _node$context.open));
3182
+ }).flatMap((child) => [child, ...getNodeChildren$1(nodes, child.id, onlyOpenChildren)]);
3183
+ }
3184
+ function isPointInPolygon(point, polygon) {
3185
+ const [x, y] = point;
3186
+ let isInside$1 = false;
3187
+ const length = polygon.length;
3188
+ for (let i = 0, j = length - 1; i < length; j = i++) {
3189
+ const [xi, yi] = polygon[i] || [0, 0];
3190
+ const [xj, yj] = polygon[j] || [0, 0];
3191
+ if (yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi) isInside$1 = !isInside$1;
3192
+ }
3193
+ return isInside$1;
3194
+ }
3195
+ function isInside(point, rect) {
3196
+ return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;
3197
+ }
3198
+ /**
3199
+ * Generates a safe polygon area that the user can traverse without closing the
3200
+ * floating element once leaving the reference element.
3201
+ * @see https://floating-ui.com/docs/useHover#safepolygon
3202
+ */
3203
+ function safePolygon(options) {
3204
+ if (options === void 0) options = {};
3205
+ const { buffer = .5, blockPointerEvents = false, requireIntent = true } = options;
3206
+ const timeoutRef = { current: -1 };
3207
+ let hasLanded = false;
3208
+ let lastX = null;
3209
+ let lastY = null;
3210
+ let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0;
3211
+ function getCursorSpeed(x, y) {
3212
+ const currentTime = performance.now();
3213
+ const elapsedTime = currentTime - lastCursorTime;
3214
+ if (lastX === null || lastY === null || elapsedTime === 0) {
3215
+ lastX = x;
3216
+ lastY = y;
3217
+ lastCursorTime = currentTime;
3218
+ return null;
3219
+ }
3220
+ const deltaX = x - lastX;
3221
+ const deltaY = y - lastY;
3222
+ const speed = Math.sqrt(deltaX * deltaX + deltaY * deltaY) / elapsedTime;
3223
+ lastX = x;
3224
+ lastY = y;
3225
+ lastCursorTime = currentTime;
3226
+ return speed;
3227
+ }
3228
+ const fn = (_ref) => {
3229
+ let { x, y, placement, elements, onClose, nodeId, tree } = _ref;
3230
+ return function onMouseMove(event) {
3231
+ function close() {
3232
+ clearTimeoutIfSet(timeoutRef);
3233
+ onClose();
3234
+ }
3235
+ clearTimeoutIfSet(timeoutRef);
3236
+ if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) return;
3237
+ const { clientX, clientY } = event;
3238
+ const clientPoint = [clientX, clientY];
3239
+ const target = getTarget$1(event);
3240
+ const isLeave = event.type === "mouseleave";
3241
+ const isOverFloatingEl = contains$1(elements.floating, target);
3242
+ const isOverReferenceEl = contains$1(elements.domReference, target);
3243
+ const refRect = elements.domReference.getBoundingClientRect();
3244
+ const rect = elements.floating.getBoundingClientRect();
3245
+ const side = placement.split("-")[0];
3246
+ const cursorLeaveFromRight = x > rect.right - rect.width / 2;
3247
+ const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;
3248
+ const isOverReferenceRect = isInside(clientPoint, refRect);
3249
+ const isFloatingWider = rect.width > refRect.width;
3250
+ const isFloatingTaller = rect.height > refRect.height;
3251
+ const left = (isFloatingWider ? refRect : rect).left;
3252
+ const right = (isFloatingWider ? refRect : rect).right;
3253
+ const top = (isFloatingTaller ? refRect : rect).top;
3254
+ const bottom = (isFloatingTaller ? refRect : rect).bottom;
3255
+ if (isOverFloatingEl) {
3256
+ hasLanded = true;
3257
+ if (!isLeave) return;
3258
+ }
3259
+ if (isOverReferenceEl) hasLanded = false;
3260
+ if (isOverReferenceEl && !isLeave) {
3261
+ hasLanded = true;
3262
+ return;
3263
+ }
3264
+ if (isLeave && isElement(event.relatedTarget) && contains$1(elements.floating, event.relatedTarget)) return;
3265
+ if (tree && getNodeChildren$1(tree.nodesRef.current, nodeId).length) return;
3266
+ if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) return close();
3267
+ let rectPoly = [];
3268
+ switch (side) {
3269
+ case "top":
3270
+ rectPoly = [
3271
+ [left, refRect.top + 1],
3272
+ [left, rect.bottom - 1],
3273
+ [right, rect.bottom - 1],
3274
+ [right, refRect.top + 1]
3275
+ ];
3276
+ break;
3277
+ case "bottom":
3278
+ rectPoly = [
3279
+ [left, rect.top + 1],
3280
+ [left, refRect.bottom - 1],
3281
+ [right, refRect.bottom - 1],
3282
+ [right, rect.top + 1]
3283
+ ];
3284
+ break;
3285
+ case "left":
3286
+ rectPoly = [
3287
+ [rect.right - 1, bottom],
3288
+ [rect.right - 1, top],
3289
+ [refRect.left + 1, top],
3290
+ [refRect.left + 1, bottom]
3291
+ ];
3292
+ break;
3293
+ case "right":
3294
+ rectPoly = [
3295
+ [refRect.right - 1, bottom],
3296
+ [refRect.right - 1, top],
3297
+ [rect.left + 1, top],
3298
+ [rect.left + 1, bottom]
3299
+ ];
3300
+ break;
3301
+ }
3302
+ function getPolygon(_ref2) {
3303
+ let [x$1, y$1] = _ref2;
3304
+ switch (side) {
3305
+ case "top": return [
3306
+ [isFloatingWider ? x$1 + buffer / 2 : cursorLeaveFromRight ? x$1 + buffer * 4 : x$1 - buffer * 4, y$1 + buffer + 1],
3307
+ [isFloatingWider ? x$1 - buffer / 2 : cursorLeaveFromRight ? x$1 + buffer * 4 : x$1 - buffer * 4, y$1 + buffer + 1],
3308
+ ...[[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]]
3309
+ ];
3310
+ case "bottom": return [
3311
+ [isFloatingWider ? x$1 + buffer / 2 : cursorLeaveFromRight ? x$1 + buffer * 4 : x$1 - buffer * 4, y$1 - buffer],
3312
+ [isFloatingWider ? x$1 - buffer / 2 : cursorLeaveFromRight ? x$1 + buffer * 4 : x$1 - buffer * 4, y$1 - buffer],
3313
+ ...[[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]]
3314
+ ];
3315
+ case "left": {
3316
+ const cursorPointOne = [x$1 + buffer + 1, isFloatingTaller ? y$1 + buffer / 2 : cursorLeaveFromBottom ? y$1 + buffer * 4 : y$1 - buffer * 4];
3317
+ const cursorPointTwo = [x$1 + buffer + 1, isFloatingTaller ? y$1 - buffer / 2 : cursorLeaveFromBottom ? y$1 + buffer * 4 : y$1 - buffer * 4];
3318
+ return [
3319
+ ...[[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]],
3320
+ cursorPointOne,
3321
+ cursorPointTwo
3322
+ ];
3323
+ }
3324
+ case "right": return [
3325
+ [x$1 - buffer, isFloatingTaller ? y$1 + buffer / 2 : cursorLeaveFromBottom ? y$1 + buffer * 4 : y$1 - buffer * 4],
3326
+ [x$1 - buffer, isFloatingTaller ? y$1 - buffer / 2 : cursorLeaveFromBottom ? y$1 + buffer * 4 : y$1 - buffer * 4],
3327
+ ...[[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]]
3328
+ ];
3329
+ }
3330
+ }
3331
+ if (isPointInPolygon([clientX, clientY], rectPoly)) return;
3332
+ if (hasLanded && !isOverReferenceRect) return close();
3333
+ if (!isLeave && requireIntent) {
3334
+ const cursorSpeed = getCursorSpeed(event.clientX, event.clientY);
3335
+ if (cursorSpeed !== null && cursorSpeed < .1) return close();
3336
+ }
3337
+ if (!isPointInPolygon([clientX, clientY], getPolygon([x, y]))) close();
3338
+ else if (!hasLanded && requireIntent) timeoutRef.current = window.setTimeout(close, 40);
3339
+ };
3340
+ };
3341
+ fn.__options = { blockPointerEvents };
3342
+ return fn;
3343
+ }
3344
+ var FloatingListContext, FOCUSABLE_ATTRIBUTE, ACTIVE_KEY, SELECTED_KEY, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, ARROW_DOWN, CompositeContext, horizontalKeys, verticalKeys, allKeys, Composite, CompositeItem, SafeReact, serverHandoffComplete, count, genId, useId, devMessageSet, FloatingArrow, FloatingNodeContext, FloatingTreeContext, useFloatingParentNodeId, useFloatingTree, safePolygonIdentifier, NOOP, FloatingDelayGroupContext, useDelayGroupContext, NextFloatingDelayGroupContext, rafId, counters, uncontrolledElementsSet, markerMap, lockCount$1, supportsInert, unwrapHost, correctElements, HIDDEN_STYLES, FocusGuard, PortalContext, attr, usePortalContext, LIST_LIMIT, previouslyFocusedElements, VisuallyHiddenDismiss, lockCount, scrollbarProperty, cleanup, FloatingOverlay, bubbleHandlerKeys, captureHandlerKeys, normalizeProp, ESCAPE, componentRoleToAriaRoleMap, camelCaseToKebabCase, inner;
3345
+ var init_floating_ui_react_esm = __esm({ "../../node_modules/.pnpm/@floating-ui+react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js": (() => {
3346
+ init_floating_ui_react_utils();
3347
+ init_floating_ui_utils_dom();
3348
+ init_index_esm();
3349
+ init_floating_ui_react_dom();
3350
+ init_floating_ui_utils();
3351
+ FloatingListContext = /* @__PURE__ */ React$1.createContext({
3352
+ register: () => {},
3353
+ unregister: () => {},
3354
+ map: /* @__PURE__ */ new Map(),
3355
+ elementsRef: { current: [] }
3356
+ });
3357
+ FOCUSABLE_ATTRIBUTE = "data-floating-ui-focusable";
3358
+ ACTIVE_KEY = "active";
3359
+ SELECTED_KEY = "selected";
3360
+ ARROW_LEFT = "ArrowLeft";
3361
+ ARROW_RIGHT = "ArrowRight";
3362
+ ARROW_UP = "ArrowUp";
3363
+ ARROW_DOWN = "ArrowDown";
3364
+ CompositeContext = /* @__PURE__ */ React$1.createContext({
3365
+ activeIndex: 0,
3366
+ onNavigate: () => {}
3367
+ });
3368
+ horizontalKeys = [ARROW_LEFT, ARROW_RIGHT];
3369
+ verticalKeys = [ARROW_UP, ARROW_DOWN];
3370
+ allKeys = [...horizontalKeys, ...verticalKeys];
3371
+ Composite = /* @__PURE__ */ React$1.forwardRef(function Composite$1(props, forwardedRef) {
3372
+ const { render, orientation = "both", loop = true, rtl = false, cols = 1, disabledIndices, activeIndex: externalActiveIndex, onNavigate: externalSetActiveIndex, itemSizes, dense = false,...domProps } = props;
3373
+ const [internalActiveIndex, internalSetActiveIndex] = React$1.useState(0);
3374
+ const activeIndex = externalActiveIndex != null ? externalActiveIndex : internalActiveIndex;
3375
+ const onNavigate = useEffectEvent(externalSetActiveIndex != null ? externalSetActiveIndex : internalSetActiveIndex);
3376
+ const elementsRef = React$1.useRef([]);
3377
+ const renderElementProps = render && typeof render !== "function" ? render.props : {};
3378
+ const contextValue = React$1.useMemo(() => ({
3379
+ activeIndex,
3380
+ onNavigate
3381
+ }), [activeIndex, onNavigate]);
3382
+ const isGrid = cols > 1;
3383
+ function handleKeyDown(event) {
3384
+ if (!allKeys.includes(event.key)) return;
3385
+ let nextIndex = activeIndex;
3386
+ const minIndex = getMinListIndex(elementsRef, disabledIndices);
3387
+ const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
3388
+ const horizontalEndKey = rtl ? ARROW_LEFT : ARROW_RIGHT;
3389
+ const horizontalStartKey = rtl ? ARROW_RIGHT : ARROW_LEFT;
3390
+ if (isGrid) {
3391
+ const sizes = itemSizes || Array.from({ length: elementsRef.current.length }, () => ({
3392
+ width: 1,
3393
+ height: 1
3394
+ }));
3395
+ const cellMap = createGridCellMap(sizes, cols, dense);
3396
+ const minGridIndex = cellMap.findIndex((index$1) => index$1 != null && !isListIndexDisabled(elementsRef, index$1, disabledIndices));
3397
+ const maxGridIndex = cellMap.reduce((foundIndex, index$1, cellIndex) => index$1 != null && !isListIndexDisabled(elementsRef, index$1, disabledIndices) ? cellIndex : foundIndex, -1);
3398
+ const maybeNextIndex = cellMap[getGridNavigatedIndex({ current: cellMap.map((itemIndex) => itemIndex ? elementsRef.current[itemIndex] : null) }, {
3399
+ event,
3400
+ orientation,
3401
+ loop,
3402
+ rtl,
3403
+ cols,
3404
+ disabledIndices: getGridCellIndices([...(typeof disabledIndices !== "function" ? disabledIndices : null) || elementsRef.current.map((_, index$1) => isListIndexDisabled(elementsRef, index$1, disabledIndices) ? index$1 : void 0), void 0], cellMap),
3405
+ minIndex: minGridIndex,
3406
+ maxIndex: maxGridIndex,
3407
+ prevIndex: getGridCellIndexOfCorner(activeIndex > maxIndex ? minIndex : activeIndex, sizes, cellMap, cols, event.key === ARROW_DOWN ? "bl" : event.key === horizontalEndKey ? "tr" : "tl")
3408
+ })];
3409
+ if (maybeNextIndex != null) nextIndex = maybeNextIndex;
3410
+ }
3411
+ const toEndKeys = {
3412
+ horizontal: [horizontalEndKey],
3413
+ vertical: [ARROW_DOWN],
3414
+ both: [horizontalEndKey, ARROW_DOWN]
3415
+ }[orientation];
3416
+ const toStartKeys = {
3417
+ horizontal: [horizontalStartKey],
3418
+ vertical: [ARROW_UP],
3419
+ both: [horizontalStartKey, ARROW_UP]
3420
+ }[orientation];
3421
+ const preventedKeys = isGrid ? allKeys : {
3422
+ horizontal: horizontalKeys,
3423
+ vertical: verticalKeys,
3424
+ both: allKeys
3425
+ }[orientation];
3426
+ if (nextIndex === activeIndex && [...toEndKeys, ...toStartKeys].includes(event.key)) if (loop && nextIndex === maxIndex && toEndKeys.includes(event.key)) nextIndex = minIndex;
3427
+ else if (loop && nextIndex === minIndex && toStartKeys.includes(event.key)) nextIndex = maxIndex;
3428
+ else nextIndex = findNonDisabledListIndex(elementsRef, {
3429
+ startingIndex: nextIndex,
3430
+ decrement: toStartKeys.includes(event.key),
3431
+ disabledIndices
3432
+ });
3433
+ if (nextIndex !== activeIndex && !isIndexOutOfListBounds(elementsRef, nextIndex)) {
3434
+ var _elementsRef$current$;
3435
+ event.stopPropagation();
3436
+ if (preventedKeys.includes(event.key)) event.preventDefault();
3437
+ onNavigate(nextIndex);
3438
+ (_elementsRef$current$ = elementsRef.current[nextIndex]) == null || _elementsRef$current$.focus();
3439
+ }
3440
+ }
3441
+ const computedProps = {
3442
+ ...domProps,
3443
+ ...renderElementProps,
3444
+ ref: forwardedRef,
3445
+ "aria-orientation": orientation === "both" ? void 0 : orientation,
3446
+ onKeyDown(e) {
3447
+ domProps.onKeyDown == null || domProps.onKeyDown(e);
3448
+ renderElementProps.onKeyDown == null || renderElementProps.onKeyDown(e);
3449
+ handleKeyDown(e);
3450
+ }
3451
+ };
3452
+ return /* @__PURE__ */ jsx(CompositeContext.Provider, {
3453
+ value: contextValue,
3454
+ children: /* @__PURE__ */ jsx(FloatingList, {
3455
+ elementsRef,
3456
+ children: renderJsx(render, computedProps)
3457
+ })
3458
+ });
3459
+ });
3460
+ CompositeItem = /* @__PURE__ */ React$1.forwardRef(function CompositeItem$1(props, forwardedRef) {
3461
+ const { render,...domProps } = props;
3462
+ const renderElementProps = render && typeof render !== "function" ? render.props : {};
3463
+ const { activeIndex, onNavigate } = React$1.useContext(CompositeContext);
3464
+ const { ref, index: index$1 } = useListItem();
3465
+ const mergedRef = useMergeRefs([
3466
+ ref,
3467
+ forwardedRef,
3468
+ renderElementProps.ref
3469
+ ]);
3470
+ const isActive = activeIndex === index$1;
3471
+ return renderJsx(render, {
3472
+ ...domProps,
3473
+ ...renderElementProps,
3474
+ ref: mergedRef,
3475
+ tabIndex: isActive ? 0 : -1,
3476
+ "data-active": isActive ? "" : void 0,
3477
+ onFocus(e) {
3478
+ domProps.onFocus == null || domProps.onFocus(e);
3479
+ renderElementProps.onFocus == null || renderElementProps.onFocus(e);
3480
+ onNavigate(index$1);
3481
+ }
3482
+ });
3483
+ });
3484
+ SafeReact = { ...React$1 };
3485
+ serverHandoffComplete = false;
3486
+ count = 0;
3487
+ genId = () => "floating-ui-" + Math.random().toString(36).slice(2, 6) + count++;
3488
+ useId = SafeReact.useId || useFloatingId;
3489
+ ;
3490
+ devMessageSet = /* @__PURE__ */ new Set();
3491
+ FloatingArrow = /* @__PURE__ */ React$1.forwardRef(function FloatingArrow$1(props, ref) {
3492
+ const { context: { placement, elements: { floating }, middlewareData: { arrow: arrow$1, shift: shift$1 } }, width = 14, height = 7, tipRadius = 0, strokeWidth = 0, staticOffset, stroke, d, style: { transform,...restStyle } = {},...rest } = props;
3493
+ if (!ref) warn("The `ref` prop is required for `FloatingArrow`.");
3494
+ const clipPathId = useId();
3495
+ const [isRTL, setIsRTL] = React$1.useState(false);
3496
+ index(() => {
3497
+ if (!floating) return;
3498
+ if (getComputedStyle(floating).direction === "rtl") setIsRTL(true);
3499
+ }, [floating]);
3500
+ if (!floating) return null;
3501
+ const [side, alignment] = placement.split("-");
3502
+ const isVerticalSide = side === "top" || side === "bottom";
3503
+ let computedStaticOffset = staticOffset;
3504
+ if (isVerticalSide && shift$1 != null && shift$1.x || !isVerticalSide && shift$1 != null && shift$1.y) computedStaticOffset = null;
3505
+ const computedStrokeWidth = strokeWidth * 2;
3506
+ const halfStrokeWidth = computedStrokeWidth / 2;
3507
+ const svgX = width / 2 * (tipRadius / -8 + 1);
3508
+ const svgY = height / 2 * tipRadius / 4;
3509
+ const isCustomShape = !!d;
3510
+ const yOffsetProp = computedStaticOffset && alignment === "end" ? "bottom" : "top";
3511
+ let xOffsetProp = computedStaticOffset && alignment === "end" ? "right" : "left";
3512
+ if (computedStaticOffset && isRTL) xOffsetProp = alignment === "end" ? "left" : "right";
3513
+ const arrowX = (arrow$1 == null ? void 0 : arrow$1.x) != null ? computedStaticOffset || arrow$1.x : "";
3514
+ const arrowY = (arrow$1 == null ? void 0 : arrow$1.y) != null ? computedStaticOffset || arrow$1.y : "";
3515
+ const dValue = d || "M0,0" + (" H" + width) + (" L" + (width - svgX) + "," + (height - svgY)) + (" Q" + width / 2 + "," + height + " " + svgX + "," + (height - svgY)) + " Z";
3516
+ const rotation = {
3517
+ top: isCustomShape ? "rotate(180deg)" : "",
3518
+ left: isCustomShape ? "rotate(90deg)" : "rotate(-90deg)",
3519
+ bottom: isCustomShape ? "" : "rotate(180deg)",
3520
+ right: isCustomShape ? "rotate(-90deg)" : "rotate(90deg)"
3521
+ }[side];
3522
+ return /* @__PURE__ */ jsxs("svg", {
3523
+ ...rest,
3524
+ "aria-hidden": true,
3525
+ ref,
3526
+ width: isCustomShape ? width : width + computedStrokeWidth,
3527
+ height: width,
3528
+ viewBox: "0 0 " + width + " " + (height > width ? height : width),
3529
+ style: {
3530
+ position: "absolute",
3531
+ pointerEvents: "none",
3532
+ [xOffsetProp]: arrowX,
3533
+ [yOffsetProp]: arrowY,
3534
+ [side]: isVerticalSide || isCustomShape ? "100%" : "calc(100% - " + computedStrokeWidth / 2 + "px)",
3535
+ transform: [rotation, transform].filter((t) => !!t).join(" "),
3536
+ ...restStyle
3537
+ },
3538
+ children: [
3539
+ computedStrokeWidth > 0 && /* @__PURE__ */ jsx("path", {
3540
+ clipPath: "url(#" + clipPathId + ")",
3541
+ fill: "none",
3542
+ stroke,
3543
+ strokeWidth: computedStrokeWidth + (d ? 0 : 1),
3544
+ d: dValue
3545
+ }),
3546
+ /* @__PURE__ */ jsx("path", {
3547
+ stroke: computedStrokeWidth && !d ? rest.fill : "none",
3548
+ d: dValue
3549
+ }),
3550
+ /* @__PURE__ */ jsx("clipPath", {
3551
+ id: clipPathId,
3552
+ children: /* @__PURE__ */ jsx("rect", {
3553
+ x: -halfStrokeWidth,
3554
+ y: halfStrokeWidth * (isCustomShape ? -1 : 1),
3555
+ width: width + computedStrokeWidth,
3556
+ height: width
3557
+ })
3558
+ })
3559
+ ]
3560
+ });
3561
+ });
3562
+ FloatingNodeContext = /* @__PURE__ */ React$1.createContext(null);
3563
+ FloatingTreeContext = /* @__PURE__ */ React$1.createContext(null);
3564
+ useFloatingParentNodeId = () => {
3565
+ var _React$useContext;
3566
+ return ((_React$useContext = React$1.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
3567
+ };
3568
+ useFloatingTree = () => React$1.useContext(FloatingTreeContext);
3569
+ safePolygonIdentifier = /* @__PURE__ */ createAttribute("safe-polygon");
3570
+ NOOP = () => {};
3571
+ FloatingDelayGroupContext = /* @__PURE__ */ React$1.createContext({
3572
+ delay: 0,
3573
+ initialDelay: 0,
3574
+ timeoutMs: 0,
3575
+ currentId: null,
3576
+ setCurrentId: NOOP,
3577
+ setState: NOOP,
3578
+ isInstantPhase: false
3579
+ });
3580
+ useDelayGroupContext = () => React$1.useContext(FloatingDelayGroupContext);
3581
+ NextFloatingDelayGroupContext = /* @__PURE__ */ React$1.createContext({
3582
+ hasProvider: false,
3583
+ timeoutMs: 0,
3584
+ delayRef: { current: 0 },
3585
+ initialDelayRef: { current: 0 },
3586
+ timeoutIdRef: { current: -1 },
3587
+ currentIdRef: { current: null },
3588
+ currentContextRef: { current: null }
3589
+ });
3590
+ rafId = 0;
3591
+ counters = {
3592
+ inert: /* @__PURE__ */ new WeakMap(),
3593
+ "aria-hidden": /* @__PURE__ */ new WeakMap(),
3594
+ none: /* @__PURE__ */ new WeakMap()
3595
+ };
3596
+ uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
3597
+ markerMap = {};
3598
+ lockCount$1 = 0;
3599
+ supportsInert = () => typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype;
3600
+ unwrapHost = (node) => node && (node.host || unwrapHost(node.parentNode));
3601
+ correctElements = (parent, targets) => targets.map((target) => {
3602
+ if (parent.contains(target)) return target;
3603
+ const correctedTarget = unwrapHost(target);
3604
+ if (parent.contains(correctedTarget)) return correctedTarget;
3605
+ return null;
3606
+ }).filter((x) => x != null);
3607
+ HIDDEN_STYLES = {
3608
+ border: 0,
3609
+ clip: "rect(0 0 0 0)",
3610
+ height: "1px",
3611
+ margin: "-1px",
3612
+ overflow: "hidden",
3613
+ padding: 0,
3614
+ position: "fixed",
3615
+ whiteSpace: "nowrap",
3616
+ width: "1px",
3617
+ top: 0,
3618
+ left: 0
3619
+ };
3620
+ FocusGuard = /* @__PURE__ */ React$1.forwardRef(function FocusGuard$1(props, ref) {
3621
+ const [role, setRole] = React$1.useState();
3622
+ index(() => {
3623
+ if (isSafari()) setRole("button");
3624
+ }, []);
3625
+ const restProps = {
3626
+ ref,
3627
+ tabIndex: 0,
3628
+ role,
3629
+ "aria-hidden": role ? void 0 : true,
3630
+ [createAttribute("focus-guard")]: "",
3631
+ style: HIDDEN_STYLES
3632
+ };
3633
+ return /* @__PURE__ */ jsx("span", {
3634
+ ...props,
3635
+ ...restProps
3636
+ });
3637
+ });
3638
+ PortalContext = /* @__PURE__ */ React$1.createContext(null);
3639
+ attr = /* @__PURE__ */ createAttribute("portal");
3640
+ usePortalContext = () => React$1.useContext(PortalContext);
3641
+ LIST_LIMIT = 20;
3642
+ previouslyFocusedElements = [];
3643
+ VisuallyHiddenDismiss = /* @__PURE__ */ React$1.forwardRef(function VisuallyHiddenDismiss$1(props, ref) {
3644
+ return /* @__PURE__ */ jsx("button", {
3645
+ ...props,
3646
+ type: "button",
3647
+ ref,
3648
+ tabIndex: -1,
3649
+ style: HIDDEN_STYLES
3650
+ });
3651
+ });
3652
+ lockCount = 0;
3653
+ scrollbarProperty = "--floating-ui-scrollbar-width";
3654
+ cleanup = () => {};
3655
+ FloatingOverlay = /* @__PURE__ */ React$1.forwardRef(function FloatingOverlay$1(props, ref) {
3656
+ const { lockScroll = false,...rest } = props;
3657
+ index(() => {
3658
+ if (!lockScroll) return;
3659
+ lockCount++;
3660
+ if (lockCount === 1) cleanup = enableScrollLock();
3661
+ return () => {
3662
+ lockCount--;
3663
+ if (lockCount === 0) cleanup();
3664
+ };
3665
+ }, [lockScroll]);
3666
+ return /* @__PURE__ */ jsx("div", {
3667
+ ref,
3668
+ ...rest,
3669
+ style: {
3670
+ position: "fixed",
3671
+ overflow: "auto",
3672
+ top: 0,
3673
+ right: 0,
3674
+ bottom: 0,
3675
+ left: 0,
3676
+ ...rest.style
3677
+ }
3678
+ });
3679
+ });
3680
+ bubbleHandlerKeys = {
3681
+ pointerdown: "onPointerDown",
3682
+ mousedown: "onMouseDown",
3683
+ click: "onClick"
3684
+ };
3685
+ captureHandlerKeys = {
3686
+ pointerdown: "onPointerDownCapture",
3687
+ mousedown: "onMouseDownCapture",
3688
+ click: "onClickCapture"
3689
+ };
3690
+ normalizeProp = (normalizable) => {
3691
+ var _normalizable$escapeK, _normalizable$outside;
3692
+ return {
3693
+ escapeKey: typeof normalizable === "boolean" ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
3694
+ outsidePress: typeof normalizable === "boolean" ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
3695
+ };
3696
+ };
3697
+ ESCAPE = "Escape";
3698
+ componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([
3699
+ ["select", "listbox"],
3700
+ ["combobox", "listbox"],
3701
+ ["label", false]
3702
+ ]);
3703
+ camelCaseToKebabCase = (str) => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
3704
+ inner = (props) => ({
3705
+ name: "inner",
3706
+ options: props,
3707
+ async fn(state) {
3708
+ const { listRef, overflowRef, onFallbackChange, offset: innerOffset = 0, index: index$1 = 0, minItemsVisible = 4, referenceOverflowThreshold = 0, scrollRef,...detectOverflowOptions } = evaluate(props, state);
3709
+ const { rects, elements: { floating } } = state;
3710
+ const item = listRef.current[index$1];
3711
+ const scrollEl = (scrollRef == null ? void 0 : scrollRef.current) || floating;
3712
+ const clientTop = floating.clientTop || scrollEl.clientTop;
3713
+ const floatingIsBordered = floating.clientTop !== 0;
3714
+ const scrollElIsBordered = scrollEl.clientTop !== 0;
3715
+ const floatingIsScrollEl = floating === scrollEl;
3716
+ if (!state.placement.startsWith("bottom")) warn("`placement` side must be \"bottom\" when using the `inner`", "middleware.");
3717
+ if (!item) return {};
3718
+ const nextArgs = {
3719
+ ...state,
3720
+ ...await offset(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state)
3721
+ };
3722
+ const overflow = await detectOverflow(getArgsWithCustomFloatingHeight(nextArgs, scrollEl.scrollHeight + clientTop + floating.clientTop), detectOverflowOptions);
3723
+ const refOverflow = await detectOverflow(nextArgs, {
3724
+ ...detectOverflowOptions,
3725
+ elementContext: "reference"
3726
+ });
3727
+ const diffY = max(0, overflow.top);
3728
+ const nextY = nextArgs.y + diffY;
3729
+ const maxHeight = (scrollEl.scrollHeight > scrollEl.clientHeight ? (v) => v : round)(max(0, scrollEl.scrollHeight + (floatingIsBordered && floatingIsScrollEl || scrollElIsBordered ? clientTop * 2 : 0) - diffY - max(0, overflow.bottom)));
3730
+ scrollEl.style.maxHeight = maxHeight + "px";
3731
+ scrollEl.scrollTop = diffY;
3732
+ if (onFallbackChange) {
3733
+ const shouldFallback = scrollEl.offsetHeight < item.offsetHeight * min(minItemsVisible, listRef.current.length) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold;
3734
+ ReactDOM$1.flushSync(() => onFallbackChange(shouldFallback));
3735
+ }
3736
+ if (overflowRef) overflowRef.current = await detectOverflow(getArgsWithCustomFloatingHeight({
3737
+ ...nextArgs,
3738
+ y: nextY
3739
+ }, scrollEl.offsetHeight + clientTop + floating.clientTop), detectOverflowOptions);
3740
+ return { y: nextY };
3741
+ }
3742
+ });
3743
+ }) });
3744
+
3745
+ //#endregion
3746
+ init_floating_ui_react_esm();
3747
+ export { floating_ui_react_esm_exports, init_floating_ui_react_esm };