sa2kit 1.6.30 → 1.6.32

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 (251) hide show
  1. package/dist/AliyunOSSProvider-4W47OFEK.mjs +6 -0
  2. package/dist/{AliyunOSSProvider-KJYRIZES.mjs.map → AliyunOSSProvider-4W47OFEK.mjs.map} +1 -1
  3. package/dist/AliyunOSSProvider-HCNGDJL7.js +15 -0
  4. package/dist/{AliyunOSSProvider-FWAKUB2T.js.map → AliyunOSSProvider-HCNGDJL7.js.map} +1 -1
  5. package/dist/ConfigService-3DIC6C3Q.js +21 -0
  6. package/dist/{ConfigService-7MEZXKJ5.js.map → ConfigService-3DIC6C3Q.js.map} +1 -1
  7. package/dist/ConfigService-V6ZK273Z.mjs +4 -0
  8. package/dist/{ConfigService-BV57YYFW.mjs.map → ConfigService-V6ZK273Z.mjs.map} +1 -1
  9. package/dist/LocalStorageProvider-3RVPCQB3.mjs +6 -0
  10. package/dist/{LocalStorageProvider-RTPMUOZ2.mjs.map → LocalStorageProvider-3RVPCQB3.mjs.map} +1 -1
  11. package/dist/LocalStorageProvider-PP7MA5OT.js +15 -0
  12. package/dist/{LocalStorageProvider-XSRCUXOU.js.map → LocalStorageProvider-PP7MA5OT.js.map} +1 -1
  13. package/dist/PMXParser-2VTA737I.js +13 -0
  14. package/dist/{PMXParser-YBS3B6HM.js.map → PMXParser-2VTA737I.js.map} +1 -1
  15. package/dist/PMXParser-RNVQL76A.mjs +4 -0
  16. package/dist/{PMXParser-L6IWHL4I.mjs.map → PMXParser-RNVQL76A.mjs.map} +1 -1
  17. package/dist/analytics/index.js +46 -45
  18. package/dist/analytics/index.js.map +1 -1
  19. package/dist/analytics/index.mjs +45 -44
  20. package/dist/analytics/index.mjs.map +1 -1
  21. package/dist/analytics/server/index.js +4 -4
  22. package/dist/analytics/server/index.js.map +1 -1
  23. package/dist/analytics/server/index.mjs +4 -4
  24. package/dist/analytics/server/index.mjs.map +1 -1
  25. package/dist/api/index.js +5 -5
  26. package/dist/api/index.js.map +1 -1
  27. package/dist/api/index.mjs +5 -5
  28. package/dist/api/index.mjs.map +1 -1
  29. package/dist/audioDetection/index.js +17 -16
  30. package/dist/audioDetection/index.js.map +1 -1
  31. package/dist/audioDetection/index.mjs +17 -16
  32. package/dist/audioDetection/index.mjs.map +1 -1
  33. package/dist/auth/client/index.js +4 -4
  34. package/dist/auth/client/index.mjs +1 -1
  35. package/dist/auth/components/index.js +3 -3
  36. package/dist/auth/components/index.js.map +1 -1
  37. package/dist/auth/components/index.mjs +3 -3
  38. package/dist/auth/components/index.mjs.map +1 -1
  39. package/dist/auth/index.js +29 -29
  40. package/dist/auth/index.mjs +5 -5
  41. package/dist/auth/middleware/index.js +3 -3
  42. package/dist/auth/middleware/index.mjs +2 -2
  43. package/dist/auth/routes/index.js +14 -14
  44. package/dist/auth/routes/index.mjs +2 -2
  45. package/dist/auth/services/index.js +7 -7
  46. package/dist/auth/services/index.mjs +1 -1
  47. package/dist/calendar/index.js +146 -182
  48. package/dist/calendar/index.js.map +1 -1
  49. package/dist/calendar/index.mjs +139 -175
  50. package/dist/calendar/index.mjs.map +1 -1
  51. package/dist/calendar/routes/index.js +1 -1
  52. package/dist/calendar/routes/index.js.map +1 -1
  53. package/dist/calendar/routes/index.mjs +1 -1
  54. package/dist/calendar/routes/index.mjs.map +1 -1
  55. package/dist/{chunk-5YQ5B7IZ.js → chunk-24HGREE6.js} +5 -5
  56. package/dist/{chunk-5YQ5B7IZ.js.map → chunk-24HGREE6.js.map} +1 -1
  57. package/dist/{chunk-6PRFP5EG.js → chunk-25OFOKNF.js} +6 -6
  58. package/dist/chunk-25OFOKNF.js.map +1 -0
  59. package/dist/{chunk-KQGP6BTS.mjs → chunk-3DXPQ4YV.mjs} +6 -6
  60. package/dist/chunk-3DXPQ4YV.mjs.map +1 -0
  61. package/dist/{chunk-3BGPZN4X.mjs → chunk-3NHAT7D4.mjs} +12 -12
  62. package/dist/chunk-3NHAT7D4.mjs.map +1 -0
  63. package/dist/{chunk-MW4BCIZC.mjs → chunk-4HC6M7FK.mjs} +3 -3
  64. package/dist/chunk-4HC6M7FK.mjs.map +1 -0
  65. package/dist/{chunk-ESRCX5TQ.mjs → chunk-52TN2QSS.mjs} +3 -3
  66. package/dist/{chunk-ESRCX5TQ.mjs.map → chunk-52TN2QSS.mjs.map} +1 -1
  67. package/dist/{chunk-CNTILN5J.mjs → chunk-5YQ62BKX.mjs} +20 -19
  68. package/dist/chunk-5YQ62BKX.mjs.map +1 -0
  69. package/dist/{chunk-6W5BMXJG.js → chunk-6OWNMJKG.js} +4 -4
  70. package/dist/{chunk-6W5BMXJG.js.map → chunk-6OWNMJKG.js.map} +1 -1
  71. package/dist/{chunk-DUHZ7VZP.js → chunk-7VRT55ZD.js} +3 -3
  72. package/dist/chunk-7VRT55ZD.js.map +1 -0
  73. package/dist/{chunk-3WOAPLEG.mjs → chunk-EB4NR623.mjs} +27 -26
  74. package/dist/chunk-EB4NR623.mjs.map +1 -0
  75. package/dist/chunk-EI27JKND.mjs +1988 -0
  76. package/dist/chunk-EI27JKND.mjs.map +1 -0
  77. package/dist/{chunk-CD77U7LZ.js → chunk-GBPLX42J.js} +9 -9
  78. package/dist/chunk-GBPLX42J.js.map +1 -0
  79. package/dist/{chunk-TFQF2HDO.mjs → chunk-HDEOCX2L.mjs} +12 -12
  80. package/dist/chunk-HDEOCX2L.mjs.map +1 -0
  81. package/dist/{chunk-TV3VKRJK.mjs → chunk-HDMIOOZY.mjs} +38 -68
  82. package/dist/chunk-HDMIOOZY.mjs.map +1 -0
  83. package/dist/{chunk-OPPF3326.js → chunk-HJ6MH7J7.js} +39 -69
  84. package/dist/chunk-HJ6MH7J7.js.map +1 -0
  85. package/dist/chunk-KO73EBUT.js +80 -0
  86. package/dist/chunk-KO73EBUT.js.map +1 -0
  87. package/dist/{chunk-6YKMCPQI.mjs → chunk-KZKIH4AS.mjs} +4 -4
  88. package/dist/chunk-KZKIH4AS.mjs.map +1 -0
  89. package/dist/{chunk-LX4XX6W7.js → chunk-L47ZOYHL.js} +15 -89
  90. package/dist/chunk-L47ZOYHL.js.map +1 -0
  91. package/dist/{chunk-6MQUBPKB.mjs → chunk-LJ4CCSSY.mjs} +3 -3
  92. package/dist/{chunk-6MQUBPKB.mjs.map → chunk-LJ4CCSSY.mjs.map} +1 -1
  93. package/dist/{chunk-TOC5FSHP.js → chunk-NJ2SNXBJ.js} +12 -12
  94. package/dist/chunk-NJ2SNXBJ.js.map +1 -0
  95. package/dist/{chunk-OCR5DS4C.mjs → chunk-PE5EAHZK.mjs} +3 -3
  96. package/dist/chunk-PE5EAHZK.mjs.map +1 -0
  97. package/dist/{chunk-LZHMNOED.js → chunk-Q5EDCKQA.js} +26 -26
  98. package/dist/chunk-Q5EDCKQA.js.map +1 -0
  99. package/dist/{chunk-CLKKZSPZ.js → chunk-RBKGYWME.js} +20 -19
  100. package/dist/chunk-RBKGYWME.js.map +1 -0
  101. package/dist/{chunk-VRTRSEEH.mjs → chunk-RSJSZ7QH.mjs} +11 -11
  102. package/dist/chunk-RSJSZ7QH.mjs.map +1 -0
  103. package/dist/{chunk-E7RGBAYJ.js → chunk-TDCDEBGP.js} +30 -29
  104. package/dist/chunk-TDCDEBGP.js.map +1 -0
  105. package/dist/{chunk-JZXJQMVE.js → chunk-UIFFDRTE.js} +11 -11
  106. package/dist/chunk-UIFFDRTE.js.map +1 -0
  107. package/dist/{chunk-T5OZHYVM.mjs → chunk-UKT3PLON.mjs} +13 -85
  108. package/dist/chunk-UKT3PLON.mjs.map +1 -0
  109. package/dist/{chunk-UOFTHYIH.js → chunk-UL6XJGUZ.js} +4 -4
  110. package/dist/chunk-UL6XJGUZ.js.map +1 -0
  111. package/dist/chunk-VVWQTO4Y.mjs +77 -0
  112. package/dist/chunk-VVWQTO4Y.mjs.map +1 -0
  113. package/dist/{chunk-A3UP56MS.js → chunk-WA67GZSZ.js} +3 -3
  114. package/dist/chunk-WA67GZSZ.js.map +1 -0
  115. package/dist/{chunk-OLHGZXN3.mjs → chunk-WEEXCPSE.mjs} +5 -5
  116. package/dist/chunk-WEEXCPSE.mjs.map +1 -0
  117. package/dist/chunk-XGBE4SUV.js +2093 -0
  118. package/dist/chunk-XGBE4SUV.js.map +1 -0
  119. package/dist/{chunk-QU5OT4DF.js → chunk-XJ7ZAGC5.js} +5 -5
  120. package/dist/chunk-XJ7ZAGC5.js.map +1 -0
  121. package/dist/{chunk-ZI25QCHD.mjs → chunk-YOTQG4NP.mjs} +25 -25
  122. package/dist/chunk-YOTQG4NP.mjs.map +1 -0
  123. package/dist/{chunk-QAT2RWAO.mjs → chunk-Z36R3P62.mjs} +7 -7
  124. package/dist/chunk-Z36R3P62.mjs.map +1 -0
  125. package/dist/{chunk-7Z5LLJ3A.js → chunk-ZWQJSZEY.js} +13 -13
  126. package/dist/chunk-ZWQJSZEY.js.map +1 -0
  127. package/dist/config/index.js +6 -6
  128. package/dist/config/index.js.map +1 -1
  129. package/dist/config/index.mjs +6 -6
  130. package/dist/config/index.mjs.map +1 -1
  131. package/dist/config/server/index.js +37 -37
  132. package/dist/config/server/index.js.map +1 -1
  133. package/dist/config/server/index.mjs +37 -37
  134. package/dist/config/server/index.mjs.map +1 -1
  135. package/dist/i18n/index.d.mts +2 -2
  136. package/dist/i18n/index.d.ts +2 -2
  137. package/dist/i18n/index.js +16 -17
  138. package/dist/i18n/index.js.map +1 -1
  139. package/dist/i18n/index.mjs +16 -17
  140. package/dist/i18n/index.mjs.map +1 -1
  141. package/dist/imageCrop/index.js +11 -10
  142. package/dist/imageCrop/index.js.map +1 -1
  143. package/dist/imageCrop/index.mjs +11 -10
  144. package/dist/imageCrop/index.mjs.map +1 -1
  145. package/dist/index.d.mts +185 -100
  146. package/dist/index.d.ts +185 -100
  147. package/dist/index.js +225 -249
  148. package/dist/index.js.map +1 -1
  149. package/dist/index.mjs +80 -104
  150. package/dist/index.mjs.map +1 -1
  151. package/dist/logger/index.js +6 -6
  152. package/dist/logger/index.mjs +1 -1
  153. package/dist/mikuFusionGame/index.d.mts +112 -0
  154. package/dist/mikuFusionGame/index.d.ts +112 -0
  155. package/dist/mikuFusionGame/index.js +680 -0
  156. package/dist/mikuFusionGame/index.js.map +1 -0
  157. package/dist/mikuFusionGame/index.mjs +667 -0
  158. package/dist/mikuFusionGame/index.mjs.map +1 -0
  159. package/dist/mmd/admin/index.js +11 -10
  160. package/dist/mmd/admin/index.js.map +1 -1
  161. package/dist/mmd/admin/index.mjs +11 -10
  162. package/dist/mmd/admin/index.mjs.map +1 -1
  163. package/dist/mmd/index.js +223 -241
  164. package/dist/mmd/index.js.map +1 -1
  165. package/dist/mmd/index.mjs +220 -238
  166. package/dist/mmd/index.mjs.map +1 -1
  167. package/dist/mmd/server/index.js +6 -6
  168. package/dist/mmd/server/index.js.map +1 -1
  169. package/dist/mmd/server/index.mjs +6 -6
  170. package/dist/mmd/server/index.mjs.map +1 -1
  171. package/dist/music/index.js +16 -16
  172. package/dist/music/index.mjs +2 -2
  173. package/dist/music/server/index.js +8 -8
  174. package/dist/music/server/index.mjs +1 -1
  175. package/dist/request/index.js +2 -2
  176. package/dist/request/index.js.map +1 -1
  177. package/dist/request/index.mjs +2 -2
  178. package/dist/request/index.mjs.map +1 -1
  179. package/dist/storage/index.js +15 -14
  180. package/dist/storage/index.mjs +3 -2
  181. package/dist/testYourself/admin/index.js +3 -3
  182. package/dist/testYourself/admin/index.mjs +1 -1
  183. package/dist/testYourself/index.js +22 -22
  184. package/dist/testYourself/index.js.map +1 -1
  185. package/dist/testYourself/index.mjs +14 -14
  186. package/dist/testYourself/index.mjs.map +1 -1
  187. package/dist/testYourself/server/index.js +4 -4
  188. package/dist/testYourself/server/index.mjs +1 -1
  189. package/dist/universalExport/index.d.mts +3 -3
  190. package/dist/universalExport/index.d.ts +3 -3
  191. package/dist/universalExport/index.js +48 -47
  192. package/dist/universalExport/index.js.map +1 -1
  193. package/dist/universalExport/index.mjs +48 -47
  194. package/dist/universalExport/index.mjs.map +1 -1
  195. package/dist/universalExport/server/index.js +29 -29
  196. package/dist/universalExport/server/index.js.map +1 -1
  197. package/dist/universalExport/server/index.mjs +28 -28
  198. package/dist/universalExport/server/index.mjs.map +1 -1
  199. package/dist/universalFile/index.d.mts +3 -3
  200. package/dist/universalFile/index.d.ts +3 -3
  201. package/dist/universalFile/index.js +73 -72
  202. package/dist/universalFile/index.js.map +1 -1
  203. package/dist/universalFile/index.mjs +73 -72
  204. package/dist/universalFile/index.mjs.map +1 -1
  205. package/dist/universalFile/server/index.js +258 -260
  206. package/dist/universalFile/server/index.js.map +1 -1
  207. package/dist/universalFile/server/index.mjs +244 -246
  208. package/dist/universalFile/server/index.mjs.map +1 -1
  209. package/dist/utils/index.js +11 -11
  210. package/dist/utils/index.mjs +2 -2
  211. package/package.json +25 -31
  212. package/dist/AliyunOSSProvider-FWAKUB2T.js +0 -15
  213. package/dist/AliyunOSSProvider-KJYRIZES.mjs +0 -6
  214. package/dist/ConfigService-7MEZXKJ5.js +0 -21
  215. package/dist/ConfigService-BV57YYFW.mjs +0 -4
  216. package/dist/LocalStorageProvider-RTPMUOZ2.mjs +0 -6
  217. package/dist/LocalStorageProvider-XSRCUXOU.js +0 -15
  218. package/dist/PMXParser-L6IWHL4I.mjs +0 -4
  219. package/dist/PMXParser-YBS3B6HM.js +0 -13
  220. package/dist/chunk-3BGPZN4X.mjs.map +0 -1
  221. package/dist/chunk-3WOAPLEG.mjs.map +0 -1
  222. package/dist/chunk-6PRFP5EG.js.map +0 -1
  223. package/dist/chunk-6YKMCPQI.mjs.map +0 -1
  224. package/dist/chunk-7Z5LLJ3A.js.map +0 -1
  225. package/dist/chunk-A3UP56MS.js.map +0 -1
  226. package/dist/chunk-CD77U7LZ.js.map +0 -1
  227. package/dist/chunk-CLKKZSPZ.js.map +0 -1
  228. package/dist/chunk-CNTILN5J.mjs.map +0 -1
  229. package/dist/chunk-DUHZ7VZP.js.map +0 -1
  230. package/dist/chunk-DW2ZTOCV.js +0 -1727
  231. package/dist/chunk-DW2ZTOCV.js.map +0 -1
  232. package/dist/chunk-E7RGBAYJ.js.map +0 -1
  233. package/dist/chunk-JZXJQMVE.js.map +0 -1
  234. package/dist/chunk-KQGP6BTS.mjs.map +0 -1
  235. package/dist/chunk-LFG6FPM5.mjs +0 -1597
  236. package/dist/chunk-LFG6FPM5.mjs.map +0 -1
  237. package/dist/chunk-LX4XX6W7.js.map +0 -1
  238. package/dist/chunk-LZHMNOED.js.map +0 -1
  239. package/dist/chunk-MW4BCIZC.mjs.map +0 -1
  240. package/dist/chunk-OCR5DS4C.mjs.map +0 -1
  241. package/dist/chunk-OLHGZXN3.mjs.map +0 -1
  242. package/dist/chunk-OPPF3326.js.map +0 -1
  243. package/dist/chunk-QAT2RWAO.mjs.map +0 -1
  244. package/dist/chunk-QU5OT4DF.js.map +0 -1
  245. package/dist/chunk-T5OZHYVM.mjs.map +0 -1
  246. package/dist/chunk-TFQF2HDO.mjs.map +0 -1
  247. package/dist/chunk-TOC5FSHP.js.map +0 -1
  248. package/dist/chunk-TV3VKRJK.mjs.map +0 -1
  249. package/dist/chunk-UOFTHYIH.js.map +0 -1
  250. package/dist/chunk-VRTRSEEH.mjs.map +0 -1
  251. package/dist/chunk-ZI25QCHD.mjs.map +0 -1
