@turinhub/atomix-common-ui 0.3.0 → 0.5.0

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 (161) hide show
  1. package/README.md +50 -17
  2. package/dist/AuthPanel-C_2JBE7t.cjs +2 -0
  3. package/dist/AuthPanel-C_2JBE7t.cjs.map +1 -0
  4. package/dist/AuthPanel-D2HFX8eN.js +656 -0
  5. package/dist/AuthPanel-D2HFX8eN.js.map +1 -0
  6. package/dist/PDFSidebar-BBtucLK6.js +232 -0
  7. package/dist/PDFSidebar-BBtucLK6.js.map +1 -0
  8. package/dist/PDFSidebar-Di0D-yPS.cjs +2 -0
  9. package/dist/PDFSidebar-Di0D-yPS.cjs.map +1 -0
  10. package/dist/auth.cjs +2 -0
  11. package/dist/auth.cjs.map +1 -0
  12. package/dist/auth.d.ts +11 -0
  13. package/dist/auth.d.ts.map +1 -0
  14. package/dist/auth.js +9 -0
  15. package/dist/auth.js.map +1 -0
  16. package/dist/component-types.cjs +2 -0
  17. package/dist/component-types.cjs.map +1 -0
  18. package/dist/component-types.d.ts +2 -0
  19. package/dist/component-types.d.ts.map +1 -0
  20. package/dist/component-types.js +2 -0
  21. package/dist/component-types.js.map +1 -0
  22. package/dist/components/AuthLoginPanel.d.ts +55 -0
  23. package/dist/components/AuthLoginPanel.d.ts.map +1 -0
  24. package/dist/components/AuthPageShell.d.ts +11 -0
  25. package/dist/components/AuthPageShell.d.ts.map +1 -0
  26. package/dist/components/AuthPanel.d.ts +20 -0
  27. package/dist/components/AuthPanel.d.ts.map +1 -0
  28. package/dist/components/AuthRegisterPanel.d.ts +34 -0
  29. package/dist/components/AuthRegisterPanel.d.ts.map +1 -0
  30. package/dist/components/AuthVisualCarousel.d.ts +20 -0
  31. package/dist/components/AuthVisualCarousel.d.ts.map +1 -0
  32. package/dist/components/DataTable.d.ts +2 -2
  33. package/dist/components/DataTable.d.ts.map +1 -1
  34. package/dist/components/ImageReader.d.ts +44 -0
  35. package/dist/components/ImageReader.d.ts.map +1 -0
  36. package/dist/components/MarkdownReader.d.ts +26 -0
  37. package/dist/components/MarkdownReader.d.ts.map +1 -0
  38. package/dist/components/PDFReader.d.ts +2 -2
  39. package/dist/components/PDFReader.d.ts.map +1 -1
  40. package/dist/components/PDFSidebar.d.ts +1 -1
  41. package/dist/components/PDFSidebar.d.ts.map +1 -1
  42. package/dist/components/SimplePDFReader.d.ts +1 -1
  43. package/dist/components/VideoReader.d.ts +39 -0
  44. package/dist/components/VideoReader.d.ts.map +1 -0
  45. package/dist/components/media-utils.d.ts +9 -0
  46. package/dist/components/media-utils.d.ts.map +1 -0
  47. package/dist/data-table.cjs +2 -0
  48. package/dist/data-table.cjs.map +1 -0
  49. package/dist/data-table.d.ts +3 -0
  50. package/dist/data-table.d.ts.map +1 -0
  51. package/dist/data-table.js +169 -0
  52. package/dist/data-table.js.map +1 -0
  53. package/dist/delete-confirm-dialog.cjs +2 -0
  54. package/dist/delete-confirm-dialog.cjs.map +1 -0
  55. package/dist/delete-confirm-dialog.d.ts +3 -0
  56. package/dist/delete-confirm-dialog.d.ts.map +1 -0
  57. package/dist/delete-confirm-dialog.js +109 -0
  58. package/dist/delete-confirm-dialog.js.map +1 -0
  59. package/dist/file-upload.cjs +2 -0
  60. package/dist/file-upload.cjs.map +1 -0
  61. package/dist/file-upload.d.ts +3 -0
  62. package/dist/file-upload.d.ts.map +1 -0
  63. package/dist/file-upload.js +354 -0
  64. package/dist/file-upload.js.map +1 -0
  65. package/dist/image-reader.cjs +2 -0
  66. package/dist/image-reader.cjs.map +1 -0
  67. package/dist/image-reader.d.ts +3 -0
  68. package/dist/image-reader.d.ts.map +1 -0
  69. package/dist/image-reader.js +214 -0
  70. package/dist/image-reader.js.map +1 -0
  71. package/dist/index.cjs +2 -0
  72. package/dist/index.cjs.map +1 -0
  73. package/dist/index.d.ts +10 -20
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +8 -12
  76. package/dist/index.js.map +1 -1
  77. package/dist/jsx-runtime-B4hRZ52C.js +283 -0
  78. package/dist/jsx-runtime-B4hRZ52C.js.map +1 -0
  79. package/dist/jsx-runtime-BB_1_6y_.cjs +23 -0
  80. package/dist/jsx-runtime-BB_1_6y_.cjs.map +1 -0
  81. package/dist/markdown-reader.cjs +2 -0
  82. package/dist/markdown-reader.cjs.map +1 -0
  83. package/dist/markdown-reader.d.ts +3 -0
  84. package/dist/markdown-reader.d.ts.map +1 -0
  85. package/dist/markdown-reader.js +145 -0
  86. package/dist/markdown-reader.js.map +1 -0
  87. package/dist/media-utils-5UPuocc1.js +23 -0
  88. package/dist/media-utils-5UPuocc1.js.map +1 -0
  89. package/dist/media-utils-X1dDYP9W.cjs +2 -0
  90. package/dist/media-utils-X1dDYP9W.cjs.map +1 -0
  91. package/dist/pdf-reader.cjs +2 -0
  92. package/dist/pdf-reader.cjs.map +1 -0
  93. package/dist/pdf-reader.d.ts +3 -0
  94. package/dist/pdf-reader.d.ts.map +1 -0
  95. package/dist/pdf-reader.js +427 -0
  96. package/dist/pdf-reader.js.map +1 -0
  97. package/dist/pdf-sidebar.cjs +2 -0
  98. package/dist/pdf-sidebar.cjs.map +1 -0
  99. package/dist/pdf-sidebar.d.ts +3 -0
  100. package/dist/pdf-sidebar.d.ts.map +1 -0
  101. package/dist/pdf-sidebar.js +5 -0
  102. package/dist/pdf-sidebar.js.map +1 -0
  103. package/dist/simple-pdf-reader.cjs +2 -0
  104. package/dist/simple-pdf-reader.cjs.map +1 -0
  105. package/dist/simple-pdf-reader.d.ts +3 -0
  106. package/dist/simple-pdf-reader.d.ts.map +1 -0
  107. package/dist/simple-pdf-reader.js +268 -0
  108. package/dist/simple-pdf-reader.js.map +1 -0
  109. package/dist/table-header.cjs +2 -0
  110. package/dist/table-header.cjs.map +1 -0
  111. package/dist/table-header.d.ts +3 -0
  112. package/dist/table-header.d.ts.map +1 -0
  113. package/dist/table-header.js +63 -0
  114. package/dist/table-header.js.map +1 -0
  115. package/dist/table-pagination.cjs +2 -0
  116. package/dist/table-pagination.cjs.map +1 -0
  117. package/dist/table-pagination.d.ts +3 -0
  118. package/dist/table-pagination.d.ts.map +1 -0
  119. package/dist/table-pagination.js +172 -0
  120. package/dist/table-pagination.js.map +1 -0
  121. package/dist/theme-switcher-content.cjs +2 -0
  122. package/dist/theme-switcher-content.cjs.map +1 -0
  123. package/dist/theme-switcher-content.d.ts +3 -0
  124. package/dist/theme-switcher-content.d.ts.map +1 -0
  125. package/dist/theme-switcher-content.js +103 -0
  126. package/dist/theme-switcher-content.js.map +1 -0
  127. package/dist/theme-switcher.cjs +2 -0
  128. package/dist/theme-switcher.cjs.map +1 -0
  129. package/dist/theme-switcher.d.ts +3 -0
  130. package/dist/theme-switcher.d.ts.map +1 -0
  131. package/dist/theme-switcher.js +140 -0
  132. package/dist/theme-switcher.js.map +1 -0
  133. package/dist/types/component-types.d.ts +1 -0
  134. package/dist/types/component-types.d.ts.map +1 -1
  135. package/dist/utils-B6yFEsav.js +9 -0
  136. package/dist/utils-B6yFEsav.js.map +1 -0
  137. package/dist/utils-IjLH3w2e.cjs +2 -0
  138. package/dist/utils-IjLH3w2e.cjs.map +1 -0
  139. package/dist/utils.cjs +2 -0
  140. package/dist/utils.cjs.map +1 -0
  141. package/dist/utils.d.ts +2 -0
  142. package/dist/utils.d.ts.map +1 -0
  143. package/dist/utils.js +5 -0
  144. package/dist/utils.js.map +1 -0
  145. package/dist/video-reader.cjs +2 -0
  146. package/dist/video-reader.cjs.map +1 -0
  147. package/dist/video-reader.d.ts +3 -0
  148. package/dist/video-reader.d.ts.map +1 -0
  149. package/dist/video-reader.js +158 -0
  150. package/dist/video-reader.js.map +1 -0
  151. package/package.json +191 -3
  152. package/dist/index-DJdfLA8M.js +0 -2140
  153. package/dist/index-DJdfLA8M.js.map +0 -1
  154. package/dist/index-DUxYhmkV.js +0 -18821
  155. package/dist/index-DUxYhmkV.js.map +0 -1
  156. package/dist/index-miejqTjn.cjs +0 -13
  157. package/dist/index-miejqTjn.cjs.map +0 -1
  158. package/dist/index-tIca-Q_M.cjs +0 -23
  159. package/dist/index-tIca-Q_M.cjs.map +0 -1
  160. package/dist/index.c.js +0 -2
  161. package/dist/index.c.js.map +0 -1
