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