@blofin/blofin-ui 0.7.57 → 0.7.58

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 (292) hide show
  1. package/dist/Badge.es.js +23 -20
  2. package/dist/Button.es.js +126 -123
  3. package/dist/Calendar.d.ts +1 -0
  4. package/dist/Calendar.es.js +210 -0
  5. package/dist/Checkbox.d.ts +1 -0
  6. package/dist/Checkbox.es.js +138 -0
  7. package/dist/CssDropdown.d.ts +1 -0
  8. package/dist/CssDropdown.es.js +38 -0
  9. package/dist/DatePickerRange.d.ts +1 -0
  10. package/dist/DatePickerRange.es.js +410 -0
  11. package/dist/DateTimePicker.d.ts +1 -0
  12. package/dist/DateTimePicker.es.js +519 -0
  13. package/dist/Dialog.es.js +180 -9
  14. package/dist/Divider.es.js +11 -8
  15. package/dist/Drawer.es.js +43 -49
  16. package/dist/Dropdown.d.ts +1 -0
  17. package/dist/Dropdown.es.js +134 -0
  18. package/dist/Empty.d.ts +1 -0
  19. package/dist/Empty.es.js +11 -0
  20. package/dist/LabelTextField.d.ts +1 -0
  21. package/dist/LabelTextField.es.js +100 -0
  22. package/dist/MonthPicker.d.ts +1 -0
  23. package/dist/MonthPicker.es.js +16 -0
  24. package/dist/MultiSelect.d.ts +1 -0
  25. package/dist/MultiSelect.es.js +425 -0
  26. package/dist/Notification.d.ts +1 -0
  27. package/dist/Notification.es.js +12 -0
  28. package/dist/Pagination.d.ts +1 -0
  29. package/dist/Pagination.es.js +219 -0
  30. package/dist/Picker.d.ts +1 -0
  31. package/dist/Picker.es.js +224 -0
  32. package/dist/Popover.d.ts +1 -0
  33. package/dist/Popover.es.js +107 -0
  34. package/dist/Popup.d.ts +1 -0
  35. package/dist/Popup.es.js +62 -0
  36. package/dist/ProTable-7a07d8b6.js +565 -0
  37. package/dist/ProTable.es.js +9 -5
  38. package/dist/RadioButton.d.ts +1 -0
  39. package/dist/RadioButton.es.js +152 -0
  40. package/dist/Select.d.ts +1 -0
  41. package/dist/Select.es.js +316 -0
  42. package/dist/Slider.es.js +141 -139
  43. package/dist/Sort.d.ts +1 -0
  44. package/dist/Sort.es.js +146 -0
  45. package/dist/Sortable.d.ts +1 -0
  46. package/dist/Sortable.es.js +39 -0
  47. package/dist/Switch.d.ts +1 -0
  48. package/dist/Switch.es.js +64 -0
  49. package/dist/Tab.d.ts +1 -0
  50. package/dist/Tab.es.js +101 -0
  51. package/dist/Table.d.ts +1 -0
  52. package/dist/Table.es.js +359 -0
  53. package/dist/TextField.d.ts +1 -0
  54. package/dist/TextField.es.js +64 -0
  55. package/dist/TextSelect.d.ts +1 -0
  56. package/dist/TextSelect.es.js +17 -0
  57. package/dist/Textarea.d.ts +1 -0
  58. package/dist/Textarea.es.js +106 -0
  59. package/dist/Toast.d.ts +1 -0
  60. package/dist/Toast.es.js +12 -0
  61. package/dist/Tooltip.d.ts +1 -0
  62. package/dist/Tooltip.es.js +144 -0
  63. package/dist/Typography.d.ts +1 -0
  64. package/dist/Typography.es.js +74 -0
  65. package/dist/_commonjsHelpers-1d52fb73.js +9 -0
  66. package/dist/arrow-down-011b02c7.js +6 -0
  67. package/dist/arrow-down-l-line-97e4fe24.js +6 -0
  68. package/dist/arrow-fill-70becd96.js +6 -0
  69. package/dist/arrow-right-l-line-87881b4d.js +7 -0
  70. package/dist/blofin.css +1 -1
  71. package/dist/{close-c67ec245.js → close-0df24351.js} +1 -0
  72. package/dist/close-bg-6d2211ef.js +6 -0
  73. package/dist/clsx.m-e965ef18.js +22 -0
  74. package/dist/components/Alert/Alert.d.ts +3 -3
  75. package/dist/components/Alert/styles.d.ts +2 -2
  76. package/dist/components/Badge/Badge.d.ts +2 -2
  77. package/dist/components/Button/Button.d.ts +2 -2
  78. package/dist/components/Button/Loading/index.d.ts +2 -2
  79. package/dist/components/Button/index.d.ts +2 -0
  80. package/dist/components/Button/styles.d.ts +1 -1
  81. package/dist/components/Checkbox/styles.d.ts +1 -1
  82. package/dist/components/CssDropdown/CssDropdown.d.ts +3 -3
  83. package/dist/components/CssDropdown/index.d.ts +2 -0
  84. package/dist/components/DatePickerRange/index.d.ts +4 -0
  85. package/dist/components/DatePickerRange/styles.d.ts +0 -1
  86. package/dist/components/DateTimePicker/ScrollableList.d.ts +1 -1
  87. package/dist/components/DateTimePicker/index.d.ts +4 -0
  88. package/dist/components/Dialog/Dialog.d.ts +5 -2
  89. package/dist/components/Dialog/index.d.ts +4 -2
  90. package/dist/components/Dialog/styles.d.ts +2 -2
  91. package/dist/components/Drawer/Drawer.d.ts +1 -1
  92. package/dist/components/Dropdown/Dropdown.d.ts +2 -2
  93. package/dist/components/Dropdown/index.d.ts +2 -0
  94. package/dist/components/Empty/Empty.d.ts +5 -0
  95. package/dist/components/Empty/index.d.ts +2 -5
  96. package/dist/components/LabelTextField/LabelTextField.d.ts +6 -6
  97. package/dist/components/MonthPicker/MonthPicker.d.ts +17 -0
  98. package/dist/components/MonthPicker/index.d.ts +2 -17
  99. package/dist/components/MultiSelect/MultiSelect.d.ts +4 -4
  100. package/dist/components/MultiSelect/index.d.ts +2 -0
  101. package/dist/components/Notification/Notification.d.ts +1 -1
  102. package/dist/components/Notification/index.d.ts +2 -0
  103. package/dist/components/Pagination/PageOptions.d.ts +1 -1
  104. package/dist/components/Pagination/Pagination.d.ts +2 -2
  105. package/dist/components/Pagination/index.d.ts +3 -0
  106. package/dist/components/Picker/Picker.d.ts +10 -0
  107. package/dist/components/Picker/hooks/usePickerMethod.d.ts +1 -1
  108. package/dist/components/Picker/index.d.ts +2 -10
  109. package/dist/components/Popover/Popover.d.ts +1 -1
  110. package/dist/components/Popover/index.d.ts +5 -0
  111. package/dist/components/Popup/Popup.d.ts +15 -0
  112. package/dist/components/Popup/index.d.ts +4 -15
  113. package/dist/components/RadioButton/RadioButton.d.ts +4 -4
  114. package/dist/components/RadioButton/styles.d.ts +1 -1
  115. package/dist/components/Select/Select.d.ts +6 -9
  116. package/dist/components/Slider/Slider.d.ts +2 -2
  117. package/dist/components/Sort/SortButton.d.ts +5 -5
  118. package/dist/components/Sort/SortGroup.d.ts +4 -4
  119. package/dist/components/Sort/index.d.ts +5 -0
  120. package/dist/components/Sortable/SortItem.d.ts +4 -4
  121. package/dist/components/Sortable/Sortable.d.ts +11 -0
  122. package/dist/components/Sortable/index.d.ts +3 -11
  123. package/dist/components/Switch/Switch.d.ts +2 -2
  124. package/dist/components/Switch/index.d.ts +2 -0
  125. package/dist/components/Switch/styles.d.ts +3 -3
  126. package/dist/components/Tab/Tab.d.ts +2 -2
  127. package/dist/components/Tab/index.d.ts +4 -0
  128. package/dist/components/Tab/styles.d.ts +1 -1
  129. package/dist/components/Table/Pagination/index.d.ts +2 -2
  130. package/dist/components/Table/Table.d.ts +2 -2
  131. package/dist/components/Table/Tbody/index.d.ts +3 -3
  132. package/dist/components/Table/Thead/index.d.ts +3 -3
  133. package/dist/components/Table/context.d.ts +3 -3
  134. package/dist/components/Table/hooks/useStickyOffset.d.ts +2 -2
  135. package/dist/components/Table/index.d.ts +3 -3
  136. package/dist/components/Table/interface.d.ts +4 -4
  137. package/dist/components/TextField/TextField.d.ts +4 -4
  138. package/dist/components/TextField/index.d.ts +2 -0
  139. package/dist/components/TextSelect/TextSelect.d.ts +8 -8
  140. package/dist/components/TextSelect/index.d.ts +2 -0
  141. package/dist/components/Textarea/Textarea.d.ts +15 -0
  142. package/dist/components/Textarea/index.d.ts +2 -15
  143. package/dist/components/Toast/Toast.d.ts +2 -13
  144. package/dist/components/Toast/index.d.ts +2 -0
  145. package/dist/components/Toast/styles.d.ts +1 -1
  146. package/dist/components/Tooltip/Tooltip.d.ts +4 -5
  147. package/dist/components/Tooltip/index.d.ts +2 -0
  148. package/dist/components/Typography/Typography.d.ts +2 -2
  149. package/dist/components/Typography/index.d.ts +4 -0
  150. package/dist/components/Typography/styles.d.ts +1 -1
  151. package/dist/enum-0398044b.js +17 -0
  152. package/dist/helper-221987f8.js +7 -0
  153. package/dist/hooks/useLatest.d.ts +1 -1
  154. package/dist/hooks/useNotification.d.ts +5 -7
  155. package/dist/hooks/useToast.d.ts +1 -1
  156. package/dist/{index-0f855a91.js → index-0230b5a9.js} +5 -4
  157. package/dist/{index-c17e103a.js → index-02f669c4.js} +2 -1
  158. package/dist/{index-6fc4d1f4.js → index-03169373.js} +12 -25
  159. package/dist/{index-4ccb3e9c.js → index-03513979.js} +11 -24
  160. package/dist/{index-d5de8c20.js → index-03d6aef0.js} +13 -26
  161. package/dist/{index-a132ac63.js → index-06d0f2f7.js} +13 -26
  162. package/dist/{index-64f4d194.js → index-06ef2e10.js} +11 -24
  163. package/dist/{index-55a7fad3.js → index-08a64465.js} +11 -24
  164. package/dist/{index-659243c0.js → index-094d2a65.js} +19 -32
  165. package/dist/{index-e3570fb6.js → index-11268759.js} +18 -31
  166. package/dist/{index-0ab7162c.js → index-117d018c.js} +22 -35
  167. package/dist/{index-2e69928d.js → index-12d32536.js} +13 -26
  168. package/dist/{index-3c7614e3.js → index-141cec17.js} +14 -27
  169. package/dist/{index-207ff1e4.js → index-19d177fe.js} +16 -29
  170. package/dist/{index-cd93af19.js → index-1b2a64df.js} +26 -39
  171. package/dist/{index-b42b7f2a.js → index-2334248a.js} +9 -22
  172. package/dist/index-293f8244.js +49 -0
  173. package/dist/{index-d907bed0.js → index-29d37c73.js} +52 -65
  174. package/dist/{index-0228f85e.js → index-2ae0474b.js} +24 -37
  175. package/dist/{index-7f2a6d68.js → index-360aaaac.js} +28 -41
  176. package/dist/{index-789ea179.js → index-3ee2bafa.js} +15 -28
  177. package/dist/index-40023d52.js +5322 -0
  178. package/dist/{index-15cca5fd.js → index-40710f09.js} +17 -30
  179. package/dist/index-4528ba11.js +49 -0
  180. package/dist/{index-2ee3d9fd.js → index-4bc493f0.js} +4 -17
  181. package/dist/{index-2acdfe81.js → index-4c6ad36c.js} +32 -45
  182. package/dist/{index-f27785e7.js → index-4d780cf4.js} +22 -35
  183. package/dist/{index-87b93a08.js → index-4df0c3e4.js} +16 -29
  184. package/dist/{index-122d1ca2.js → index-4f94900a.js} +19 -32
  185. package/dist/{index-693a21bb.js → index-4f94d7fa.js} +22 -35
  186. package/dist/{index-1810cc68.js → index-57a163fd.js} +11 -24
  187. package/dist/index-596c785d.js +50 -0
  188. package/dist/{index-94ca2048.js → index-5beeed26.js} +23 -36
  189. package/dist/{index-54cbdaa4.js → index-5e6ffc2f.js} +2 -1
  190. package/dist/{index-9c669079.js → index-5fb7b3bc.js} +12 -25
  191. package/dist/{index-d914889d.js → index-60fe7f16.js} +13 -26
  192. package/dist/{index-7dfec241.js → index-63a66f13.js} +30 -43
  193. package/dist/index-67554651.js +49 -0
  194. package/dist/{index-b69e64e6.js → index-67678963.js} +22 -35
  195. package/dist/{index-523acf7a.js → index-6856be22.js} +21 -34
  196. package/dist/{index-0be486a6.js → index-6e969585.js} +27 -40
  197. package/dist/{index-cb3b96c6.js → index-6f728206.js} +9 -22
  198. package/dist/{index-2add17c1.js → index-6f963c6a.js} +20 -33
  199. package/dist/{index-a5251ade.js → index-73bfc020.js} +31 -44
  200. package/dist/{index-721120f3.js → index-75190b99.js} +7 -20
  201. package/dist/{index-70099dad.js → index-770e5f53.js} +12 -25
  202. package/dist/{index-f0b0c5fc.js → index-79e7317f.js} +12 -25
  203. package/dist/{index-312ee80f.js → index-7bb9ffdf.js} +3 -2
  204. package/dist/{index-013c5769.js → index-7cf9b111.js} +18 -31
  205. package/dist/{index-8d34dc76.js → index-7edb6aec.js} +19 -32
  206. package/dist/{index-0fa20e69.js → index-80cc70e4.js} +26 -39
  207. package/dist/{index-24112094.js → index-8585c2f3.js} +23 -36
  208. package/dist/{index-c1206eaf.js → index-898678dc.js} +21 -34
  209. package/dist/{index-fd4e070b.js → index-8aa9b1be.js} +24 -37
  210. package/dist/index-9349bf2d.js +345 -0
  211. package/dist/{index-dc3cd1ef.js → index-954d3973.js} +13 -26
  212. package/dist/{index-f5df4eec.js → index-956b36a6.js} +37 -50
  213. package/dist/{index-31004470.js → index-9c73c442.js} +45 -58
  214. package/dist/{index-887b08f6.js → index-9e5efc0a.js} +29 -42
  215. package/dist/{index-584c1de8.js → index-a6fa33ce.js} +13 -26
  216. package/dist/{index-2c3346b8.js → index-a89abb42.js} +4 -17
  217. package/dist/{index-0333ccf9.js → index-b0da3dfd.js} +14 -27
  218. package/dist/{index-fcb10f63.js → index-b103ed31.js} +12 -25
  219. package/dist/{index-9c3f8d80.js → index-b54ef52a.js} +16 -29
  220. package/dist/index-b7027a1d.js +1295 -0
  221. package/dist/{index-81a64a31.js → index-b7941b97.js} +8 -21
  222. package/dist/{index-b8e94395.js → index-c1381bca.js} +20 -33
  223. package/dist/index-c57db938.js +37 -0
  224. package/dist/{index-051b64c8.js → index-c6371af1.js} +10 -23
  225. package/dist/{index-a9c0f025.js → index-c69f6dfc.js} +19 -32
  226. package/dist/{index-e1f19bc5.js → index-cb1218d8.js} +10 -23
  227. package/dist/{index-c1b82aa9.js → index-cbc0d36b.js} +13 -26
  228. package/dist/{index-3b42042f.js → index-cc1cd309.js} +13 -26
  229. package/dist/{index-abb9f006.js → index-ceae4147.js} +12 -25
  230. package/dist/{index-b4116538.js → index-cfee583b.js} +21 -34
  231. package/dist/{index-7b28ddea.js → index-d2f2742e.js} +10 -23
  232. package/dist/{index-00d6276c.js → index-d3419554.js} +15 -28
  233. package/dist/{index-30f61bdc.js → index-d81e15f3.js} +19 -32
  234. package/dist/{index-40958da3.js → index-d86842c8.js} +17 -30
  235. package/dist/{index-46e4bfa3.js → index-e169373b.js} +10 -23
  236. package/dist/{index-aa5e48ef.js → index-e1a6a03d.js} +9 -22
  237. package/dist/{index-a45e1710.js → index-e2b960e4.js} +23 -36
  238. package/dist/{index-5648e9fa.js → index-e8fb69e0.js} +21 -34
  239. package/dist/{index-3b632a87.js → index-e98ef24f.js} +14 -27
  240. package/dist/{index-c6a5236d.js → index-e9a1ff7f.js} +4 -17
  241. package/dist/index-eea69add.js +71 -0
  242. package/dist/{index-9864c94e.js → index-ef31f5f8.js} +2 -1
  243. package/dist/{index-2e09190f.js → index-f1726c63.js} +11 -24
  244. package/dist/{index-d15a69b6.js → index-f40f45fb.js} +13 -26
  245. package/dist/{index-88d32101.js → index-f64eddcc.js} +16 -29
  246. package/dist/{index-44ed585d.js → index-f7c4ae83.js} +22 -35
  247. package/dist/{index-44b988bb.js → index-fda88eb4.js} +23 -36
  248. package/dist/{index-c58b598e.js → index-fdffd6e6.js} +14 -27
  249. package/dist/index.d.ts +36 -48
  250. package/dist/index.es.js +223 -53
  251. package/dist/index.esm-71578db5.js +1198 -0
  252. package/dist/index.module-1d7bbdf8.js +7 -0
  253. package/dist/index.module-86edc823.js +15 -0
  254. package/dist/index.module-b4239ff5.js +9 -0
  255. package/dist/index.module-fb41ba3b.js +39 -0
  256. package/dist/locales-776f0072.js +440 -0
  257. package/dist/provider/NoticeProvider.d.ts +1 -1
  258. package/dist/provider/ThemeProvider.d.ts +7 -3
  259. package/dist/provider/useTheme.d.ts +1 -1
  260. package/dist/search-b79a3be5.js +6 -0
  261. package/dist/sortable.esm-1c13d908.js +2896 -0
  262. package/dist/sortable.esm-8d31c120.js +1275 -0
  263. package/dist/styles-85a9fe64.js +136 -0
  264. package/dist/types/component.d.ts +1 -1
  265. package/dist/useAlign-916ed3be.js +44 -0
  266. package/dist/useDelayEvent-f577f6a3.js +1082 -0
  267. package/dist/useTheme-0688f238.js +16 -0
  268. package/dist/utils/helper.d.ts +1 -1
  269. package/dist/{utils-19b44377.js → utils-071abd68.js} +2 -1
  270. package/package.json +1 -1
  271. package/dist/Form.d.ts +0 -1
  272. package/dist/Form.es.js +0 -752
  273. package/dist/ProTable-079d6c86.js +0 -3443
  274. package/dist/components/Form/Control.d.ts +0 -13
  275. package/dist/components/Form/Form.d.ts +0 -4
  276. package/dist/components/Form/FormItem.d.ts +0 -4
  277. package/dist/components/Form/FormLabel.d.ts +0 -4
  278. package/dist/components/Form/context.d.ts +0 -6
  279. package/dist/components/Form/index.d.ts +0 -8
  280. package/dist/components/Form/interface.d.ts +0 -48
  281. package/dist/components/Form/store.d.ts +0 -16
  282. package/dist/components/Form/styles/item.d.ts +0 -5
  283. package/dist/components/Form/useForm.d.ts +0 -3
  284. package/dist/index-0b47cbae.js +0 -173
  285. package/dist/index-14c3a4d7.js +0 -62
  286. package/dist/index-6ffbeca8.js +0 -65
  287. package/dist/index-7be8731d.js +0 -62
  288. package/dist/index-b5974e22.js +0 -62
  289. package/dist/index-e102400f.js +0 -11706
  290. package/dist/index-fb1f3ef1.js +0 -63
  291. package/dist/isObjectLike-1b8bbac2.js +0 -44
  292. package/dist/jsx-runtime-82a9ddf6.js +0 -646