@@ -0,0 +1,1988 @@
1
+ import { cn } from './chunk-3NHAT7D4.mjs';
2
+ import * as React10 from 'react';
3
+ import React10__default, { useRef, useState, useEffect, useCallback } from 'react';
4
+ import { cva } from 'class-variance-authority';
5
+ import { createPortal } from 'react-dom';
6
+ import { X, Check, Circle, ChevronRight, ChevronDown, ChevronUp, RotateCcw, Save, AlertCircle, GripVertical } from 'lucide-react';
7
+ import { clsx } from 'clsx';
8
+ import { useRouter } from 'next/navigation';
9
+
10
+ var buttonVariants = cva(
11
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
12
+ {
13
+ variants: {
14
+ variant: {
15
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
16
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
17
+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
18
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
19
+ ghost: "hover:bg-accent hover:text-accent-foreground",
20
+ link: "text-primary underline-offset-4 hover:underline"
21
+ },
22
+ size: {
23
+ default: "h-9 px-4 py-2",
24
+ sm: "h-8 rounded-md px-3 text-xs",
25
+ lg: "h-10 rounded-md px-8",
26
+ icon: "h-9 w-9"
27
+ }
28
+ },
29
+ defaultVariants: {
30
+ variant: "default",
31
+ size: "default"
32
+ }
33
+ }
34
+ );
35
+ var Button = React10.forwardRef(
36
+ ({ className, variant = "default", size = "default", asChild = false, children, ...props }, ref) => {
37
+ if (asChild && React10.isValidElement(children)) {
38
+ const childProps = children.props;
39
+ return React10.cloneElement(children, {
40
+ ...props,
41
+ className: cn(buttonVariants({ variant, size, className }), childProps.className)
42
+ });
43
+ }
44
+ return /* @__PURE__ */ React10.createElement(
45
+ "button",
46
+ {
47
+ className: cn(buttonVariants({ variant, size, className })),
48
+ ref,
49
+ ...props
50
+ },
51
+ children
52
+ );
53
+ }
54
+ );
55
+ Button.displayName = "Button";
56
+ var Card = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
57
+ "div",
58
+ {
59
+ ref,
60
+ className: cn(
61
+ "rounded-xl border bg-card text-card-foreground shadow",
62
+ className
63
+ ),
64
+ ...props
65
+ }
66
+ ));
67
+ Card.displayName = "Card";
68
+ var CardHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
69
+ "div",
70
+ {
71
+ ref,
72
+ className: cn("flex flex-col space-y-1.5 p-6", className),
73
+ ...props
74
+ }
75
+ ));
76
+ CardHeader.displayName = "CardHeader";
77
+ var CardTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
78
+ "div",
79
+ {
80
+ ref,
81
+ className: cn("font-semibold leading-none tracking-tight", className),
82
+ ...props
83
+ }
84
+ ));
85
+ CardTitle.displayName = "CardTitle";
86
+ var CardDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
87
+ "div",
88
+ {
89
+ ref,
90
+ className: cn("text-sm text-muted-foreground", className),
91
+ ...props
92
+ }
93
+ ));
94
+ CardDescription.displayName = "CardDescription";
95
+ var CardContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement("div", { ref, className: cn("p-6 pt-0", className), ...props }));
96
+ CardContent.displayName = "CardContent";
97
+ var CardFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
98
+ "div",
99
+ {
100
+ ref,
101
+ className: cn("flex items-center p-6 pt-0", className),
102
+ ...props
103
+ }
104
+ ));
105
+ CardFooter.displayName = "CardFooter";
106
+ var badgeVariants = cva(
107
+ "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
108
+ {
109
+ variants: {
110
+ variant: {
111
+ default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
112
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
113
+ destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
114
+ outline: "text-foreground"
115
+ }
116
+ },
117
+ defaultVariants: {
118
+ variant: "default"
119
+ }
120
+ }
121
+ );
122
+ function Badge({ className, variant, ...props }) {
123
+ return /* @__PURE__ */ React10.createElement("div", { className: cn(badgeVariants({ variant }), className), ...props });
124
+ }
125
+ var Input = React10.forwardRef(
126
+ ({ className, type, ...props }, ref) => {
127
+ return /* @__PURE__ */ React10.createElement(
128
+ "input",
129
+ {
130
+ type,
131
+ className: cn(
132
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
133
+ className
134
+ ),
135
+ ref,
136
+ ...props
137
+ }
138
+ );
139
+ }
140
+ );
141
+ Input.displayName = "Input";
142
+ var labelVariants = cva(
143
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
144
+ );
145
+ var Label = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
146
+ "label",
147
+ {
148
+ ref,
149
+ className: cn(labelVariants(), className),
150
+ ...props
151
+ }
152
+ ));
153
+ Label.displayName = "Label";
154
+ function useControllableState({
155
+ value,
156
+ defaultValue,
157
+ onChange
158
+ }) {
159
+ const [internal, setInternal] = React10.useState(defaultValue);
160
+ const isControlled = value !== void 0;
161
+ const state = isControlled ? value : internal;
162
+ const setState = React10.useCallback(
163
+ (next) => {
164
+ if (!isControlled) setInternal(next);
165
+ onChange?.(next);
166
+ },
167
+ [isControlled, onChange]
168
+ );
169
+ return [state, setState];
170
+ }
171
+ function Portal({
172
+ children,
173
+ container
174
+ }) {
175
+ const [mounted, setMounted] = React10.useState(false);
176
+ React10.useEffect(() => {
177
+ setMounted(true);
178
+ }, []);
179
+ if (!mounted) return null;
180
+ return createPortal(children, container ?? document.body);
181
+ }
182
+ function useOnClickOutside(refs, handler, enabled) {
183
+ React10.useEffect(() => {
184
+ if (!enabled) return;
185
+ const listener = (event) => {
186
+ const target = event.target;
187
+ const clickedInside = refs.some((ref) => {
188
+ const el = ref.current;
189
+ return el && el.contains(target);
190
+ });
191
+ if (!clickedInside) {
192
+ handler(event);
193
+ }
194
+ };
195
+ document.addEventListener("mousedown", listener);
196
+ document.addEventListener("touchstart", listener);
197
+ return () => {
198
+ document.removeEventListener("mousedown", listener);
199
+ document.removeEventListener("touchstart", listener);
200
+ };
201
+ }, [refs, handler, enabled]);
202
+ }
203
+ function mergeRefs(...refs) {
204
+ return (value) => {
205
+ refs.forEach((ref) => {
206
+ if (!ref) return;
207
+ if (typeof ref === "function") {
208
+ ref(value);
209
+ } else {
210
+ ref.current = value;
211
+ }
212
+ });
213
+ };
214
+ }
215
+
216
+ // src/components/Tabs.tsx
217
+ var TabsContext = React10.createContext(null);
218
+ var Tabs = ({
219
+ value,
220
+ defaultValue = "",
221
+ onValueChange,
222
+ className,
223
+ ...props
224
+ }) => {
225
+ const [current, setCurrent] = useControllableState({
226
+ value,
227
+ defaultValue,
228
+ onChange: onValueChange
229
+ });
230
+ return /* @__PURE__ */ React10.createElement(TabsContext.Provider, { value: { value: current, setValue: setCurrent } }, /* @__PURE__ */ React10.createElement("div", { className, ...props }));
231
+ };
232
+ var TabsList = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
233
+ "div",
234
+ {
235
+ ref,
236
+ className: cn(
237
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
238
+ className
239
+ ),
240
+ ...props
241
+ }
242
+ ));
243
+ TabsList.displayName = "TabsList";
244
+ var TabsTrigger = React10.forwardRef(
245
+ ({ className, value, onClick, ...props }, ref) => {
246
+ const ctx = React10.useContext(TabsContext);
247
+ const active = ctx?.value === value;
248
+ return /* @__PURE__ */ React10.createElement(
249
+ "button",
250
+ {
251
+ ref,
252
+ type: "button",
253
+ "data-state": active ? "active" : "inactive",
254
+ className: cn(
255
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
256
+ active && "bg-background text-foreground shadow",
257
+ className
258
+ ),
259
+ onClick: (e) => {
260
+ ctx?.setValue(value);
261
+ onClick?.(e);
262
+ },
263
+ ...props
264
+ }
265
+ );
266
+ }
267
+ );
268
+ TabsTrigger.displayName = "TabsTrigger";
269
+ var TabsContent = React10.forwardRef(
270
+ ({ className, value, forceMount = false, ...props }, ref) => {
271
+ const ctx = React10.useContext(TabsContext);
272
+ const active = ctx?.value === value;
273
+ if (!active && !forceMount) return null;
274
+ return /* @__PURE__ */ React10.createElement(
275
+ "div",
276
+ {
277
+ ref,
278
+ "data-state": active ? "active" : "inactive",
279
+ hidden: !active && forceMount,
280
+ className: cn(
281
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
282
+ className
283
+ ),
284
+ ...props
285
+ }
286
+ );
287
+ }
288
+ );
289
+ TabsContent.displayName = "TabsContent";
290
+ var DialogContext = React10.createContext(null);
291
+ var Dialog = ({ open, defaultOpen = false, onOpenChange, children }) => {
292
+ const [isOpen, setIsOpen] = useControllableState({
293
+ value: open,
294
+ defaultValue: defaultOpen,
295
+ onChange: onOpenChange
296
+ });
297
+ const triggerRef = React10.useRef(null);
298
+ const contentRef = React10.useRef(null);
299
+ return /* @__PURE__ */ React10.createElement(DialogContext.Provider, { value: { open: isOpen, setOpen: setIsOpen, triggerRef, contentRef } }, children);
300
+ };
301
+ var DialogTrigger = React10.forwardRef(
302
+ ({ children, onClick, ...props }, ref) => {
303
+ const ctx = React10.useContext(DialogContext);
304
+ if (!ctx) return null;
305
+ const mergedRef = mergeRefs(ctx.triggerRef, ref);
306
+ const handleClick = (e) => {
307
+ ctx.setOpen(true);
308
+ onClick?.(e);
309
+ };
310
+ return /* @__PURE__ */ React10.createElement("button", { ref: mergedRef, type: "button", onClick: handleClick, ...props }, children);
311
+ }
312
+ );
313
+ DialogTrigger.displayName = "DialogTrigger";
314
+ var DialogPortal = ({ children }) => {
315
+ const ctx = React10.useContext(DialogContext);
316
+ if (!ctx?.open) return null;
317
+ return /* @__PURE__ */ React10.createElement(Portal, null, children);
318
+ };
319
+ var DialogClose = React10.forwardRef(({ onClick, ...props }, ref) => {
320
+ const ctx = React10.useContext(DialogContext);
321
+ return /* @__PURE__ */ React10.createElement(
322
+ "button",
323
+ {
324
+ ref,
325
+ type: "button",
326
+ onClick: (e) => {
327
+ ctx?.setOpen(false);
328
+ onClick?.(e);
329
+ },
330
+ ...props
331
+ }
332
+ );
333
+ });
334
+ DialogClose.displayName = "DialogClose";
335
+ var DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => {
336
+ const ctx = React10.useContext(DialogContext);
337
+ if (!ctx?.open) return null;
338
+ return /* @__PURE__ */ React10.createElement(
339
+ "div",
340
+ {
341
+ ref,
342
+ className: cn("fixed inset-0 z-[9999] bg-black/80", className),
343
+ ...props
344
+ }
345
+ );
346
+ });
347
+ DialogOverlay.displayName = "DialogOverlay";
348
+ var DialogContent = React10.forwardRef(
349
+ ({ className, children, onPointerDownOutside, onEscapeKeyDown, showCloseButton = true, ...props }, ref) => {
350
+ const ctx = React10.useContext(DialogContext);
351
+ const open = !!ctx?.open;
352
+ useOnClickOutside(
353
+ [ctx?.contentRef ?? { current: null }, ctx?.triggerRef ?? { current: null }],
354
+ (evt) => {
355
+ onPointerDownOutside?.(evt);
356
+ if (!evt.defaultPrevented) {
357
+ ctx?.setOpen(false);
358
+ }
359
+ },
360
+ open
361
+ );
362
+ React10.useEffect(() => {
363
+ if (!open) return;
364
+ const onKey = (e) => {
365
+ if (e.key !== "Escape") return;
366
+ onEscapeKeyDown?.(e);
367
+ if (!e.defaultPrevented) {
368
+ ctx?.setOpen(false);
369
+ }
370
+ };
371
+ document.addEventListener("keydown", onKey);
372
+ return () => document.removeEventListener("keydown", onKey);
373
+ }, [ctx, onEscapeKeyDown, open]);
374
+ if (!ctx || !open) return null;
375
+ return /* @__PURE__ */ React10.createElement(DialogPortal, null, /* @__PURE__ */ React10.createElement(DialogOverlay, null), /* @__PURE__ */ React10.createElement(
376
+ "div",
377
+ {
378
+ ref: mergeRefs(ctx.contentRef, ref),
379
+ className: cn(
380
+ "fixed left-[50%] top-[50%] z-[10000] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg sm:rounded-lg",
381
+ className
382
+ ),
383
+ ...props
384
+ },
385
+ children,
386
+ showCloseButton ? /* @__PURE__ */ React10.createElement(DialogClose, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100" }, /* @__PURE__ */ React10.createElement(X, { className: "h-4 w-4" }), /* @__PURE__ */ React10.createElement("span", { className: "sr-only" }, "Close")) : null
387
+ ));
388
+ }
389
+ );
390
+ DialogContent.displayName = "DialogContent";
391
+ var DialogHeader = ({
392
+ className,
393
+ ...props
394
+ }) => /* @__PURE__ */ React10.createElement(
395
+ "div",
396
+ {
397
+ className: cn(
398
+ "flex flex-col space-y-1.5 text-center sm:text-left",
399
+ className
400
+ ),
401
+ ...props
402
+ }
403
+ );
404
+ DialogHeader.displayName = "DialogHeader";
405
+ var DialogFooter = ({
406
+ className,
407
+ ...props
408
+ }) => /* @__PURE__ */ React10.createElement(
409
+ "div",
410
+ {
411
+ className: cn(
412
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
413
+ className
414
+ ),
415
+ ...props
416
+ }
417
+ );
418
+ DialogFooter.displayName = "DialogFooter";
419
+ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
420
+ "h2",
421
+ {
422
+ ref,
423
+ className: cn(
424
+ "text-lg font-semibold leading-none tracking-tight",
425
+ className
426
+ ),
427
+ ...props
428
+ }
429
+ ));
430
+ DialogTitle.displayName = "DialogTitle";
431
+ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
432
+ "p",
433
+ {
434
+ ref,
435
+ className: cn("text-sm text-muted-foreground", className),
436
+ ...props
437
+ }
438
+ ));
439
+ DialogDescription.displayName = "DialogDescription";
440
+ var AlertDialogContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
441
+ DialogContent,
442
+ {
443
+ ref,
444
+ className: cn("z-[9999]", className),
445
+ ...props
446
+ }
447
+ ));
448
+ AlertDialogContent.displayName = "AlertDialogContent";
449
+ var AlertDialogAction = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
450
+ DialogClose,
451
+ {
452
+ ref,
453
+ className: cn(buttonVariants(), className),
454
+ ...props
455
+ }
456
+ ));
457
+ AlertDialogAction.displayName = "AlertDialogAction";
458
+ var AlertDialogCancel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
459
+ DialogClose,
460
+ {
461
+ ref,
462
+ className: cn(
463
+ buttonVariants({ variant: "outline" }),
464
+ "mt-2 sm:mt-0",
465
+ className
466
+ ),
467
+ ...props
468
+ }
469
+ ));
470
+ AlertDialogCancel.displayName = "AlertDialogCancel";
471
+ var DropdownMenuContext = React10.createContext(null);
472
+ var DropdownMenuRadioGroupContext = React10.createContext(null);
473
+ var DropdownMenu = ({ open, defaultOpen = false, onOpenChange, children }) => {
474
+ const [isOpen, setIsOpen] = useControllableState({
475
+ value: open,
476
+ defaultValue: defaultOpen,
477
+ onChange: onOpenChange
478
+ });
479
+ const triggerRef = React10.useRef(null);
480
+ const contentRef = React10.useRef(null);
481
+ return /* @__PURE__ */ React10.createElement(DropdownMenuContext.Provider, { value: { open: isOpen, setOpen: setIsOpen, triggerRef, contentRef } }, children);
482
+ };
483
+ var DropdownMenuTrigger = React10.forwardRef(({ children, onClick, ...props }, ref) => {
484
+ const ctx = React10.useContext(DropdownMenuContext);
485
+ if (!ctx) return null;
486
+ const mergedRef = mergeRefs(ctx.triggerRef, ref);
487
+ const handleClick = (e) => {
488
+ ctx.setOpen(!ctx.open);
489
+ onClick?.(e);
490
+ };
491
+ return /* @__PURE__ */ React10.createElement("button", { ref: mergedRef, type: "button", onClick: handleClick, ...props }, children);
492
+ });
493
+ DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
494
+ var DropdownMenuGroup = ({ children }) => /* @__PURE__ */ React10.createElement(React10.Fragment, null, children);
495
+ var DropdownMenuPortal = ({ children }) => /* @__PURE__ */ React10.createElement(Portal, null, children);
496
+ var DropdownMenuSub = ({ children }) => /* @__PURE__ */ React10.createElement(React10.Fragment, null, children);
497
+ var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, style, ...props }, ref) => {
498
+ const ctx = React10.useContext(DropdownMenuContext);
499
+ const [pos, setPos] = React10.useState({ top: 0, left: 0 });
500
+ const open = !!ctx?.open;
501
+ const trigger = ctx?.triggerRef.current ?? null;
502
+ React10.useLayoutEffect(() => {
503
+ if (!trigger) return;
504
+ const rect = trigger.getBoundingClientRect();
505
+ setPos({ top: rect.bottom + sideOffset, left: rect.left });
506
+ }, [trigger, sideOffset]);
507
+ useOnClickOutside(
508
+ [ctx?.contentRef ?? { current: null }, ctx?.triggerRef ?? { current: null }],
509
+ () => ctx?.setOpen(false),
510
+ open
511
+ );
512
+ if (!ctx || !open || !trigger) return null;
513
+ return /* @__PURE__ */ React10.createElement(DropdownMenuPortal, null, /* @__PURE__ */ React10.createElement(
514
+ "div",
515
+ {
516
+ ref: mergeRefs(ctx.contentRef, ref),
517
+ className: cn(
518
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
519
+ className
520
+ ),
521
+ style: { position: "fixed", top: pos.top, left: pos.left, ...style },
522
+ ...props
523
+ }
524
+ ));
525
+ });
526
+ DropdownMenuContent.displayName = "DropdownMenuContent";
527
+ var DropdownMenuItem = React10.forwardRef(({ className, inset, onSelect, onClick, ...props }, ref) => {
528
+ const ctx = React10.useContext(DropdownMenuContext);
529
+ return /* @__PURE__ */ React10.createElement(
530
+ "button",
531
+ {
532
+ ref,
533
+ type: "button",
534
+ className: cn(
535
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
536
+ inset && "pl-8",
537
+ className
538
+ ),
539
+ onClick: (e) => {
540
+ onSelect?.(e.nativeEvent);
541
+ onClick?.(e);
542
+ if (!e.isDefaultPrevented()) {
543
+ ctx?.setOpen(false);
544
+ }
545
+ },
546
+ ...props
547
+ }
548
+ );
549
+ });
550
+ DropdownMenuItem.displayName = "DropdownMenuItem";
551
+ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checked = false, onCheckedChange, onClick, ...props }, ref) => /* @__PURE__ */ React10.createElement(
552
+ "button",
553
+ {
554
+ ref,
555
+ type: "button",
556
+ className: cn(
557
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
558
+ className
559
+ ),
560
+ onClick: (e) => {
561
+ onCheckedChange?.(!checked);
562
+ onClick?.(e);
563
+ },
564
+ ...props
565
+ },
566
+ /* @__PURE__ */ React10.createElement("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, checked ? /* @__PURE__ */ React10.createElement(Check, { className: "h-4 w-4" }) : null),
567
+ children
568
+ ));
569
+ DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
570
+ var DropdownMenuRadioGroup = ({
571
+ value,
572
+ onValueChange,
573
+ children
574
+ }) => /* @__PURE__ */ React10.createElement(DropdownMenuRadioGroupContext.Provider, { value: { value, onValueChange } }, children);
575
+ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, value, onClick, ...props }, ref) => {
576
+ const radioCtx = React10.useContext(DropdownMenuRadioGroupContext);
577
+ const menuCtx = React10.useContext(DropdownMenuContext);
578
+ const checked = radioCtx?.value === value;
579
+ return /* @__PURE__ */ React10.createElement(
580
+ "button",
581
+ {
582
+ ref,
583
+ type: "button",
584
+ className: cn(
585
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
586
+ className
587
+ ),
588
+ onClick: (e) => {
589
+ radioCtx?.onValueChange?.(value);
590
+ onClick?.(e);
591
+ menuCtx?.setOpen(false);
592
+ },
593
+ ...props
594
+ },
595
+ /* @__PURE__ */ React10.createElement("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, checked ? /* @__PURE__ */ React10.createElement(Circle, { className: "h-2 w-2 fill-current" }) : null),
596
+ children
597
+ );
598
+ });
599
+ DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
600
+ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ React10.createElement(
601
+ "div",
602
+ {
603
+ ref,
604
+ className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
605
+ ...props
606
+ }
607
+ ));
608
+ DropdownMenuLabel.displayName = "DropdownMenuLabel";
609
+ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
610
+ "div",
611
+ {
612
+ ref,
613
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
614
+ ...props
615
+ }
616
+ ));
617
+ DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
618
+ var DropdownMenuShortcut = ({
619
+ className,
620
+ ...props
621
+ }) => /* @__PURE__ */ React10.createElement(
622
+ "span",
623
+ {
624
+ className: cn("ml-auto text-xs tracking-widest opacity-60", className),
625
+ ...props
626
+ }
627
+ );
628
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
629
+ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ React10.createElement(
630
+ "button",
631
+ {
632
+ ref,
633
+ type: "button",
634
+ className: cn(
635
+ "flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent",
636
+ inset && "pl-8",
637
+ className
638
+ ),
639
+ ...props
640
+ },
641
+ children,
642
+ /* @__PURE__ */ React10.createElement(ChevronRight, { className: "ml-auto" })
643
+ ));
644
+ DropdownMenuSubTrigger.displayName = "DropdownMenuSubTrigger";
645
+ var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
646
+ "div",
647
+ {
648
+ ref,
649
+ className: cn(
650
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg",
651
+ className
652
+ ),
653
+ ...props
654
+ }
655
+ ));
656
+ DropdownMenuSubContent.displayName = "DropdownMenuSubContent";
657
+ var PopoverContext = React10.createContext(null);
658
+ var Popover = ({ open, defaultOpen = false, onOpenChange, children }) => {
659
+ const [isOpen, setIsOpen] = useControllableState({
660
+ value: open,
661
+ defaultValue: defaultOpen,
662
+ onChange: onOpenChange
663
+ });
664
+ const triggerRef = React10.useRef(null);
665
+ const anchorRef = React10.useRef(null);
666
+ const contentRef = React10.useRef(null);
667
+ return /* @__PURE__ */ React10.createElement(PopoverContext.Provider, { value: { open: isOpen, setOpen: setIsOpen, triggerRef, anchorRef, contentRef } }, children);
668
+ };
669
+ var PopoverTrigger = React10.forwardRef(
670
+ ({ children, onClick, ...props }, ref) => {
671
+ const ctx = React10.useContext(PopoverContext);
672
+ if (!ctx) return null;
673
+ const mergedRef = mergeRefs(ctx.triggerRef, ref);
674
+ const handleClick = (e) => {
675
+ ctx.setOpen(!ctx.open);
676
+ onClick?.(e);
677
+ };
678
+ return /* @__PURE__ */ React10.createElement("button", { ref: mergedRef, type: "button", onClick: handleClick, ...props }, children);
679
+ }
680
+ );
681
+ PopoverTrigger.displayName = "PopoverTrigger";
682
+ var PopoverAnchor = React10.forwardRef(
683
+ ({ ...props }, ref) => {
684
+ const ctx = React10.useContext(PopoverContext);
685
+ if (!ctx) return null;
686
+ return /* @__PURE__ */ React10.createElement("span", { ref: mergeRefs(ctx.anchorRef, ref), ...props });
687
+ }
688
+ );
689
+ PopoverAnchor.displayName = "PopoverAnchor";
690
+ var PopoverContent = React10.forwardRef(
691
+ ({ className, align = "center", sideOffset = 4, style, ...props }, ref) => {
692
+ const ctx = React10.useContext(PopoverContext);
693
+ const [position, setPosition] = React10.useState({ top: 0, left: 0 });
694
+ const open = !!ctx?.open;
695
+ const anchor = ctx?.anchorRef.current ?? ctx?.triggerRef.current ?? null;
696
+ React10.useLayoutEffect(() => {
697
+ if (!anchor) return;
698
+ const rect = anchor.getBoundingClientRect();
699
+ let left = rect.left + rect.width / 2;
700
+ if (align === "start") left = rect.left;
701
+ if (align === "end") left = rect.right;
702
+ setPosition({ top: rect.bottom + sideOffset, left });
703
+ }, [anchor, align, sideOffset]);
704
+ useOnClickOutside(
705
+ [ctx?.contentRef ?? { current: null }, ctx?.triggerRef ?? { current: null }],
706
+ () => ctx?.setOpen(false),
707
+ open
708
+ );
709
+ if (!ctx || !open) return null;
710
+ return /* @__PURE__ */ React10.createElement(Portal, null, /* @__PURE__ */ React10.createElement(
711
+ "div",
712
+ {
713
+ ref: mergeRefs(ctx.contentRef, ref),
714
+ className: cn(
715
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
716
+ className
717
+ ),
718
+ style: {
719
+ position: "fixed",
720
+ top: position.top,
721
+ left: position.left,
722
+ transform: align === "center" ? "translateX(-50%)" : align === "end" ? "translateX(-100%)" : void 0,
723
+ ...style
724
+ },
725
+ ...props
726
+ }
727
+ ));
728
+ }
729
+ );
730
+ PopoverContent.displayName = "PopoverContent";
731
+ var Progress = React10.forwardRef(
732
+ ({ className, value = 0, max = 100, ...props }, ref) => {
733
+ const safeMax = max <= 0 ? 100 : max;
734
+ const safeValue = Math.max(0, Math.min(value, safeMax));
735
+ const percent = safeValue / safeMax * 100;
736
+ return /* @__PURE__ */ React10.createElement(
737
+ "div",
738
+ {
739
+ ref,
740
+ role: "progressbar",
741
+ "aria-valuemin": 0,
742
+ "aria-valuemax": safeMax,
743
+ "aria-valuenow": safeValue,
744
+ className: cn(
745
+ "relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
746
+ className
747
+ ),
748
+ ...props
749
+ },
750
+ /* @__PURE__ */ React10.createElement(
751
+ "div",
752
+ {
753
+ className: "h-full w-full flex-1 bg-primary transition-all",
754
+ style: { transform: `translateX(-${100 - percent}%)` }
755
+ }
756
+ )
757
+ );
758
+ }
759
+ );
760
+ Progress.displayName = "Progress";
761
+ var ScrollArea = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ React10.createElement(
762
+ "div",
763
+ {
764
+ ref,
765
+ className: cn("relative overflow-auto", className),
766
+ ...props
767
+ },
768
+ children
769
+ ));
770
+ ScrollArea.displayName = "ScrollArea";
771
+ var ScrollBar = React10.forwardRef(
772
+ ({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ React10.createElement(
773
+ "div",
774
+ {
775
+ ref,
776
+ className: cn(
777
+ "pointer-events-none absolute",
778
+ orientation === "vertical" ? "right-0 top-0 h-full w-2.5" : "bottom-0 left-0 h-2.5 w-full",
779
+ className
780
+ ),
781
+ ...props
782
+ }
783
+ )
784
+ );
785
+ ScrollBar.displayName = "ScrollBar";
786
+ var SelectContext = React10.createContext(null);
787
+ var SelectGroupContext = React10.createContext(false);
788
+ var Select = ({
789
+ value,
790
+ defaultValue,
791
+ onValueChange,
792
+ open,
793
+ defaultOpen = false,
794
+ onOpenChange,
795
+ disabled = false,
796
+ children
797
+ }) => {
798
+ const [isOpen, setIsOpen] = useControllableState({
799
+ value: open,
800
+ defaultValue: defaultOpen,
801
+ onChange: onOpenChange
802
+ });
803
+ const [currentValue, setCurrentValue] = useControllableState({
804
+ value,
805
+ defaultValue,
806
+ onChange: (next) => {
807
+ if (next !== void 0) {
808
+ onValueChange?.(next);
809
+ }
810
+ }
811
+ });
812
+ const triggerRef = React10.useRef(null);
813
+ const contentRef = React10.useRef(null);
814
+ const itemsRef = React10.useRef(/* @__PURE__ */ new Map());
815
+ return /* @__PURE__ */ React10.createElement(
816
+ SelectContext.Provider,
817
+ {
818
+ value: {
819
+ open: disabled ? false : isOpen,
820
+ setOpen: disabled ? () => void 0 : setIsOpen,
821
+ value: currentValue,
822
+ setValue: (next) => {
823
+ if (disabled) return;
824
+ setCurrentValue(next);
825
+ setIsOpen(false);
826
+ },
827
+ triggerRef,
828
+ contentRef,
829
+ itemsRef
830
+ }
831
+ },
832
+ children
833
+ );
834
+ };
835
+ var SelectGroup = ({ children }) => /* @__PURE__ */ React10.createElement(SelectGroupContext.Provider, { value: true }, children);
836
+ var SelectValue = ({
837
+ placeholder,
838
+ children
839
+ }) => {
840
+ const ctx = React10.useContext(SelectContext);
841
+ if (!ctx) return null;
842
+ if (children) return /* @__PURE__ */ React10.createElement(React10.Fragment, null, children);
843
+ if (ctx.value && ctx.itemsRef.current.has(ctx.value)) {
844
+ return /* @__PURE__ */ React10.createElement(React10.Fragment, null, ctx.itemsRef.current.get(ctx.value));
845
+ }
846
+ return /* @__PURE__ */ React10.createElement("span", { className: "text-muted-foreground" }, placeholder);
847
+ };
848
+ var SelectTrigger = React10.forwardRef(({ className, children, onClick, ...props }, ref) => {
849
+ const ctx = React10.useContext(SelectContext);
850
+ if (!ctx) return null;
851
+ return /* @__PURE__ */ React10.createElement(
852
+ "button",
853
+ {
854
+ ref: mergeRefs(ctx.triggerRef, ref),
855
+ type: "button",
856
+ className: cn(
857
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
858
+ className
859
+ ),
860
+ onClick: (e) => {
861
+ ctx.setOpen(!ctx.open);
862
+ onClick?.(e);
863
+ },
864
+ ...props
865
+ },
866
+ /* @__PURE__ */ React10.createElement("span", null, children),
867
+ /* @__PURE__ */ React10.createElement(ChevronDown, { className: "h-4 w-4 opacity-50" })
868
+ );
869
+ });
870
+ SelectTrigger.displayName = "SelectTrigger";
871
+ var SelectScrollUpButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
872
+ "div",
873
+ {
874
+ ref,
875
+ className: cn("flex cursor-default items-center justify-center py-1", className),
876
+ ...props
877
+ },
878
+ /* @__PURE__ */ React10.createElement(ChevronUp, { className: "h-4 w-4" })
879
+ ));
880
+ SelectScrollUpButton.displayName = "SelectScrollUpButton";
881
+ var SelectScrollDownButton = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
882
+ "div",
883
+ {
884
+ ref,
885
+ className: cn("flex cursor-default items-center justify-center py-1", className),
886
+ ...props
887
+ },
888
+ /* @__PURE__ */ React10.createElement(ChevronDown, { className: "h-4 w-4" })
889
+ ));
890
+ SelectScrollDownButton.displayName = "SelectScrollDownButton";
891
+ var SelectContent = React10.forwardRef(({ className, children, style, ...props }, ref) => {
892
+ const ctx = React10.useContext(SelectContext);
893
+ const [pos, setPos] = React10.useState({ top: 0, left: 0, width: 0 });
894
+ const open = !!ctx?.open;
895
+ const trigger = ctx?.triggerRef.current ?? null;
896
+ React10.useLayoutEffect(() => {
897
+ if (!trigger) return;
898
+ const rect = trigger.getBoundingClientRect();
899
+ setPos({ top: rect.bottom + 4, left: rect.left, width: rect.width });
900
+ }, [trigger]);
901
+ useOnClickOutside(
902
+ [ctx?.contentRef ?? { current: null }, ctx?.triggerRef ?? { current: null }],
903
+ () => ctx?.setOpen(false),
904
+ open
905
+ );
906
+ if (!ctx || !open || !trigger) return null;
907
+ return /* @__PURE__ */ React10.createElement(Portal, null, /* @__PURE__ */ React10.createElement(
908
+ "div",
909
+ {
910
+ ref: mergeRefs(ctx.contentRef, ref),
911
+ className: cn(
912
+ "relative z-50 max-h-80 overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
913
+ className
914
+ ),
915
+ style: {
916
+ position: "fixed",
917
+ top: pos.top,
918
+ left: pos.left,
919
+ minWidth: Math.max(pos.width, 128),
920
+ ...style
921
+ },
922
+ ...props
923
+ },
924
+ /* @__PURE__ */ React10.createElement("div", { className: "p-1" }, children)
925
+ ));
926
+ });
927
+ SelectContent.displayName = "SelectContent";
928
+ var SelectLabel = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
929
+ "div",
930
+ {
931
+ ref,
932
+ className: cn("px-2 py-1.5 text-sm font-semibold", className),
933
+ ...props
934
+ }
935
+ ));
936
+ SelectLabel.displayName = "SelectLabel";
937
+ var SelectItem = React10.forwardRef(
938
+ ({ className, children, value, onClick, ...props }, ref) => {
939
+ const ctx = React10.useContext(SelectContext);
940
+ React10.useEffect(() => {
941
+ if (!ctx) return;
942
+ ctx.itemsRef.current.set(value, children);
943
+ return () => {
944
+ ctx.itemsRef.current.delete(value);
945
+ };
946
+ }, [ctx, value, children]);
947
+ if (!ctx) return null;
948
+ const selected = ctx.value === value;
949
+ return /* @__PURE__ */ React10.createElement(
950
+ "button",
951
+ {
952
+ ref,
953
+ type: "button",
954
+ className: cn(
955
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50",
956
+ className
957
+ ),
958
+ onClick: (e) => {
959
+ ctx.setValue(value);
960
+ onClick?.(e);
961
+ },
962
+ ...props
963
+ },
964
+ /* @__PURE__ */ React10.createElement("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center" }, selected ? /* @__PURE__ */ React10.createElement(Check, { className: "h-4 w-4" }) : null),
965
+ /* @__PURE__ */ React10.createElement("span", null, children)
966
+ );
967
+ }
968
+ );
969
+ SelectItem.displayName = "SelectItem";
970
+ var SelectSeparator = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
971
+ "div",
972
+ {
973
+ ref,
974
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
975
+ ...props
976
+ }
977
+ ));
978
+ SelectSeparator.displayName = "SelectSeparator";
979
+ var Separator = React10.forwardRef(
980
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ React10.createElement(
981
+ "div",
982
+ {
983
+ ref,
984
+ role: decorative ? void 0 : "separator",
985
+ "aria-orientation": orientation,
986
+ className: cn(
987
+ "shrink-0 bg-border",
988
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
989
+ className
990
+ ),
991
+ ...props
992
+ }
993
+ )
994
+ );
995
+ Separator.displayName = "Separator";
996
+ var sheetVariants = cva(
997
+ "fixed z-[10000] gap-4 bg-background p-6 shadow-lg transition ease-in-out translate-x-0 translate-y-0",
998
+ {
999
+ variants: {
1000
+ side: {
1001
+ top: "inset-x-0 top-0 left-0 border-b",
1002
+ bottom: "inset-x-0 bottom-0 left-0 border-t",
1003
+ left: "inset-y-0 left-0 top-0 h-full w-3/4 border-r sm:max-w-sm",
1004
+ right: "inset-y-0 right-0 top-0 h-full w-3/4 border-l sm:max-w-sm"
1005
+ }
1006
+ },
1007
+ defaultVariants: {
1008
+ side: "right"
1009
+ }
1010
+ }
1011
+ );
1012
+ var SheetContent = React10.forwardRef(
1013
+ ({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ React10.createElement(
1014
+ DialogContent,
1015
+ {
1016
+ ref,
1017
+ className: cn(
1018
+ "max-w-none rounded-none",
1019
+ sheetVariants({ side }),
1020
+ className
1021
+ ),
1022
+ showCloseButton: false,
1023
+ ...props
1024
+ },
1025
+ /* @__PURE__ */ React10.createElement(DialogClose, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100" }, /* @__PURE__ */ React10.createElement(X, { className: "h-4 w-4" }), /* @__PURE__ */ React10.createElement("span", { className: "sr-only" }, "Close")),
1026
+ children
1027
+ )
1028
+ );
1029
+ SheetContent.displayName = "SheetContent";
1030
+ var SheetHeader = ({
1031
+ className,
1032
+ ...props
1033
+ }) => /* @__PURE__ */ React10.createElement(
1034
+ "div",
1035
+ {
1036
+ className: cn(
1037
+ "flex flex-col space-y-2 text-center sm:text-left",
1038
+ className
1039
+ ),
1040
+ ...props
1041
+ }
1042
+ );
1043
+ SheetHeader.displayName = "SheetHeader";
1044
+ var SheetFooter = ({
1045
+ className,
1046
+ ...props
1047
+ }) => /* @__PURE__ */ React10.createElement(
1048
+ "div",
1049
+ {
1050
+ className: cn(
1051
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
1052
+ className
1053
+ ),
1054
+ ...props
1055
+ }
1056
+ );
1057
+ SheetFooter.displayName = "SheetFooter";
1058
+ var SheetTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
1059
+ "h2",
1060
+ {
1061
+ ref,
1062
+ className: cn("text-lg font-semibold text-foreground", className),
1063
+ ...props
1064
+ }
1065
+ ));
1066
+ SheetTitle.displayName = "SheetTitle";
1067
+ var SheetDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React10.createElement(
1068
+ "p",
1069
+ {
1070
+ ref,
1071
+ className: cn("text-sm text-muted-foreground", className),
1072
+ ...props
1073
+ }
1074
+ ));
1075
+ SheetDescription.displayName = "SheetDescription";
1076
+ var Textarea = React10.forwardRef(({ className, ...props }, ref) => {
1077
+ return /* @__PURE__ */ React10.createElement(
1078
+ "textarea",
1079
+ {
1080
+ className: cn(
1081
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1082
+ className
1083
+ ),
1084
+ ref,
1085
+ ...props
1086
+ }
1087
+ );
1088
+ });
1089
+ Textarea.displayName = "Textarea";
1090
+ var TooltipConfigContext = React10.createContext({
1091
+ delayDuration: 200
1092
+ });
1093
+ var TooltipContext = React10.createContext(null);
1094
+ var TooltipProvider = ({
1095
+ children,
1096
+ delayDuration = 200
1097
+ }) => {
1098
+ return /* @__PURE__ */ React10.createElement(TooltipConfigContext.Provider, { value: { delayDuration } }, children);
1099
+ };
1100
+ var Tooltip = ({ children }) => {
1101
+ const [open, setOpen] = React10.useState(false);
1102
+ const triggerRef = React10.useRef(null);
1103
+ return /* @__PURE__ */ React10.createElement(TooltipContext.Provider, { value: { open, setOpen, triggerRef } }, children);
1104
+ };
1105
+ var TooltipTrigger = React10.forwardRef(({ children, ...props }, ref) => {
1106
+ const ctx = React10.useContext(TooltipContext);
1107
+ const cfg = React10.useContext(TooltipConfigContext);
1108
+ const timer = React10.useRef(null);
1109
+ if (!ctx) return null;
1110
+ const setRef = mergeRefs(ctx.triggerRef, ref);
1111
+ const openWithDelay = () => {
1112
+ if (timer.current) clearTimeout(timer.current);
1113
+ timer.current = setTimeout(() => ctx.setOpen(true), cfg.delayDuration);
1114
+ };
1115
+ const closeNow = () => {
1116
+ if (timer.current) clearTimeout(timer.current);
1117
+ ctx.setOpen(false);
1118
+ };
1119
+ const shared = {
1120
+ onMouseEnter: openWithDelay,
1121
+ onMouseLeave: closeNow,
1122
+ onFocus: openWithDelay,
1123
+ onBlur: closeNow,
1124
+ ...props
1125
+ };
1126
+ return /* @__PURE__ */ React10.createElement("span", { ref: setRef, ...shared }, children);
1127
+ });
1128
+ TooltipTrigger.displayName = "TooltipTrigger";
1129
+ var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, style, ...props }, ref) => {
1130
+ const ctx = React10.useContext(TooltipContext);
1131
+ const [pos, setPos] = React10.useState({ top: 0, left: 0 });
1132
+ const open = !!ctx?.open;
1133
+ const trigger = ctx?.triggerRef.current ?? null;
1134
+ React10.useLayoutEffect(() => {
1135
+ if (!trigger) return;
1136
+ const rect = trigger.getBoundingClientRect();
1137
+ setPos({
1138
+ top: rect.top - sideOffset,
1139
+ left: rect.left + rect.width / 2
1140
+ });
1141
+ }, [trigger, sideOffset]);
1142
+ if (!ctx || !open || !trigger) return null;
1143
+ return /* @__PURE__ */ React10.createElement(Portal, null, /* @__PURE__ */ React10.createElement(
1144
+ "div",
1145
+ {
1146
+ ref,
1147
+ className: cn(
1148
+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground",
1149
+ className
1150
+ ),
1151
+ style: {
1152
+ position: "fixed",
1153
+ top: pos.top,
1154
+ left: pos.left,
1155
+ transform: "translate(-50%, -100%)",
1156
+ ...style
1157
+ },
1158
+ ...props
1159
+ }
1160
+ ));
1161
+ });
1162
+ TooltipContent.displayName = "TooltipContent";
1163
+ var AvatarContext = React10.createContext(null);
1164
+ var Avatar = React10.forwardRef(({ className, ...props }, ref) => {
1165
+ const [status, setStatus] = React10.useState("idle");
1166
+ return /* @__PURE__ */ React10.createElement(AvatarContext.Provider, { value: { status, setStatus } }, /* @__PURE__ */ React10.createElement(
1167
+ "span",
1168
+ {
1169
+ ref,
1170
+ className: cn(
1171
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
1172
+ className
1173
+ ),
1174
+ ...props
1175
+ }
1176
+ ));
1177
+ });
1178
+ Avatar.displayName = "Avatar";
1179
+ var AvatarImage = React10.forwardRef(({ className, onLoad, onError, ...props }, ref) => {
1180
+ const ctx = React10.useContext(AvatarContext);
1181
+ return /* @__PURE__ */ React10.createElement(
1182
+ "img",
1183
+ {
1184
+ ref,
1185
+ className: cn(
1186
+ "aspect-square h-full w-full",
1187
+ ctx?.status === "error" ? "hidden" : void 0,
1188
+ className
1189
+ ),
1190
+ onLoad: (e) => {
1191
+ ctx?.setStatus("loaded");
1192
+ onLoad?.(e);
1193
+ },
1194
+ onError: (e) => {
1195
+ ctx?.setStatus("error");
1196
+ onError?.(e);
1197
+ },
1198
+ ...props
1199
+ }
1200
+ );
1201
+ });
1202
+ AvatarImage.displayName = "AvatarImage";
1203
+ var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => {
1204
+ const ctx = React10.useContext(AvatarContext);
1205
+ const show = ctx?.status !== "loaded";
1206
+ if (!show) return null;
1207
+ return /* @__PURE__ */ React10.createElement(
1208
+ "span",
1209
+ {
1210
+ ref,
1211
+ className: cn(
1212
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
1213
+ className
1214
+ ),
1215
+ ...props
1216
+ }
1217
+ );
1218
+ });
1219
+ AvatarFallback.displayName = "AvatarFallback";
1220
+ function buildGridColsClasses(columns) {
1221
+ return [
1222
+ "grid-cols-1",
1223
+ // 默认单列
1224
+ columns.sm ? "sm:grid-cols-" + columns.sm : "",
1225
+ columns.md ? "md:grid-cols-" + columns.md : "md:grid-cols-2",
1226
+ columns.lg ? "lg:grid-cols-" + columns.lg : "lg:grid-cols-3",
1227
+ columns.xl ? "xl:grid-cols-" + columns.xl : ""
1228
+ ].filter(Boolean).join(" ");
1229
+ }
1230
+ function getGapClassName(gap) {
1231
+ const gapClasses = {
1232
+ sm: "gap-3",
1233
+ md: "gap-6",
1234
+ lg: "gap-8",
1235
+ xl: "gap-10"
1236
+ };
1237
+ return gapClasses[gap];
1238
+ }
1239
+ function Grid({
1240
+ items,
1241
+ renderItem,
1242
+ columns = { md: 2, lg: 3 },
1243
+ gap = "md",
1244
+ className = "",
1245
+ style
1246
+ }) {
1247
+ const gridColsClasses = buildGridColsClasses(columns);
1248
+ const gapClass = getGapClassName(gap);
1249
+ return /* @__PURE__ */ React10__default.createElement(
1250
+ "div",
1251
+ {
1252
+ className: clsx("grid", gridColsClasses, gapClass, className),
1253
+ style
1254
+ },
1255
+ items.map((item, index) => /* @__PURE__ */ React10__default.createElement("div", { key: item.id }, renderItem(item, index)))
1256
+ );
1257
+ }
1258
+ var SearchBox = ({
1259
+ searchQuery,
1260
+ onSearchChange,
1261
+ placeholder = "\u641C\u7D22\u5B9E\u9A8C\u9879\u76EE\u7684\u6807\u9898\u3001\u63CF\u8FF0\u6216\u6807\u7B7E...",
1262
+ size = "large"
1263
+ }) => {
1264
+ const getSizeStyles = () => {
1265
+ switch (size) {
1266
+ case "small":
1267
+ return {
1268
+ container: "h-10",
1269
+ input: "pl-10 pr-10 text-sm",
1270
+ icon: "w-4 h-4",
1271
+ iconPosition: "left-3",
1272
+ clearButton: "right-2 w-6 h-6",
1273
+ clearIcon: "w-3 h-3"
1274
+ };
1275
+ case "medium":
1276
+ return {
1277
+ container: "h-12",
1278
+ input: "pl-12 pr-12 text-base",
1279
+ icon: "w-5 h-5",
1280
+ iconPosition: "left-3",
1281
+ clearButton: "right-3 w-7 h-7",
1282
+ clearIcon: "w-4 h-4"
1283
+ };
1284
+ case "large":
1285
+ default:
1286
+ return {
1287
+ container: "h-16",
1288
+ input: "pl-6 pr-16 text-lg",
1289
+ icon: "w-6 h-6",
1290
+ iconPosition: "left-6",
1291
+ clearButton: "right-4 w-8 h-8",
1292
+ clearIcon: "w-4 h-4"
1293
+ };
1294
+ }
1295
+ };
1296
+ const styles = getSizeStyles();
1297
+ const isLarge = size === "large";
1298
+ return /* @__PURE__ */ React10__default.createElement("div", { className: "relative group w-full" }, /* @__PURE__ */ React10__default.createElement(
1299
+ "input",
1300
+ {
1301
+ type: "text",
1302
+ placeholder,
1303
+ value: searchQuery,
1304
+ onChange: (e) => onSearchChange(e.target.value),
1305
+ className: clsx(
1306
+ "w-full",
1307
+ styles.container,
1308
+ styles.input,
1309
+ isLarge ? "border-2 border-gray-200 rounded-2xl shadow-lg" : "border border-gray-300 rounded-lg shadow-sm",
1310
+ "bg-white focus:ring-2 focus:ring-blue-500/20 focus:border-blue-500 hover:border-gray-400",
1311
+ isLarge ? "hover:shadow-xl" : "hover:shadow-md",
1312
+ "transition-all duration-300 ease-out text-gray-800 placeholder-gray-500",
1313
+ isLarge ? "font-medium" : "font-normal"
1314
+ )
1315
+ }
1316
+ ), searchQuery && /* @__PURE__ */ React10__default.createElement(
1317
+ "button",
1318
+ {
1319
+ onClick: () => onSearchChange(""),
1320
+ className: clsx(
1321
+ "absolute top-1/2",
1322
+ styles.clearButton,
1323
+ "transform -translate-y-1/2 z-10 group/clear"
1324
+ )
1325
+ },
1326
+ /* @__PURE__ */ React10__default.createElement("div", { className: clsx(
1327
+ styles.clearButton,
1328
+ "flex items-center justify-center rounded-full bg-gray-100 hover:bg-gray-200 transition-all duration-200 group-hover/clear:scale-105"
1329
+ ) }, /* @__PURE__ */ React10__default.createElement(
1330
+ "svg",
1331
+ {
1332
+ className: clsx(styles.clearIcon, "text-gray-500 group-hover/clear:text-gray-700"),
1333
+ fill: "none",
1334
+ stroke: "currentColor",
1335
+ viewBox: "0 0 24 24"
1336
+ },
1337
+ /* @__PURE__ */ React10__default.createElement(
1338
+ "path",
1339
+ {
1340
+ strokeLinecap: "round",
1341
+ strokeLinejoin: "round",
1342
+ strokeWidth: 2,
1343
+ d: "M6 18L18 6M6 6l12 12"
1344
+ }
1345
+ )
1346
+ ))
1347
+ ));
1348
+ };
1349
+ var Timeline = ({ items = [] }) => {
1350
+ if (!items || items.length === 0) {
1351
+ return null;
1352
+ }
1353
+ return /* @__PURE__ */ React10__default.createElement("div", { className: "relative" }, /* @__PURE__ */ React10__default.createElement("div", { className: "absolute left-4 top-0 bottom-0 w-0.5 bg-gray-200" }), items.map((item, index) => /* @__PURE__ */ React10__default.createElement("div", { key: index, className: "relative pl-12 pb-8" }, /* @__PURE__ */ React10__default.createElement("div", { className: "absolute left-0 w-8 h-8 rounded-full bg-blue-500 border-4 border-white shadow-md flex items-center justify-center" }, /* @__PURE__ */ React10__default.createElement("div", { className: "w-2 h-2 rounded-full bg-white" })), /* @__PURE__ */ React10__default.createElement("div", { className: "bg-white rounded-lg p-4 shadow-md" }, /* @__PURE__ */ React10__default.createElement("div", { className: "text-sm text-gray-500 mb-2" }, item.date), /* @__PURE__ */ React10__default.createElement("h4", { className: "text-lg font-semibold mb-2" }, item.title), /* @__PURE__ */ React10__default.createElement("p", { className: "text-gray-600" }, item.description)))));
1354
+ };
1355
+ var CollisionBalls = ({
1356
+ collisionBallsConfig: {
1357
+ balls,
1358
+ width,
1359
+ height
1360
+ }
1361
+ }) => {
1362
+ const canvasRef = useRef(null);
1363
+ const containerRef = useRef(null);
1364
+ const ballsRef = useRef([]);
1365
+ const [isShaking, setIsShaking] = useState(false);
1366
+ const [draggedBall, setDraggedBall] = useState(null);
1367
+ const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
1368
+ const animationRef = useRef(null);
1369
+ const updateCanvasSize = () => {
1370
+ const container = containerRef.current;
1371
+ const canvas = canvasRef.current;
1372
+ if (!container || !canvas) {
1373
+ console.error("Container or canvas not found");
1374
+ return;
1375
+ }
1376
+ const containerWidth = container.clientWidth;
1377
+ const containerHeight = container.clientHeight;
1378
+ console.log("Container size:", { containerWidth, containerHeight });
1379
+ canvas.width = containerWidth;
1380
+ canvas.height = containerHeight;
1381
+ canvas.style.width = containerWidth + "px";
1382
+ canvas.style.height = containerHeight + "px";
1383
+ console.log("Canvas size updated:", {
1384
+ width: canvas.width,
1385
+ height: canvas.height,
1386
+ containerWidth,
1387
+ containerHeight
1388
+ });
1389
+ };
1390
+ const initBalls = () => {
1391
+ const canvas = canvasRef.current;
1392
+ if (!canvas) {
1393
+ console.error("Canvas not found during ball initialization");
1394
+ return [];
1395
+ }
1396
+ console.log("Initializing balls with canvas size:", {
1397
+ width: canvas.width,
1398
+ height: canvas.height
1399
+ });
1400
+ return balls.map((ballConfig) => ({
1401
+ x: Math.random() * (canvas.width - 100) + 50,
1402
+ y: Math.random() * (canvas.height - 100) + 50,
1403
+ vx: (Math.random() - 0.5) * 4,
1404
+ vy: (Math.random() - 0.5) * 4,
1405
+ radius: ballConfig.size,
1406
+ color: ballConfig.color,
1407
+ text: ballConfig.label,
1408
+ isDragging: false
1409
+ }));
1410
+ };
1411
+ useEffect(() => {
1412
+ const handleResize = () => {
1413
+ console.log("Window resized");
1414
+ updateCanvasSize();
1415
+ };
1416
+ if (typeof window !== "undefined") {
1417
+ window.addEventListener("resize", handleResize);
1418
+ updateCanvasSize();
1419
+ }
1420
+ return () => {
1421
+ if (typeof window !== "undefined") {
1422
+ window.removeEventListener("resize", handleResize);
1423
+ }
1424
+ };
1425
+ }, []);
1426
+ useEffect(() => {
1427
+ const canvas = canvasRef.current;
1428
+ if (!canvas) {
1429
+ console.error("Canvas element not found");
1430
+ return;
1431
+ }
1432
+ const ctx = canvas.getContext("2d");
1433
+ if (!ctx) {
1434
+ console.error("Failed to get canvas context");
1435
+ return;
1436
+ }
1437
+ console.log("Starting animation setup...");
1438
+ updateCanvasSize();
1439
+ ballsRef.current = initBalls();
1440
+ console.log("Balls initialized:", ballsRef.current);
1441
+ let lastTime = performance.now();
1442
+ let frameCount = 0;
1443
+ const animate = (currentTime) => {
1444
+ try {
1445
+ frameCount++;
1446
+ if (currentTime - lastTime >= 1e3) {
1447
+ console.log("FPS: " + frameCount);
1448
+ frameCount = 0;
1449
+ lastTime = currentTime;
1450
+ }
1451
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1452
+ ballsRef.current.forEach((ball) => {
1453
+ if (!ball.isDragging) {
1454
+ updatePosition(ball, canvas.width, canvas.height);
1455
+ }
1456
+ for (let i = 0; i < ballsRef.current.length; i++) {
1457
+ for (let j = i + 1; j < ballsRef.current.length; j++) {
1458
+ const ball1 = ballsRef.current[i];
1459
+ const ball2 = ballsRef.current[j];
1460
+ if (ball1 && ball2) {
1461
+ checkCollision(ball1, ball2);
1462
+ }
1463
+ }
1464
+ }
1465
+ draw(ctx, ball);
1466
+ });
1467
+ animationRef.current = requestAnimationFrame(animate);
1468
+ } catch (error) {
1469
+ console.error("Animation error:", error);
1470
+ }
1471
+ };
1472
+ console.log("Starting animation loop...");
1473
+ animationRef.current = requestAnimationFrame(animate);
1474
+ return () => {
1475
+ console.log("Cleaning up animation...");
1476
+ if (animationRef.current) {
1477
+ cancelAnimationFrame(animationRef.current);
1478
+ animationRef.current = null;
1479
+ }
1480
+ };
1481
+ }, []);
1482
+ const shake = () => {
1483
+ setIsShaking(true);
1484
+ ballsRef.current.forEach((ball) => {
1485
+ ball.vx = (Math.random() - 0.5) * 10;
1486
+ ball.vy = (Math.random() - 0.5) * 10;
1487
+ });
1488
+ setTimeout(() => setIsShaking(false), 200);
1489
+ };
1490
+ const slowdown = () => {
1491
+ setIsShaking(true);
1492
+ ballsRef.current.forEach((ball) => {
1493
+ ball.vx = ball.vx * 0.5;
1494
+ ball.vy = ball.vy * 0.5;
1495
+ });
1496
+ setTimeout(() => setIsShaking(false), 200);
1497
+ };
1498
+ const checkCollision = (ball1, ball2) => {
1499
+ const dx = ball2.x - ball1.x;
1500
+ const dy = ball2.y - ball1.y;
1501
+ const distance = Math.sqrt(dx * dx + dy * dy);
1502
+ if (distance < ball1.radius + ball2.radius) {
1503
+ const angle = Math.atan2(dy, dx);
1504
+ const overlap = (ball1.radius + ball2.radius - distance) / 2;
1505
+ if (ball1.isDragging || ball2.isDragging) {
1506
+ const draggedBall2 = ball1.isDragging ? ball1 : ball2;
1507
+ const otherBall = ball1.isDragging ? ball2 : ball1;
1508
+ otherBall.x += (draggedBall2 === ball1 ? 1 : -1) * overlap * Math.cos(angle);
1509
+ otherBall.y += (draggedBall2 === ball1 ? 1 : -1) * overlap * Math.sin(angle);
1510
+ const pushForce = 2;
1511
+ otherBall.vx = (draggedBall2 === ball1 ? -1 : 1) * Math.cos(angle) * pushForce;
1512
+ otherBall.vy = (draggedBall2 === ball1 ? -1 : 1) * Math.sin(angle) * pushForce;
1513
+ return;
1514
+ }
1515
+ const sin = Math.sin(angle);
1516
+ const cos = Math.cos(angle);
1517
+ const vx1 = ball1.vx * cos + ball1.vy * sin;
1518
+ const vy1 = ball1.vy * cos - ball1.vx * sin;
1519
+ const vx2 = ball2.vx * cos + ball2.vy * sin;
1520
+ const vy2 = ball2.vy * cos - ball2.vx * sin;
1521
+ const newVx1 = vx2;
1522
+ const newVx2 = vx1;
1523
+ ball1.vx = newVx1 * cos - vy1 * sin;
1524
+ ball1.vy = vy1 * cos + newVx1 * sin;
1525
+ ball2.vx = newVx2 * cos - vy2 * sin;
1526
+ ball2.vy = vy2 * cos + newVx2 * sin;
1527
+ ball1.x -= overlap * Math.cos(angle);
1528
+ ball1.y -= overlap * Math.sin(angle);
1529
+ ball2.x += overlap * Math.cos(angle);
1530
+ ball2.y += overlap * Math.sin(angle);
1531
+ }
1532
+ };
1533
+ const updatePosition = (ball, width2, height2) => {
1534
+ const handleBoundaryCollision = (velocity, position, boundary, radius) => {
1535
+ let newVelocity = velocity;
1536
+ let newPosition = position;
1537
+ if (position - radius < 0) {
1538
+ newPosition = radius;
1539
+ newVelocity = Math.abs(velocity);
1540
+ } else if (position + radius > boundary) {
1541
+ newPosition = boundary - radius;
1542
+ newVelocity = -Math.abs(velocity);
1543
+ }
1544
+ return [newVelocity, newPosition];
1545
+ };
1546
+ const [newVx, newX] = handleBoundaryCollision(
1547
+ ball.vx,
1548
+ ball.x,
1549
+ width2,
1550
+ ball.radius
1551
+ );
1552
+ const [newVy, newY] = handleBoundaryCollision(
1553
+ ball.vy,
1554
+ ball.y,
1555
+ height2,
1556
+ ball.radius
1557
+ );
1558
+ ball.vx = newVx;
1559
+ ball.vy = newVy;
1560
+ ball.x = newX;
1561
+ ball.y = newY;
1562
+ };
1563
+ const draw = (ctx, ball) => {
1564
+ ctx.beginPath();
1565
+ ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2);
1566
+ ctx.fillStyle = ball.color;
1567
+ ctx.fill();
1568
+ ctx.closePath();
1569
+ if (ball.text) {
1570
+ ctx.font = "14px Arial";
1571
+ ctx.fillStyle = "#fff";
1572
+ ctx.textAlign = "center";
1573
+ ctx.textBaseline = "middle";
1574
+ ctx.fillText(ball.text, ball.x, ball.y);
1575
+ }
1576
+ };
1577
+ const handleMouseDown = (event) => {
1578
+ const mousePos2 = getMousePos(event);
1579
+ const ball = ballsRef.current.find((b) => {
1580
+ const dx = b.x - mousePos2.x;
1581
+ const dy = b.y - mousePos2.y;
1582
+ return Math.sqrt(dx * dx + dy * dy) < b.radius;
1583
+ });
1584
+ if (ball) {
1585
+ ball.isDragging = true;
1586
+ setDraggedBall(ball);
1587
+ }
1588
+ };
1589
+ const handleMouseMove = (event) => {
1590
+ const mousePos2 = getMousePos(event);
1591
+ setMousePos(mousePos2);
1592
+ if (draggedBall) {
1593
+ draggedBall.x = mousePos2.x;
1594
+ draggedBall.y = mousePos2.y;
1595
+ draggedBall.vx = 0;
1596
+ draggedBall.vy = 0;
1597
+ }
1598
+ };
1599
+ const handleMouseUp = () => {
1600
+ if (draggedBall) {
1601
+ draggedBall.isDragging = false;
1602
+ setDraggedBall(null);
1603
+ }
1604
+ };
1605
+ const getMousePos = (event) => {
1606
+ const canvas = canvasRef.current;
1607
+ if (!canvas) return { x: 0, y: 0 };
1608
+ const rect = canvas.getBoundingClientRect();
1609
+ const scaleX = canvas.width / rect.width;
1610
+ const scaleY = canvas.height / rect.height;
1611
+ return {
1612
+ x: (event.clientX - rect.left) * scaleX,
1613
+ y: (event.clientY - rect.top) * scaleY
1614
+ };
1615
+ };
1616
+ return /* @__PURE__ */ React10__default.createElement("div", { style: { width: "100%", height: "100%", position: "relative", backgroundColor: "#f9fafb", borderRadius: "0.5rem" } }, /* @__PURE__ */ React10__default.createElement("div", { ref: containerRef, style: { width: "100%", height: "100%", position: "absolute", top: 0, left: 0 } }, /* @__PURE__ */ React10__default.createElement(
1617
+ "canvas",
1618
+ {
1619
+ ref: canvasRef,
1620
+ style: {
1621
+ width: "100%",
1622
+ height: "100%",
1623
+ display: "block"
1624
+ // 确保canvas正确显示
1625
+ },
1626
+ onMouseDown: handleMouseDown,
1627
+ onMouseMove: handleMouseMove,
1628
+ onMouseUp: handleMouseUp,
1629
+ onMouseLeave: handleMouseUp
1630
+ }
1631
+ )), /* @__PURE__ */ React10__default.createElement("div", { className: "absolute bottom-4 right-4 flex gap-2" }, /* @__PURE__ */ React10__default.createElement(
1632
+ "button",
1633
+ {
1634
+ onClick: shake,
1635
+ className: clsx("px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors", isShaking ? "animate-pulse" : "")
1636
+ },
1637
+ "\u6447\u4E00\u6447"
1638
+ ), /* @__PURE__ */ React10__default.createElement(
1639
+ "button",
1640
+ {
1641
+ onClick: slowdown,
1642
+ className: clsx("px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors", isShaking ? "animate-pulse" : "")
1643
+ },
1644
+ "\u51CF\u901F"
1645
+ )));
1646
+ };
1647
+ function GenericOrderManager({
1648
+ operations,
1649
+ renderItem,
1650
+ className = "",
1651
+ title = "\u987A\u5E8F\u7BA1\u7406",
1652
+ description = "\u62D6\u62FD\u6216\u4F7F\u7528\u6309\u94AE\u8C03\u6574\u663E\u793A\u987A\u5E8F",
1653
+ onOrderChanged,
1654
+ emptyMessage = "\u6682\u65E0\u6570\u636E",
1655
+ loadingMessage = "\u52A0\u8F7D\u6570\u636E..."
1656
+ }) {
1657
+ const [items, setItems] = useState([]);
1658
+ const [originalOrder, setOriginalOrder] = useState([]);
1659
+ const [loading, setLoading] = useState(true);
1660
+ const [saving, setSaving] = useState(false);
1661
+ const [error, setError] = useState(null);
1662
+ const [hasChanges, setHasChanges] = useState(false);
1663
+ const [draggedItem, setDraggedItem] = useState(null);
1664
+ const loadItems = useCallback(async () => {
1665
+ try {
1666
+ setLoading(true);
1667
+ setError(null);
1668
+ const data = await operations.loadItems();
1669
+ setItems(data);
1670
+ setOriginalOrder([...data]);
1671
+ setHasChanges(false);
1672
+ } catch (err) {
1673
+ console.error("\u274C [\u901A\u7528\u6392\u5E8F] \u52A0\u8F7D\u6570\u636E\u9519\u8BEF:", err);
1674
+ setError(err instanceof Error ? err.message : "\u52A0\u8F7D\u6570\u636E\u5931\u8D25");
1675
+ } finally {
1676
+ setLoading(false);
1677
+ }
1678
+ }, [operations]);
1679
+ useEffect(() => {
1680
+ loadItems();
1681
+ }, [loadItems]);
1682
+ useEffect(() => {
1683
+ const hasOrderChanged = items.some(
1684
+ (item, index) => originalOrder[index]?.id !== item.id
1685
+ );
1686
+ setHasChanges(hasOrderChanged);
1687
+ }, [items, originalOrder]);
1688
+ const handleMoveUp = async (itemId) => {
1689
+ try {
1690
+ setError(null);
1691
+ const currentIndex = items.findIndex((item) => item.id === itemId);
1692
+ if (currentIndex === -1) {
1693
+ setError("\u9879\u76EE\u4E0D\u5B58\u5728");
1694
+ return;
1695
+ }
1696
+ if (currentIndex === 0) {
1697
+ setError("\u9879\u76EE\u5DF2\u7ECF\u5728\u6700\u524D\u9762\uFF0C\u65E0\u6CD5\u4E0A\u79FB");
1698
+ return;
1699
+ }
1700
+ await operations.moveItemUp(itemId);
1701
+ await loadItems();
1702
+ onOrderChanged?.();
1703
+ } catch (err) {
1704
+ console.error("\u274C [\u901A\u7528\u6392\u5E8F] \u4E0A\u79FB\u9879\u76EE\u9519\u8BEF:", err);
1705
+ setError(err instanceof Error ? err.message : "\u4E0A\u79FB\u5931\u8D25");
1706
+ }
1707
+ };
1708
+ const handleMoveDown = async (itemId) => {
1709
+ try {
1710
+ setError(null);
1711
+ const currentIndex = items.findIndex((item) => item.id === itemId);
1712
+ if (currentIndex === -1) {
1713
+ setError("\u9879\u76EE\u4E0D\u5B58\u5728");
1714
+ return;
1715
+ }
1716
+ if (currentIndex === items.length - 1) {
1717
+ setError("\u9879\u76EE\u5DF2\u7ECF\u5728\u6700\u540E\u9762\uFF0C\u65E0\u6CD5\u4E0B\u79FB");
1718
+ return;
1719
+ }
1720
+ await operations.moveItemDown(itemId);
1721
+ await loadItems();
1722
+ onOrderChanged?.();
1723
+ } catch (err) {
1724
+ console.error("\u274C [\u901A\u7528\u6392\u5E8F] \u4E0B\u79FB\u9879\u76EE\u9519\u8BEF:", err);
1725
+ setError(err instanceof Error ? err.message : "\u4E0B\u79FB\u5931\u8D25");
1726
+ }
1727
+ };
1728
+ const handleDragStart = (e, index) => {
1729
+ setDraggedItem(index);
1730
+ e.dataTransfer.effectAllowed = "move";
1731
+ };
1732
+ const handleDragOver = (e, _index) => {
1733
+ e.preventDefault();
1734
+ e.dataTransfer.dropEffect = "move";
1735
+ };
1736
+ const handleDrop = async (e, dropIndex) => {
1737
+ e.preventDefault();
1738
+ if (draggedItem === null || draggedItem === dropIndex) {
1739
+ setDraggedItem(null);
1740
+ return;
1741
+ }
1742
+ try {
1743
+ setError(null);
1744
+ const newItems = [...items];
1745
+ const draggedItemData = newItems[draggedItem];
1746
+ if (!draggedItemData) return;
1747
+ newItems.splice(draggedItem, 1);
1748
+ newItems.splice(dropIndex, 0, draggedItemData);
1749
+ const itemOrders = newItems.map((item, index) => ({
1750
+ id: item.id,
1751
+ order: index
1752
+ }));
1753
+ await operations.updateItemOrder(itemOrders);
1754
+ await loadItems();
1755
+ onOrderChanged?.();
1756
+ } catch (err) {
1757
+ console.error("\u274C [\u901A\u7528\u6392\u5E8F] \u62D6\u62FD\u6392\u5E8F\u9519\u8BEF:", err);
1758
+ setError(err instanceof Error ? err.message : "\u6392\u5E8F\u5931\u8D25");
1759
+ } finally {
1760
+ setDraggedItem(null);
1761
+ }
1762
+ };
1763
+ const handleSaveOrder = async () => {
1764
+ try {
1765
+ setSaving(true);
1766
+ setError(null);
1767
+ const itemOrders = items.map((item, index) => ({
1768
+ id: item.id,
1769
+ order: index
1770
+ }));
1771
+ await operations.updateItemOrder(itemOrders);
1772
+ setOriginalOrder([...items]);
1773
+ setHasChanges(false);
1774
+ onOrderChanged?.();
1775
+ } catch (err) {
1776
+ console.error("\u274C [\u901A\u7528\u6392\u5E8F] \u4FDD\u5B58\u987A\u5E8F\u9519\u8BEF:", err);
1777
+ setError(err instanceof Error ? err.message : "\u4FDD\u5B58\u5931\u8D25");
1778
+ await loadItems();
1779
+ } finally {
1780
+ setSaving(false);
1781
+ }
1782
+ };
1783
+ const handleResetOrder = () => {
1784
+ setItems([...originalOrder]);
1785
+ };
1786
+ if (loading) {
1787
+ return /* @__PURE__ */ React10__default.createElement("div", { className: cn("flex flex-col items-center justify-center p-12 text-gray-500", className) }, /* @__PURE__ */ React10__default.createElement("div", { className: "w-6 h-6 border-2 border-gray-200 border-t-blue-500 rounded-full animate-spin mb-2" }), /* @__PURE__ */ React10__default.createElement("span", null, loadingMessage));
1788
+ }
1789
+ return /* @__PURE__ */ React10__default.createElement("div", { className: cn("bg-white rounded-xl p-6 shadow-md border-2 border-gray-100", className) }, /* @__PURE__ */ React10__default.createElement("div", { className: "flex items-center justify-between mb-4 pb-3 border-b border-gray-100 sm:flex-row flex-col sm:items-center items-start gap-4" }, /* @__PURE__ */ React10__default.createElement("h3", { className: "m-0 text-gray-900 text-lg font-semibold" }, title), /* @__PURE__ */ React10__default.createElement("div", { className: "flex gap-3 w-full sm:w-auto" }, hasChanges && /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(
1790
+ "button",
1791
+ {
1792
+ onClick: handleResetOrder,
1793
+ className: "flex items-center gap-2 bg-amber-500 hover:bg-amber-600 text-white px-4 py-2 rounded-lg font-medium transition-colors",
1794
+ title: "\u91CD\u7F6E\u4E3A\u539F\u59CB\u987A\u5E8F"
1795
+ },
1796
+ /* @__PURE__ */ React10__default.createElement(RotateCcw, { size: 16 }),
1797
+ "\u91CD\u7F6E"
1798
+ ), /* @__PURE__ */ React10__default.createElement(
1799
+ "button",
1800
+ {
1801
+ onClick: handleSaveOrder,
1802
+ disabled: saving,
1803
+ className: "flex items-center gap-2 bg-blue-500 hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-medium transition-colors",
1804
+ title: "\u4FDD\u5B58\u65B0\u987A\u5E8F"
1805
+ },
1806
+ /* @__PURE__ */ React10__default.createElement(Save, { size: 16 }),
1807
+ saving ? "\u4FDD\u5B58\u4E2D..." : "\u4FDD\u5B58\u987A\u5E8F"
1808
+ )))), error && /* @__PURE__ */ React10__default.createElement("div", { className: "flex items-center gap-2 bg-red-50 text-red-600 p-3 rounded-lg mb-4 border border-red-200" }, /* @__PURE__ */ React10__default.createElement(AlertCircle, { size: 16 }), /* @__PURE__ */ React10__default.createElement("span", null, error)), /* @__PURE__ */ React10__default.createElement("div", { className: "bg-slate-50 border border-slate-200 rounded-lg p-4 mb-6" }, /* @__PURE__ */ React10__default.createElement("p", { className: "m-0 mb-2 color-slate-500 text-sm" }, description), /* @__PURE__ */ React10__default.createElement("ul", { className: "m-0 pl-6 color-slate-500 text-sm list-disc" }, /* @__PURE__ */ React10__default.createElement("li", { className: "mb-1" }, "\u4F7F\u7528\u62D6\u62FD\uFF1A\u70B9\u51FB\u5E76\u62D6\u52A8 ", /* @__PURE__ */ React10__default.createElement(GripVertical, { size: 14, className: "inline-block align-middle text-gray-500" }), " \u56FE\u6807"), /* @__PURE__ */ React10__default.createElement("li", { className: "mb-1" }, "\u4F7F\u7528\u6309\u94AE\uFF1A\u70B9\u51FB ", /* @__PURE__ */ React10__default.createElement(ChevronUp, { size: 14, className: "inline-block align-middle text-gray-500" }), " \u6216 ", /* @__PURE__ */ React10__default.createElement(ChevronDown, { size: 14, className: "inline-block align-middle text-gray-500" }), " \u6309\u94AE"), /* @__PURE__ */ React10__default.createElement("li", null, '\u5B8C\u6210\u8C03\u6574\u540E\uFF0C\u70B9\u51FB"\u4FDD\u5B58\u987A\u5E8F"\u6309\u94AE\u4FDD\u5B58\u66F4\u6539'))), /* @__PURE__ */ React10__default.createElement("div", { className: "flex flex-col gap-3" }, items.map((item, index) => /* @__PURE__ */ React10__default.createElement(
1809
+ "div",
1810
+ {
1811
+ key: item.id,
1812
+ className: cn(
1813
+ "flex items-center gap-3 p-4 bg-gray-50 border-2 border-gray-200 rounded-lg transition-all hover:border-gray-300 hover:shadow-sm",
1814
+ draggedItem === index && "opacity-50 rotate-2 border-blue-500"
1815
+ ),
1816
+ draggable: true,
1817
+ onDragStart: (e) => handleDragStart(e, index),
1818
+ onDragOver: (e) => handleDragOver(e),
1819
+ onDrop: (e) => handleDrop(e, index)
1820
+ },
1821
+ /* @__PURE__ */ React10__default.createElement("div", { className: "flex items-center cursor-grab active:cursor-grabbing text-gray-400 p-1 rounded hover:text-gray-500 hover:bg-gray-100 transition-colors" }, /* @__PURE__ */ React10__default.createElement(GripVertical, { size: 20 })),
1822
+ /* @__PURE__ */ React10__default.createElement("div", { className: "flex-1 min-w-0" }, renderItem(item, index, index === 0, index === items.length - 1)),
1823
+ /* @__PURE__ */ React10__default.createElement("div", { className: "flex items-center mx-3" }, /* @__PURE__ */ React10__default.createElement("span", { className: "flex items-center justify-center w-8 h-8 bg-blue-500 text-white text-sm font-semibold rounded-full sm:w-8 sm:h-8 w-7 h-7 sm:text-sm text-xs" }, "#", index + 1)),
1824
+ /* @__PURE__ */ React10__default.createElement("div", { className: "flex flex-col gap-1 sm:flex-col flex-row" }, /* @__PURE__ */ React10__default.createElement(
1825
+ "button",
1826
+ {
1827
+ onClick: () => handleMoveUp(item.id),
1828
+ disabled: index === 0,
1829
+ className: "flex items-center justify-center w-8 h-8 p-0 border border-gray-300 bg-white text-gray-500 rounded cursor-pointer transition-all hover:bg-gray-100 hover:border-gray-400 hover:text-gray-700 disabled:opacity-40 disabled:cursor-not-allowed disabled:bg-gray-50 sm:w-8 sm:h-8 w-7 h-7",
1830
+ title: "\u4E0A\u79FB"
1831
+ },
1832
+ /* @__PURE__ */ React10__default.createElement(ChevronUp, { size: 18 })
1833
+ ), /* @__PURE__ */ React10__default.createElement(
1834
+ "button",
1835
+ {
1836
+ onClick: () => handleMoveDown(item.id),
1837
+ disabled: index === items.length - 1,
1838
+ className: "flex items-center justify-center w-8 h-8 p-0 border border-gray-300 bg-white text-gray-500 rounded cursor-pointer transition-all hover:bg-gray-100 hover:border-gray-400 hover:text-gray-700 disabled:opacity-40 disabled:cursor-not-allowed disabled:bg-gray-50 sm:w-8 sm:h-8 w-7 h-7",
1839
+ title: "\u4E0B\u79FB"
1840
+ },
1841
+ /* @__PURE__ */ React10__default.createElement(ChevronDown, { size: 18 })
1842
+ ))
1843
+ ))), items.length === 0 && /* @__PURE__ */ React10__default.createElement("div", { className: "text-center p-12 text-gray-400 italic" }, /* @__PURE__ */ React10__default.createElement("p", { className: "m-0" }, emptyMessage)));
1844
+ }
1845
+ var BackButton = ({ href, className = "" }) => {
1846
+ const router = useRouter();
1847
+ const handleClick = () => {
1848
+ if (href) {
1849
+ router.push(href);
1850
+ } else {
1851
+ router.back();
1852
+ }
1853
+ };
1854
+ return /* @__PURE__ */ React10__default.createElement(
1855
+ "button",
1856
+ {
1857
+ onClick: handleClick,
1858
+ className: cn(
1859
+ "inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition-colors",
1860
+ className
1861
+ )
1862
+ },
1863
+ /* @__PURE__ */ React10__default.createElement(
1864
+ "svg",
1865
+ {
1866
+ className: "w-5 h-5 mr-2",
1867
+ fill: "none",
1868
+ stroke: "currentColor",
1869
+ viewBox: "0 0 24 24"
1870
+ },
1871
+ /* @__PURE__ */ React10__default.createElement(
1872
+ "path",
1873
+ {
1874
+ strokeLinecap: "round",
1875
+ strokeLinejoin: "round",
1876
+ strokeWidth: 2,
1877
+ d: "M10 19l-7-7m0 0l7-7m-7 7h18"
1878
+ }
1879
+ )
1880
+ ),
1881
+ "\u8FD4\u56DE"
1882
+ );
1883
+ };
1884
+ function getColorValue(bgClass) {
1885
+ const colorMap = {
1886
+ "bg-blue-500": "#3b82f6",
1887
+ "bg-green-500": "#10b981",
1888
+ "bg-red-500": "#ef4444",
1889
+ "bg-purple-500": "#8b5cf6",
1890
+ "bg-slate-500": "#64748b",
1891
+ "bg-emerald-500": "#10b981",
1892
+ "bg-orange-500": "#f97316"
1893
+ };
1894
+ return colorMap[bgClass] || "#3b82f6";
1895
+ }
1896
+ function FilterButtonGroup({
1897
+ label,
1898
+ value,
1899
+ options,
1900
+ onChange,
1901
+ className
1902
+ }) {
1903
+ return /* @__PURE__ */ React10__default.createElement("div", { className: cn("space-y-4", className) }, /* @__PURE__ */ React10__default.createElement("h3", { className: "text-lg font-semibold text-gray-800" }, label), /* @__PURE__ */ React10__default.createElement("div", { className: "flex gap-3" }, options.map((option) => {
1904
+ const isActive = value === option.value;
1905
+ return /* @__PURE__ */ React10__default.createElement(
1906
+ "button",
1907
+ {
1908
+ key: option.value,
1909
+ onClick: () => onChange(option.value),
1910
+ style: isActive ? { backgroundColor: getColorValue(option.activeColor.bg) } : void 0,
1911
+ className: cn(
1912
+ "flex-1 h-12 rounded-lg font-medium text-sm transition-all duration-200 ease-out focus:outline-none focus:ring-2 focus:ring-opacity-50 border",
1913
+ isActive ? "text-white border-transparent shadow-md focus:ring-white" : "bg-white text-gray-700 border-gray-200 shadow-sm hover:bg-gray-50 hover:border-gray-300 hover:shadow focus:ring-blue-300"
1914
+ )
1915
+ },
1916
+ /* @__PURE__ */ React10__default.createElement("div", { className: "flex items-center justify-center space-x-2" }, /* @__PURE__ */ React10__default.createElement("span", { className: "text-lg" }, option.icon), /* @__PURE__ */ React10__default.createElement("span", null, option.label), option.showCount && option.count !== void 0 && /* @__PURE__ */ React10__default.createElement("span", { className: cn(
1917
+ "text-xs font-semibold px-2 py-0.5 rounded-full min-w-[1.25rem] text-center",
1918
+ isActive ? "bg-white/20 text-white" : "bg-gray-100 text-gray-600"
1919
+ ) }, option.count))
1920
+ );
1921
+ })));
1922
+ }
1923
+ function SearchResultHint({ searchQuery, resultCount, className }) {
1924
+ if (!searchQuery) return null;
1925
+ return /* @__PURE__ */ React10__default.createElement("div", { className: cn("mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg", className) }, /* @__PURE__ */ React10__default.createElement("p", { className: "text-sm text-blue-700" }, '\u641C\u7D22 "', /* @__PURE__ */ React10__default.createElement("span", { className: "font-medium" }, searchQuery), '" \u627E\u5230 ', resultCount, " \u4E2A\u7ED3\u679C"));
1926
+ }
1927
+ var Modal = ({
1928
+ isOpen,
1929
+ onClose,
1930
+ title,
1931
+ width,
1932
+ className,
1933
+ maskClosable = true,
1934
+ children,
1935
+ zIndex = 50
1936
+ }) => {
1937
+ return /* @__PURE__ */ React10__default.createElement(Dialog, { open: isOpen, onOpenChange: (open) => {
1938
+ if (!open) {
1939
+ if (maskClosable) {
1940
+ onClose();
1941
+ }
1942
+ }
1943
+ } }, /* @__PURE__ */ React10__default.createElement(
1944
+ DialogContent,
1945
+ {
1946
+ className: cn("sm:max-w-[425px]", className) + " z-[" + zIndex + "]",
1947
+ onPointerDownOutside: (e) => {
1948
+ if (!maskClosable) e.preventDefault();
1949
+ },
1950
+ onEscapeKeyDown: (e) => {
1951
+ if (!maskClosable) e.preventDefault();
1952
+ },
1953
+ style: width ? { maxWidth: typeof width === "number" ? width + "px" : width } : void 0
1954
+ },
1955
+ title ? /* @__PURE__ */ React10__default.createElement(DialogHeader, null, /* @__PURE__ */ React10__default.createElement(DialogTitle, null, title)) : (
1956
+ // 无障碍性:始终需要 DialogTitle,使用 sr-only 对视觉隐藏但对屏幕阅读器可见
1957
+ /* @__PURE__ */ React10__default.createElement(DialogTitle, { className: "sr-only" }, "\u5F39\u7A97")
1958
+ ),
1959
+ /* @__PURE__ */ React10__default.createElement("div", { className: "py-4" }, children)
1960
+ ));
1961
+ };
1962
+ var ConfirmModal = ({
1963
+ isOpen,
1964
+ onClose,
1965
+ onConfirm,
1966
+ title = "\u786E\u8BA4\u64CD\u4F5C",
1967
+ message,
1968
+ confirmText = "\u786E\u8BA4",
1969
+ cancelText = "\u53D6\u6D88",
1970
+ isLoading = false
1971
+ }) => {
1972
+ return /* @__PURE__ */ React10__default.createElement(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose() }, /* @__PURE__ */ React10__default.createElement(AlertDialogContent, null, /* @__PURE__ */ React10__default.createElement(DialogHeader, null, /* @__PURE__ */ React10__default.createElement(DialogTitle, null, title), /* @__PURE__ */ React10__default.createElement(DialogDescription, null, message)), /* @__PURE__ */ React10__default.createElement(DialogFooter, null, /* @__PURE__ */ React10__default.createElement(AlertDialogCancel, { disabled: isLoading }, cancelText), /* @__PURE__ */ React10__default.createElement(
1973
+ AlertDialogAction,
1974
+ {
1975
+ onClick: (e) => {
1976
+ e.preventDefault();
1977
+ onConfirm();
1978
+ },
1979
+ disabled: isLoading,
1980
+ className: "bg-destructive text-destructive-foreground hover:bg-destructive/90"
1981
+ },
1982
+ isLoading ? "\u5904\u7406\u4E2D..." : confirmText
1983
+ ))));
1984
+ };
1985
+
1986
+ export { AlertDialogAction, AlertDialogCancel, AlertDialogContent, Avatar, AvatarFallback, AvatarImage, BackButton, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CollisionBalls, ConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FilterButtonGroup, GenericOrderManager, Grid, Input, Label, Modal, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, ScrollArea, ScrollBar, SearchBox, SearchResultHint, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Timeline, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants };
1987
+ //# sourceMappingURL=chunk-EI27JKND.mjs.map
1988
+ //# sourceMappingURL=chunk-EI27JKND.mjs.map