@@ -1,2140 +0,0 @@
1
- import { clsx as st } from "clsx";
2
- import { twMerge as rt } from "tailwind-merge";
3
- import nt, { useState as O, useEffect as ae, useRef as ge, useMemo as Oe, useCallback as ie, memo as at } from "react";
4
- import { MoreVertical as lt, Plus as it, Search as ct, ChevronLeft as Ee, ChevronRight as Pe, ZoomOut as Fe, ZoomIn as Se, Minimize2 as ze, Maximize2 as We, PanelLeft as ot, RotateCw as dt, ScrollText as ut, FileText as Be, UploadCloud as mt, X as xt, Loader2 as ft, CheckCircle2 as ht, XCircle as pt } from "lucide-react";
5
- function De(...r) {
6
- return rt(st(r));
7
- }
8
- var Te = { exports: {} }, Ne = {};
9
- /**
10
- * @license React
11
- * react-jsx-runtime.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
- var Me;
19
- function jt() {
20
- if (Me) return Ne;
21
- Me = 1;
22
- var r = Symbol.for("react.transitional.element"), m = Symbol.for("react.fragment");
23
- function d(h, l, v) {
24
- var y = null;
25
- if (v !== void 0 && (y = "" + v), l.key !== void 0 && (y = "" + l.key), "key" in l) {
26
- v = {};
27
- for (var x in l)
28
- x !== "key" && (v[x] = l[x]);
29
- } else v = l;
30
- return l = v.ref, {
31
- $$typeof: r,
32
- type: h,
33
- key: y,
34
- ref: l !== void 0 ? l : null,
35
- props: v
36
- };
37
- }
38
- return Ne.Fragment = m, Ne.jsx = d, Ne.jsxs = d, Ne;
39
- }
40
- var we = {};
41
- /**
42
- * @license React
43
- * react-jsx-runtime.development.js
44
- *
45
- * Copyright (c) Meta Platforms, Inc. and affiliates.
46
- *
47
- * This source code is licensed under the MIT license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */
50
- var Ae;
51
- function vt() {
52
- return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && (function() {
53
- function r(s) {
54
- if (s == null) return null;
55
- if (typeof s == "function")
56
- return s.$$typeof === J ? null : s.displayName || s.name || null;
57
- if (typeof s == "string") return s;
58
- switch (s) {
59
- case Y:
60
- return "Fragment";
61
- case E:
62
- return "Profiler";
63
- case L:
64
- return "StrictMode";
65
- case X:
66
- return "Suspense";
67
- case S:
68
- return "SuspenseList";
69
- case K:
70
- return "Activity";
71
- }
72
- if (typeof s == "object")
73
- switch (typeof s.tag == "number" && console.error(
74
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
- ), s.$$typeof) {
76
- case H:
77
- return "Portal";
78
- case g:
79
- return s.displayName || "Context";
80
- case P:
81
- return (s._context.displayName || "Context") + ".Consumer";
82
- case G:
83
- var n = s.render;
84
- return s = s.displayName, s || (s = n.displayName || n.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
85
- case z:
86
- return n = s.displayName || null, n !== null ? n : r(s.type) || "Memo";
87
- case W:
88
- n = s._payload, s = s._init;
89
- try {
90
- return r(s(n));
91
- } catch {
92
- }
93
- }
94
- return null;
95
- }
96
- function m(s) {
97
- return "" + s;
98
- }
99
- function d(s) {
100
- try {
101
- m(s);
102
- var n = !1;
103
- } catch {
104
- n = !0;
105
- }
106
- if (n) {
107
- n = console;
108
- var j = n.error, I = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
109
- return j.call(
110
- n,
111
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- I
113
- ), m(s);
114
- }
115
- }
116
- function h(s) {
117
- if (s === Y) return "<>";
118
- if (typeof s == "object" && s !== null && s.$$typeof === W)
119
- return "<...>";
120
- try {
121
- var n = r(s);
122
- return n ? "<" + n + ">" : "<...>";
123
- } catch {
124
- return "<...>";
125
- }
126
- }
127
- function l() {
128
- var s = u.A;
129
- return s === null ? null : s.getOwner();
130
- }
131
- function v() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function y(s) {
135
- if (M.call(s, "key")) {
136
- var n = Object.getOwnPropertyDescriptor(s, "key").get;
137
- if (n && n.isReactWarning) return !1;
138
- }
139
- return s.key !== void 0;
140
- }
141
- function x(s, n) {
142
- function j() {
143
- U || (U = !0, console.error(
144
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
145
- n
146
- ));
147
- }
148
- j.isReactWarning = !0, Object.defineProperty(s, "key", {
149
- get: j,
150
- configurable: !0
151
- });
152
- }
153
- function p() {
154
- var s = r(this.type);
155
- return de[s] || (de[s] = !0, console.error(
156
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
157
- )), s = this.props.ref, s !== void 0 ? s : null;
158
- }
159
- function w(s, n, j, I, Q, re) {
160
- var _ = j.ref;
161
- return s = {
162
- $$typeof: B,
163
- type: s,
164
- key: n,
165
- props: j,
166
- _owner: I
167
- }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(s, "ref", {
168
- enumerable: !1,
169
- get: p
170
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: 0
175
- }), Object.defineProperty(s, "_debugInfo", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: null
180
- }), Object.defineProperty(s, "_debugStack", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: Q
185
- }), Object.defineProperty(s, "_debugTask", {
186
- configurable: !1,
187
- enumerable: !1,
188
- writable: !0,
189
- value: re
190
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
191
- }
192
- function i(s, n, j, I, Q, re) {
193
- var _ = n.children;
194
- if (_ !== void 0)
195
- if (I)
196
- if (C(_)) {
197
- for (I = 0; I < _.length; I++)
198
- D(_[I]);
199
- Object.freeze && Object.freeze(_);
200
- } else
201
- console.error(
202
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
203
- );
204
- else D(_);
205
- if (M.call(n, "key")) {
206
- _ = r(s);
207
- var q = Object.keys(n).filter(function(N) {
208
- return N !== "key";
209
- });
210
- I = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", se[_ + I] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
211
- `A props object containing a "key" prop is being spread into JSX:
212
- let props = %s;
213
- <%s {...props} />
214
- React keys must be passed directly to JSX without using spread:
215
- let props = %s;
216
- <%s key={someKey} {...props} />`,
217
- I,
218
- _,
219
- q,
220
- _
221
- ), se[_ + I] = !0);
222
- }
223
- if (_ = null, j !== void 0 && (d(j), _ = "" + j), y(n) && (d(n.key), _ = "" + n.key), "key" in n) {
224
- j = {};
225
- for (var b in n)
226
- b !== "key" && (j[b] = n[b]);
227
- } else j = n;
228
- return _ && x(
229
- j,
230
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
231
- ), w(
232
- s,
233
- _,
234
- j,
235
- l(),
236
- Q,
237
- re
238
- );
239
- }
240
- function D(s) {
241
- F(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === W && (s._payload.status === "fulfilled" ? F(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
242
- }
243
- function F(s) {
244
- return typeof s == "object" && s !== null && s.$$typeof === B;
245
- }
246
- var T = nt, B = Symbol.for("react.transitional.element"), H = Symbol.for("react.portal"), Y = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), P = Symbol.for("react.consumer"), g = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), W = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), J = Symbol.for("react.client.reference"), u = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, C = Array.isArray, R = console.createTask ? console.createTask : function() {
247
- return null;
248
- };
249
- T = {
250
- react_stack_bottom_frame: function(s) {
251
- return s();
252
- }
253
- };
254
- var U, de = {}, te = T.react_stack_bottom_frame.bind(
255
- T,
256
- v
257
- )(), V = R(h(v)), se = {};
258
- we.Fragment = Y, we.jsx = function(s, n, j) {
259
- var I = 1e4 > u.recentlyCreatedOwnerStacks++;
260
- return i(
261
- s,
262
- n,
263
- j,
264
- !1,
265
- I ? Error("react-stack-top-frame") : te,
266
- I ? R(h(s)) : V
267
- );
268
- }, we.jsxs = function(s, n, j) {
269
- var I = 1e4 > u.recentlyCreatedOwnerStacks++;
270
- return i(
271
- s,
272
- n,
273
- j,
274
- !0,
275
- I ? Error("react-stack-top-frame") : te,
276
- I ? R(h(s)) : V
277
- );
278
- };
279
- })()), we;
280
- }
281
- var Ie;
282
- function gt() {
283
- return Ie || (Ie = 1, process.env.NODE_ENV === "production" ? Te.exports = jt() : Te.exports = vt()), Te.exports;
284
- }
285
- var e = gt();
286
- function Mt({
287
- data: r,
288
- loading: m = !1,
289
- columns: d,
290
- rowKey: h,
291
- emptyText: l = "暂无数据",
292
- searchActiveEmptyText: v = "未找到匹配的记录",
293
- header: y,
294
- pagination: x,
295
- rowClassName: p,
296
- onRow: w,
297
- actions: i,
298
- components: D,
299
- renderCard: F,
300
- renderTable: T,
301
- renderActions: B
302
- }) {
303
- var _, q;
304
- if (!D)
305
- return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
306
- "错误:请通过 components prop 注入 UI 组件",
307
- /* @__PURE__ */ e.jsx("br", {}),
308
- /* @__PURE__ */ e.jsx("code", { className: "text-sm", children: 'import { Card, Table, Button, ... } from "@/components/ui"' })
309
- ] });
310
- const {
311
- Card: H,
312
- CardContent: Y,
313
- CardFooter: L,
314
- Table: E,
315
- TableBody: P,
316
- TableCell: g,
317
- TableHead: G,
318
- TableHeader: X,
319
- TableRow: S,
320
- Button: z,
321
- DropdownMenu: W,
322
- DropdownMenuTrigger: K,
323
- DropdownMenuContent: J,
324
- DropdownMenuItem: u,
325
- DropdownMenuSeparator: M,
326
- Skeleton: C,
327
- TableHeaderComponent: R,
328
- TablePaginationComponent: U
329
- } = D, de = (b, N) => {
330
- if (typeof h == "function")
331
- return h(b);
332
- const $ = b[h];
333
- return $ != null ? String($) : `row-${N}`;
334
- }, te = !!(y != null && y.searchValue && y.searchValue.trim().length > 0), V = !!(i != null && i.render || (_ = i == null ? void 0 : i.items) != null && _.length), se = (i == null ? void 0 : i.mode) ?? ((q = i == null ? void 0 : i.items) != null && q.length ? "collapsed" : "expanded"), s = (b) => b.separator === !0, n = (b, N) => !i || !V ? null : se === "collapsed" && i.items && i.items.length > 0 ? /* @__PURE__ */ e.jsxs(W, { children: [
335
- /* @__PURE__ */ e.jsx(K, { asChild: !0, children: /* @__PURE__ */ e.jsx(
336
- z,
337
- {
338
- variant: "ghost",
339
- className: "h-8 w-8 p-0",
340
- "aria-label": "打开行操作菜单",
341
- children: /* @__PURE__ */ e.jsx(lt, { className: "h-4 w-4" })
342
- }
343
- ) }),
344
- /* @__PURE__ */ e.jsx(J, { align: "end", children: i.items.map(
345
- ($, ce) => s($) ? /* @__PURE__ */ e.jsx(M, {}, `separator-${ce}`) : /* @__PURE__ */ e.jsxs(
346
- u,
347
- {
348
- onClick: () => $.onClick(b, N),
349
- className: $.className,
350
- children: [
351
- $.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: $.icon }),
352
- $.label
353
- ]
354
- },
355
- `action-${ce}`
356
- )
357
- ) })
358
- ] }) : i.render ? i.render(b, N) : null, j = () => /* @__PURE__ */ e.jsx(X, { children: /* @__PURE__ */ e.jsxs(S, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
- d.map((b) => /* @__PURE__ */ e.jsx(
360
- G,
361
- {
362
- className: `font-semibold text-foreground ${b.align === "center" ? "text-center" : b.align === "right" ? "text-right" : "text-left"}`,
363
- style: { width: b.width },
364
- children: b.title
365
- },
366
- String(b.key)
367
- )),
368
- V && /* @__PURE__ */ e.jsx(G, { className: "text-right font-semibold text-foreground", children: (i == null ? void 0 : i.title) || "操作" })
369
- ] }) }), I = () => m ? /* @__PURE__ */ e.jsx(P, { children: Array.from({ length: 5 }).map((b, N) => /* @__PURE__ */ e.jsxs(S, { children: [
370
- d.map(($) => /* @__PURE__ */ e.jsx(
371
- g,
372
- {
373
- style: { width: $.width },
374
- className: $.align === "center" ? "text-center" : $.align === "right" ? "text-right" : "",
375
- children: /* @__PURE__ */ e.jsx(C, { className: "h-4 w-full" })
376
- },
377
- String($.key)
378
- )),
379
- V && /* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsx(C, { className: "ml-auto h-4 w-8" }) })
380
- ] }, N)) }) : r.length === 0 ? /* @__PURE__ */ e.jsx(P, { children: /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(
381
- g,
382
- {
383
- colSpan: d.length + (V ? 1 : 0),
384
- className: "py-8 text-center text-muted-foreground",
385
- children: te ? v : l
386
- }
387
- ) }) }) : /* @__PURE__ */ e.jsx(P, { children: r.map((b, N) => {
388
- const $ = de(b, N), ce = w == null ? void 0 : w(b, N), le = p == null ? void 0 : p(b, N);
389
- return /* @__PURE__ */ e.jsxs(
390
- S,
391
- {
392
- className: `${le || ""} hover:bg-muted/50`,
393
- ...ce,
394
- children: [
395
- d.map((ee) => {
396
- const ue = b[ee.key], me = ee.render ? ee.render(ue, b, N) : ue;
397
- return /* @__PURE__ */ e.jsx(
398
- g,
399
- {
400
- className: ee.align === "center" ? "text-center" : ee.align === "right" ? "text-right" : "",
401
- children: me
402
- },
403
- String(ee.key)
404
- );
405
- }),
406
- V && /* @__PURE__ */ e.jsx(g, { className: "text-right", children: B ? B(b, N) : n(b, N) })
407
- ]
408
- },
409
- $
410
- );
411
- }) }), Q = (b) => /* @__PURE__ */ e.jsxs(H, { children: [
412
- y && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx(R, { ...y }) }),
413
- /* @__PURE__ */ e.jsx(Y, { className: "p-0", children: b }),
414
- (x == null ? void 0 : x.show) !== !1 && x && /* @__PURE__ */ e.jsx(L, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
415
- U,
416
- {
417
- currentPage: x.currentPage,
418
- pageSize: x.pageSize,
419
- total: x.total,
420
- onPageChange: x.onPageChange,
421
- onPageSizeChange: x.onPageSizeChange,
422
- pageSizeOptions: x.pageSizeOptions,
423
- showPageSizeSelector: x.showPageSizeSelector,
424
- showJumpToPage: x.showJumpToPage,
425
- showTotal: x.showTotal,
426
- searchActive: te
427
- }
428
- ) })
429
- ] }), re = (b, N) => /* @__PURE__ */ e.jsxs(E, { children: [
430
- b,
431
- N
432
- ] });
433
- return F ? F(
434
- T ? T(j(), I()) : re(j(), I())
435
- ) : Q(
436
- T ? T(j(), I()) : re(j(), I())
437
- );
438
- }
439
- function At({
440
- open: r,
441
- onOpenChange: m,
442
- title: d,
443
- description: h,
444
- onConfirm: l,
445
- loading: v = !1,
446
- confirmText: y = "确认删除",
447
- cancelText: x = "取消",
448
- confirmButtonVariant: p = "destructive",
449
- verification: w,
450
- components: i,
451
- loadingIcon: D
452
- }) {
453
- const [F, T] = O("");
454
- if (ae(() => {
455
- r && T("");
456
- }, [r, w == null ? void 0 : w.targetValue]), !i)
457
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
458
- const {
459
- Dialog: B,
460
- DialogContent: H,
461
- DialogHeader: Y,
462
- DialogFooter: L,
463
- DialogTitle: E,
464
- DialogDescription: P,
465
- Button: g,
466
- Input: G,
467
- Label: X
468
- } = i, S = w ? F !== w.targetValue : !1, z = () => {
469
- S || l();
470
- };
471
- return /* @__PURE__ */ e.jsx(B, { open: r, onOpenChange: m, children: /* @__PURE__ */ e.jsxs(H, { children: [
472
- /* @__PURE__ */ e.jsxs(Y, { children: [
473
- /* @__PURE__ */ e.jsx(E, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: d }) }),
474
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: h }) })
475
- ] }),
476
- w && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
477
- /* @__PURE__ */ e.jsx(X, { htmlFor: "confirm-input", children: w.label || "请输入以确认" }),
478
- /* @__PURE__ */ e.jsx(
479
- G,
480
- {
481
- id: "confirm-input",
482
- value: F,
483
- onChange: (W) => T(W.target.value),
484
- placeholder: w.placeholder,
485
- disabled: v
486
- }
487
- )
488
- ] }) }),
489
- /* @__PURE__ */ e.jsxs(L, { children: [
490
- /* @__PURE__ */ e.jsx(
491
- g,
492
- {
493
- variant: "outline",
494
- onClick: () => m(!1),
495
- disabled: v,
496
- children: x
497
- }
498
- ),
499
- /* @__PURE__ */ e.jsxs(
500
- g,
501
- {
502
- variant: p,
503
- onClick: z,
504
- disabled: S || v,
505
- children: [
506
- v && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: D || /* @__PURE__ */ e.jsxs(
507
- "svg",
508
- {
509
- className: "h-4 w-4 animate-spin",
510
- fill: "none",
511
- viewBox: "0 0 24 24",
512
- children: [
513
- /* @__PURE__ */ e.jsx(
514
- "circle",
515
- {
516
- className: "opacity-25",
517
- cx: "12",
518
- cy: "12",
519
- r: "10",
520
- stroke: "currentColor",
521
- strokeWidth: "4"
522
- }
523
- ),
524
- /* @__PURE__ */ e.jsx(
525
- "path",
526
- {
527
- className: "opacity-75",
528
- fill: "currentColor",
529
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
530
- }
531
- )
532
- ]
533
- }
534
- ) }),
535
- y
536
- ]
537
- }
538
- )
539
- ] })
540
- ] }) });
541
- }
542
- function It({
543
- title: r,
544
- searchPlaceholder: m = "搜索...",
545
- searchValue: d = "",
546
- onSearchChange: h,
547
- onSearch: l,
548
- showSearch: v = !0,
549
- action: y,
550
- actionLabel: x,
551
- onActionClick: p,
552
- loading: w = !1,
553
- components: i
554
- }) {
555
- if (!i)
556
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
557
- const { Input: D, Button: F } = i, T = (B) => {
558
- B.key === "Enter" && l && l();
559
- };
560
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
561
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
562
- /* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: r }),
563
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
564
- y && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: y }),
565
- !y && x && p && /* @__PURE__ */ e.jsxs(F, { onClick: p, disabled: w, size: "sm", children: [
566
- /* @__PURE__ */ e.jsx(it, { className: "mr-2 h-4 w-4" }),
567
- x
568
- ] })
569
- ] })
570
- ] }),
571
- v && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
572
- /* @__PURE__ */ e.jsxs("div", { className: "relative max-w-sm flex-1", children: [
573
- /* @__PURE__ */ e.jsx(ct, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
574
- /* @__PURE__ */ e.jsx(
575
- D,
576
- {
577
- placeholder: m,
578
- value: d,
579
- onChange: (B) => h == null ? void 0 : h(B.target.value),
580
- onKeyPress: T,
581
- className: "h-9 pl-8",
582
- disabled: w
583
- }
584
- )
585
- ] }),
586
- l && /* @__PURE__ */ e.jsx(
587
- F,
588
- {
589
- onClick: l,
590
- disabled: w,
591
- variant: "secondary",
592
- size: "sm",
593
- children: "搜索"
594
- }
595
- )
596
- ] })
597
- ] });
598
- }
599
- function $t({
600
- currentPage: r,
601
- pageSize: m,
602
- total: d,
603
- onPageChange: h,
604
- onPageSizeChange: l,
605
- pageSizeOptions: v = [10, 20, 50],
606
- showPageSizeSelector: y = !0,
607
- showJumpToPage: x = !0,
608
- showTotal: p = !0,
609
- searchActive: w = !1,
610
- components: i
611
- }) {
612
- const [D, F] = O(String(r + 1));
613
- if (ae(() => {
614
- F(String(r + 1));
615
- }, [r]), !i)
616
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
617
- const {
618
- Button: T,
619
- Select: B,
620
- SelectTrigger: H,
621
- SelectContent: Y,
622
- SelectItem: L,
623
- SelectValue: E
624
- } = i, P = Math.ceil(d / m), g = Math.max(P, 1), G = r * m + 1, X = Math.min((r + 1) * m, d), S = Array.from(
625
- /* @__PURE__ */ new Set([...v, m])
626
- ).sort((u, M) => u - M), z = y && !!l, W = g > 1, K = (u) => {
627
- const M = Math.max(0, Math.min(u, g - 1));
628
- M !== r && h(M);
629
- }, J = (() => {
630
- if (g <= 7)
631
- return Array.from({ length: g }, (R, U) => U);
632
- const u = /* @__PURE__ */ new Set([
633
- 0,
634
- 1,
635
- g - 2,
636
- g - 1,
637
- r - 1,
638
- r,
639
- r + 1
640
- ]), M = Array.from(u).filter((R) => R >= 0 && R < g).sort((R, U) => R - U), C = [];
641
- for (const R of M) {
642
- const U = C[C.length - 1];
643
- typeof U == "number" && R - U > 1 && C.push("ellipsis"), C.push(R);
644
- }
645
- return C;
646
- })();
647
- return d === 0 ? null : /* @__PURE__ */ e.jsxs(
648
- "div",
649
- {
650
- className: `flex w-full items-center gap-3 ${p ? "justify-between" : "justify-end"}`,
651
- children: [
652
- p && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: w ? `找到 ${d} 条匹配记录` : d > 0 ? `显示 ${G} - ${X} 条,共 ${d} 条记录` : "暂无数据" }),
653
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
654
- z && /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
655
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
656
- /* @__PURE__ */ e.jsxs(
657
- B,
658
- {
659
- value: String(m),
660
- onValueChange: (u) => {
661
- const M = Number(u);
662
- Number.isNaN(M) || M === m || !l || l(M);
663
- },
664
- children: [
665
- /* @__PURE__ */ e.jsx(H, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(E, {}) }),
666
- /* @__PURE__ */ e.jsx(Y, { children: S.map((u) => /* @__PURE__ */ e.jsx(L, { value: String(u), children: u }, u)) })
667
- ]
668
- }
669
- ),
670
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "条" })
671
- ] }),
672
- /* @__PURE__ */ e.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
673
- "第 ",
674
- r + 1,
675
- " 页,共 ",
676
- g,
677
- " 页"
678
- ] }),
679
- /* @__PURE__ */ e.jsx(
680
- T,
681
- {
682
- variant: "outline",
683
- size: "icon",
684
- onClick: () => K(r - 1),
685
- disabled: r === 0 || !W,
686
- "aria-label": "上一页",
687
- children: /* @__PURE__ */ e.jsx(Ee, { className: "h-4 w-4" })
688
- }
689
- ),
690
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: J.map(
691
- (u, M) => u === "ellipsis" ? /* @__PURE__ */ e.jsx(
692
- "span",
693
- {
694
- className: "inline-flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
695
- children: "..."
696
- },
697
- `ellipsis-${M}`
698
- ) : /* @__PURE__ */ e.jsx(
699
- T,
700
- {
701
- variant: u === r ? "default" : "outline",
702
- size: "sm",
703
- onClick: () => K(u),
704
- disabled: u === r,
705
- "aria-current": u === r ? "page" : void 0,
706
- children: u + 1
707
- },
708
- u
709
- )
710
- ) }),
711
- /* @__PURE__ */ e.jsx(
712
- T,
713
- {
714
- variant: "outline",
715
- size: "icon",
716
- onClick: () => K(r + 1),
717
- disabled: r >= g - 1 || !W,
718
- "aria-label": "下一页",
719
- children: /* @__PURE__ */ e.jsx(Pe, { className: "h-4 w-4" })
720
- }
721
- ),
722
- x && /* @__PURE__ */ e.jsxs(
723
- "form",
724
- {
725
- className: "ml-1 flex items-center gap-2",
726
- onSubmit: (u) => {
727
- u.preventDefault();
728
- const M = Number.parseInt(D, 10);
729
- Number.isNaN(M) || K(M - 1);
730
- },
731
- children: [
732
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "跳至" }),
733
- /* @__PURE__ */ e.jsx(
734
- "input",
735
- {
736
- type: "number",
737
- min: 1,
738
- max: g,
739
- value: D,
740
- disabled: !W,
741
- onChange: (u) => F(u.target.value),
742
- className: "h-8 w-16 rounded-md border border-input bg-background px-2 text-sm",
743
- "aria-label": "跳转页码"
744
- }
745
- ),
746
- /* @__PURE__ */ e.jsx(
747
- T,
748
- {
749
- type: "submit",
750
- variant: "outline",
751
- size: "sm",
752
- disabled: !W,
753
- children: "跳转"
754
- }
755
- )
756
- ]
757
- }
758
- )
759
- ] })
760
- ]
761
- }
762
- );
763
- }
764
- const bt = [
765
- {
766
- value: "light",
767
- label: "浅色",
768
- icon: /* @__PURE__ */ e.jsxs(
769
- "svg",
770
- {
771
- className: "h-4 w-4",
772
- fill: "none",
773
- viewBox: "0 0 24 24",
774
- stroke: "currentColor",
775
- children: [
776
- /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
777
- /* @__PURE__ */ e.jsx(
778
- "path",
779
- {
780
- className: "opacity-75",
781
- d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
782
- strokeWidth: "2",
783
- strokeLinecap: "round"
784
- }
785
- )
786
- ]
787
- }
788
- )
789
- },
790
- {
791
- value: "dark",
792
- label: "深色",
793
- icon: /* @__PURE__ */ e.jsx(
794
- "svg",
795
- {
796
- className: "h-4 w-4",
797
- fill: "none",
798
- viewBox: "0 0 24 24",
799
- stroke: "currentColor",
800
- children: /* @__PURE__ */ e.jsx(
801
- "path",
802
- {
803
- d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
804
- strokeWidth: "2",
805
- strokeLinecap: "round",
806
- strokeLinejoin: "round"
807
- }
808
- )
809
- }
810
- )
811
- },
812
- {
813
- value: "system",
814
- label: "跟随系统",
815
- icon: /* @__PURE__ */ e.jsxs(
816
- "svg",
817
- {
818
- className: "h-4 w-4",
819
- fill: "none",
820
- viewBox: "0 0 24 24",
821
- stroke: "currentColor",
822
- children: [
823
- /* @__PURE__ */ e.jsx(
824
- "rect",
825
- {
826
- x: "2",
827
- y: "3",
828
- width: "20",
829
- height: "14",
830
- rx: "2",
831
- ry: "2",
832
- strokeWidth: "2"
833
- }
834
- ),
835
- /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
836
- ]
837
- }
838
- )
839
- }
840
- ];
841
- function Ot({
842
- value: r,
843
- onValueChange: m,
844
- themes: d = bt,
845
- triggerVariant: h = "ghost",
846
- triggerSize: l = "icon",
847
- triggerClassName: v,
848
- iconSize: y = 16,
849
- showCurrentIcon: x = !0,
850
- enableSSRHandling: p = !0,
851
- triggerContent: w,
852
- components: i,
853
- themeIcons: D
854
- }) {
855
- const [F, T] = O(!1);
856
- if (ae(() => {
857
- T(!0);
858
- }, []), p && !F)
859
- return null;
860
- if (!i)
861
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
862
- const {
863
- DropdownMenu: B,
864
- DropdownMenuTrigger: H,
865
- DropdownMenuContent: Y,
866
- DropdownMenuRadioGroup: L,
867
- DropdownMenuRadioItem: E,
868
- Button: P
869
- } = i, g = (z) => {
870
- if (D && D[z])
871
- return D[z];
872
- const W = d.find((K) => K.value === z);
873
- return W == null ? void 0 : W.icon;
874
- }, G = g(r), X = x ? G : null, S = y ? { width: y, height: y } : {};
875
- return /* @__PURE__ */ e.jsxs(B, { children: [
876
- /* @__PURE__ */ e.jsx(H, { asChild: !0, children: /* @__PURE__ */ e.jsx(
877
- P,
878
- {
879
- variant: h,
880
- size: l,
881
- className: v,
882
- children: w || /* @__PURE__ */ e.jsx(
883
- "span",
884
- {
885
- style: S,
886
- className: "inline-flex items-center justify-center",
887
- children: X
888
- }
889
- )
890
- }
891
- ) }),
892
- /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsx(L, { value: r, onValueChange: m, children: d.map((z) => /* @__PURE__ */ e.jsxs(E, { value: z.value, children: [
893
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: g(z.value) }),
894
- /* @__PURE__ */ e.jsx("span", { children: z.label })
895
- ] }, z.value)) }) })
896
- ] });
897
- }
898
- const yt = [
899
- {
900
- value: "light",
901
- label: "浅色",
902
- icon: /* @__PURE__ */ e.jsxs(
903
- "svg",
904
- {
905
- className: "h-4 w-4",
906
- fill: "none",
907
- viewBox: "0 0 24 24",
908
- stroke: "currentColor",
909
- children: [
910
- /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
911
- /* @__PURE__ */ e.jsx(
912
- "path",
913
- {
914
- className: "opacity-75",
915
- d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
916
- strokeWidth: "2",
917
- strokeLinecap: "round"
918
- }
919
- )
920
- ]
921
- }
922
- )
923
- },
924
- {
925
- value: "dark",
926
- label: "深色",
927
- icon: /* @__PURE__ */ e.jsx(
928
- "svg",
929
- {
930
- className: "h-4 w-4",
931
- fill: "none",
932
- viewBox: "0 0 24 24",
933
- stroke: "currentColor",
934
- children: /* @__PURE__ */ e.jsx(
935
- "path",
936
- {
937
- d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
938
- strokeWidth: "2",
939
- strokeLinecap: "round",
940
- strokeLinejoin: "round"
941
- }
942
- )
943
- }
944
- )
945
- },
946
- {
947
- value: "system",
948
- label: "跟随系统",
949
- icon: /* @__PURE__ */ e.jsxs(
950
- "svg",
951
- {
952
- className: "h-4 w-4",
953
- fill: "none",
954
- viewBox: "0 0 24 24",
955
- stroke: "currentColor",
956
- children: [
957
- /* @__PURE__ */ e.jsx(
958
- "rect",
959
- {
960
- x: "2",
961
- y: "3",
962
- width: "20",
963
- height: "14",
964
- rx: "2",
965
- ry: "2",
966
- strokeWidth: "2"
967
- }
968
- ),
969
- /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
970
- ]
971
- }
972
- )
973
- }
974
- ];
975
- function Ft({
976
- value: r,
977
- onValueChange: m,
978
- themes: d = yt,
979
- iconSize: h = 16,
980
- components: l,
981
- themeIcons: v
982
- }) {
983
- if (!l)
984
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
985
- const { DropdownMenuRadioGroup: y, DropdownMenuRadioItem: x } = l, p = (i) => {
986
- if (v && v[i])
987
- return v[i];
988
- const D = d.find((F) => F.value === i);
989
- return D == null ? void 0 : D.icon;
990
- }, w = h ? { width: h, height: h } : {};
991
- return /* @__PURE__ */ e.jsx(y, { value: r, onValueChange: m, children: d.map((i) => /* @__PURE__ */ e.jsxs(x, { value: i.value, children: [
992
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: w, children: p(i.value) }),
993
- /* @__PURE__ */ e.jsx("span", { children: i.label })
994
- ] }, i.value)) });
995
- }
996
- function St({
997
- url: r,
998
- initialPage: m = 1,
999
- initialScale: d = 1,
1000
- scale: h,
1001
- onScaleChange: l,
1002
- minScale: v = 0.5,
1003
- maxScale: y = 3,
1004
- currentPage: x,
1005
- onPageChange: p,
1006
- showToolbar: w = !0,
1007
- showPagination: i = !0,
1008
- enableHotkeys: D = !0,
1009
- className: F,
1010
- containerClassName: T,
1011
- pageClassName: B,
1012
- components: H,
1013
- onLoadSuccess: Y,
1014
- onLoadError: L,
1015
- loadingText: E = "加载中...",
1016
- errorText: P = "加载失败"
1017
- }) {
1018
- const [g, G] = O(null), [X, S] = O(m), [z, W] = O(d), [K, J] = O(!0), [u, M] = O(null), [C, R] = O(0), [U, de] = O(!1), te = ge(null), V = ge(null), [se, s] = O(null), n = x ?? X, j = h ?? z, I = Oe(() => {
1019
- const t = [n];
1020
- return n > 1 && t.push(n - 1), n < C && t.push(n + 1), t;
1021
- }, [n, C]), Q = ie(
1022
- (t) => {
1023
- const c = Math.max(C, 1), a = Math.min(Math.max(t, 1), c);
1024
- x === void 0 && S(a), p == null || p(a);
1025
- },
1026
- [C, x, p]
1027
- ), re = ie(() => {
1028
- n > 1 && Q(n - 1);
1029
- }, [n, Q]), _ = ie(() => {
1030
- n < C && Q(n + 1);
1031
- }, [n, C, Q]), q = ie(() => {
1032
- const t = Math.min(j + 0.25, y);
1033
- h === void 0 && W(t), l == null || l(t);
1034
- }, [j, y, h, l]), b = ie(() => {
1035
- const t = Math.max(j - 0.25, v);
1036
- h === void 0 && W(t), l == null || l(t);
1037
- }, [j, v, h, l]), N = ie(async () => {
1038
- var t, c, a;
1039
- if (!(typeof document > "u")) {
1040
- if (!document.fullscreenElement) {
1041
- await ((c = (t = te.current) == null ? void 0 : t.requestFullscreen) == null ? void 0 : c.call(t));
1042
- return;
1043
- }
1044
- await ((a = document.exitFullscreen) == null ? void 0 : a.call(document));
1045
- }
1046
- }, []);
1047
- if (ae(() => {
1048
- let t = !0;
1049
- return (async () => {
1050
- try {
1051
- const a = await import("./index-DUxYhmkV.js");
1052
- if (typeof window < "u") {
1053
- const f = a.pdfjs, k = f == null ? void 0 : f.version;
1054
- f != null && f.GlobalWorkerOptions && k && (f.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${k}/build/pdf.worker.min.mjs`);
1055
- }
1056
- t && s(a);
1057
- } catch (a) {
1058
- if (t) {
1059
- const f = a instanceof Error ? a : new Error("无法加载 react-pdf 库");
1060
- M(f), J(!1), L == null || L(f);
1061
- }
1062
- }
1063
- })(), () => {
1064
- t = !1;
1065
- };
1066
- }, []), ae(() => {
1067
- if (!se || !r) return;
1068
- let t = !0;
1069
- return (async () => {
1070
- J(!0), M(null);
1071
- try {
1072
- const { Document: a } = se;
1073
- if (!a)
1074
- throw new Error("react-pdf Document 组件不可用");
1075
- const f = se.pdfjs.getDocument(r);
1076
- V.current = f;
1077
- const k = await f.promise;
1078
- t && (G(k), R(k.numPages), x === void 0 && S(
1079
- (oe) => Math.max(1, Math.min(oe, k.numPages))
1080
- ), J(!1), Y == null || Y(k));
1081
- } catch (a) {
1082
- if (t) {
1083
- const f = a instanceof Error ? a : new Error("PDF 加载失败");
1084
- M(f), J(!1), L == null || L(f);
1085
- }
1086
- }
1087
- })(), () => {
1088
- t = !1, V.current && typeof V.current.destroy == "function" && (V.current.destroy(), V.current = null);
1089
- };
1090
- }, [se, r, x, Y, L]), ae(() => {
1091
- if (typeof document > "u") return;
1092
- const t = () => {
1093
- de(document.fullscreenElement === te.current);
1094
- };
1095
- return document.addEventListener("fullscreenchange", t), () => {
1096
- document.removeEventListener("fullscreenchange", t);
1097
- };
1098
- }, []), ae(() => {
1099
- if (!D) return;
1100
- const t = (c) => {
1101
- const a = document.activeElement;
1102
- a && (a.tagName === "INPUT" || a.getAttribute("role") === "input") || ((c.ctrlKey || c.metaKey) && (c.key === "=" || c.key === "+") ? (c.preventDefault(), q()) : (c.ctrlKey || c.metaKey) && c.key === "-" ? (c.preventDefault(), b()) : c.key === "ArrowLeft" ? (c.preventDefault(), re()) : c.key === "ArrowRight" ? (c.preventDefault(), _()) : (c.key === "f" || c.key === "F") && (c.preventDefault(), N()));
1103
- };
1104
- return document.addEventListener("keydown", t), () => {
1105
- document.removeEventListener("keydown", t);
1106
- };
1107
- }, [
1108
- D,
1109
- q,
1110
- b,
1111
- re,
1112
- _,
1113
- N
1114
- ]), !H)
1115
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1116
- const {
1117
- Card: $,
1118
- CardContent: ce,
1119
- Button: le,
1120
- Input: ee,
1121
- Skeleton: ue
1122
- } = H, me = () => w ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1123
- /* @__PURE__ */ e.jsx(
1124
- le,
1125
- {
1126
- variant: "outline",
1127
- size: "sm",
1128
- onClick: b,
1129
- disabled: j <= v,
1130
- children: /* @__PURE__ */ e.jsx(Fe, {})
1131
- }
1132
- ),
1133
- /* @__PURE__ */ e.jsxs("span", { className: "text-sm", children: [
1134
- Math.round(j * 100),
1135
- "%"
1136
- ] }),
1137
- /* @__PURE__ */ e.jsx(
1138
- le,
1139
- {
1140
- variant: "outline",
1141
- size: "sm",
1142
- onClick: q,
1143
- disabled: j >= y,
1144
- children: /* @__PURE__ */ e.jsx(Se, {})
1145
- }
1146
- ),
1147
- /* @__PURE__ */ e.jsx(
1148
- le,
1149
- {
1150
- variant: "outline",
1151
- size: "icon",
1152
- onClick: () => {
1153
- N();
1154
- },
1155
- children: U ? /* @__PURE__ */ e.jsx(ze, {}) : /* @__PURE__ */ e.jsx(We, {})
1156
- }
1157
- )
1158
- ] }) : null, he = () => i ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1159
- /* @__PURE__ */ e.jsx(
1160
- le,
1161
- {
1162
- variant: "outline",
1163
- size: "icon",
1164
- onClick: re,
1165
- disabled: n <= 1,
1166
- children: /* @__PURE__ */ e.jsx(Ee, {})
1167
- }
1168
- ),
1169
- ee ? /* @__PURE__ */ e.jsx(
1170
- ee,
1171
- {
1172
- type: "number",
1173
- min: 1,
1174
- max: Math.max(C, 1),
1175
- value: n,
1176
- onChange: (t) => Q(parseInt(t.target.value, 10) || 1),
1177
- className: "w-16 text-center"
1178
- }
1179
- ) : /* @__PURE__ */ e.jsx(
1180
- "input",
1181
- {
1182
- type: "number",
1183
- min: 1,
1184
- max: Math.max(C, 1),
1185
- value: n,
1186
- onChange: (t) => Q(parseInt(t.target.value, 10) || 1),
1187
- className: "w-16 rounded-md border border-input bg-background px-2 text-center text-sm"
1188
- }
1189
- ),
1190
- /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
1191
- "/ ",
1192
- C
1193
- ] }),
1194
- /* @__PURE__ */ e.jsx(
1195
- le,
1196
- {
1197
- variant: "outline",
1198
- size: "icon",
1199
- onClick: _,
1200
- disabled: n >= C,
1201
- children: /* @__PURE__ */ e.jsx(Pe, {})
1202
- }
1203
- )
1204
- ] }) : null, pe = () => !w && !i ? null : /* @__PURE__ */ e.jsxs(
1205
- "div",
1206
- {
1207
- "data-testid": "pdf-operations-bar",
1208
- className: "flex items-center justify-between gap-4 border-b px-4 py-2",
1209
- children: [
1210
- me(),
1211
- he()
1212
- ]
1213
- }
1214
- ), be = () => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: [
1215
- /* @__PURE__ */ e.jsx(ue, { className: "h-8 w-32" }),
1216
- /* @__PURE__ */ e.jsx(ue, { className: "h-64 w-full max-w-2xl" }),
1217
- /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: E })
1218
- ] }), je = () => /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center text-destructive", children: [
1219
- /* @__PURE__ */ e.jsx("p", { className: "font-medium", children: P }),
1220
- u && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: u.message })
1221
- ] }) }), ve = () => {
1222
- if (!se || !g) return null;
1223
- const { Page: t } = se;
1224
- return /* @__PURE__ */ e.jsx(
1225
- "div",
1226
- {
1227
- className: `flex flex-col items-center justify-center ${U ? "h-[calc(100vh-56px)] overflow-auto" : "overflow-visible"}`,
1228
- children: I.map((c) => /* @__PURE__ */ e.jsx(
1229
- "div",
1230
- {
1231
- className: B,
1232
- style: {
1233
- display: c === n ? "block" : "none"
1234
- },
1235
- children: /* @__PURE__ */ e.jsx(
1236
- t,
1237
- {
1238
- pdf: g,
1239
- pageNumber: c,
1240
- scale: j,
1241
- renderTextLayer: !1,
1242
- renderAnnotationLayer: !1,
1243
- className: "shadow-md"
1244
- }
1245
- )
1246
- },
1247
- c
1248
- ))
1249
- }
1250
- );
1251
- };
1252
- return /* @__PURE__ */ e.jsx("div", { ref: te, children: /* @__PURE__ */ e.jsxs($, { className: F, children: [
1253
- pe(),
1254
- /* @__PURE__ */ e.jsx(ce, { className: T, children: K ? be() : u ? je() : ve() })
1255
- ] }) });
1256
- }
1257
- const Le = at(
1258
- ({
1259
- thumbnail: r,
1260
- isCurrentPage: m,
1261
- onClick: d
1262
- }) => /* @__PURE__ */ e.jsxs(
1263
- "div",
1264
- {
1265
- className: `flex w-full flex-col items-center rounded p-1 ${m ? "bg-primary/10" : ""}`,
1266
- children: [
1267
- /* @__PURE__ */ e.jsx(
1268
- "img",
1269
- {
1270
- src: r.url,
1271
- alt: `Page ${r.pageNumber}`,
1272
- className: "w-48 cursor-pointer border transition-opacity hover:opacity-80",
1273
- onClick: d,
1274
- onKeyDown: (h) => {
1275
- (h.key === "Enter" || h.key === " ") && (h.preventDefault(), d());
1276
- },
1277
- role: "button",
1278
- tabIndex: 0
1279
- }
1280
- ),
1281
- /* @__PURE__ */ e.jsxs("span", { className: "mt-1 text-sm", children: [
1282
- "第 ",
1283
- r.pageNumber,
1284
- " 页"
1285
- ] })
1286
- ]
1287
- }
1288
- )
1289
- );
1290
- Le.displayName = "PDFThumbnail";
1291
- const Ve = ({
1292
- bookmark: r,
1293
- depth: m,
1294
- onClick: d
1295
- }) => /* @__PURE__ */ e.jsxs("div", { style: { paddingLeft: `${m * 16}px` }, children: [
1296
- /* @__PURE__ */ e.jsx(
1297
- "button",
1298
- {
1299
- onClick: () => d(r),
1300
- className: "w-full rounded px-2 py-1 text-left text-sm hover:bg-primary/10 hover:text-primary",
1301
- children: r.title
1302
- }
1303
- ),
1304
- r.items && r.items.map((h, l) => /* @__PURE__ */ e.jsx(
1305
- Ve,
1306
- {
1307
- bookmark: h,
1308
- depth: m + 1,
1309
- onClick: d
1310
- },
1311
- `${r.title}-${l}`
1312
- ))
1313
- ] });
1314
- function Nt({
1315
- pdfDocument: r,
1316
- currentPage: m,
1317
- onPageClick: d,
1318
- components: h
1319
- }) {
1320
- const [l, v] = O([]), [y, x] = O([]), [p, w] = O(!0), { Tabs: i, TabsList: D, TabsTrigger: F, TabsContent: T, ScrollArea: B, Skeleton: H } = h;
1321
- ae(() => {
1322
- (async () => {
1323
- if (!r) return;
1324
- w(!0);
1325
- const P = [];
1326
- for (let g = 1; g <= r.numPages; g++)
1327
- try {
1328
- const G = await r.getPage(g), X = G.getViewport({ scale: 0.2 }), S = document.createElement("canvas"), z = S.getContext("2d");
1329
- if (!z) continue;
1330
- S.width = X.width, S.height = X.height, await G.render({
1331
- canvasContext: z,
1332
- viewport: X,
1333
- canvas: S
1334
- }).promise, P.push({
1335
- pageNumber: g,
1336
- url: S.toDataURL()
1337
- });
1338
- } catch (G) {
1339
- console.error(`Error loading thumbnail for page ${g}:`, G);
1340
- }
1341
- v(P), w(!1);
1342
- })();
1343
- }, [r]), ae(() => {
1344
- (async () => {
1345
- if (r)
1346
- try {
1347
- const P = await r.getOutline();
1348
- x(P || []);
1349
- } catch (P) {
1350
- console.error("Error loading bookmarks:", P), x([]);
1351
- }
1352
- })();
1353
- }, [r]);
1354
- const Y = async (E) => {
1355
- if (r)
1356
- try {
1357
- let P;
1358
- if (E.dest)
1359
- if (typeof E.dest == "string") {
1360
- const g = await r.getDestination(E.dest);
1361
- g && g[0] && (P = await r.getPageIndex(g[0]));
1362
- } else Array.isArray(E.dest) && E.dest[0] && (P = await r.getPageIndex(E.dest[0]));
1363
- else E.pageNumber && (P = E.pageNumber - 1);
1364
- typeof P == "number" && d(P + 1);
1365
- } catch (P) {
1366
- console.error("Error navigating to bookmark:", P);
1367
- }
1368
- }, L = () => /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: Array.from({ length: (r == null ? void 0 : r.numPages) || 5 }, (E, P) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center p-1", children: [
1369
- /* @__PURE__ */ e.jsx(H, { className: "h-32 w-48" }),
1370
- /* @__PURE__ */ e.jsx(H, { className: "mt-1 h-4 w-16" })
1371
- ] }, P)) });
1372
- return /* @__PURE__ */ e.jsx("div", { className: "w-64 border-r bg-muted", children: /* @__PURE__ */ e.jsxs(i, { defaultValue: "thumbnails", children: [
1373
- /* @__PURE__ */ e.jsxs(D, { className: "w-full p-2", children: [
1374
- /* @__PURE__ */ e.jsx(F, { value: "thumbnails", className: "flex-1 bg-transparent", children: "缩略图" }),
1375
- /* @__PURE__ */ e.jsx(F, { value: "bookmarks", className: "flex-1 bg-transparent", children: "书签" })
1376
- ] }),
1377
- /* @__PURE__ */ e.jsx(T, { value: "thumbnails", children: /* @__PURE__ */ e.jsx(B, { className: "h-[calc(100vh-8rem)]", children: p ? L() : /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: l.map((E) => /* @__PURE__ */ e.jsx(
1378
- Le,
1379
- {
1380
- thumbnail: E,
1381
- isCurrentPage: m === E.pageNumber,
1382
- onClick: () => d(E.pageNumber)
1383
- },
1384
- E.pageNumber
1385
- )) }) }) }),
1386
- /* @__PURE__ */ e.jsx(T, { value: "bookmarks", children: /* @__PURE__ */ e.jsx(B, { className: "h-[calc(100vh-8rem)]", children: /* @__PURE__ */ e.jsx("div", { className: "p-4", children: y.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "py-4 text-center text-sm text-muted-foreground", children: "没有可用的书签" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: y.map((E, P) => /* @__PURE__ */ e.jsx(
1387
- Ve,
1388
- {
1389
- bookmark: E,
1390
- depth: 0,
1391
- onClick: Y
1392
- },
1393
- `${E.title}-${P}`
1394
- )) }) }) }) })
1395
- ] }) });
1396
- }
1397
- function wt(r, m) {
1398
- const d = ge(
1399
- void 0
1400
- );
1401
- return ie(
1402
- (...h) => {
1403
- d.current && clearTimeout(d.current), d.current = setTimeout(() => r(...h), m);
1404
- },
1405
- [r, m]
1406
- );
1407
- }
1408
- function zt({
1409
- url: r,
1410
- initialPage: m = 1,
1411
- initialScale: d = 1,
1412
- initialRotation: h = 0,
1413
- currentPage: l,
1414
- onPageChange: v,
1415
- scale: y,
1416
- onScaleChange: x,
1417
- rotation: p,
1418
- onRotationChange: w,
1419
- minScale: i = 0.5,
1420
- maxScale: D = 2.5,
1421
- showToolbar: F = !0,
1422
- showSidebar: T = !0,
1423
- showRotation: B = !0,
1424
- showModeToggle: H = !0,
1425
- showFullscreen: Y = !0,
1426
- enableHotkeys: L = !0,
1427
- enableMobileNav: E = !0,
1428
- displayMode: P = "scroll",
1429
- className: g,
1430
- toolbarClassName: G,
1431
- contentClassName: X,
1432
- contentHeight: S = "80vh",
1433
- pageClassName: z,
1434
- workerUrl: W,
1435
- cMapUrl: K,
1436
- standardFontDataUrl: J,
1437
- components: u,
1438
- onLoadSuccess: M,
1439
- onLoadError: C,
1440
- onPageRender: R,
1441
- loadingText: U = "正在加载PDF文档...",
1442
- errorText: de = "PDF加载失败"
1443
- }) {
1444
- const [te, V] = O(null), [se, s] = O(m), [n, j] = O(d), [I, Q] = O(h), [re, _] = O(!1), [q, b] = O(null), [N, $] = O(0), [ce, le] = O(!1), [ee, ue] = O(
1445
- P === "scroll"
1446
- ), [me, he] = O(T);
1447
- ae(() => {
1448
- he(T);
1449
- }, [T]);
1450
- const [pe, be] = O(void 0), [je, ve] = O(null), t = ge(null), c = ge(null), a = l ?? se, f = y ?? n, k = p ?? I, { Card: oe, CardContent: Ye, Button: xe, Input: Ge, Skeleton: Ke } = u || {}, Je = Oe(() => {
1451
- const o = {
1452
- withCredentials: !1
1453
- };
1454
- return K && (o.cMapUrl = K, o.cMapPacked = !0), J && (o.standardFontDataUrl = J), o;
1455
- }, [K, J]);
1456
- ae(() => {
1457
- let o = !0;
1458
- return (async () => {
1459
- try {
1460
- const ne = await import("./index-DUxYhmkV.js");
1461
- if (typeof window < "u") {
1462
- const Z = ne.pdfjs, ke = Z == null ? void 0 : Z.version;
1463
- Z != null && Z.GlobalWorkerOptions && ke && (W ? Z.GlobalWorkerOptions.workerSrc = W : Z.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${ke}/build/pdf.worker.min.mjs`, !K && Z.GlobalWorkerOptions && (Z.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${ke}/cmaps/`), !J && Z.GlobalWorkerOptions && (Z.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${ke}/standard_fonts/`));
1464
- }
1465
- o && ve(ne);
1466
- } catch (ne) {
1467
- if (o) {
1468
- const Z = ne instanceof Error ? ne : new Error("无法加载 react-pdf 库");
1469
- b(Z), _(!1), C == null || C(Z);
1470
- }
1471
- }
1472
- })(), () => {
1473
- o = !1;
1474
- };
1475
- }, [W, K, J, C]);
1476
- const qe = ie(
1477
- (o) => {
1478
- console.error("PDF加载失败:", o), console.error("PDF URL:", r), b(
1479
- new Error(`${de}: ${o.message || "请检查文件路径或网络连接"}`)
1480
- ), C == null || C(o);
1481
- },
1482
- [r, de, C]
1483
- ), fe = ie(
1484
- (o) => {
1485
- const A = N > 0 ? Math.max(1, Math.min(o, N)) : o;
1486
- l === void 0 && s(A), v == null || v(A);
1487
- },
1488
- [N, l, v]
1489
- ), ye = ie(
1490
- (o) => {
1491
- const A = Math.max(i, Math.min(D, f + o));
1492
- y === void 0 && j(A), x == null || x(A);
1493
- },
1494
- [f, i, D, y, x]
1495
- ), He = ie(() => {
1496
- const o = (k + 90) % 360;
1497
- p === void 0 && Q(o), w == null || w(o);
1498
- }, [k, p, w]), _e = wt((o) => {
1499
- be(o);
1500
- }, 100);
1501
- ae(() => {
1502
- if (!c.current) return;
1503
- const o = c.current, A = () => {
1504
- _e(o.clientWidth);
1505
- };
1506
- A();
1507
- const ne = new ResizeObserver(() => {
1508
- A();
1509
- });
1510
- return ne.observe(o), () => {
1511
- ne.disconnect();
1512
- };
1513
- }, [_e]), ae(() => {
1514
- if (!L) return;
1515
- const o = (A) => {
1516
- (A.ctrlKey || A.metaKey) && (A.key === "=" || A.key === "+") ? (A.preventDefault(), ye(0.1)) : (A.ctrlKey || A.metaKey) && A.key === "-" ? (A.preventDefault(), ye(-0.1)) : A.key === "ArrowLeft" ? (A.preventDefault(), fe(a - 1)) : A.key === "ArrowRight" && (A.preventDefault(), fe(a + 1));
1517
- };
1518
- return document.addEventListener("keydown", o), () => {
1519
- document.removeEventListener("keydown", o);
1520
- };
1521
- }, [L, a, fe, ye]);
1522
- const Ue = ie(async () => {
1523
- var o, A;
1524
- if (!(typeof document > "u"))
1525
- if (document.fullscreenElement)
1526
- document.exitFullscreen && (await document.exitFullscreen(), le(!1));
1527
- else
1528
- try {
1529
- await ((A = (o = t.current) == null ? void 0 : o.requestFullscreen) == null ? void 0 : A.call(o)), le(!0);
1530
- } catch (ne) {
1531
- console.error("Error attempting to enable fullscreen:", ne);
1532
- }
1533
- }, []);
1534
- ae(() => {
1535
- if (typeof document > "u") return;
1536
- const o = () => {
1537
- le(!!document.fullscreenElement);
1538
- };
1539
- return document.addEventListener("fullscreenchange", o), () => {
1540
- document.removeEventListener("fullscreenchange", o);
1541
- };
1542
- }, []);
1543
- const Xe = ie(
1544
- (o) => {
1545
- fe(o), ue(!1);
1546
- },
1547
- [fe]
1548
- ), Ze = () => F ? /* @__PURE__ */ e.jsxs(
1549
- "div",
1550
- {
1551
- className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${G || ""}`,
1552
- children: [
1553
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1554
- T && /* @__PURE__ */ e.jsx(
1555
- xe,
1556
- {
1557
- variant: "outline",
1558
- size: "icon",
1559
- onClick: () => he(!me),
1560
- title: me ? "隐藏侧边栏" : "显示侧边栏",
1561
- children: /* @__PURE__ */ e.jsx(ot, {})
1562
- }
1563
- ),
1564
- /* @__PURE__ */ e.jsx(
1565
- xe,
1566
- {
1567
- variant: "outline",
1568
- size: "icon",
1569
- onClick: () => ye(-0.1),
1570
- disabled: f <= i,
1571
- children: /* @__PURE__ */ e.jsx(Fe, {})
1572
- }
1573
- ),
1574
- /* @__PURE__ */ e.jsxs("span", { className: "min-w-[3rem] text-center text-sm", children: [
1575
- Math.round(f * 100),
1576
- "%"
1577
- ] }),
1578
- /* @__PURE__ */ e.jsx(
1579
- xe,
1580
- {
1581
- variant: "outline",
1582
- size: "icon",
1583
- onClick: () => ye(0.1),
1584
- disabled: f >= D,
1585
- children: /* @__PURE__ */ e.jsx(Se, {})
1586
- }
1587
- ),
1588
- B && /* @__PURE__ */ e.jsx(xe, { variant: "outline", size: "icon", onClick: He, children: /* @__PURE__ */ e.jsx(dt, {}) }),
1589
- H && /* @__PURE__ */ e.jsx(
1590
- xe,
1591
- {
1592
- variant: "outline",
1593
- size: "icon",
1594
- onClick: () => ue(!ee),
1595
- title: ee ? "单页模式" : "滚动模式",
1596
- children: ee ? /* @__PURE__ */ e.jsx(ut, {}) : /* @__PURE__ */ e.jsx(Be, {})
1597
- }
1598
- ),
1599
- Y && /* @__PURE__ */ e.jsx(xe, { variant: "outline", size: "icon", onClick: Ue, children: ce ? /* @__PURE__ */ e.jsx(ze, {}) : /* @__PURE__ */ e.jsx(We, {}) })
1600
- ] }),
1601
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1602
- /* @__PURE__ */ e.jsx(
1603
- xe,
1604
- {
1605
- variant: "outline",
1606
- size: "icon",
1607
- onClick: () => fe(a - 1),
1608
- disabled: a <= 1,
1609
- children: /* @__PURE__ */ e.jsx(Ee, {})
1610
- }
1611
- ),
1612
- /* @__PURE__ */ e.jsx(
1613
- Ge,
1614
- {
1615
- type: "number",
1616
- min: 1,
1617
- max: N,
1618
- value: a,
1619
- onChange: (o) => fe(parseInt(o.target.value) || 1),
1620
- className: "w-16 text-center"
1621
- }
1622
- ),
1623
- /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
1624
- "/ ",
1625
- N
1626
- ] }),
1627
- /* @__PURE__ */ e.jsx(
1628
- xe,
1629
- {
1630
- variant: "outline",
1631
- size: "icon",
1632
- onClick: () => fe(a + 1),
1633
- disabled: N > 0 && a >= N,
1634
- children: /* @__PURE__ */ e.jsx(Pe, {})
1635
- }
1636
- )
1637
- ] })
1638
- ]
1639
- }
1640
- ) : null, Ce = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: U }) }), Re = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full min-h-[400px] items-center justify-center px-4 text-center text-destructive", children: /* @__PURE__ */ e.jsxs("div", { className: "max-w-md", children: [
1641
- /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-lg font-medium", children: "文件加载失败" }),
1642
- /* @__PURE__ */ e.jsx("p", { className: "text-sm opacity-80", children: q == null ? void 0 : q.message })
1643
- ] }) }), Qe = () => {
1644
- if (!je) return Ce();
1645
- const { Document: o, Page: A } = je;
1646
- return /* @__PURE__ */ e.jsx(
1647
- "div",
1648
- {
1649
- ref: c,
1650
- className: `pdf-container flex-1 overflow-y-auto ${X || ""}`,
1651
- children: /* @__PURE__ */ e.jsx("div", { className: "flex min-h-full justify-center px-4", children: /* @__PURE__ */ e.jsx(
1652
- o,
1653
- {
1654
- file: r,
1655
- onLoadError: qe,
1656
- options: Je,
1657
- loading: Ce(),
1658
- error: Re(),
1659
- onLoadSuccess: (ne) => {
1660
- te || (V(ne), $(ne.numPages), _(!1), M == null || M(ne));
1661
- },
1662
- children: q ? Re() : ee ? (
1663
- // 显示所有页面模式
1664
- Array.from(new Array(N), (ne, Z) => /* @__PURE__ */ e.jsx(
1665
- "div",
1666
- {
1667
- className: `mb-4 ${z || ""}`,
1668
- children: /* @__PURE__ */ e.jsx(
1669
- A,
1670
- {
1671
- pageNumber: Z + 1,
1672
- renderTextLayer: !1,
1673
- renderAnnotationLayer: !1,
1674
- width: pe,
1675
- scale: f,
1676
- rotate: k,
1677
- onRenderSuccess: () => R == null ? void 0 : R(Z + 1)
1678
- }
1679
- )
1680
- },
1681
- `page_${Z + 1}`
1682
- ))
1683
- ) : (
1684
- // 单页模式
1685
- /* @__PURE__ */ e.jsx("div", { className: z || "", children: /* @__PURE__ */ e.jsx(
1686
- A,
1687
- {
1688
- pageNumber: a,
1689
- renderTextLayer: !1,
1690
- renderAnnotationLayer: !1,
1691
- width: pe,
1692
- scale: f,
1693
- rotate: k,
1694
- onRenderSuccess: () => R == null ? void 0 : R(a)
1695
- }
1696
- ) })
1697
- )
1698
- }
1699
- ) })
1700
- }
1701
- );
1702
- }, et = () => {
1703
- if (!T || !me || !te) return null;
1704
- const o = Nt;
1705
- return /* @__PURE__ */ e.jsx(
1706
- o,
1707
- {
1708
- pdfDocument: te,
1709
- currentPage: a,
1710
- onPageClick: Xe,
1711
- components: {
1712
- Tabs: u.Tabs,
1713
- TabsList: u.TabsList,
1714
- TabsTrigger: u.TabsTrigger,
1715
- TabsContent: u.TabsContent,
1716
- ScrollArea: u.ScrollArea,
1717
- Skeleton: Ke
1718
- }
1719
- }
1720
- );
1721
- }, tt = () => E ? /* @__PURE__ */ e.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
1722
- /* @__PURE__ */ e.jsxs(
1723
- xe,
1724
- {
1725
- variant: "secondary",
1726
- size: "sm",
1727
- onClick: () => fe(a - 1),
1728
- disabled: a <= 1,
1729
- children: [
1730
- /* @__PURE__ */ e.jsx(Ee, {}),
1731
- /* @__PURE__ */ e.jsx("span", { className: "ml-1", children: "上一页" })
1732
- ]
1733
- }
1734
- ),
1735
- /* @__PURE__ */ e.jsxs(
1736
- xe,
1737
- {
1738
- variant: "secondary",
1739
- size: "sm",
1740
- onClick: () => fe(a + 1),
1741
- disabled: a >= N,
1742
- children: [
1743
- /* @__PURE__ */ e.jsx("span", { className: "mr-1", children: "下一页" }),
1744
- /* @__PURE__ */ e.jsx(Pe, {})
1745
- ]
1746
- }
1747
- )
1748
- ] }) : null;
1749
- if (!u)
1750
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1751
- if (T) {
1752
- const o = [];
1753
- if (u.Tabs || o.push("Tabs"), u.TabsList || o.push("TabsList"), u.TabsTrigger || o.push("TabsTrigger"), u.TabsContent || o.push("TabsContent"), u.ScrollArea || o.push("ScrollArea"), o.length > 0) {
1754
- const A = o.length === 1 ? o[0] : `${o.slice(0, -1).join("、")} 和 ${o[o.length - 1]}`;
1755
- return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
1756
- "错误:侧边栏功能需要注入 ",
1757
- A,
1758
- " 组件"
1759
- ] });
1760
- }
1761
- }
1762
- return /* @__PURE__ */ e.jsxs("div", { ref: t, children: [
1763
- /* @__PURE__ */ e.jsxs(oe, { className: g, children: [
1764
- Ze(),
1765
- /* @__PURE__ */ e.jsx(
1766
- Ye,
1767
- {
1768
- className: "p-0",
1769
- style: { height: ce ? "100vh" : S },
1770
- children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
1771
- et(),
1772
- re ? Ce() : q ? Re() : Qe()
1773
- ] }) })
1774
- }
1775
- )
1776
- ] }),
1777
- tt()
1778
- ] });
1779
- }
1780
- const kt = (r) => r < 1024 ? `${r} B` : r < 1024 * 1024 ? `${(r / 1024).toFixed(1)} KB` : r < 1024 * 1024 * 1024 ? `${(r / 1024 / 1024).toFixed(1)} MB` : `${(r / 1024 / 1024 / 1024).toFixed(1)} GB`, $e = (r) => `${r.name}-${r.size}-${r.lastModified}-${Math.random().toString(36).slice(2)}`, Tt = (r) => {
1781
- const m = r.lastIndexOf(".");
1782
- return m > -1 ? r.slice(m).toLowerCase() : "";
1783
- }, Et = (r, m) => {
1784
- if (!m) return !0;
1785
- const d = r.type.toLowerCase(), h = Tt(r.name);
1786
- return m.split(",").map((l) => l.trim().toLowerCase()).filter(Boolean).some((l) => l.startsWith(".") ? h === l : l.endsWith("/*") ? d.startsWith(l.slice(0, -1)) : d === l);
1787
- }, Pt = (r, m) => r instanceof Error && r.message ? r.message : typeof r == "string" && r ? r : m;
1788
- function Wt({
1789
- components: r,
1790
- title: m = "文件上传",
1791
- description: d = "选择文件后开始上传,支持 Tale SDK 的直接上传和预签名上传流程。",
1792
- helperText: h,
1793
- accept: l,
1794
- multiple: v = !1,
1795
- maxFiles: y,
1796
- maxSize: x,
1797
- disabled: p = !1,
1798
- autoUpload: w = !1,
1799
- showUploadButton: i,
1800
- showResetButton: D = !0,
1801
- selectLabel: F = "选择文件",
1802
- uploadLabel: T = "开始上传",
1803
- retryLabel: B = "重试",
1804
- resetLabel: H = "清空",
1805
- emptyLabel: Y = "尚未选择文件",
1806
- dropzoneLabel: L = "拖拽文件到这里,或点击选择",
1807
- dropzoneDescription: E = "上传前会先完成文件校验,上传逻辑由业务侧注入。",
1808
- uploadingText: P = "上传中",
1809
- successText: g = "上传完成",
1810
- errorText: G = "上传失败",
1811
- className: X,
1812
- dropzoneClassName: S,
1813
- listClassName: z,
1814
- formatFileSize: W = kt,
1815
- validateFile: K,
1816
- onFilesChange: J,
1817
- onUpload: u,
1818
- onUploadComplete: M,
1819
- onUploadError: C
1820
- }) {
1821
- const [R, U] = O([]), [de, te] = O(!1), V = ge(null), se = i ?? !!u, s = v ? y : 1, n = R.some((t) => t.status === "ready"), j = R.some((t) => t.status === "uploading");
1822
- if (ae(() => {
1823
- J == null || J(R);
1824
- }, [R, J]), !r)
1825
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1826
- const {
1827
- Card: I,
1828
- CardHeader: Q,
1829
- CardTitle: re,
1830
- CardDescription: _,
1831
- CardContent: q,
1832
- CardFooter: b,
1833
- Button: N
1834
- } = r, $ = (t) => {
1835
- U((c) => t(c));
1836
- }, ce = (t, c) => x && t.size > x ? `文件不能超过 ${W(x)}` : Et(t, l) ? K == null ? void 0 : K(t, c) : "文件类型不符合要求", le = (t, c) => {
1837
- const a = v ? [...c] : [], f = s === void 0 ? t.length : Math.max(s - a.length, 0);
1838
- return t.slice(0, f).forEach((k) => {
1839
- const oe = ce(k, a);
1840
- a.push({
1841
- id: $e(k),
1842
- file: k,
1843
- name: k.name,
1844
- size: k.size,
1845
- type: k.type,
1846
- status: oe ? "error" : "ready",
1847
- progress: 0,
1848
- error: oe
1849
- });
1850
- }), s !== void 0 && t.length > f && t.slice(f).forEach((k) => {
1851
- a.push({
1852
- id: $e(k),
1853
- file: k,
1854
- name: k.name,
1855
- size: k.size,
1856
- type: k.type,
1857
- status: "error",
1858
- progress: 0,
1859
- error: `最多只能选择 ${s} 个文件`
1860
- });
1861
- }), a;
1862
- }, ee = async (t) => {
1863
- if (!u || t.status === "uploading") return;
1864
- $(
1865
- (a) => a.map(
1866
- (f) => f.id === t.id ? { ...f, status: "uploading", progress: f.progress || 5 } : f
1867
- )
1868
- );
1869
- const c = (a) => {
1870
- $(
1871
- (f) => f.map(
1872
- (k) => k.id === t.id ? {
1873
- ...k,
1874
- progress: Math.max(0, Math.min(100, Math.round(a)))
1875
- } : k
1876
- )
1877
- );
1878
- };
1879
- try {
1880
- const a = await u(t, { setProgress: c }), f = {
1881
- ...t,
1882
- status: "success",
1883
- progress: 100,
1884
- error: void 0,
1885
- result: a
1886
- };
1887
- $(
1888
- (k) => k.map(
1889
- (oe) => oe.id === t.id ? f : oe
1890
- )
1891
- ), M == null || M(f);
1892
- } catch (a) {
1893
- const f = {
1894
- ...t,
1895
- status: "error",
1896
- progress: 0,
1897
- error: Pt(a, G)
1898
- };
1899
- $(
1900
- (k) => k.map(
1901
- (oe) => oe.id === t.id ? f : oe
1902
- )
1903
- ), C == null || C(f, a);
1904
- }
1905
- }, ue = async () => {
1906
- const t = R.filter((c) => c.status === "ready");
1907
- for (const c of t)
1908
- await ee(c);
1909
- }, me = (t) => {
1910
- if (!t || p) return;
1911
- const c = Array.from(t);
1912
- $((a) => {
1913
- const f = le(c, a);
1914
- return w && u && f.filter((k) => k.status === "ready").forEach((k) => {
1915
- window.setTimeout(() => ee(k), 0);
1916
- }), f;
1917
- }), V.current && (V.current.value = "");
1918
- }, he = (t) => {
1919
- t.preventDefault(), te(!1), me(t.dataTransfer.files);
1920
- }, pe = (t) => {
1921
- $(
1922
- (c) => c.filter((a) => a.id !== t)
1923
- );
1924
- }, be = (t) => {
1925
- const c = ce(
1926
- t.file,
1927
- R.filter((a) => a.id !== t.id)
1928
- );
1929
- if (c) {
1930
- $(
1931
- (a) => a.map(
1932
- (f) => f.id === t.id ? { ...f, error: c } : f
1933
- )
1934
- );
1935
- return;
1936
- }
1937
- ee({ ...t, status: "ready", error: void 0, progress: 0 });
1938
- }, je = (t) => t.status === "uploading" ? /* @__PURE__ */ e.jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-blue-600 dark:text-blue-300", children: [
1939
- /* @__PURE__ */ e.jsx(ft, { className: "h-3.5 w-3.5 animate-spin" }),
1940
- P
1941
- ] }) : t.status === "success" ? /* @__PURE__ */ e.jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-emerald-600 dark:text-emerald-300", children: [
1942
- /* @__PURE__ */ e.jsx(ht, { className: "h-3.5 w-3.5" }),
1943
- g
1944
- ] }) : t.status === "error" ? /* @__PURE__ */ e.jsxs("span", { className: "inline-flex items-center gap-1 text-xs font-medium text-destructive", children: [
1945
- /* @__PURE__ */ e.jsx(pt, { className: "h-3.5 w-3.5" }),
1946
- G
1947
- ] }) : /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: "待上传" }), ve = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1948
- m && re && /* @__PURE__ */ e.jsx(re, { children: m }),
1949
- m && !re && /* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: m }),
1950
- d && _ && /* @__PURE__ */ e.jsx(_, { children: d }),
1951
- d && !_ && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: d })
1952
- ] });
1953
- return /* @__PURE__ */ e.jsxs(I, { className: De("overflow-hidden", X), children: [
1954
- Q && (m || d) ? /* @__PURE__ */ e.jsx(Q, { children: ve }) : (m || d) && /* @__PURE__ */ e.jsx("div", { className: "space-y-1.5 p-6", children: ve }),
1955
- /* @__PURE__ */ e.jsxs(q, { className: "space-y-4", children: [
1956
- /* @__PURE__ */ e.jsx(
1957
- "input",
1958
- {
1959
- ref: V,
1960
- type: "file",
1961
- accept: l,
1962
- multiple: v,
1963
- className: "sr-only",
1964
- onChange: (t) => me(t.target.files),
1965
- disabled: p
1966
- }
1967
- ),
1968
- /* @__PURE__ */ e.jsxs(
1969
- "div",
1970
- {
1971
- role: "button",
1972
- tabIndex: p ? -1 : 0,
1973
- "aria-disabled": p,
1974
- className: De(
1975
- "flex min-h-40 cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed border-muted-foreground/30 bg-muted/20 px-6 py-8 text-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1976
- de && "border-primary bg-primary/5",
1977
- p && "cursor-not-allowed opacity-60",
1978
- S
1979
- ),
1980
- onClick: () => {
1981
- var t;
1982
- p || (t = V.current) == null || t.click();
1983
- },
1984
- onKeyDown: (t) => {
1985
- var c;
1986
- !p && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), (c = V.current) == null || c.click());
1987
- },
1988
- onDragOver: (t) => {
1989
- t.preventDefault(), p || te(!0);
1990
- },
1991
- onDragLeave: () => te(!1),
1992
- onDrop: he,
1993
- children: [
1994
- /* @__PURE__ */ e.jsx("div", { className: "mb-3 rounded-full bg-primary/10 p-3 text-primary", children: /* @__PURE__ */ e.jsx(mt, { className: "h-6 w-6" }) }),
1995
- /* @__PURE__ */ e.jsx("div", { className: "text-sm font-medium", children: L }),
1996
- E && /* @__PURE__ */ e.jsx("div", { className: "mt-1 max-w-md text-sm text-muted-foreground", children: E }),
1997
- /* @__PURE__ */ e.jsx(
1998
- N,
1999
- {
2000
- type: "button",
2001
- size: "sm",
2002
- variant: "secondary",
2003
- className: "mt-4",
2004
- disabled: p,
2005
- onClick: (t) => {
2006
- var c;
2007
- t.stopPropagation(), (c = V.current) == null || c.click();
2008
- },
2009
- children: F
2010
- }
2011
- )
2012
- ]
2013
- }
2014
- ),
2015
- h && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: h }),
2016
- /* @__PURE__ */ e.jsx("div", { className: De("space-y-3", z), children: R.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "rounded-md border border-dashed px-4 py-3 text-sm text-muted-foreground", children: Y }) : R.map((t) => /* @__PURE__ */ e.jsx(
2017
- "div",
2018
- {
2019
- className: "rounded-lg border bg-background px-4 py-3",
2020
- children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-start gap-3", children: [
2021
- /* @__PURE__ */ e.jsx("div", { className: "mt-0.5 rounded-md bg-muted p-2 text-muted-foreground", children: /* @__PURE__ */ e.jsx(Be, { className: "h-4 w-4" }) }),
2022
- /* @__PURE__ */ e.jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [
2023
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
2024
- /* @__PURE__ */ e.jsxs("div", { className: "min-w-0", children: [
2025
- /* @__PURE__ */ e.jsx("div", { className: "truncate text-sm font-medium", children: t.name }),
2026
- /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-muted-foreground", children: [
2027
- W(t.size),
2028
- t.type ? ` · ${t.type}` : ""
2029
- ] })
2030
- ] }),
2031
- je(t)
2032
- ] }),
2033
- t.status === "uploading" && /* @__PURE__ */ e.jsx(
2034
- "div",
2035
- {
2036
- className: "h-2 overflow-hidden rounded-full bg-muted",
2037
- "aria-label": `${t.name} 上传进度`,
2038
- role: "progressbar",
2039
- "aria-valuenow": t.progress,
2040
- "aria-valuemin": 0,
2041
- "aria-valuemax": 100,
2042
- children: /* @__PURE__ */ e.jsx(
2043
- "div",
2044
- {
2045
- className: "h-full rounded-full bg-primary transition-all",
2046
- style: { width: `${t.progress}%` }
2047
- }
2048
- )
2049
- }
2050
- ),
2051
- t.error && /* @__PURE__ */ e.jsx("div", { className: "text-xs text-destructive", children: t.error })
2052
- ] }),
2053
- /* @__PURE__ */ e.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
2054
- t.status === "error" && u && /* @__PURE__ */ e.jsx(
2055
- N,
2056
- {
2057
- type: "button",
2058
- variant: "ghost",
2059
- size: "sm",
2060
- disabled: p || j,
2061
- onClick: () => be(t),
2062
- children: B
2063
- }
2064
- ),
2065
- /* @__PURE__ */ e.jsx(
2066
- N,
2067
- {
2068
- type: "button",
2069
- variant: "ghost",
2070
- size: "icon",
2071
- "aria-label": `移除 ${t.name}`,
2072
- disabled: p || t.status === "uploading",
2073
- onClick: () => pe(t.id),
2074
- children: /* @__PURE__ */ e.jsx(xt, { className: "h-4 w-4" })
2075
- }
2076
- )
2077
- ] })
2078
- ] })
2079
- },
2080
- t.id
2081
- )) })
2082
- ] }),
2083
- (se || D) && (b ? /* @__PURE__ */ e.jsxs(b, { className: "justify-end gap-2", children: [
2084
- D && /* @__PURE__ */ e.jsx(
2085
- N,
2086
- {
2087
- type: "button",
2088
- variant: "outline",
2089
- disabled: p || j || R.length === 0,
2090
- onClick: () => U([]),
2091
- children: H
2092
- }
2093
- ),
2094
- se && /* @__PURE__ */ e.jsx(
2095
- N,
2096
- {
2097
- type: "button",
2098
- disabled: p || j || !n || !u,
2099
- onClick: ue,
2100
- children: T
2101
- }
2102
- )
2103
- ] }) : /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end gap-2 p-6 pt-0", children: [
2104
- D && /* @__PURE__ */ e.jsx(
2105
- N,
2106
- {
2107
- type: "button",
2108
- variant: "outline",
2109
- disabled: p || j || R.length === 0,
2110
- onClick: () => U([]),
2111
- children: H
2112
- }
2113
- ),
2114
- se && /* @__PURE__ */ e.jsx(
2115
- N,
2116
- {
2117
- type: "button",
2118
- disabled: p || j || !n || !u,
2119
- onClick: ue,
2120
- children: T
2121
- }
2122
- )
2123
- ] }))
2124
- ] });
2125
- }
2126
- export {
2127
- Mt as D,
2128
- Wt as F,
2129
- zt as P,
2130
- St as S,
2131
- It as T,
2132
- At as a,
2133
- Nt as b,
2134
- $t as c,
2135
- Ot as d,
2136
- Ft as e,
2137
- De as f,
2138
- e as j
2139
- };
2140
- //# sourceMappingURL=index-DJdfLA8M.js.map