@@ -1,3443 +0,0 @@
1
- import { j as z } from "./jsx-runtime-82a9ddf6.js";
2
- import * as Ce from "react";
3
- import V, { useLayoutEffect as $n, useEffect as M, useRef as L, useMemo as O, useCallback as K, useState as Q, createContext as Je, memo as Fn, useReducer as Hn, useContext as Ie } from "react";
4
- import { c as W, a as Me, u as Wn } from "./index-6ffbeca8.js";
5
- import { unstable_batchedUpdates as rt, createPortal as Xn } from "react-dom";
6
- var ne = /* @__PURE__ */ ((e) => (e.default = "default", e.desc = "desc", e.asc = "asc", e))(ne || {});
7
- const Yn = W("bu-w-full bu-rounded-lg", {
8
- variants: {
9
- theme: {
10
- light: "bu-bg-light-background",
11
- dark: "bu-bg-dark-background"
12
- }
13
- }
14
- }), Kn = W("bu-w-full bu-border-collapse"), Un = W("bu-sticky bu-top-0 bu-z-[100]", {
15
- variants: {
16
- theme: {
17
- light: "bu-bg-light-background",
18
- dark: "bu-bg-dark-background"
19
- }
20
- }
21
- }), rn = W(
22
- "bu-relative bu-z-[999] bu-h-[25px] bu-select-none bu-border-b bu-px-[4px] bu-text-left bu-text-[12px] bu-font-medium bu-transition-all bu-duration-300",
23
- {
24
- variants: {
25
- theme: {
26
- light: "bu-border-light-line-primary bu-text-light-label-40",
27
- dark: "bu-border-dark-line-primary bu-text-dark-label-40"
28
- },
29
- draggable: {
30
- true: "bu-cursor-grab hover:bu-cursor-grab",
31
- false: ""
32
- }
33
- }
34
- }
35
- ), on = W("bu-sticky bu-left-0 bu-top-0 bu-z-[1000]", {
36
- variants: {
37
- theme: {
38
- light: "bu-bg-light-background",
39
- dark: "bu-bg-dark-background"
40
- }
41
- }
42
- }), sn = W("bu-sticky bu-right-0 bu-top-0 bu-z-[1000]", {
43
- variants: {
44
- theme: {
45
- light: "bu-bg-light-background",
46
- dark: "bu-bg-dark-background"
47
- }
48
- }
49
- }), Vn = W("bu-cursor-pointer", {
50
- variants: {
51
- theme: {
52
- light: "hover:bu-bg-light-hover-fill-primary",
53
- dark: "hover:bu-bg-dark-hover-fill-primary"
54
- }
55
- }
56
- }), qn = W(
57
- "bu-pointer-events-auto bu-opacity-0 bu-transition-opacity bu-duration-200 group-hover:bu-opacity-100",
58
- {
59
- variants: {
60
- theme: {
61
- light: "bu-text-light-label-60 hover:bu-text-light-primary",
62
- dark: "bu-text-dark-label-60 hover:bu-text-dark-primary"
63
- }
64
- }
65
- }
66
- ), an = W("bu-z-[1002] !bu-cursor-grabbing bu-opacity-60 bu-shadow-lg", {
67
- variants: {
68
- theme: {
69
- light: "bu-bg-light-background",
70
- dark: "bu-bg-dark-background"
71
- }
72
- }
73
- }), Gn = W("bu-ml-2 bu-inline-flex bu-flex-col bu-align-middle"), Jn = W(
74
- "bu-h-0 bu-w-0 bu-border-l-4 bu-border-r-4 bu-border-transparent",
75
- {
76
- variants: {
77
- direction: {
78
- asc: "bu-mb-0.5 bu-border-b-[5px]",
79
- desc: "bu-border-t-[5px]"
80
- },
81
- theme: {
82
- light: "bu-border-b-light-line-secondary bu-border-t-light-line-secondary",
83
- dark: "bu-border-b-dark-line-secondary bu-border-t-dark-line-secondary"
84
- },
85
- active: {
86
- true: "!bu-border-b-light-primary !bu-border-t-light-primary",
87
- false: ""
88
- }
89
- }
90
- }
91
- ), _n = W("", {
92
- variants: {
93
- theme: {
94
- light: "bu-bg-light-background",
95
- dark: "bu-bg-dark-background"
96
- }
97
- }
98
- }), Zn = W("bu-group bu-border-b bu-transition-colors bu-duration-200", {
99
- variants: {
100
- theme: {
101
- light: "bu-hover:bu-bg-light-fill-primary bu-border-light-line-primary",
102
- dark: "bu-hover:bu-bg-dark-fill-primary bu-border-dark-line-primary"
103
- }
104
- }
105
- }), ln = W("bu-h-[60px] bu-border-b bu-px-[4px] bu-text-[12px]", {
106
- variants: {
107
- theme: {
108
- light: "bu-border-light-line-primary bu-text-light-label group-hover:bu-bg-light-fill-primary",
109
- dark: "bu-border-dark-line-primary bu-text-dark-label group-hover:bu-bg-dark-fill-primary"
110
- }
111
- }
112
- }), cn = W("bu-sticky bu-left-0", {
113
- variants: {
114
- theme: {
115
- light: "bu-bg-light-background group-hover:bu-bg-light-fill-primary",
116
- dark: "bu-bg-dark-background group-hover:bu-bg-dark-fill-primary"
117
- }
118
- }
119
- }), un = W("bu-sticky bu-right-0", {
120
- variants: {
121
- theme: {
122
- light: "bu-bg-light-background group-hover:bu-bg-light-fill-primary",
123
- dark: "bu-bg-dark-background group-hover:bu-bg-dark-fill-primary"
124
- }
125
- }
126
- }), Qn = W("bu-px-5 bu-py-10 bu-text-center", {
127
- variants: {
128
- theme: {
129
- light: "bu-text-light-label-60",
130
- dark: "bu-text-dark-label-60"
131
- }
132
- }
133
- }), er = (e) => ({
134
- "flex-start": "left",
135
- center: "center",
136
- "flex-end": "right"
137
- })[e || "center"], tr = (e) => {
138
- const { theme: t, fixed: n, sortable: r, isDragging: o, draggable: i, customClass: s } = e, l = [rn({ theme: t, draggable: i && !n })];
139
- return n === "left" ? l.push(on({ theme: t })) : n === "right" && l.push(sn({ theme: t })), o && l.push(an({ theme: t })), s && l.push(s), l.join(" ");
140
- }, nr = (e) => {
141
- const { theme: t, fixed: n, customClass: r } = e, o = [ln({ theme: t })];
142
- return n === "left" ? o.push(cn({ theme: t })) : n === "right" && o.push(un({ theme: t })), r && o.push(r), o.join(" ");
143
- }, oe = {
144
- container: Yn,
145
- table: Kn,
146
- thead: Un,
147
- th: rn,
148
- thFixedLeft: on,
149
- thFixedRight: sn,
150
- thSortable: Vn,
151
- dragHandle: qn,
152
- dragging: an,
153
- sortIcon: Gn,
154
- sortArrow: Jn,
155
- tbody: _n,
156
- tr: Zn,
157
- td: ln,
158
- tdFixedLeft: cn,
159
- tdFixedRight: un,
160
- empty: Qn,
161
- getThClasses: tr,
162
- getTdClasses: nr,
163
- getTextAlign: er
164
- };
165
- function rr() {
166
- for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
167
- t[n] = arguments[n];
168
- return O(
169
- () => (r) => {
170
- t.forEach((o) => o(r));
171
- },
172
- // eslint-disable-next-line react-hooks/exhaustive-deps
173
- t
174
- );
175
- }
176
- const dt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
177
- function ze(e) {
178
- const t = Object.prototype.toString.call(e);
179
- return t === "[object Window]" || // In Electron context the Window object serializes to [object global]
180
- t === "[object global]";
181
- }
182
- function It(e) {
183
- return "nodeType" in e;
184
- }
185
- function q(e) {
186
- var t, n;
187
- return e ? ze(e) ? e : It(e) && (t = (n = e.ownerDocument) == null ? void 0 : n.defaultView) != null ? t : window : window;
188
- }
189
- function Et(e) {
190
- const {
191
- Document: t
192
- } = q(e);
193
- return e instanceof t;
194
- }
195
- function _e(e) {
196
- return ze(e) ? !1 : e instanceof q(e).HTMLElement;
197
- }
198
- function dn(e) {
199
- return e instanceof q(e).SVGElement;
200
- }
201
- function je(e) {
202
- return e ? ze(e) ? e.document : It(e) ? Et(e) ? e : _e(e) || dn(e) ? e.ownerDocument : document : document : document;
203
- }
204
- const fe = dt ? $n : M;
205
- function kt(e) {
206
- const t = L(e);
207
- return fe(() => {
208
- t.current = e;
209
- }), K(function() {
210
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
211
- r[o] = arguments[o];
212
- return t.current == null ? void 0 : t.current(...r);
213
- }, []);
214
- }
215
- function or() {
216
- const e = L(null), t = K((r, o) => {
217
- e.current = setInterval(r, o);
218
- }, []), n = K(() => {
219
- e.current !== null && (clearInterval(e.current), e.current = null);
220
- }, []);
221
- return [t, n];
222
- }
223
- function Ve(e, t) {
224
- t === void 0 && (t = [e]);
225
- const n = L(e);
226
- return fe(() => {
227
- n.current !== e && (n.current = e);
228
- }, t), n;
229
- }
230
- function Ze(e, t) {
231
- const n = L();
232
- return O(
233
- () => {
234
- const r = e(n.current);
235
- return n.current = r, r;
236
- },
237
- // eslint-disable-next-line react-hooks/exhaustive-deps
238
- [...t]
239
- );
240
- }
241
- function at(e) {
242
- const t = kt(e), n = L(null), r = K(
243
- (o) => {
244
- o !== n.current && (t == null || t(o, n.current)), n.current = o;
245
- },
246
- //eslint-disable-next-line
247
- []
248
- );
249
- return [n, r];
250
- }
251
- function mt(e) {
252
- const t = L();
253
- return M(() => {
254
- t.current = e;
255
- }, [e]), t.current;
256
- }
257
- let pt = {};
258
- function Qe(e, t) {
259
- return O(() => {
260
- if (t)
261
- return t;
262
- const n = pt[e] == null ? 0 : pt[e] + 1;
263
- return pt[e] = n, e + "-" + n;
264
- }, [e, t]);
265
- }
266
- function fn(e) {
267
- return function(t) {
268
- for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
269
- r[o - 1] = arguments[o];
270
- return r.reduce((i, s) => {
271
- const a = Object.entries(s);
272
- for (const [l, u] of a) {
273
- const c = i[l];
274
- c != null && (i[l] = c + e * u);
275
- }
276
- return i;
277
- }, {
278
- ...t
279
- });
280
- };
281
- }
282
- const Le = /* @__PURE__ */ fn(1), lt = /* @__PURE__ */ fn(-1);
283
- function ir(e) {
284
- return "clientX" in e && "clientY" in e;
285
- }
286
- function Tt(e) {
287
- if (!e)
288
- return !1;
289
- const {
290
- KeyboardEvent: t
291
- } = q(e.target);
292
- return t && e instanceof t;
293
- }
294
- function sr(e) {
295
- if (!e)
296
- return !1;
297
- const {
298
- TouchEvent: t
299
- } = q(e.target);
300
- return t && e instanceof t;
301
- }
302
- function St(e) {
303
- if (sr(e)) {
304
- if (e.touches && e.touches.length) {
305
- const {
306
- clientX: t,
307
- clientY: n
308
- } = e.touches[0];
309
- return {
310
- x: t,
311
- y: n
312
- };
313
- } else if (e.changedTouches && e.changedTouches.length) {
314
- const {
315
- clientX: t,
316
- clientY: n
317
- } = e.changedTouches[0];
318
- return {
319
- x: t,
320
- y: n
321
- };
322
- }
323
- }
324
- return ir(e) ? {
325
- x: e.clientX,
326
- y: e.clientY
327
- } : null;
328
- }
329
- const qe = /* @__PURE__ */ Object.freeze({
330
- Translate: {
331
- toString(e) {
332
- if (!e)
333
- return;
334
- const {
335
- x: t,
336
- y: n
337
- } = e;
338
- return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
339
- }
340
- },
341
- Scale: {
342
- toString(e) {
343
- if (!e)
344
- return;
345
- const {
346
- scaleX: t,
347
- scaleY: n
348
- } = e;
349
- return "scaleX(" + t + ") scaleY(" + n + ")";
350
- }
351
- },
352
- Transform: {
353
- toString(e) {
354
- if (e)
355
- return [qe.Translate.toString(e), qe.Scale.toString(e)].join(" ");
356
- }
357
- },
358
- Transition: {
359
- toString(e) {
360
- let {
361
- property: t,
362
- duration: n,
363
- easing: r
364
- } = e;
365
- return t + " " + n + "ms " + r;
366
- }
367
- }
368
- }), Yt = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
369
- function ar(e) {
370
- return e.matches(Yt) ? e : e.querySelector(Yt);
371
- }
372
- const lr = {
373
- display: "none"
374
- };
375
- function cr(e) {
376
- let {
377
- id: t,
378
- value: n
379
- } = e;
380
- return V.createElement("div", {
381
- id: t,
382
- style: lr
383
- }, n);
384
- }
385
- function ur(e) {
386
- let {
387
- id: t,
388
- announcement: n,
389
- ariaLiveType: r = "assertive"
390
- } = e;
391
- const o = {
392
- position: "fixed",
393
- top: 0,
394
- left: 0,
395
- width: 1,
396
- height: 1,
397
- margin: -1,
398
- border: 0,
399
- padding: 0,
400
- overflow: "hidden",
401
- clip: "rect(0 0 0 0)",
402
- clipPath: "inset(100%)",
403
- whiteSpace: "nowrap"
404
- };
405
- return V.createElement("div", {
406
- id: t,
407
- style: o,
408
- role: "status",
409
- "aria-live": r,
410
- "aria-atomic": !0
411
- }, n);
412
- }
413
- function dr() {
414
- const [e, t] = Q("");
415
- return {
416
- announce: K((r) => {
417
- r != null && t(r);
418
- }, []),
419
- announcement: e
420
- };
421
- }
422
- const hn = /* @__PURE__ */ Je(null);
423
- function fr(e) {
424
- const t = Ie(hn);
425
- M(() => {
426
- if (!t)
427
- throw new Error("useDndMonitor must be used within a children of <DndContext>");
428
- return t(e);
429
- }, [e, t]);
430
- }
431
- function hr() {
432
- const [e] = Q(() => /* @__PURE__ */ new Set()), t = K((r) => (e.add(r), () => e.delete(r)), [e]);
433
- return [K((r) => {
434
- let {
435
- type: o,
436
- event: i
437
- } = r;
438
- e.forEach((s) => {
439
- var a;
440
- return (a = s[o]) == null ? void 0 : a.call(s, i);
441
- });
442
- }, [e]), t];
443
- }
444
- const gr = {
445
- draggable: `
446
- To pick up a draggable item, press the space bar.
447
- While dragging, use the arrow keys to move the item.
448
- Press space again to drop the item in its new position, or press escape to cancel.
449
- `
450
- }, br = {
451
- onDragStart(e) {
452
- let {
453
- active: t
454
- } = e;
455
- return "Picked up draggable item " + t.id + ".";
456
- },
457
- onDragOver(e) {
458
- let {
459
- active: t,
460
- over: n
461
- } = e;
462
- return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
463
- },
464
- onDragEnd(e) {
465
- let {
466
- active: t,
467
- over: n
468
- } = e;
469
- return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
470
- },
471
- onDragCancel(e) {
472
- let {
473
- active: t
474
- } = e;
475
- return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
476
- }
477
- };
478
- function vr(e) {
479
- let {
480
- announcements: t = br,
481
- container: n,
482
- hiddenTextDescribedById: r,
483
- screenReaderInstructions: o = gr
484
- } = e;
485
- const {
486
- announce: i,
487
- announcement: s
488
- } = dr(), a = Qe("DndLiveRegion"), [l, u] = Q(!1);
489
- if (M(() => {
490
- u(!0);
491
- }, []), fr(O(() => ({
492
- onDragStart(d) {
493
- let {
494
- active: f
495
- } = d;
496
- i(t.onDragStart({
497
- active: f
498
- }));
499
- },
500
- onDragMove(d) {
501
- let {
502
- active: f,
503
- over: h
504
- } = d;
505
- t.onDragMove && i(t.onDragMove({
506
- active: f,
507
- over: h
508
- }));
509
- },
510
- onDragOver(d) {
511
- let {
512
- active: f,
513
- over: h
514
- } = d;
515
- i(t.onDragOver({
516
- active: f,
517
- over: h
518
- }));
519
- },
520
- onDragEnd(d) {
521
- let {
522
- active: f,
523
- over: h
524
- } = d;
525
- i(t.onDragEnd({
526
- active: f,
527
- over: h
528
- }));
529
- },
530
- onDragCancel(d) {
531
- let {
532
- active: f,
533
- over: h
534
- } = d;
535
- i(t.onDragCancel({
536
- active: f,
537
- over: h
538
- }));
539
- }
540
- }), [i, t])), !l)
541
- return null;
542
- const c = V.createElement(V.Fragment, null, V.createElement(cr, {
543
- id: r,
544
- value: o.draggable
545
- }), V.createElement(ur, {
546
- id: a,
547
- announcement: s
548
- }));
549
- return n ? Xn(c, n) : c;
550
- }
551
- var $;
552
- (function(e) {
553
- e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
554
- })($ || ($ = {}));
555
- function ct() {
556
- }
557
- function Kt(e, t) {
558
- return O(
559
- () => ({
560
- sensor: e,
561
- options: t ?? {}
562
- }),
563
- // eslint-disable-next-line react-hooks/exhaustive-deps
564
- [e, t]
565
- );
566
- }
567
- function pr() {
568
- for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
569
- t[n] = arguments[n];
570
- return O(
571
- () => [...t].filter((r) => r != null),
572
- // eslint-disable-next-line react-hooks/exhaustive-deps
573
- [...t]
574
- );
575
- }
576
- const ie = /* @__PURE__ */ Object.freeze({
577
- x: 0,
578
- y: 0
579
- });
580
- function yr(e, t) {
581
- return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
582
- }
583
- function xr(e, t) {
584
- let {
585
- data: {
586
- value: n
587
- }
588
- } = e, {
589
- data: {
590
- value: r
591
- }
592
- } = t;
593
- return n - r;
594
- }
595
- function wr(e, t) {
596
- let {
597
- data: {
598
- value: n
599
- }
600
- } = e, {
601
- data: {
602
- value: r
603
- }
604
- } = t;
605
- return r - n;
606
- }
607
- function mr(e, t) {
608
- if (!e || e.length === 0)
609
- return null;
610
- const [n] = e;
611
- return t ? n[t] : n;
612
- }
613
- function Ut(e, t, n) {
614
- return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
615
- x: t + e.width * 0.5,
616
- y: n + e.height * 0.5
617
- };
618
- }
619
- const Sr = (e) => {
620
- let {
621
- collisionRect: t,
622
- droppableRects: n,
623
- droppableContainers: r
624
- } = e;
625
- const o = Ut(t, t.left, t.top), i = [];
626
- for (const s of r) {
627
- const {
628
- id: a
629
- } = s, l = n.get(a);
630
- if (l) {
631
- const u = yr(Ut(l), o);
632
- i.push({
633
- id: a,
634
- data: {
635
- droppableContainer: s,
636
- value: u
637
- }
638
- });
639
- }
640
- }
641
- return i.sort(xr);
642
- };
643
- function Dr(e, t) {
644
- const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height), s = o - r, a = i - n;
645
- if (r < o && n < i) {
646
- const l = t.width * t.height, u = e.width * e.height, c = s * a, d = c / (l + u - c);
647
- return Number(d.toFixed(4));
648
- }
649
- return 0;
650
- }
651
- const Cr = (e) => {
652
- let {
653
- collisionRect: t,
654
- droppableRects: n,
655
- droppableContainers: r
656
- } = e;
657
- const o = [];
658
- for (const i of r) {
659
- const {
660
- id: s
661
- } = i, a = n.get(s);
662
- if (a) {
663
- const l = Dr(a, t);
664
- l > 0 && o.push({
665
- id: s,
666
- data: {
667
- droppableContainer: i,
668
- value: l
669
- }
670
- });
671
- }
672
- }
673
- return o.sort(wr);
674
- };
675
- function Rr(e, t, n) {
676
- return {
677
- ...e,
678
- scaleX: t && n ? t.width / n.width : 1,
679
- scaleY: t && n ? t.height / n.height : 1
680
- };
681
- }
682
- function gn(e, t) {
683
- return e && t ? {
684
- x: e.left - t.left,
685
- y: e.top - t.top
686
- } : ie;
687
- }
688
- function Ir(e) {
689
- return function(n) {
690
- for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
691
- o[i - 1] = arguments[i];
692
- return o.reduce((s, a) => ({
693
- ...s,
694
- top: s.top + e * a.y,
695
- bottom: s.bottom + e * a.y,
696
- left: s.left + e * a.x,
697
- right: s.right + e * a.x
698
- }), {
699
- ...n
700
- });
701
- };
702
- }
703
- const Er = /* @__PURE__ */ Ir(1);
704
- function kr(e) {
705
- if (e.startsWith("matrix3d(")) {
706
- const t = e.slice(9, -1).split(/, /);
707
- return {
708
- x: +t[12],
709
- y: +t[13],
710
- scaleX: +t[0],
711
- scaleY: +t[5]
712
- };
713
- } else if (e.startsWith("matrix(")) {
714
- const t = e.slice(7, -1).split(/, /);
715
- return {
716
- x: +t[4],
717
- y: +t[5],
718
- scaleX: +t[0],
719
- scaleY: +t[3]
720
- };
721
- }
722
- return null;
723
- }
724
- function Tr(e, t, n) {
725
- const r = kr(t);
726
- if (!r)
727
- return e;
728
- const {
729
- scaleX: o,
730
- scaleY: i,
731
- x: s,
732
- y: a
733
- } = r, l = e.left - s - (1 - o) * parseFloat(n), u = e.top - a - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), c = o ? e.width / o : e.width, d = i ? e.height / i : e.height;
734
- return {
735
- width: c,
736
- height: d,
737
- top: u,
738
- right: l + c,
739
- bottom: u + d,
740
- left: l
741
- };
742
- }
743
- const Ar = {
744
- ignoreTransform: !1
745
- };
746
- function Pe(e, t) {
747
- t === void 0 && (t = Ar);
748
- let n = e.getBoundingClientRect();
749
- if (t.ignoreTransform) {
750
- const {
751
- transform: u,
752
- transformOrigin: c
753
- } = q(e).getComputedStyle(e);
754
- u && (n = Tr(n, u, c));
755
- }
756
- const {
757
- top: r,
758
- left: o,
759
- width: i,
760
- height: s,
761
- bottom: a,
762
- right: l
763
- } = n;
764
- return {
765
- top: r,
766
- left: o,
767
- width: i,
768
- height: s,
769
- bottom: a,
770
- right: l
771
- };
772
- }
773
- function Vt(e) {
774
- return Pe(e, {
775
- ignoreTransform: !0
776
- });
777
- }
778
- function Nr(e) {
779
- const t = e.innerWidth, n = e.innerHeight;
780
- return {
781
- top: 0,
782
- left: 0,
783
- right: t,
784
- bottom: n,
785
- width: t,
786
- height: n
787
- };
788
- }
789
- function Or(e, t) {
790
- return t === void 0 && (t = q(e).getComputedStyle(e)), t.position === "fixed";
791
- }
792
- function Mr(e, t) {
793
- t === void 0 && (t = q(e).getComputedStyle(e));
794
- const n = /(auto|scroll|overlay)/;
795
- return ["overflow", "overflowX", "overflowY"].some((o) => {
796
- const i = t[o];
797
- return typeof i == "string" ? n.test(i) : !1;
798
- });
799
- }
800
- function At(e, t) {
801
- const n = [];
802
- function r(o) {
803
- if (t != null && n.length >= t || !o)
804
- return n;
805
- if (Et(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
806
- return n.push(o.scrollingElement), n;
807
- if (!_e(o) || dn(o) || n.includes(o))
808
- return n;
809
- const i = q(e).getComputedStyle(o);
810
- return o !== e && Mr(o, i) && n.push(o), Or(o, i) ? n : r(o.parentNode);
811
- }
812
- return e ? r(e) : n;
813
- }
814
- function bn(e) {
815
- const [t] = At(e, 1);
816
- return t ?? null;
817
- }
818
- function yt(e) {
819
- return !dt || !e ? null : ze(e) ? e : It(e) ? Et(e) || e === je(e).scrollingElement ? window : _e(e) ? e : null : null;
820
- }
821
- function vn(e) {
822
- return ze(e) ? e.scrollX : e.scrollLeft;
823
- }
824
- function pn(e) {
825
- return ze(e) ? e.scrollY : e.scrollTop;
826
- }
827
- function Dt(e) {
828
- return {
829
- x: vn(e),
830
- y: pn(e)
831
- };
832
- }
833
- var F;
834
- (function(e) {
835
- e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
836
- })(F || (F = {}));
837
- function yn(e) {
838
- return !dt || !e ? !1 : e === document.scrollingElement;
839
- }
840
- function xn(e) {
841
- const t = {
842
- x: 0,
843
- y: 0
844
- }, n = yn(e) ? {
845
- height: window.innerHeight,
846
- width: window.innerWidth
847
- } : {
848
- height: e.clientHeight,
849
- width: e.clientWidth
850
- }, r = {
851
- x: e.scrollWidth - n.width,
852
- y: e.scrollHeight - n.height
853
- }, o = e.scrollTop <= t.y, i = e.scrollLeft <= t.x, s = e.scrollTop >= r.y, a = e.scrollLeft >= r.x;
854
- return {
855
- isTop: o,
856
- isLeft: i,
857
- isBottom: s,
858
- isRight: a,
859
- maxScroll: r,
860
- minScroll: t
861
- };
862
- }
863
- const Lr = {
864
- x: 0.2,
865
- y: 0.2
866
- };
867
- function zr(e, t, n, r, o) {
868
- let {
869
- top: i,
870
- left: s,
871
- right: a,
872
- bottom: l
873
- } = n;
874
- r === void 0 && (r = 10), o === void 0 && (o = Lr);
875
- const {
876
- isTop: u,
877
- isBottom: c,
878
- isLeft: d,
879
- isRight: f
880
- } = xn(e), h = {
881
- x: 0,
882
- y: 0
883
- }, v = {
884
- x: 0,
885
- y: 0
886
- }, g = {
887
- height: t.height * o.y,
888
- width: t.width * o.x
889
- };
890
- return !u && i <= t.top + g.height ? (h.y = F.Backward, v.y = r * Math.abs((t.top + g.height - i) / g.height)) : !c && l >= t.bottom - g.height && (h.y = F.Forward, v.y = r * Math.abs((t.bottom - g.height - l) / g.height)), !f && a >= t.right - g.width ? (h.x = F.Forward, v.x = r * Math.abs((t.right - g.width - a) / g.width)) : !d && s <= t.left + g.width && (h.x = F.Backward, v.x = r * Math.abs((t.left + g.width - s) / g.width)), {
891
- direction: h,
892
- speed: v
893
- };
894
- }
895
- function jr(e) {
896
- if (e === document.scrollingElement) {
897
- const {
898
- innerWidth: i,
899
- innerHeight: s
900
- } = window;
901
- return {
902
- top: 0,
903
- left: 0,
904
- right: i,
905
- bottom: s,
906
- width: i,
907
- height: s
908
- };
909
- }
910
- const {
911
- top: t,
912
- left: n,
913
- right: r,
914
- bottom: o
915
- } = e.getBoundingClientRect();
916
- return {
917
- top: t,
918
- left: n,
919
- right: r,
920
- bottom: o,
921
- width: e.clientWidth,
922
- height: e.clientHeight
923
- };
924
- }
925
- function wn(e) {
926
- return e.reduce((t, n) => Le(t, Dt(n)), ie);
927
- }
928
- function Pr(e) {
929
- return e.reduce((t, n) => t + vn(n), 0);
930
- }
931
- function Br(e) {
932
- return e.reduce((t, n) => t + pn(n), 0);
933
- }
934
- function $r(e, t) {
935
- if (t === void 0 && (t = Pe), !e)
936
- return;
937
- const {
938
- top: n,
939
- left: r,
940
- bottom: o,
941
- right: i
942
- } = t(e);
943
- bn(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
944
- block: "center",
945
- inline: "center"
946
- });
947
- }
948
- const Fr = [["x", ["left", "right"], Pr], ["y", ["top", "bottom"], Br]];
949
- class Nt {
950
- constructor(t, n) {
951
- this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
952
- const r = At(n), o = wn(r);
953
- this.rect = {
954
- ...t
955
- }, this.width = t.width, this.height = t.height;
956
- for (const [i, s, a] of Fr)
957
- for (const l of s)
958
- Object.defineProperty(this, l, {
959
- get: () => {
960
- const u = a(r), c = o[i] - u;
961
- return this.rect[l] + c;
962
- },
963
- enumerable: !0
964
- });
965
- Object.defineProperty(this, "rect", {
966
- enumerable: !1
967
- });
968
- }
969
- }
970
- class Ye {
971
- constructor(t) {
972
- this.target = void 0, this.listeners = [], this.removeAll = () => {
973
- this.listeners.forEach((n) => {
974
- var r;
975
- return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
976
- });
977
- }, this.target = t;
978
- }
979
- add(t, n, r) {
980
- var o;
981
- (o = this.target) == null || o.addEventListener(t, n, r), this.listeners.push([t, n, r]);
982
- }
983
- }
984
- function Hr(e) {
985
- const {
986
- EventTarget: t
987
- } = q(e);
988
- return e instanceof t ? e : je(e);
989
- }
990
- function xt(e, t) {
991
- const n = Math.abs(e.x), r = Math.abs(e.y);
992
- return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
993
- }
994
- var re;
995
- (function(e) {
996
- e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
997
- })(re || (re = {}));
998
- function qt(e) {
999
- e.preventDefault();
1000
- }
1001
- function Wr(e) {
1002
- e.stopPropagation();
1003
- }
1004
- var E;
1005
- (function(e) {
1006
- e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
1007
- })(E || (E = {}));
1008
- const mn = {
1009
- start: [E.Space, E.Enter],
1010
- cancel: [E.Esc],
1011
- end: [E.Space, E.Enter, E.Tab]
1012
- }, Xr = (e, t) => {
1013
- let {
1014
- currentCoordinates: n
1015
- } = t;
1016
- switch (e.code) {
1017
- case E.Right:
1018
- return {
1019
- ...n,
1020
- x: n.x + 25
1021
- };
1022
- case E.Left:
1023
- return {
1024
- ...n,
1025
- x: n.x - 25
1026
- };
1027
- case E.Down:
1028
- return {
1029
- ...n,
1030
- y: n.y + 25
1031
- };
1032
- case E.Up:
1033
- return {
1034
- ...n,
1035
- y: n.y - 25
1036
- };
1037
- }
1038
- };
1039
- class Ot {
1040
- constructor(t) {
1041
- this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = t;
1042
- const {
1043
- event: {
1044
- target: n
1045
- }
1046
- } = t;
1047
- this.props = t, this.listeners = new Ye(je(n)), this.windowListeners = new Ye(q(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
1048
- }
1049
- attach() {
1050
- this.handleStart(), this.windowListeners.add(re.Resize, this.handleCancel), this.windowListeners.add(re.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(re.Keydown, this.handleKeyDown));
1051
- }
1052
- handleStart() {
1053
- const {
1054
- activeNode: t,
1055
- onStart: n
1056
- } = this.props, r = t.node.current;
1057
- r && $r(r), n(ie);
1058
- }
1059
- handleKeyDown(t) {
1060
- if (Tt(t)) {
1061
- const {
1062
- active: n,
1063
- context: r,
1064
- options: o
1065
- } = this.props, {
1066
- keyboardCodes: i = mn,
1067
- coordinateGetter: s = Xr,
1068
- scrollBehavior: a = "smooth"
1069
- } = o, {
1070
- code: l
1071
- } = t;
1072
- if (i.end.includes(l)) {
1073
- this.handleEnd(t);
1074
- return;
1075
- }
1076
- if (i.cancel.includes(l)) {
1077
- this.handleCancel(t);
1078
- return;
1079
- }
1080
- const {
1081
- collisionRect: u
1082
- } = r.current, c = u ? {
1083
- x: u.left,
1084
- y: u.top
1085
- } : ie;
1086
- this.referenceCoordinates || (this.referenceCoordinates = c);
1087
- const d = s(t, {
1088
- active: n,
1089
- context: r.current,
1090
- currentCoordinates: c
1091
- });
1092
- if (d) {
1093
- const f = lt(d, c), h = {
1094
- x: 0,
1095
- y: 0
1096
- }, {
1097
- scrollableAncestors: v
1098
- } = r.current;
1099
- for (const g of v) {
1100
- const b = t.code, {
1101
- isTop: x,
1102
- isRight: p,
1103
- isLeft: y,
1104
- isBottom: R,
1105
- maxScroll: S,
1106
- minScroll: I
1107
- } = xn(g), m = jr(g), w = {
1108
- x: Math.min(b === E.Right ? m.right - m.width / 2 : m.right, Math.max(b === E.Right ? m.left : m.left + m.width / 2, d.x)),
1109
- y: Math.min(b === E.Down ? m.bottom - m.height / 2 : m.bottom, Math.max(b === E.Down ? m.top : m.top + m.height / 2, d.y))
1110
- }, D = b === E.Right && !p || b === E.Left && !y, N = b === E.Down && !R || b === E.Up && !x;
1111
- if (D && w.x !== d.x) {
1112
- const C = g.scrollLeft + f.x, P = b === E.Right && C <= S.x || b === E.Left && C >= I.x;
1113
- if (P && !f.y) {
1114
- g.scrollTo({
1115
- left: C,
1116
- behavior: a
1117
- });
1118
- return;
1119
- }
1120
- P ? h.x = g.scrollLeft - C : h.x = b === E.Right ? g.scrollLeft - S.x : g.scrollLeft - I.x, h.x && g.scrollBy({
1121
- left: -h.x,
1122
- behavior: a
1123
- });
1124
- break;
1125
- } else if (N && w.y !== d.y) {
1126
- const C = g.scrollTop + f.y, P = b === E.Down && C <= S.y || b === E.Up && C >= I.y;
1127
- if (P && !f.x) {
1128
- g.scrollTo({
1129
- top: C,
1130
- behavior: a
1131
- });
1132
- return;
1133
- }
1134
- P ? h.y = g.scrollTop - C : h.y = b === E.Down ? g.scrollTop - S.y : g.scrollTop - I.y, h.y && g.scrollBy({
1135
- top: -h.y,
1136
- behavior: a
1137
- });
1138
- break;
1139
- }
1140
- }
1141
- this.handleMove(t, Le(lt(d, this.referenceCoordinates), h));
1142
- }
1143
- }
1144
- }
1145
- handleMove(t, n) {
1146
- const {
1147
- onMove: r
1148
- } = this.props;
1149
- t.preventDefault(), r(n);
1150
- }
1151
- handleEnd(t) {
1152
- const {
1153
- onEnd: n
1154
- } = this.props;
1155
- t.preventDefault(), this.detach(), n();
1156
- }
1157
- handleCancel(t) {
1158
- const {
1159
- onCancel: n
1160
- } = this.props;
1161
- t.preventDefault(), this.detach(), n();
1162
- }
1163
- detach() {
1164
- this.listeners.removeAll(), this.windowListeners.removeAll();
1165
- }
1166
- }
1167
- Ot.activators = [{
1168
- eventName: "onKeyDown",
1169
- handler: (e, t, n) => {
1170
- let {
1171
- keyboardCodes: r = mn,
1172
- onActivation: o
1173
- } = t, {
1174
- active: i
1175
- } = n;
1176
- const {
1177
- code: s
1178
- } = e.nativeEvent;
1179
- if (r.start.includes(s)) {
1180
- const a = i.activatorNode.current;
1181
- return a && e.target !== a ? !1 : (e.preventDefault(), o == null || o({
1182
- event: e.nativeEvent
1183
- }), !0);
1184
- }
1185
- return !1;
1186
- }
1187
- }];
1188
- function Gt(e) {
1189
- return !!(e && "distance" in e);
1190
- }
1191
- function Jt(e) {
1192
- return !!(e && "delay" in e);
1193
- }
1194
- class Mt {
1195
- constructor(t, n, r) {
1196
- var o;
1197
- r === void 0 && (r = Hr(t.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = t, this.events = n;
1198
- const {
1199
- event: i
1200
- } = t, {
1201
- target: s
1202
- } = i;
1203
- this.props = t, this.events = n, this.document = je(s), this.documentListeners = new Ye(this.document), this.listeners = new Ye(r), this.windowListeners = new Ye(q(s)), this.initialCoordinates = (o = St(i)) != null ? o : ie, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
1204
- }
1205
- attach() {
1206
- const {
1207
- events: t,
1208
- props: {
1209
- options: {
1210
- activationConstraint: n,
1211
- bypassActivationConstraint: r
1212
- }
1213
- }
1214
- } = this;
1215
- if (this.listeners.add(t.move.name, this.handleMove, {
1216
- passive: !1
1217
- }), this.listeners.add(t.end.name, this.handleEnd), t.cancel && this.listeners.add(t.cancel.name, this.handleCancel), this.windowListeners.add(re.Resize, this.handleCancel), this.windowListeners.add(re.DragStart, qt), this.windowListeners.add(re.VisibilityChange, this.handleCancel), this.windowListeners.add(re.ContextMenu, qt), this.documentListeners.add(re.Keydown, this.handleKeydown), n) {
1218
- if (r != null && r({
1219
- event: this.props.event,
1220
- activeNode: this.props.activeNode,
1221
- options: this.props.options
1222
- }))
1223
- return this.handleStart();
1224
- if (Jt(n)) {
1225
- this.timeoutId = setTimeout(this.handleStart, n.delay), this.handlePending(n);
1226
- return;
1227
- }
1228
- if (Gt(n)) {
1229
- this.handlePending(n);
1230
- return;
1231
- }
1232
- }
1233
- this.handleStart();
1234
- }
1235
- detach() {
1236
- this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
1237
- }
1238
- handlePending(t, n) {
1239
- const {
1240
- active: r,
1241
- onPending: o
1242
- } = this.props;
1243
- o(r, t, this.initialCoordinates, n);
1244
- }
1245
- handleStart() {
1246
- const {
1247
- initialCoordinates: t
1248
- } = this, {
1249
- onStart: n
1250
- } = this.props;
1251
- t && (this.activated = !0, this.documentListeners.add(re.Click, Wr, {
1252
- capture: !0
1253
- }), this.removeTextSelection(), this.documentListeners.add(re.SelectionChange, this.removeTextSelection), n(t));
1254
- }
1255
- handleMove(t) {
1256
- var n;
1257
- const {
1258
- activated: r,
1259
- initialCoordinates: o,
1260
- props: i
1261
- } = this, {
1262
- onMove: s,
1263
- options: {
1264
- activationConstraint: a
1265
- }
1266
- } = i;
1267
- if (!o)
1268
- return;
1269
- const l = (n = St(t)) != null ? n : ie, u = lt(o, l);
1270
- if (!r && a) {
1271
- if (Gt(a)) {
1272
- if (a.tolerance != null && xt(u, a.tolerance))
1273
- return this.handleCancel();
1274
- if (xt(u, a.distance))
1275
- return this.handleStart();
1276
- }
1277
- if (Jt(a) && xt(u, a.tolerance))
1278
- return this.handleCancel();
1279
- this.handlePending(a, u);
1280
- return;
1281
- }
1282
- t.cancelable && t.preventDefault(), s(l);
1283
- }
1284
- handleEnd() {
1285
- const {
1286
- onAbort: t,
1287
- onEnd: n
1288
- } = this.props;
1289
- this.detach(), this.activated || t(this.props.active), n();
1290
- }
1291
- handleCancel() {
1292
- const {
1293
- onAbort: t,
1294
- onCancel: n
1295
- } = this.props;
1296
- this.detach(), this.activated || t(this.props.active), n();
1297
- }
1298
- handleKeydown(t) {
1299
- t.code === E.Esc && this.handleCancel();
1300
- }
1301
- removeTextSelection() {
1302
- var t;
1303
- (t = this.document.getSelection()) == null || t.removeAllRanges();
1304
- }
1305
- }
1306
- const Yr = {
1307
- cancel: {
1308
- name: "pointercancel"
1309
- },
1310
- move: {
1311
- name: "pointermove"
1312
- },
1313
- end: {
1314
- name: "pointerup"
1315
- }
1316
- };
1317
- class Lt extends Mt {
1318
- constructor(t) {
1319
- const {
1320
- event: n
1321
- } = t, r = je(n.target);
1322
- super(t, Yr, r);
1323
- }
1324
- }
1325
- Lt.activators = [{
1326
- eventName: "onPointerDown",
1327
- handler: (e, t) => {
1328
- let {
1329
- nativeEvent: n
1330
- } = e, {
1331
- onActivation: r
1332
- } = t;
1333
- return !n.isPrimary || n.button !== 0 ? !1 : (r == null || r({
1334
- event: n
1335
- }), !0);
1336
- }
1337
- }];
1338
- const Kr = {
1339
- move: {
1340
- name: "mousemove"
1341
- },
1342
- end: {
1343
- name: "mouseup"
1344
- }
1345
- };
1346
- var Ct;
1347
- (function(e) {
1348
- e[e.RightClick = 2] = "RightClick";
1349
- })(Ct || (Ct = {}));
1350
- class Ur extends Mt {
1351
- constructor(t) {
1352
- super(t, Kr, je(t.event.target));
1353
- }
1354
- }
1355
- Ur.activators = [{
1356
- eventName: "onMouseDown",
1357
- handler: (e, t) => {
1358
- let {
1359
- nativeEvent: n
1360
- } = e, {
1361
- onActivation: r
1362
- } = t;
1363
- return n.button === Ct.RightClick ? !1 : (r == null || r({
1364
- event: n
1365
- }), !0);
1366
- }
1367
- }];
1368
- const wt = {
1369
- cancel: {
1370
- name: "touchcancel"
1371
- },
1372
- move: {
1373
- name: "touchmove"
1374
- },
1375
- end: {
1376
- name: "touchend"
1377
- }
1378
- };
1379
- class Vr extends Mt {
1380
- constructor(t) {
1381
- super(t, wt);
1382
- }
1383
- static setup() {
1384
- return window.addEventListener(wt.move.name, t, {
1385
- capture: !1,
1386
- passive: !1
1387
- }), function() {
1388
- window.removeEventListener(wt.move.name, t);
1389
- };
1390
- function t() {
1391
- }
1392
- }
1393
- }
1394
- Vr.activators = [{
1395
- eventName: "onTouchStart",
1396
- handler: (e, t) => {
1397
- let {
1398
- nativeEvent: n
1399
- } = e, {
1400
- onActivation: r
1401
- } = t;
1402
- const {
1403
- touches: o
1404
- } = n;
1405
- return o.length > 1 ? !1 : (r == null || r({
1406
- event: n
1407
- }), !0);
1408
- }
1409
- }];
1410
- var Ke;
1411
- (function(e) {
1412
- e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
1413
- })(Ke || (Ke = {}));
1414
- var ut;
1415
- (function(e) {
1416
- e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
1417
- })(ut || (ut = {}));
1418
- function qr(e) {
1419
- let {
1420
- acceleration: t,
1421
- activator: n = Ke.Pointer,
1422
- canScroll: r,
1423
- draggingRect: o,
1424
- enabled: i,
1425
- interval: s = 5,
1426
- order: a = ut.TreeOrder,
1427
- pointerCoordinates: l,
1428
- scrollableAncestors: u,
1429
- scrollableAncestorRects: c,
1430
- delta: d,
1431
- threshold: f
1432
- } = e;
1433
- const h = Jr({
1434
- delta: d,
1435
- disabled: !i
1436
- }), [v, g] = or(), b = L({
1437
- x: 0,
1438
- y: 0
1439
- }), x = L({
1440
- x: 0,
1441
- y: 0
1442
- }), p = O(() => {
1443
- switch (n) {
1444
- case Ke.Pointer:
1445
- return l ? {
1446
- top: l.y,
1447
- bottom: l.y,
1448
- left: l.x,
1449
- right: l.x
1450
- } : null;
1451
- case Ke.DraggableRect:
1452
- return o;
1453
- }
1454
- }, [n, o, l]), y = L(null), R = K(() => {
1455
- const I = y.current;
1456
- if (!I)
1457
- return;
1458
- const m = b.current.x * x.current.x, w = b.current.y * x.current.y;
1459
- I.scrollBy(m, w);
1460
- }, []), S = O(() => a === ut.TreeOrder ? [...u].reverse() : u, [a, u]);
1461
- M(
1462
- () => {
1463
- if (!i || !u.length || !p) {
1464
- g();
1465
- return;
1466
- }
1467
- for (const I of S) {
1468
- if ((r == null ? void 0 : r(I)) === !1)
1469
- continue;
1470
- const m = u.indexOf(I), w = c[m];
1471
- if (!w)
1472
- continue;
1473
- const {
1474
- direction: D,
1475
- speed: N
1476
- } = zr(I, w, p, t, f);
1477
- for (const C of ["x", "y"])
1478
- h[C][D[C]] || (N[C] = 0, D[C] = 0);
1479
- if (N.x > 0 || N.y > 0) {
1480
- g(), y.current = I, v(R, s), b.current = N, x.current = D;
1481
- return;
1482
- }
1483
- }
1484
- b.current = {
1485
- x: 0,
1486
- y: 0
1487
- }, x.current = {
1488
- x: 0,
1489
- y: 0
1490
- }, g();
1491
- },
1492
- // eslint-disable-next-line react-hooks/exhaustive-deps
1493
- [
1494
- t,
1495
- R,
1496
- r,
1497
- g,
1498
- i,
1499
- s,
1500
- // eslint-disable-next-line react-hooks/exhaustive-deps
1501
- JSON.stringify(p),
1502
- // eslint-disable-next-line react-hooks/exhaustive-deps
1503
- JSON.stringify(h),
1504
- v,
1505
- u,
1506
- S,
1507
- c,
1508
- // eslint-disable-next-line react-hooks/exhaustive-deps
1509
- JSON.stringify(f)
1510
- ]
1511
- );
1512
- }
1513
- const Gr = {
1514
- x: {
1515
- [F.Backward]: !1,
1516
- [F.Forward]: !1
1517
- },
1518
- y: {
1519
- [F.Backward]: !1,
1520
- [F.Forward]: !1
1521
- }
1522
- };
1523
- function Jr(e) {
1524
- let {
1525
- delta: t,
1526
- disabled: n
1527
- } = e;
1528
- const r = mt(t);
1529
- return Ze((o) => {
1530
- if (n || !r || !o)
1531
- return Gr;
1532
- const i = {
1533
- x: Math.sign(t.x - r.x),
1534
- y: Math.sign(t.y - r.y)
1535
- };
1536
- return {
1537
- x: {
1538
- [F.Backward]: o.x[F.Backward] || i.x === -1,
1539
- [F.Forward]: o.x[F.Forward] || i.x === 1
1540
- },
1541
- y: {
1542
- [F.Backward]: o.y[F.Backward] || i.y === -1,
1543
- [F.Forward]: o.y[F.Forward] || i.y === 1
1544
- }
1545
- };
1546
- }, [n, t, r]);
1547
- }
1548
- function _r(e, t) {
1549
- const n = t != null ? e.get(t) : void 0, r = n ? n.node.current : null;
1550
- return Ze((o) => {
1551
- var i;
1552
- return t == null ? null : (i = r ?? o) != null ? i : null;
1553
- }, [r, t]);
1554
- }
1555
- function Zr(e, t) {
1556
- return O(() => e.reduce((n, r) => {
1557
- const {
1558
- sensor: o
1559
- } = r, i = o.activators.map((s) => ({
1560
- eventName: s.eventName,
1561
- handler: t(s.handler, r)
1562
- }));
1563
- return [...n, ...i];
1564
- }, []), [e, t]);
1565
- }
1566
- var Ge;
1567
- (function(e) {
1568
- e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
1569
- })(Ge || (Ge = {}));
1570
- var Rt;
1571
- (function(e) {
1572
- e.Optimized = "optimized";
1573
- })(Rt || (Rt = {}));
1574
- const _t = /* @__PURE__ */ new Map();
1575
- function Qr(e, t) {
1576
- let {
1577
- dragging: n,
1578
- dependencies: r,
1579
- config: o
1580
- } = t;
1581
- const [i, s] = Q(null), {
1582
- frequency: a,
1583
- measure: l,
1584
- strategy: u
1585
- } = o, c = L(e), d = b(), f = Ve(d), h = K(function(x) {
1586
- x === void 0 && (x = []), !f.current && s((p) => p === null ? x : p.concat(x.filter((y) => !p.includes(y))));
1587
- }, [f]), v = L(null), g = Ze((x) => {
1588
- if (d && !n)
1589
- return _t;
1590
- if (!x || x === _t || c.current !== e || i != null) {
1591
- const p = /* @__PURE__ */ new Map();
1592
- for (let y of e) {
1593
- if (!y)
1594
- continue;
1595
- if (i && i.length > 0 && !i.includes(y.id) && y.rect.current) {
1596
- p.set(y.id, y.rect.current);
1597
- continue;
1598
- }
1599
- const R = y.node.current, S = R ? new Nt(l(R), R) : null;
1600
- y.rect.current = S, S && p.set(y.id, S);
1601
- }
1602
- return p;
1603
- }
1604
- return x;
1605
- }, [e, i, n, d, l]);
1606
- return M(() => {
1607
- c.current = e;
1608
- }, [e]), M(
1609
- () => {
1610
- d || h();
1611
- },
1612
- // eslint-disable-next-line react-hooks/exhaustive-deps
1613
- [n, d]
1614
- ), M(
1615
- () => {
1616
- i && i.length > 0 && s(null);
1617
- },
1618
- //eslint-disable-next-line react-hooks/exhaustive-deps
1619
- [JSON.stringify(i)]
1620
- ), M(
1621
- () => {
1622
- d || typeof a != "number" || v.current !== null || (v.current = setTimeout(() => {
1623
- h(), v.current = null;
1624
- }, a));
1625
- },
1626
- // eslint-disable-next-line react-hooks/exhaustive-deps
1627
- [a, d, h, ...r]
1628
- ), {
1629
- droppableRects: g,
1630
- measureDroppableContainers: h,
1631
- measuringScheduled: i != null
1632
- };
1633
- function b() {
1634
- switch (u) {
1635
- case Ge.Always:
1636
- return !1;
1637
- case Ge.BeforeDragging:
1638
- return n;
1639
- default:
1640
- return !n;
1641
- }
1642
- }
1643
- }
1644
- function Sn(e, t) {
1645
- return Ze((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
1646
- }
1647
- function eo(e, t) {
1648
- return Sn(e, t);
1649
- }
1650
- function to(e) {
1651
- let {
1652
- callback: t,
1653
- disabled: n
1654
- } = e;
1655
- const r = kt(t), o = O(() => {
1656
- if (n || typeof window > "u" || typeof window.MutationObserver > "u")
1657
- return;
1658
- const {
1659
- MutationObserver: i
1660
- } = window;
1661
- return new i(r);
1662
- }, [r, n]);
1663
- return M(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1664
- }
1665
- function ft(e) {
1666
- let {
1667
- callback: t,
1668
- disabled: n
1669
- } = e;
1670
- const r = kt(t), o = O(
1671
- () => {
1672
- if (n || typeof window > "u" || typeof window.ResizeObserver > "u")
1673
- return;
1674
- const {
1675
- ResizeObserver: i
1676
- } = window;
1677
- return new i(r);
1678
- },
1679
- // eslint-disable-next-line react-hooks/exhaustive-deps
1680
- [n]
1681
- );
1682
- return M(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
1683
- }
1684
- function no(e) {
1685
- return new Nt(Pe(e), e);
1686
- }
1687
- function Zt(e, t, n) {
1688
- t === void 0 && (t = no);
1689
- const [r, o] = Q(null);
1690
- function i() {
1691
- o((l) => {
1692
- if (!e)
1693
- return null;
1694
- if (e.isConnected === !1) {
1695
- var u;
1696
- return (u = l ?? n) != null ? u : null;
1697
- }
1698
- const c = t(e);
1699
- return JSON.stringify(l) === JSON.stringify(c) ? l : c;
1700
- });
1701
- }
1702
- const s = to({
1703
- callback(l) {
1704
- if (e)
1705
- for (const u of l) {
1706
- const {
1707
- type: c,
1708
- target: d
1709
- } = u;
1710
- if (c === "childList" && d instanceof HTMLElement && d.contains(e)) {
1711
- i();
1712
- break;
1713
- }
1714
- }
1715
- }
1716
- }), a = ft({
1717
- callback: i
1718
- });
1719
- return fe(() => {
1720
- i(), e ? (a == null || a.observe(e), s == null || s.observe(document.body, {
1721
- childList: !0,
1722
- subtree: !0
1723
- })) : (a == null || a.disconnect(), s == null || s.disconnect());
1724
- }, [e]), r;
1725
- }
1726
- function ro(e) {
1727
- const t = Sn(e);
1728
- return gn(e, t);
1729
- }
1730
- const Qt = [];
1731
- function oo(e) {
1732
- const t = L(e), n = Ze((r) => e ? r && r !== Qt && e && t.current && e.parentNode === t.current.parentNode ? r : At(e) : Qt, [e]);
1733
- return M(() => {
1734
- t.current = e;
1735
- }, [e]), n;
1736
- }
1737
- function io(e) {
1738
- const [t, n] = Q(null), r = L(e), o = K((i) => {
1739
- const s = yt(i.target);
1740
- s && n((a) => a ? (a.set(s, Dt(s)), new Map(a)) : null);
1741
- }, []);
1742
- return M(() => {
1743
- const i = r.current;
1744
- if (e !== i) {
1745
- s(i);
1746
- const a = e.map((l) => {
1747
- const u = yt(l);
1748
- return u ? (u.addEventListener("scroll", o, {
1749
- passive: !0
1750
- }), [u, Dt(u)]) : null;
1751
- }).filter((l) => l != null);
1752
- n(a.length ? new Map(a) : null), r.current = e;
1753
- }
1754
- return () => {
1755
- s(e), s(i);
1756
- };
1757
- function s(a) {
1758
- a.forEach((l) => {
1759
- const u = yt(l);
1760
- u == null || u.removeEventListener("scroll", o);
1761
- });
1762
- }
1763
- }, [o, e]), O(() => e.length ? t ? Array.from(t.values()).reduce((i, s) => Le(i, s), ie) : wn(e) : ie, [e, t]);
1764
- }
1765
- function en(e, t) {
1766
- t === void 0 && (t = []);
1767
- const n = L(null);
1768
- return M(
1769
- () => {
1770
- n.current = null;
1771
- },
1772
- // eslint-disable-next-line react-hooks/exhaustive-deps
1773
- t
1774
- ), M(() => {
1775
- const r = e !== ie;
1776
- r && !n.current && (n.current = e), !r && n.current && (n.current = null);
1777
- }, [e]), n.current ? lt(e, n.current) : ie;
1778
- }
1779
- function so(e) {
1780
- M(
1781
- () => {
1782
- if (!dt)
1783
- return;
1784
- const t = e.map((n) => {
1785
- let {
1786
- sensor: r
1787
- } = n;
1788
- return r.setup == null ? void 0 : r.setup();
1789
- });
1790
- return () => {
1791
- for (const n of t)
1792
- n == null || n();
1793
- };
1794
- },
1795
- // TO-DO: Sensors length could theoretically change which would not be a valid dependency
1796
- // eslint-disable-next-line react-hooks/exhaustive-deps
1797
- e.map((t) => {
1798
- let {
1799
- sensor: n
1800
- } = t;
1801
- return n;
1802
- })
1803
- );
1804
- }
1805
- function ao(e, t) {
1806
- return O(() => e.reduce((n, r) => {
1807
- let {
1808
- eventName: o,
1809
- handler: i
1810
- } = r;
1811
- return n[o] = (s) => {
1812
- i(s, t);
1813
- }, n;
1814
- }, {}), [e, t]);
1815
- }
1816
- function Dn(e) {
1817
- return O(() => e ? Nr(e) : null, [e]);
1818
- }
1819
- const tn = [];
1820
- function lo(e, t) {
1821
- t === void 0 && (t = Pe);
1822
- const [n] = e, r = Dn(n ? q(n) : null), [o, i] = Q(tn);
1823
- function s() {
1824
- i(() => e.length ? e.map((l) => yn(l) ? r : new Nt(t(l), l)) : tn);
1825
- }
1826
- const a = ft({
1827
- callback: s
1828
- });
1829
- return fe(() => {
1830
- a == null || a.disconnect(), s(), e.forEach((l) => a == null ? void 0 : a.observe(l));
1831
- }, [e]), o;
1832
- }
1833
- function co(e) {
1834
- if (!e)
1835
- return null;
1836
- if (e.children.length > 1)
1837
- return e;
1838
- const t = e.children[0];
1839
- return _e(t) ? t : e;
1840
- }
1841
- function uo(e) {
1842
- let {
1843
- measure: t
1844
- } = e;
1845
- const [n, r] = Q(null), o = K((u) => {
1846
- for (const {
1847
- target: c
1848
- } of u)
1849
- if (_e(c)) {
1850
- r((d) => {
1851
- const f = t(c);
1852
- return d ? {
1853
- ...d,
1854
- width: f.width,
1855
- height: f.height
1856
- } : f;
1857
- });
1858
- break;
1859
- }
1860
- }, [t]), i = ft({
1861
- callback: o
1862
- }), s = K((u) => {
1863
- const c = co(u);
1864
- i == null || i.disconnect(), c && (i == null || i.observe(c)), r(c ? t(c) : null);
1865
- }, [t, i]), [a, l] = at(s);
1866
- return O(() => ({
1867
- nodeRef: a,
1868
- rect: n,
1869
- setRef: l
1870
- }), [n, a, l]);
1871
- }
1872
- const fo = [{
1873
- sensor: Lt,
1874
- options: {}
1875
- }, {
1876
- sensor: Ot,
1877
- options: {}
1878
- }], ho = {
1879
- current: {}
1880
- }, st = {
1881
- draggable: {
1882
- measure: Vt
1883
- },
1884
- droppable: {
1885
- measure: Vt,
1886
- strategy: Ge.WhileDragging,
1887
- frequency: Rt.Optimized
1888
- },
1889
- dragOverlay: {
1890
- measure: Pe
1891
- }
1892
- };
1893
- class Ue extends Map {
1894
- get(t) {
1895
- var n;
1896
- return t != null && (n = super.get(t)) != null ? n : void 0;
1897
- }
1898
- toArray() {
1899
- return Array.from(this.values());
1900
- }
1901
- getEnabled() {
1902
- return this.toArray().filter((t) => {
1903
- let {
1904
- disabled: n
1905
- } = t;
1906
- return !n;
1907
- });
1908
- }
1909
- getNodeFor(t) {
1910
- var n, r;
1911
- return (n = (r = this.get(t)) == null ? void 0 : r.node.current) != null ? n : void 0;
1912
- }
1913
- }
1914
- const go = {
1915
- activatorEvent: null,
1916
- active: null,
1917
- activeNode: null,
1918
- activeNodeRect: null,
1919
- collisions: null,
1920
- containerNodeRect: null,
1921
- draggableNodes: /* @__PURE__ */ new Map(),
1922
- droppableRects: /* @__PURE__ */ new Map(),
1923
- droppableContainers: /* @__PURE__ */ new Ue(),
1924
- over: null,
1925
- dragOverlay: {
1926
- nodeRef: {
1927
- current: null
1928
- },
1929
- rect: null,
1930
- setRef: ct
1931
- },
1932
- scrollableAncestors: [],
1933
- scrollableAncestorRects: [],
1934
- measuringConfiguration: st,
1935
- measureDroppableContainers: ct,
1936
- windowRect: null,
1937
- measuringScheduled: !1
1938
- }, bo = {
1939
- activatorEvent: null,
1940
- activators: [],
1941
- active: null,
1942
- activeNodeRect: null,
1943
- ariaDescribedById: {
1944
- draggable: ""
1945
- },
1946
- dispatch: ct,
1947
- draggableNodes: /* @__PURE__ */ new Map(),
1948
- over: null,
1949
- measureDroppableContainers: ct
1950
- }, ht = /* @__PURE__ */ Je(bo), Cn = /* @__PURE__ */ Je(go);
1951
- function vo() {
1952
- return {
1953
- draggable: {
1954
- active: null,
1955
- initialCoordinates: {
1956
- x: 0,
1957
- y: 0
1958
- },
1959
- nodes: /* @__PURE__ */ new Map(),
1960
- translate: {
1961
- x: 0,
1962
- y: 0
1963
- }
1964
- },
1965
- droppable: {
1966
- containers: new Ue()
1967
- }
1968
- };
1969
- }
1970
- function po(e, t) {
1971
- switch (t.type) {
1972
- case $.DragStart:
1973
- return {
1974
- ...e,
1975
- draggable: {
1976
- ...e.draggable,
1977
- initialCoordinates: t.initialCoordinates,
1978
- active: t.active
1979
- }
1980
- };
1981
- case $.DragMove:
1982
- return e.draggable.active == null ? e : {
1983
- ...e,
1984
- draggable: {
1985
- ...e.draggable,
1986
- translate: {
1987
- x: t.coordinates.x - e.draggable.initialCoordinates.x,
1988
- y: t.coordinates.y - e.draggable.initialCoordinates.y
1989
- }
1990
- }
1991
- };
1992
- case $.DragEnd:
1993
- case $.DragCancel:
1994
- return {
1995
- ...e,
1996
- draggable: {
1997
- ...e.draggable,
1998
- active: null,
1999
- initialCoordinates: {
2000
- x: 0,
2001
- y: 0
2002
- },
2003
- translate: {
2004
- x: 0,
2005
- y: 0
2006
- }
2007
- }
2008
- };
2009
- case $.RegisterDroppable: {
2010
- const {
2011
- element: n
2012
- } = t, {
2013
- id: r
2014
- } = n, o = new Ue(e.droppable.containers);
2015
- return o.set(r, n), {
2016
- ...e,
2017
- droppable: {
2018
- ...e.droppable,
2019
- containers: o
2020
- }
2021
- };
2022
- }
2023
- case $.SetDroppableDisabled: {
2024
- const {
2025
- id: n,
2026
- key: r,
2027
- disabled: o
2028
- } = t, i = e.droppable.containers.get(n);
2029
- if (!i || r !== i.key)
2030
- return e;
2031
- const s = new Ue(e.droppable.containers);
2032
- return s.set(n, {
2033
- ...i,
2034
- disabled: o
2035
- }), {
2036
- ...e,
2037
- droppable: {
2038
- ...e.droppable,
2039
- containers: s
2040
- }
2041
- };
2042
- }
2043
- case $.UnregisterDroppable: {
2044
- const {
2045
- id: n,
2046
- key: r
2047
- } = t, o = e.droppable.containers.get(n);
2048
- if (!o || r !== o.key)
2049
- return e;
2050
- const i = new Ue(e.droppable.containers);
2051
- return i.delete(n), {
2052
- ...e,
2053
- droppable: {
2054
- ...e.droppable,
2055
- containers: i
2056
- }
2057
- };
2058
- }
2059
- default:
2060
- return e;
2061
- }
2062
- }
2063
- function yo(e) {
2064
- let {
2065
- disabled: t
2066
- } = e;
2067
- const {
2068
- active: n,
2069
- activatorEvent: r,
2070
- draggableNodes: o
2071
- } = Ie(ht), i = mt(r), s = mt(n == null ? void 0 : n.id);
2072
- return M(() => {
2073
- if (!t && !r && i && s != null) {
2074
- if (!Tt(i) || document.activeElement === i.target)
2075
- return;
2076
- const a = o.get(s);
2077
- if (!a)
2078
- return;
2079
- const {
2080
- activatorNode: l,
2081
- node: u
2082
- } = a;
2083
- if (!l.current && !u.current)
2084
- return;
2085
- requestAnimationFrame(() => {
2086
- for (const c of [l.current, u.current]) {
2087
- if (!c)
2088
- continue;
2089
- const d = ar(c);
2090
- if (d) {
2091
- d.focus();
2092
- break;
2093
- }
2094
- }
2095
- });
2096
- }
2097
- }, [r, t, o, s, i]), null;
2098
- }
2099
- function xo(e, t) {
2100
- let {
2101
- transform: n,
2102
- ...r
2103
- } = t;
2104
- return e != null && e.length ? e.reduce((o, i) => i({
2105
- transform: o,
2106
- ...r
2107
- }), n) : n;
2108
- }
2109
- function wo(e) {
2110
- return O(
2111
- () => ({
2112
- draggable: {
2113
- ...st.draggable,
2114
- ...e == null ? void 0 : e.draggable
2115
- },
2116
- droppable: {
2117
- ...st.droppable,
2118
- ...e == null ? void 0 : e.droppable
2119
- },
2120
- dragOverlay: {
2121
- ...st.dragOverlay,
2122
- ...e == null ? void 0 : e.dragOverlay
2123
- }
2124
- }),
2125
- // eslint-disable-next-line react-hooks/exhaustive-deps
2126
- [e == null ? void 0 : e.draggable, e == null ? void 0 : e.droppable, e == null ? void 0 : e.dragOverlay]
2127
- );
2128
- }
2129
- function mo(e) {
2130
- let {
2131
- activeNode: t,
2132
- measure: n,
2133
- initialRect: r,
2134
- config: o = !0
2135
- } = e;
2136
- const i = L(!1), {
2137
- x: s,
2138
- y: a
2139
- } = typeof o == "boolean" ? {
2140
- x: o,
2141
- y: o
2142
- } : o;
2143
- fe(() => {
2144
- if (!s && !a || !t) {
2145
- i.current = !1;
2146
- return;
2147
- }
2148
- if (i.current || !r)
2149
- return;
2150
- const u = t == null ? void 0 : t.node.current;
2151
- if (!u || u.isConnected === !1)
2152
- return;
2153
- const c = n(u), d = gn(c, r);
2154
- if (s || (d.x = 0), a || (d.y = 0), i.current = !0, Math.abs(d.x) > 0 || Math.abs(d.y) > 0) {
2155
- const f = bn(u);
2156
- f && f.scrollBy({
2157
- top: d.y,
2158
- left: d.x
2159
- });
2160
- }
2161
- }, [t, s, a, r, n]);
2162
- }
2163
- const Rn = /* @__PURE__ */ Je({
2164
- ...ie,
2165
- scaleX: 1,
2166
- scaleY: 1
2167
- });
2168
- var De;
2169
- (function(e) {
2170
- e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
2171
- })(De || (De = {}));
2172
- const So = /* @__PURE__ */ Fn(function(t) {
2173
- var n, r, o, i;
2174
- let {
2175
- id: s,
2176
- accessibility: a,
2177
- autoScroll: l = !0,
2178
- children: u,
2179
- sensors: c = fo,
2180
- collisionDetection: d = Cr,
2181
- measuring: f,
2182
- modifiers: h,
2183
- ...v
2184
- } = t;
2185
- const g = Hn(po, void 0, vo), [b, x] = g, [p, y] = hr(), [R, S] = Q(De.Uninitialized), I = R === De.Initialized, {
2186
- draggable: {
2187
- active: m,
2188
- nodes: w,
2189
- translate: D
2190
- },
2191
- droppable: {
2192
- containers: N
2193
- }
2194
- } = b, C = m != null ? w.get(m) : null, P = L({
2195
- initial: null,
2196
- translated: null
2197
- }), j = O(() => {
2198
- var Y;
2199
- return m != null ? {
2200
- id: m,
2201
- // It's possible for the active node to unmount while dragging
2202
- data: (Y = C == null ? void 0 : C.data) != null ? Y : ho,
2203
- rect: P
2204
- } : null;
2205
- }, [m, C]), T = L(null), [G, U] = Q(null), [k, se] = Q(null), B = Ve(v, Object.values(v)), ae = Qe("DndDescribedBy", s), le = O(() => N.getEnabled(), [N]), X = wo(f), {
2206
- droppableRects: he,
2207
- measureDroppableContainers: Re,
2208
- measuringScheduled: Be
2209
- } = Qr(le, {
2210
- dragging: I,
2211
- dependencies: [D.x, D.y],
2212
- config: X.droppable
2213
- }), ee = _r(w, m), et = O(() => k ? St(k) : null, [k]), pe = Bn(), ge = eo(ee, X.draggable.measure);
2214
- mo({
2215
- activeNode: m != null ? w.get(m) : null,
2216
- config: pe.layoutShiftCompensation,
2217
- initialRect: ge,
2218
- measure: X.draggable.measure
2219
- });
2220
- const A = Zt(ee, X.draggable.measure, ge), $e = Zt(ee ? ee.parentElement : null), ce = L({
2221
- activatorEvent: null,
2222
- active: null,
2223
- activeNode: ee,
2224
- collisionRect: null,
2225
- collisions: null,
2226
- droppableRects: he,
2227
- draggableNodes: w,
2228
- draggingNode: null,
2229
- draggingNodeRect: null,
2230
- droppableContainers: N,
2231
- over: null,
2232
- scrollableAncestors: [],
2233
- scrollAdjustedTranslate: null
2234
- }), Ee = N.getNodeFor((n = ce.current.over) == null ? void 0 : n.id), be = uo({
2235
- measure: X.dragOverlay.measure
2236
- }), ke = (r = be.nodeRef.current) != null ? r : ee, Te = I ? (o = be.rect) != null ? o : A : null, jt = !!(be.nodeRef.current && be.rect), Pt = ro(jt ? null : A), gt = Dn(ke ? q(ke) : null), ye = oo(I ? Ee ?? ee : null), tt = lo(ye), nt = xo(h, {
2237
- transform: {
2238
- x: D.x - Pt.x,
2239
- y: D.y - Pt.y,
2240
- scaleX: 1,
2241
- scaleY: 1
2242
- },
2243
- activatorEvent: k,
2244
- active: j,
2245
- activeNodeRect: A,
2246
- containerNodeRect: $e,
2247
- draggingNodeRect: Te,
2248
- over: ce.current.over,
2249
- overlayNodeRect: be.rect,
2250
- scrollableAncestors: ye,
2251
- scrollableAncestorRects: tt,
2252
- windowRect: gt
2253
- }), Bt = et ? Le(et, D) : null, $t = io(ye), Nn = en($t), On = en($t, [A]), Ae = Le(nt, Nn), Ne = Te ? Er(Te, nt) : null, Fe = j && Ne ? d({
2254
- active: j,
2255
- collisionRect: Ne,
2256
- droppableRects: he,
2257
- droppableContainers: le,
2258
- pointerCoordinates: Bt
2259
- }) : null, Ft = mr(Fe, "id"), [xe, Ht] = Q(null), Mn = jt ? nt : Le(nt, On), Ln = Rr(Mn, (i = xe == null ? void 0 : xe.rect) != null ? i : null, A), bt = L(null), Wt = K(
2260
- (Y, J) => {
2261
- let {
2262
- sensor: _,
2263
- options: we
2264
- } = J;
2265
- if (T.current == null)
2266
- return;
2267
- const te = w.get(T.current);
2268
- if (!te)
2269
- return;
2270
- const Z = Y.nativeEvent, ue = new _({
2271
- active: T.current,
2272
- activeNode: te,
2273
- event: Z,
2274
- options: we,
2275
- // Sensors need to be instantiated with refs for arguments that change over time
2276
- // otherwise they are frozen in time with the stale arguments
2277
- context: ce,
2278
- onAbort(H) {
2279
- if (!w.get(H))
2280
- return;
2281
- const {
2282
- onDragAbort: de
2283
- } = B.current, ve = {
2284
- id: H
2285
- };
2286
- de == null || de(ve), p({
2287
- type: "onDragAbort",
2288
- event: ve
2289
- });
2290
- },
2291
- onPending(H, me, de, ve) {
2292
- if (!w.get(H))
2293
- return;
2294
- const {
2295
- onDragPending: We
2296
- } = B.current, Se = {
2297
- id: H,
2298
- constraint: me,
2299
- initialCoordinates: de,
2300
- offset: ve
2301
- };
2302
- We == null || We(Se), p({
2303
- type: "onDragPending",
2304
- event: Se
2305
- });
2306
- },
2307
- onStart(H) {
2308
- const me = T.current;
2309
- if (me == null)
2310
- return;
2311
- const de = w.get(me);
2312
- if (!de)
2313
- return;
2314
- const {
2315
- onDragStart: ve
2316
- } = B.current, He = {
2317
- activatorEvent: Z,
2318
- active: {
2319
- id: me,
2320
- data: de.data,
2321
- rect: P
2322
- }
2323
- };
2324
- rt(() => {
2325
- ve == null || ve(He), S(De.Initializing), x({
2326
- type: $.DragStart,
2327
- initialCoordinates: H,
2328
- active: me
2329
- }), p({
2330
- type: "onDragStart",
2331
- event: He
2332
- }), U(bt.current), se(Z);
2333
- });
2334
- },
2335
- onMove(H) {
2336
- x({
2337
- type: $.DragMove,
2338
- coordinates: H
2339
- });
2340
- },
2341
- onEnd: Oe($.DragEnd),
2342
- onCancel: Oe($.DragCancel)
2343
- });
2344
- bt.current = ue;
2345
- function Oe(H) {
2346
- return async function() {
2347
- const {
2348
- active: de,
2349
- collisions: ve,
2350
- over: He,
2351
- scrollAdjustedTranslate: We
2352
- } = ce.current;
2353
- let Se = null;
2354
- if (de && We) {
2355
- const {
2356
- cancelDrop: Xe
2357
- } = B.current;
2358
- Se = {
2359
- activatorEvent: Z,
2360
- active: de,
2361
- collisions: ve,
2362
- delta: We,
2363
- over: He
2364
- }, H === $.DragEnd && typeof Xe == "function" && await Promise.resolve(Xe(Se)) && (H = $.DragCancel);
2365
- }
2366
- T.current = null, rt(() => {
2367
- x({
2368
- type: H
2369
- }), S(De.Uninitialized), Ht(null), U(null), se(null), bt.current = null;
2370
- const Xe = H === $.DragEnd ? "onDragEnd" : "onDragCancel";
2371
- if (Se) {
2372
- const vt = B.current[Xe];
2373
- vt == null || vt(Se), p({
2374
- type: Xe,
2375
- event: Se
2376
- });
2377
- }
2378
- });
2379
- };
2380
- }
2381
- },
2382
- // eslint-disable-next-line react-hooks/exhaustive-deps
2383
- [w]
2384
- ), zn = K((Y, J) => (_, we) => {
2385
- const te = _.nativeEvent, Z = w.get(we);
2386
- if (
2387
- // Another sensor is already instantiating
2388
- T.current !== null || // No active draggable
2389
- !Z || // Event has already been captured
2390
- te.dndKit || te.defaultPrevented
2391
- )
2392
- return;
2393
- const ue = {
2394
- active: Z
2395
- };
2396
- Y(_, J.options, ue) === !0 && (te.dndKit = {
2397
- capturedBy: J.sensor
2398
- }, T.current = we, Wt(_, J));
2399
- }, [w, Wt]), Xt = Zr(c, zn);
2400
- so(c), fe(() => {
2401
- A && R === De.Initializing && S(De.Initialized);
2402
- }, [A, R]), M(
2403
- () => {
2404
- const {
2405
- onDragMove: Y
2406
- } = B.current, {
2407
- active: J,
2408
- activatorEvent: _,
2409
- collisions: we,
2410
- over: te
2411
- } = ce.current;
2412
- if (!J || !_)
2413
- return;
2414
- const Z = {
2415
- active: J,
2416
- activatorEvent: _,
2417
- collisions: we,
2418
- delta: {
2419
- x: Ae.x,
2420
- y: Ae.y
2421
- },
2422
- over: te
2423
- };
2424
- rt(() => {
2425
- Y == null || Y(Z), p({
2426
- type: "onDragMove",
2427
- event: Z
2428
- });
2429
- });
2430
- },
2431
- // eslint-disable-next-line react-hooks/exhaustive-deps
2432
- [Ae.x, Ae.y]
2433
- ), M(
2434
- () => {
2435
- const {
2436
- active: Y,
2437
- activatorEvent: J,
2438
- collisions: _,
2439
- droppableContainers: we,
2440
- scrollAdjustedTranslate: te
2441
- } = ce.current;
2442
- if (!Y || T.current == null || !J || !te)
2443
- return;
2444
- const {
2445
- onDragOver: Z
2446
- } = B.current, ue = we.get(Ft), Oe = ue && ue.rect.current ? {
2447
- id: ue.id,
2448
- rect: ue.rect.current,
2449
- data: ue.data,
2450
- disabled: ue.disabled
2451
- } : null, H = {
2452
- active: Y,
2453
- activatorEvent: J,
2454
- collisions: _,
2455
- delta: {
2456
- x: te.x,
2457
- y: te.y
2458
- },
2459
- over: Oe
2460
- };
2461
- rt(() => {
2462
- Ht(Oe), Z == null || Z(H), p({
2463
- type: "onDragOver",
2464
- event: H
2465
- });
2466
- });
2467
- },
2468
- // eslint-disable-next-line react-hooks/exhaustive-deps
2469
- [Ft]
2470
- ), fe(() => {
2471
- ce.current = {
2472
- activatorEvent: k,
2473
- active: j,
2474
- activeNode: ee,
2475
- collisionRect: Ne,
2476
- collisions: Fe,
2477
- droppableRects: he,
2478
- draggableNodes: w,
2479
- draggingNode: ke,
2480
- draggingNodeRect: Te,
2481
- droppableContainers: N,
2482
- over: xe,
2483
- scrollableAncestors: ye,
2484
- scrollAdjustedTranslate: Ae
2485
- }, P.current = {
2486
- initial: Te,
2487
- translated: Ne
2488
- };
2489
- }, [j, ee, Fe, Ne, w, ke, Te, he, N, xe, ye, Ae]), qr({
2490
- ...pe,
2491
- delta: D,
2492
- draggingRect: Ne,
2493
- pointerCoordinates: Bt,
2494
- scrollableAncestors: ye,
2495
- scrollableAncestorRects: tt
2496
- });
2497
- const jn = O(() => ({
2498
- active: j,
2499
- activeNode: ee,
2500
- activeNodeRect: A,
2501
- activatorEvent: k,
2502
- collisions: Fe,
2503
- containerNodeRect: $e,
2504
- dragOverlay: be,
2505
- draggableNodes: w,
2506
- droppableContainers: N,
2507
- droppableRects: he,
2508
- over: xe,
2509
- measureDroppableContainers: Re,
2510
- scrollableAncestors: ye,
2511
- scrollableAncestorRects: tt,
2512
- measuringConfiguration: X,
2513
- measuringScheduled: Be,
2514
- windowRect: gt
2515
- }), [j, ee, A, k, Fe, $e, be, w, N, he, xe, Re, ye, tt, X, Be, gt]), Pn = O(() => ({
2516
- activatorEvent: k,
2517
- activators: Xt,
2518
- active: j,
2519
- activeNodeRect: A,
2520
- ariaDescribedById: {
2521
- draggable: ae
2522
- },
2523
- dispatch: x,
2524
- draggableNodes: w,
2525
- over: xe,
2526
- measureDroppableContainers: Re
2527
- }), [k, Xt, j, A, x, ae, w, xe, Re]);
2528
- return V.createElement(hn.Provider, {
2529
- value: y
2530
- }, V.createElement(ht.Provider, {
2531
- value: Pn
2532
- }, V.createElement(Cn.Provider, {
2533
- value: jn
2534
- }, V.createElement(Rn.Provider, {
2535
- value: Ln
2536
- }, u)), V.createElement(yo, {
2537
- disabled: (a == null ? void 0 : a.restoreFocus) === !1
2538
- })), V.createElement(vr, {
2539
- ...a,
2540
- hiddenTextDescribedById: ae
2541
- }));
2542
- function Bn() {
2543
- const Y = (G == null ? void 0 : G.autoScrollEnabled) === !1, J = typeof l == "object" ? l.enabled === !1 : l === !1, _ = I && !Y && !J;
2544
- return typeof l == "object" ? {
2545
- ...l,
2546
- enabled: _
2547
- } : {
2548
- enabled: _
2549
- };
2550
- }
2551
- }), Do = /* @__PURE__ */ Je(null), nn = "button", Co = "Draggable";
2552
- function Ro(e) {
2553
- let {
2554
- id: t,
2555
- data: n,
2556
- disabled: r = !1,
2557
- attributes: o
2558
- } = e;
2559
- const i = Qe(Co), {
2560
- activators: s,
2561
- activatorEvent: a,
2562
- active: l,
2563
- activeNodeRect: u,
2564
- ariaDescribedById: c,
2565
- draggableNodes: d,
2566
- over: f
2567
- } = Ie(ht), {
2568
- role: h = nn,
2569
- roleDescription: v = "draggable",
2570
- tabIndex: g = 0
2571
- } = o ?? {}, b = (l == null ? void 0 : l.id) === t, x = Ie(b ? Rn : Do), [p, y] = at(), [R, S] = at(), I = ao(s, t), m = Ve(n);
2572
- fe(
2573
- () => (d.set(t, {
2574
- id: t,
2575
- key: i,
2576
- node: p,
2577
- activatorNode: R,
2578
- data: m
2579
- }), () => {
2580
- const D = d.get(t);
2581
- D && D.key === i && d.delete(t);
2582
- }),
2583
- // eslint-disable-next-line react-hooks/exhaustive-deps
2584
- [d, t]
2585
- );
2586
- const w = O(() => ({
2587
- role: h,
2588
- tabIndex: g,
2589
- "aria-disabled": r,
2590
- "aria-pressed": b && h === nn ? !0 : void 0,
2591
- "aria-roledescription": v,
2592
- "aria-describedby": c.draggable
2593
- }), [r, h, g, b, v, c.draggable]);
2594
- return {
2595
- active: l,
2596
- activatorEvent: a,
2597
- activeNodeRect: u,
2598
- attributes: w,
2599
- isDragging: b,
2600
- listeners: r ? void 0 : I,
2601
- node: p,
2602
- over: f,
2603
- setNodeRef: y,
2604
- setActivatorNodeRef: S,
2605
- transform: x
2606
- };
2607
- }
2608
- function Io() {
2609
- return Ie(Cn);
2610
- }
2611
- const Eo = "Droppable", ko = {
2612
- timeout: 25
2613
- };
2614
- function To(e) {
2615
- let {
2616
- data: t,
2617
- disabled: n = !1,
2618
- id: r,
2619
- resizeObserverConfig: o
2620
- } = e;
2621
- const i = Qe(Eo), {
2622
- active: s,
2623
- dispatch: a,
2624
- over: l,
2625
- measureDroppableContainers: u
2626
- } = Ie(ht), c = L({
2627
- disabled: n
2628
- }), d = L(!1), f = L(null), h = L(null), {
2629
- disabled: v,
2630
- updateMeasurementsFor: g,
2631
- timeout: b
2632
- } = {
2633
- ...ko,
2634
- ...o
2635
- }, x = Ve(g ?? r), p = K(
2636
- () => {
2637
- if (!d.current) {
2638
- d.current = !0;
2639
- return;
2640
- }
2641
- h.current != null && clearTimeout(h.current), h.current = setTimeout(() => {
2642
- u(Array.isArray(x.current) ? x.current : [x.current]), h.current = null;
2643
- }, b);
2644
- },
2645
- //eslint-disable-next-line react-hooks/exhaustive-deps
2646
- [b]
2647
- ), y = ft({
2648
- callback: p,
2649
- disabled: v || !s
2650
- }), R = K((w, D) => {
2651
- y && (D && (y.unobserve(D), d.current = !1), w && y.observe(w));
2652
- }, [y]), [S, I] = at(R), m = Ve(t);
2653
- return M(() => {
2654
- !y || !S.current || (y.disconnect(), d.current = !1, y.observe(S.current));
2655
- }, [S, y]), M(
2656
- () => (a({
2657
- type: $.RegisterDroppable,
2658
- element: {
2659
- id: r,
2660
- key: i,
2661
- disabled: n,
2662
- node: S,
2663
- rect: f,
2664
- data: m
2665
- }
2666
- }), () => a({
2667
- type: $.UnregisterDroppable,
2668
- key: i,
2669
- id: r
2670
- })),
2671
- // eslint-disable-next-line react-hooks/exhaustive-deps
2672
- [r]
2673
- ), M(() => {
2674
- n !== c.current.disabled && (a({
2675
- type: $.SetDroppableDisabled,
2676
- id: r,
2677
- key: i,
2678
- disabled: n
2679
- }), c.current.disabled = n);
2680
- }, [r, i, n, a]), {
2681
- active: s,
2682
- rect: f,
2683
- isOver: (l == null ? void 0 : l.id) === r,
2684
- node: S,
2685
- over: l,
2686
- setNodeRef: I
2687
- };
2688
- }
2689
- function zt(e, t, n) {
2690
- const r = e.slice();
2691
- return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
2692
- }
2693
- function Ao(e, t) {
2694
- return e.reduce((n, r, o) => {
2695
- const i = t.get(r);
2696
- return i && (n[o] = i), n;
2697
- }, Array(e.length));
2698
- }
2699
- function ot(e) {
2700
- return e !== null && e >= 0;
2701
- }
2702
- function No(e, t) {
2703
- if (e === t)
2704
- return !0;
2705
- if (e.length !== t.length)
2706
- return !1;
2707
- for (let n = 0; n < e.length; n++)
2708
- if (e[n] !== t[n])
2709
- return !1;
2710
- return !0;
2711
- }
2712
- function Oo(e) {
2713
- return typeof e == "boolean" ? {
2714
- draggable: e,
2715
- droppable: e
2716
- } : e;
2717
- }
2718
- const it = {
2719
- scaleX: 1,
2720
- scaleY: 1
2721
- }, Mo = (e) => {
2722
- var t;
2723
- let {
2724
- rects: n,
2725
- activeNodeRect: r,
2726
- activeIndex: o,
2727
- overIndex: i,
2728
- index: s
2729
- } = e;
2730
- const a = (t = n[o]) != null ? t : r;
2731
- if (!a)
2732
- return null;
2733
- const l = Lo(n, s, o);
2734
- if (s === o) {
2735
- const u = n[i];
2736
- return u ? {
2737
- x: o < i ? u.left + u.width - (a.left + a.width) : u.left - a.left,
2738
- y: 0,
2739
- ...it
2740
- } : null;
2741
- }
2742
- return s > o && s <= i ? {
2743
- x: -a.width - l,
2744
- y: 0,
2745
- ...it
2746
- } : s < o && s >= i ? {
2747
- x: a.width + l,
2748
- y: 0,
2749
- ...it
2750
- } : {
2751
- x: 0,
2752
- y: 0,
2753
- ...it
2754
- };
2755
- };
2756
- function Lo(e, t, n) {
2757
- const r = e[t], o = e[t - 1], i = e[t + 1];
2758
- return !r || !o && !i ? 0 : n < t ? o ? r.left - (o.left + o.width) : i.left - (r.left + r.width) : i ? i.left - (r.left + r.width) : r.left - (o.left + o.width);
2759
- }
2760
- const In = (e) => {
2761
- let {
2762
- rects: t,
2763
- activeIndex: n,
2764
- overIndex: r,
2765
- index: o
2766
- } = e;
2767
- const i = zt(t, r, n), s = t[o], a = i[o];
2768
- return !a || !s ? null : {
2769
- x: a.left - s.left,
2770
- y: a.top - s.top,
2771
- scaleX: a.width / s.width,
2772
- scaleY: a.height / s.height
2773
- };
2774
- }, En = "Sortable", kn = /* @__PURE__ */ V.createContext({
2775
- activeIndex: -1,
2776
- containerId: En,
2777
- disableTransforms: !1,
2778
- items: [],
2779
- overIndex: -1,
2780
- useDragOverlay: !1,
2781
- sortedRects: [],
2782
- strategy: In,
2783
- disabled: {
2784
- draggable: !1,
2785
- droppable: !1
2786
- }
2787
- });
2788
- function zo(e) {
2789
- let {
2790
- children: t,
2791
- id: n,
2792
- items: r,
2793
- strategy: o = In,
2794
- disabled: i = !1
2795
- } = e;
2796
- const {
2797
- active: s,
2798
- dragOverlay: a,
2799
- droppableRects: l,
2800
- over: u,
2801
- measureDroppableContainers: c
2802
- } = Io(), d = Qe(En, n), f = a.rect !== null, h = O(() => r.map((I) => typeof I == "object" && "id" in I ? I.id : I), [r]), v = s != null, g = s ? h.indexOf(s.id) : -1, b = u ? h.indexOf(u.id) : -1, x = L(h), p = !No(h, x.current), y = b !== -1 && g === -1 || p, R = Oo(i);
2803
- fe(() => {
2804
- p && v && c(h);
2805
- }, [p, h, v, c]), M(() => {
2806
- x.current = h;
2807
- }, [h]);
2808
- const S = O(
2809
- () => ({
2810
- activeIndex: g,
2811
- containerId: d,
2812
- disabled: R,
2813
- disableTransforms: y,
2814
- items: h,
2815
- overIndex: b,
2816
- useDragOverlay: f,
2817
- sortedRects: Ao(h, l),
2818
- strategy: o
2819
- }),
2820
- // eslint-disable-next-line react-hooks/exhaustive-deps
2821
- [g, d, R.draggable, R.droppable, y, h, b, l, f, o]
2822
- );
2823
- return V.createElement(kn.Provider, {
2824
- value: S
2825
- }, t);
2826
- }
2827
- const jo = (e) => {
2828
- let {
2829
- id: t,
2830
- items: n,
2831
- activeIndex: r,
2832
- overIndex: o
2833
- } = e;
2834
- return zt(n, r, o).indexOf(t);
2835
- }, Tn = (e) => {
2836
- let {
2837
- containerId: t,
2838
- isSorting: n,
2839
- wasDragging: r,
2840
- index: o,
2841
- items: i,
2842
- newIndex: s,
2843
- previousItems: a,
2844
- previousContainerId: l,
2845
- transition: u
2846
- } = e;
2847
- return !u || !r || a !== i && o === s ? !1 : n ? !0 : s !== o && t === l;
2848
- }, Po = {
2849
- duration: 200,
2850
- easing: "ease"
2851
- }, An = "transform", Bo = /* @__PURE__ */ qe.Transition.toString({
2852
- property: An,
2853
- duration: 0,
2854
- easing: "linear"
2855
- }), $o = {
2856
- roleDescription: "sortable"
2857
- };
2858
- function Fo(e) {
2859
- let {
2860
- disabled: t,
2861
- index: n,
2862
- node: r,
2863
- rect: o
2864
- } = e;
2865
- const [i, s] = Q(null), a = L(n);
2866
- return fe(() => {
2867
- if (!t && n !== a.current && r.current) {
2868
- const l = o.current;
2869
- if (l) {
2870
- const u = Pe(r.current, {
2871
- ignoreTransform: !0
2872
- }), c = {
2873
- x: l.left - u.left,
2874
- y: l.top - u.top,
2875
- scaleX: l.width / u.width,
2876
- scaleY: l.height / u.height
2877
- };
2878
- (c.x || c.y) && s(c);
2879
- }
2880
- }
2881
- n !== a.current && (a.current = n);
2882
- }, [t, n, r, o]), M(() => {
2883
- i && s(null);
2884
- }, [i]), i;
2885
- }
2886
- function Ho(e) {
2887
- let {
2888
- animateLayoutChanges: t = Tn,
2889
- attributes: n,
2890
- disabled: r,
2891
- data: o,
2892
- getNewIndex: i = jo,
2893
- id: s,
2894
- strategy: a,
2895
- resizeObserverConfig: l,
2896
- transition: u = Po
2897
- } = e;
2898
- const {
2899
- items: c,
2900
- containerId: d,
2901
- activeIndex: f,
2902
- disabled: h,
2903
- disableTransforms: v,
2904
- sortedRects: g,
2905
- overIndex: b,
2906
- useDragOverlay: x,
2907
- strategy: p
2908
- } = Ie(kn), y = Wo(r, h), R = c.indexOf(s), S = O(() => ({
2909
- sortable: {
2910
- containerId: d,
2911
- index: R,
2912
- items: c
2913
- },
2914
- ...o
2915
- }), [d, o, R, c]), I = O(() => c.slice(c.indexOf(s)), [c, s]), {
2916
- rect: m,
2917
- node: w,
2918
- isOver: D,
2919
- setNodeRef: N
2920
- } = To({
2921
- id: s,
2922
- data: S,
2923
- disabled: y.droppable,
2924
- resizeObserverConfig: {
2925
- updateMeasurementsFor: I,
2926
- ...l
2927
- }
2928
- }), {
2929
- active: C,
2930
- activatorEvent: P,
2931
- activeNodeRect: j,
2932
- attributes: T,
2933
- setNodeRef: G,
2934
- listeners: U,
2935
- isDragging: k,
2936
- over: se,
2937
- setActivatorNodeRef: B,
2938
- transform: ae
2939
- } = Ro({
2940
- id: s,
2941
- data: S,
2942
- attributes: {
2943
- ...$o,
2944
- ...n
2945
- },
2946
- disabled: y.draggable
2947
- }), le = rr(N, G), X = !!C, he = X && !v && ot(f) && ot(b), Re = !x && k, Be = Re && he ? ae : null, et = he ? Be ?? (a ?? p)({
2948
- rects: g,
2949
- activeNodeRect: j,
2950
- activeIndex: f,
2951
- overIndex: b,
2952
- index: R
2953
- }) : null, pe = ot(f) && ot(b) ? i({
2954
- id: s,
2955
- items: c,
2956
- activeIndex: f,
2957
- overIndex: b
2958
- }) : R, ge = C == null ? void 0 : C.id, A = L({
2959
- activeId: ge,
2960
- items: c,
2961
- newIndex: pe,
2962
- containerId: d
2963
- }), $e = c !== A.current.items, ce = t({
2964
- active: C,
2965
- containerId: d,
2966
- isDragging: k,
2967
- isSorting: X,
2968
- id: s,
2969
- index: R,
2970
- items: c,
2971
- newIndex: A.current.newIndex,
2972
- previousItems: A.current.items,
2973
- previousContainerId: A.current.containerId,
2974
- transition: u,
2975
- wasDragging: A.current.activeId != null
2976
- }), Ee = Fo({
2977
- disabled: !ce,
2978
- index: R,
2979
- node: w,
2980
- rect: m
2981
- });
2982
- return M(() => {
2983
- X && A.current.newIndex !== pe && (A.current.newIndex = pe), d !== A.current.containerId && (A.current.containerId = d), c !== A.current.items && (A.current.items = c);
2984
- }, [X, pe, d, c]), M(() => {
2985
- if (ge === A.current.activeId)
2986
- return;
2987
- if (ge != null && A.current.activeId == null) {
2988
- A.current.activeId = ge;
2989
- return;
2990
- }
2991
- const ke = setTimeout(() => {
2992
- A.current.activeId = ge;
2993
- }, 50);
2994
- return () => clearTimeout(ke);
2995
- }, [ge]), {
2996
- active: C,
2997
- activeIndex: f,
2998
- attributes: T,
2999
- data: S,
3000
- rect: m,
3001
- index: R,
3002
- newIndex: pe,
3003
- items: c,
3004
- isOver: D,
3005
- isSorting: X,
3006
- isDragging: k,
3007
- listeners: U,
3008
- node: w,
3009
- overIndex: b,
3010
- over: se,
3011
- setNodeRef: le,
3012
- setActivatorNodeRef: B,
3013
- setDroppableNodeRef: N,
3014
- setDraggableNodeRef: G,
3015
- transform: Ee ?? et,
3016
- transition: be()
3017
- };
3018
- function be() {
3019
- if (
3020
- // Temporarily disable transitions for a single frame to set up derived transforms
3021
- Ee || // Or to prevent items jumping to back to their "new" position when items change
3022
- $e && A.current.newIndex === R
3023
- )
3024
- return Bo;
3025
- if (!(Re && !Tt(P) || !u) && (X || ce))
3026
- return qe.Transition.toString({
3027
- ...u,
3028
- property: An
3029
- });
3030
- }
3031
- }
3032
- function Wo(e, t) {
3033
- var n, r;
3034
- return typeof e == "boolean" ? {
3035
- draggable: e,
3036
- // Backwards compatibility
3037
- droppable: !1
3038
- } : {
3039
- draggable: (n = e == null ? void 0 : e.draggable) != null ? n : t.draggable,
3040
- droppable: (r = e == null ? void 0 : e.droppable) != null ? r : t.droppable
3041
- };
3042
- }
3043
- E.Down, E.Right, E.Up, E.Left;
3044
- const Xo = ({ className: e }) => /* @__PURE__ */ z.jsxs(
3045
- "svg",
3046
- {
3047
- width: "16",
3048
- height: "16",
3049
- viewBox: "0 0 16 16",
3050
- fill: "currentColor",
3051
- className: e,
3052
- style: { flexShrink: 0 },
3053
- children: [
3054
- /* @__PURE__ */ z.jsx("rect", { x: "4", y: "5", width: "8", height: "2", rx: "1" }),
3055
- /* @__PURE__ */ z.jsx("rect", { x: "4", y: "9", width: "8", height: "2", rx: "1" })
3056
- ]
3057
- }
3058
- ), Yo = ({
3059
- column: e,
3060
- index: t,
3061
- columns: n,
3062
- sortState: r,
3063
- onSort: o,
3064
- renderSortIcon: i,
3065
- draggable: s = !1,
3066
- dragHandleIcon: a,
3067
- theme: l = "light"
3068
- }) => {
3069
- const u = Ce.useRef(null), [c, d] = Ce.useState(null), f = (D) => {
3070
- const { isSorting: N, wasDragging: C } = D;
3071
- return N || C ? Tn(D) : !0;
3072
- }, {
3073
- attributes: h,
3074
- listeners: v,
3075
- setNodeRef: g,
3076
- transform: b,
3077
- transition: x,
3078
- isDragging: p
3079
- } = Ho({
3080
- id: e.key || `col-${t}`,
3081
- disabled: !s || !!e.fixed,
3082
- animateLayoutChanges: f,
3083
- transition: {
3084
- duration: 250,
3085
- easing: "cubic-bezier(0.25, 1, 0.5, 1)"
3086
- }
3087
- }), y = Ce.useCallback(
3088
- (D) => {
3089
- u.current = D, g(D);
3090
- },
3091
- [g]
3092
- );
3093
- Ce.useEffect(() => {
3094
- if (p && u.current) {
3095
- const D = u.current.getBoundingClientRect().width;
3096
- d(D);
3097
- } else
3098
- p || d(null);
3099
- }, [p]);
3100
- const R = () => {
3101
- const D = p && c ? `${c}px` : e.width || "auto";
3102
- let N = "auto";
3103
- e.fixed ? N = p ? 1001 : 1e3 : p && (N = 100);
3104
- const C = {
3105
- transform: b ? qe.Translate.toString(b) : void 0,
3106
- transition: x || "transform 250ms cubic-bezier(0.25, 1, 0.5, 1)",
3107
- willChange: "transform",
3108
- width: D,
3109
- textAlign: oe.getTextAlign(e.align),
3110
- opacity: p ? 0.5 : 1,
3111
- // cursor 由 className 控制,不在 inline style 中设置
3112
- zIndex: N,
3113
- whiteSpace: "nowrap",
3114
- overflow: "hidden",
3115
- textOverflow: "ellipsis"
3116
- };
3117
- if (p && c && (C.minWidth = `${c}px`, C.maxWidth = `${c}px`), e.fixed === "left") {
3118
- let P = 0;
3119
- for (let j = 0; j < t; j++)
3120
- n[j].fixed === "left" && (P += parseInt(n[j].width || "150"));
3121
- C.left = `${P}px`;
3122
- } else if (e.fixed === "right") {
3123
- let P = 0;
3124
- for (let j = t + 1; j < n.length; j++)
3125
- n[j].fixed === "right" && (P += parseInt(n[j].width || "150"));
3126
- C.right = `${P}px`;
3127
- }
3128
- return C;
3129
- }, S = Me(
3130
- "bu-group",
3131
- oe.getThClasses({
3132
- theme: l,
3133
- fixed: e.fixed,
3134
- sortable: e.filter,
3135
- isDragging: p,
3136
- draggable: s
3137
- })
3138
- ), I = s && !e.fixed, m = e.filter && e.key, w = (D) => {
3139
- m && (D.target.closest(".drag-handle-icon") || o(e));
3140
- };
3141
- return /* @__PURE__ */ z.jsx(
3142
- "th",
3143
- {
3144
- ref: y,
3145
- className: S,
3146
- style: R(),
3147
- ...h,
3148
- ...v,
3149
- onClick: w,
3150
- children: /* @__PURE__ */ z.jsxs(
3151
- "div",
3152
- {
3153
- className: "bu-relative bu-flex bu-items-center bu-gap-2",
3154
- style: { justifyContent: e.align || "center" },
3155
- children: [
3156
- /* @__PURE__ */ z.jsxs("div", { className: "bu-flex bu-items-center", children: [
3157
- e.renderHeader ? e.renderHeader([]) : e.title,
3158
- i(e),
3159
- e.renderEndIcon ? e.renderEndIcon() : null
3160
- ] }),
3161
- I && /* @__PURE__ */ z.jsx(
3162
- "span",
3163
- {
3164
- "data-drag-handle": !0,
3165
- className: `${Me(
3166
- oe.dragHandle({
3167
- theme: l
3168
- }),
3169
- "group-hover:bu-opacity-100"
3170
- )} drag-handle-icon`,
3171
- style: {
3172
- display: "flex",
3173
- alignItems: "center",
3174
- marginLeft: "4px"
3175
- },
3176
- children: a !== null && (a || /* @__PURE__ */ z.jsx(Xo, {}))
3177
- }
3178
- )
3179
- ]
3180
- }
3181
- )
3182
- }
3183
- );
3184
- }, Ko = (e) => {
3185
- const {
3186
- columns: t,
3187
- sortStates: n,
3188
- onSort: r,
3189
- activeId: o,
3190
- theadClass: i,
3191
- draggable: s = !1,
3192
- dragHandleIcon: a,
3193
- theme: l = "light",
3194
- rowIdPrefix: u
3195
- } = e, c = (f) => {
3196
- f.filter && f.key && r(f.key, f.type);
3197
- }, d = (f) => {
3198
- if (!f.filter || !f.key)
3199
- return null;
3200
- const h = n[f.key] || ne.default, v = l === "dark" ? "rgba(235, 236, 245, 0.20)" : "rgba(10, 10, 10, 0.20)", g = l === "dark" ? "rgba(235, 236, 245, 0.60)" : "rgba(10, 10, 10, 0.60)", b = h !== ne.default;
3201
- return /* @__PURE__ */ z.jsx(
3202
- "span",
3203
- {
3204
- className: Me(
3205
- "bu-inline-flex bu-align-middle bu-transition-opacity bu-duration-200",
3206
- "bu-ml-[4px]"
3207
- ),
3208
- children: /* @__PURE__ */ z.jsxs(
3209
- "svg",
3210
- {
3211
- xmlns: "http://www.w3.org/2000/svg",
3212
- width: "6",
3213
- height: "10",
3214
- viewBox: "0 0 6 10",
3215
- fill: "none",
3216
- className: Me(
3217
- "bu-transition-opacity bu-duration-200",
3218
- b ? "bu-opacity-100" : "bu-opacity-0 group-hover:bu-opacity-100"
3219
- ),
3220
- children: [
3221
- /* @__PURE__ */ z.jsx(
3222
- "path",
3223
- {
3224
- d: "M5.4847 3.04301V4.10942H0.151367V3.04301L2.81803 0.376343L5.4847 3.04301Z",
3225
- fill: h === ne.asc ? g : v
3226
- }
3227
- ),
3228
- /* @__PURE__ */ z.jsx(
3229
- "path",
3230
- {
3231
- d: "M5.4847 5.89067V6.95707L2.81803 9.62374L0.151367 6.95707V5.89067H5.4847Z",
3232
- fill: h === ne.desc ? g : v
3233
- }
3234
- )
3235
- ]
3236
- }
3237
- )
3238
- }
3239
- );
3240
- };
3241
- return /* @__PURE__ */ z.jsx("thead", { className: Me(oe.thead({ theme: l }), i), children: /* @__PURE__ */ z.jsx("tr", { id: u ? `${u}-thead` : "", children: t.map((f, h) => /* @__PURE__ */ z.jsx(
3242
- Yo,
3243
- {
3244
- column: f,
3245
- index: h,
3246
- columns: t,
3247
- sortState: f.key ? n[f.key] : void 0,
3248
- onSort: c,
3249
- renderSortIcon: d,
3250
- isDragging: f.key === o,
3251
- draggable: s,
3252
- dragHandleIcon: a,
3253
- theme: l
3254
- },
3255
- f.key || h
3256
- )) }) });
3257
- }, Uo = (e) => {
3258
- const { columns: t, data: n, rowKey: r, tdClass: o, tbodyClass: i, theme: s = "light" } = e, a = (c, d) => {
3259
- const f = {
3260
- textAlign: oe.getTextAlign(c.align)
3261
- };
3262
- if (c.fixed === "left") {
3263
- let h = 0;
3264
- for (let v = 0; v < d; v++)
3265
- t[v].fixed === "left" && (h += parseInt(t[v].width || "150"));
3266
- f.left = `${h}px`;
3267
- } else if (c.fixed === "right") {
3268
- let h = 0;
3269
- for (let v = d + 1; v < t.length; v++)
3270
- t[v].fixed === "right" && (h += parseInt(t[v].width || "150"));
3271
- f.right = `${h}px`;
3272
- }
3273
- return f;
3274
- }, l = (c, d, f) => c.render ? c.render(d, f) : c.key ? d[c.key] : null, u = (c, d, f) => {
3275
- if (c.onCell)
3276
- return c.onCell(d, f);
3277
- };
3278
- return /* @__PURE__ */ z.jsx("tbody", { className: Me(oe.tbody({ theme: s }), i), children: n.map((c, d) => /* @__PURE__ */ z.jsx(
3279
- "tr",
3280
- {
3281
- id: e.rowIdPrefix ? `${e.rowIdPrefix}-${d}` : "",
3282
- className: oe.tr({ theme: s }),
3283
- children: t.map((f, h) => {
3284
- const v = u(f, c, d);
3285
- return v === 0 ? null : /* @__PURE__ */ z.jsx(
3286
- "td",
3287
- {
3288
- className: oe.getTdClasses({
3289
- theme: s,
3290
- fixed: f.fixed,
3291
- customClass: o
3292
- }),
3293
- style: a(f, h),
3294
- colSpan: v,
3295
- children: l(f, c, d)
3296
- },
3297
- f.key || h
3298
- );
3299
- })
3300
- },
3301
- c[r] || d
3302
- )) });
3303
- }, Vo = (e) => {
3304
- let {
3305
- transform: t
3306
- } = e;
3307
- return {
3308
- ...t,
3309
- y: 0
3310
- };
3311
- }, Zo = (e) => {
3312
- const {
3313
- columns: t,
3314
- data: n,
3315
- rowKey: r = "id",
3316
- theadClass: o,
3317
- tdClass: i,
3318
- tbodyClass: s,
3319
- renderEmpty: a,
3320
- onSortChange: l,
3321
- tableLayout: u = "auto",
3322
- draggable: c = !1,
3323
- // 默认不启用拖拽
3324
- onColumnsChange: d,
3325
- dragHandleIcon: f,
3326
- maxHeight: h,
3327
- rowIdPrefix: v
3328
- } = e, { theme: g } = Wn(), [b, x] = Ce.useState(t), [p, y] = Ce.useState({}), [R, S] = Ce.useState(null), I = pr(
3329
- Kt(Lt, {
3330
- activationConstraint: {
3331
- distance: 8
3332
- // 8px 移动后才激活拖拽
3333
- }
3334
- }),
3335
- Kt(Ot)
3336
- );
3337
- Ce.useEffect(() => {
3338
- x(t);
3339
- }, [t]);
3340
- const m = (T, G) => {
3341
- const U = p[T] || ne.default;
3342
- let k;
3343
- U === ne.default ? k = ne.desc : U === ne.desc ? k = ne.asc : k = ne.default;
3344
- const se = G || "single";
3345
- let B;
3346
- if (se === "single" ? B = { [T]: k } : (B = { ...p, [T]: k }, k === ne.default && delete B[T]), y(B), l)
3347
- if (se === "single")
3348
- l({ sortKey: T, sort: k });
3349
- else {
3350
- const ae = Object.entries(B).map(([le, X]) => ({
3351
- sortKey: le,
3352
- sort: X
3353
- }));
3354
- l(ae);
3355
- }
3356
- }, w = (T) => {
3357
- S(T.active.id);
3358
- }, D = (T) => {
3359
- const { active: G, over: U } = T;
3360
- S(null), !(!U || G.id === U.id) && x((k) => {
3361
- const se = k.findIndex((le) => le.key === G.id), B = k.findIndex((le) => le.key === U.id);
3362
- if (se === -1 || B === -1 || k[B].fixed)
3363
- return k;
3364
- const ae = zt(k, se, B);
3365
- return d && d(ae), ae;
3366
- });
3367
- }, N = b.filter((T) => !T.fixed && T.key).map((T) => T.key), P = (() => {
3368
- const T = b.reduce((G, U) => {
3369
- if (U.width) {
3370
- const k = parseInt(U.width);
3371
- return G + (isNaN(k) ? 150 : k);
3372
- }
3373
- return G + 150;
3374
- }, 0);
3375
- return T > 0 ? `${T}px` : void 0;
3376
- })(), j = () => /* @__PURE__ */ z.jsx(
3377
- "div",
3378
- {
3379
- className: oe.container({ theme: g }),
3380
- style: h ? { maxHeight: h, overflowX: "auto", overflowY: "auto" } : { overflowX: "auto" },
3381
- children: n.length > 0 ? /* @__PURE__ */ z.jsxs(
3382
- "table",
3383
- {
3384
- className: oe.table(),
3385
- style: {
3386
- tableLayout: u,
3387
- minWidth: u === "fixed" ? P : void 0
3388
- },
3389
- children: [
3390
- /* @__PURE__ */ z.jsx(
3391
- Ko,
3392
- {
3393
- columns: b,
3394
- sortStates: p,
3395
- onSort: m,
3396
- activeId: c ? R : null,
3397
- theadClass: o,
3398
- draggable: c,
3399
- dragHandleIcon: f,
3400
- theme: g,
3401
- rowIdPrefix: v
3402
- }
3403
- ),
3404
- /* @__PURE__ */ z.jsx(
3405
- Uo,
3406
- {
3407
- columns: b,
3408
- data: n,
3409
- rowKey: r,
3410
- tdClass: i,
3411
- tbodyClass: s,
3412
- theme: g,
3413
- rowIdPrefix: v
3414
- }
3415
- )
3416
- ]
3417
- }
3418
- ) : /* @__PURE__ */ z.jsx("div", { className: oe.empty({ theme: g }), children: a || "No Data" })
3419
- }
3420
- );
3421
- return c ? /* @__PURE__ */ z.jsx(
3422
- So,
3423
- {
3424
- sensors: I,
3425
- collisionDetection: Sr,
3426
- onDragStart: w,
3427
- onDragEnd: D,
3428
- modifiers: [Vo],
3429
- children: /* @__PURE__ */ z.jsx(
3430
- zo,
3431
- {
3432
- items: N,
3433
- strategy: Mo,
3434
- children: j()
3435
- }
3436
- )
3437
- }
3438
- ) : j();
3439
- };
3440
- export {
3441
- Zo as P,
3442
- ne as S
3443
- };