@turinhub/atomix-common-ui 0.2.1 → 0.2.2

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.
@@ -1,11 +1,11 @@
1
1
  import { clsx as Qe } from "clsx";
2
2
  import { twMerge as et } from "tailwind-merge";
3
- import tt, { useState as M, useEffect as ee, useRef as ge, useMemo as Oe, useCallback as ne, memo as st } from "react";
4
- import { MoreVertical as rt, Plus as nt, Search as lt, ChevronLeft as we, ChevronRight as ke, ZoomOut as Ie, ZoomIn as Fe, Minimize2 as Se, Maximize2 as $e, PanelLeft as at, RotateCw as it, ScrollText as ct, FileText as ot } from "lucide-react";
5
- function yt(...s) {
6
- return et(Qe(s));
3
+ import tt, { useState as M, useEffect as te, useRef as je, useMemo as Oe, useCallback as ne, memo as rt } from "react";
4
+ import { MoreVertical as st, Plus as nt, Search as lt, ChevronLeft as we, ChevronRight as ke, ZoomOut as Ie, ZoomIn as Fe, Minimize2 as Se, Maximize2 as $e, PanelLeft as at, RotateCw as it, ScrollText as ct, FileText as ot } from "lucide-react";
5
+ function yt(...r) {
6
+ return et(Qe(r));
7
7
  }
8
- var Ne = { exports: {} }, je = {};
8
+ var Ne = { exports: {} }, he = {};
9
9
  /**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.js
@@ -15,29 +15,29 @@ var Ne = { exports: {} }, je = {};
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
17
  */
18
- var Ce;
18
+ var De;
19
19
  function ut() {
20
- if (Ce) return je;
21
- Ce = 1;
22
- var s = Symbol.for("react.transitional.element"), j = Symbol.for("react.fragment");
23
- function c(u, a, x) {
24
- var p = null;
25
- if (x !== void 0 && (p = "" + x), a.key !== void 0 && (p = "" + a.key), "key" in a) {
26
- x = {};
20
+ if (De) return he;
21
+ De = 1;
22
+ var r = Symbol.for("react.transitional.element"), j = Symbol.for("react.fragment");
23
+ function c(u, a, f) {
24
+ var h = null;
25
+ if (f !== void 0 && (h = "" + f), a.key !== void 0 && (h = "" + a.key), "key" in a) {
26
+ f = {};
27
27
  for (var o in a)
28
- o !== "key" && (x[o] = a[o]);
29
- } else x = a;
30
- return a = x.ref, {
31
- $$typeof: s,
28
+ o !== "key" && (f[o] = a[o]);
29
+ } else f = a;
30
+ return a = f.ref, {
31
+ $$typeof: r,
32
32
  type: u,
33
- key: p,
33
+ key: h,
34
34
  ref: a !== void 0 ? a : null,
35
- props: x
35
+ props: f
36
36
  };
37
37
  }
38
- return je.Fragment = j, je.jsx = c, je.jsxs = c, je;
38
+ return he.Fragment = j, he.jsx = c, he.jsxs = c, he;
39
39
  }
40
- var ve = {};
40
+ var pe = {};
41
41
  /**
42
42
  * @license React
43
43
  * react-jsx-runtime.development.js
@@ -50,17 +50,17 @@ var ve = {};
50
50
  var Me;
51
51
  function dt() {
52
52
  return Me || (Me = 1, process.env.NODE_ENV !== "production" && (function() {
53
- function s(t) {
53
+ function r(t) {
54
54
  if (t == null) return null;
55
55
  if (typeof t == "function")
56
56
  return t.$$typeof === K ? null : t.displayName || t.name || null;
57
57
  if (typeof t == "string") return t;
58
58
  switch (t) {
59
- case V:
59
+ case L:
60
60
  return "Fragment";
61
- case w:
61
+ case N:
62
62
  return "Profiler";
63
- case B:
63
+ case W:
64
64
  return "StrictMode";
65
65
  case q:
66
66
  return "Suspense";
@@ -77,17 +77,17 @@ function dt() {
77
77
  return "Portal";
78
78
  case d:
79
79
  return t.displayName || "Context";
80
- case b:
80
+ case g:
81
81
  return (t._context.displayName || "Context") + ".Consumer";
82
- case G:
83
- var r = t.render;
84
- return t = t.displayName, t || (t = r.displayName || r.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
82
+ case Y:
83
+ var s = t.render;
84
+ return t = t.displayName, t || (t = s.displayName || s.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
85
85
  case I:
86
- return r = t.displayName || null, r !== null ? r : s(t.type) || "Memo";
86
+ return s = t.displayName || null, s !== null ? s : r(t.type) || "Memo";
87
87
  case S:
88
- r = t._payload, t = t._init;
88
+ s = t._payload, t = t._init;
89
89
  try {
90
- return s(t(r));
90
+ return r(t(s));
91
91
  } catch {
92
92
  }
93
93
  }
@@ -99,27 +99,27 @@ function dt() {
99
99
  function c(t) {
100
100
  try {
101
101
  j(t);
102
- var r = !1;
102
+ var s = !1;
103
103
  } catch {
104
- r = !0;
104
+ s = !0;
105
105
  }
106
- if (r) {
107
- r = console;
108
- var h = r.error, C = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
109
- return h.call(
110
- r,
106
+ if (s) {
107
+ s = console;
108
+ var x = s.error, D = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
109
+ return x.call(
110
+ s,
111
111
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- C
112
+ D
113
113
  ), j(t);
114
114
  }
115
115
  }
116
116
  function u(t) {
117
- if (t === V) return "<>";
117
+ if (t === L) return "<>";
118
118
  if (typeof t == "object" && t !== null && t.$$typeof === S)
119
119
  return "<...>";
120
120
  try {
121
- var r = s(t);
122
- return r ? "<" + r + ">" : "<...>";
121
+ var s = r(t);
122
+ return s ? "<" + s + ">" : "<...>";
123
123
  } catch {
124
124
  return "<...>";
125
125
  }
@@ -128,45 +128,45 @@ function dt() {
128
128
  var t = i.A;
129
129
  return t === null ? null : t.getOwner();
130
130
  }
131
- function x() {
131
+ function f() {
132
132
  return Error("react-stack-top-frame");
133
133
  }
134
- function p(t) {
135
- if (R.call(t, "key")) {
136
- var r = Object.getOwnPropertyDescriptor(t, "key").get;
137
- if (r && r.isReactWarning) return !1;
134
+ function h(t) {
135
+ if (C.call(t, "key")) {
136
+ var s = Object.getOwnPropertyDescriptor(t, "key").get;
137
+ if (s && s.isReactWarning) return !1;
138
138
  }
139
139
  return t.key !== void 0;
140
140
  }
141
- function o(t, r) {
142
- function h() {
141
+ function o(t, s) {
142
+ function x() {
143
143
  H || (H = !0, console.error(
144
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
- r
145
+ s
146
146
  ));
147
147
  }
148
- h.isReactWarning = !0, Object.defineProperty(t, "key", {
149
- get: h,
148
+ x.isReactWarning = !0, Object.defineProperty(t, "key", {
149
+ get: x,
150
150
  configurable: !0
151
151
  });
152
152
  }
153
- function D() {
154
- var t = s(this.type);
153
+ function _() {
154
+ var t = r(this.type);
155
155
  return ue[t] || (ue[t] = !0, console.error(
156
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
157
  )), t = this.props.ref, t !== void 0 ? t : null;
158
158
  }
159
- function g(t, r, h, C, Q, le) {
160
- var T = h.ref;
159
+ function b(t, s, x, D, X, le) {
160
+ var R = x.ref;
161
161
  return t = {
162
- $$typeof: W,
162
+ $$typeof: z,
163
163
  type: t,
164
- key: r,
165
- props: h,
166
- _owner: C
167
- }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(t, "ref", {
164
+ key: s,
165
+ props: x,
166
+ _owner: D
167
+ }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
168
168
  enumerable: !1,
169
- get: D
169
+ get: _
170
170
  }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
171
171
  configurable: !1,
172
172
  enumerable: !1,
@@ -181,7 +181,7 @@ function dt() {
181
181
  configurable: !1,
182
182
  enumerable: !1,
183
183
  writable: !0,
184
- value: Q
184
+ value: X
185
185
  }), Object.defineProperty(t, "_debugTask", {
186
186
  configurable: !1,
187
187
  enumerable: !1,
@@ -189,94 +189,94 @@ function dt() {
189
189
  value: le
190
190
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
191
191
  }
192
- function l(t, r, h, C, Q, le) {
193
- var T = r.children;
194
- if (T !== void 0)
195
- if (C)
196
- if (y(T)) {
197
- for (C = 0; C < T.length; C++)
198
- E(T[C]);
199
- Object.freeze && Object.freeze(T);
192
+ function l(t, s, x, D, X, le) {
193
+ var R = s.children;
194
+ if (R !== void 0)
195
+ if (D)
196
+ if (E(R)) {
197
+ for (D = 0; D < R.length; D++)
198
+ P(R[D]);
199
+ Object.freeze && Object.freeze(R);
200
200
  } else
201
201
  console.error(
202
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
203
  );
204
- else E(T);
205
- if (R.call(r, "key")) {
206
- T = s(t);
207
- var L = Object.keys(r).filter(function(_) {
208
- return _ !== "key";
204
+ else P(R);
205
+ if (C.call(s, "key")) {
206
+ R = r(t);
207
+ var V = Object.keys(s).filter(function(w) {
208
+ return w !== "key";
209
209
  });
210
- C = 0 < L.length ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}", re[T + C] || (L = 0 < L.length ? "{" + L.join(": ..., ") + ": ...}" : "{}", console.error(
210
+ D = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", se[R + D] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
211
211
  `A props object containing a "key" prop is being spread into JSX:
212
212
  let props = %s;
213
213
  <%s {...props} />
214
214
  React keys must be passed directly to JSX without using spread:
215
215
  let props = %s;
216
216
  <%s key={someKey} {...props} />`,
217
- C,
218
- T,
219
- L,
220
- T
221
- ), re[T + C] = !0);
217
+ D,
218
+ R,
219
+ V,
220
+ R
221
+ ), se[R + D] = !0);
222
222
  }
223
- if (T = null, h !== void 0 && (c(h), T = "" + h), p(r) && (c(r.key), T = "" + r.key), "key" in r) {
224
- h = {};
225
- for (var m in r)
226
- m !== "key" && (h[m] = r[m]);
227
- } else h = r;
228
- return T && o(
229
- h,
223
+ if (R = null, x !== void 0 && (c(x), R = "" + x), h(s) && (c(s.key), R = "" + s.key), "key" in s) {
224
+ x = {};
225
+ for (var p in s)
226
+ p !== "key" && (x[p] = s[p]);
227
+ } else x = s;
228
+ return R && o(
229
+ x,
230
230
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
231
- ), g(
231
+ ), b(
232
232
  t,
233
- T,
234
- h,
233
+ R,
234
+ x,
235
235
  a(),
236
- Q,
236
+ X,
237
237
  le
238
238
  );
239
239
  }
240
- function E(t) {
240
+ function P(t) {
241
241
  A(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === S && (t._payload.status === "fulfilled" ? A(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
242
242
  }
243
243
  function A(t) {
244
- return typeof t == "object" && t !== null && t.$$typeof === W;
244
+ return typeof t == "object" && t !== null && t.$$typeof === z;
245
245
  }
246
- var N = tt, W = Symbol.for("react.transitional.element"), J = Symbol.for("react.portal"), V = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), d = Symbol.for("react.context"), G = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), O = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), i = N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, y = Array.isArray, $ = console.createTask ? console.createTask : function() {
246
+ var y = tt, z = Symbol.for("react.transitional.element"), J = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), d = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), O = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), i = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, E = Array.isArray, $ = console.createTask ? console.createTask : function() {
247
247
  return null;
248
248
  };
249
- N = {
249
+ y = {
250
250
  react_stack_bottom_frame: function(t) {
251
251
  return t();
252
252
  }
253
253
  };
254
- var H, ue = {}, se = N.react_stack_bottom_frame.bind(
255
- N,
256
- x
257
- )(), Z = $(u(x)), re = {};
258
- ve.Fragment = V, ve.jsx = function(t, r, h) {
259
- var C = 1e4 > i.recentlyCreatedOwnerStacks++;
254
+ var H, ue = {}, re = y.react_stack_bottom_frame.bind(
255
+ y,
256
+ f
257
+ )(), Z = $(u(f)), se = {};
258
+ pe.Fragment = L, pe.jsx = function(t, s, x) {
259
+ var D = 1e4 > i.recentlyCreatedOwnerStacks++;
260
260
  return l(
261
261
  t,
262
- r,
263
- h,
262
+ s,
263
+ x,
264
264
  !1,
265
- C ? Error("react-stack-top-frame") : se,
266
- C ? $(u(t)) : Z
265
+ D ? Error("react-stack-top-frame") : re,
266
+ D ? $(u(t)) : Z
267
267
  );
268
- }, ve.jsxs = function(t, r, h) {
269
- var C = 1e4 > i.recentlyCreatedOwnerStacks++;
268
+ }, pe.jsxs = function(t, s, x) {
269
+ var D = 1e4 > i.recentlyCreatedOwnerStacks++;
270
270
  return l(
271
271
  t,
272
- r,
273
- h,
272
+ s,
273
+ x,
274
274
  !0,
275
- C ? Error("react-stack-top-frame") : se,
276
- C ? $(u(t)) : Z
275
+ D ? Error("react-stack-top-frame") : re,
276
+ D ? $(u(t)) : Z
277
277
  );
278
278
  };
279
- })()), ve;
279
+ })()), pe;
280
280
  }
281
281
  var Ae;
282
282
  function mt() {
@@ -284,24 +284,24 @@ function mt() {
284
284
  }
285
285
  var e = mt();
286
286
  function Nt({
287
- data: s,
287
+ data: r,
288
288
  loading: j = !1,
289
289
  columns: c,
290
290
  rowKey: u,
291
291
  emptyText: a = "暂无数据",
292
- searchActiveEmptyText: x = "未找到匹配的记录",
293
- header: p,
292
+ searchActiveEmptyText: f = "未找到匹配的记录",
293
+ header: h,
294
294
  pagination: o,
295
- rowClassName: D,
296
- onRow: g,
295
+ rowClassName: _,
296
+ onRow: b,
297
297
  actions: l,
298
- components: E,
298
+ components: P,
299
299
  renderCard: A,
300
- renderTable: N,
301
- renderActions: W
300
+ renderTable: y,
301
+ renderActions: z
302
302
  }) {
303
- var T, L;
304
- if (!E)
303
+ var R, V;
304
+ if (!P)
305
305
  return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
306
306
  "错误:请通过 components prop 注入 UI 组件",
307
307
  /* @__PURE__ */ e.jsx("br", {}),
@@ -309,12 +309,12 @@ function Nt({
309
309
  ] });
310
310
  const {
311
311
  Card: J,
312
- CardContent: V,
313
- CardFooter: B,
314
- Table: w,
315
- TableBody: b,
312
+ CardContent: L,
313
+ CardFooter: W,
314
+ Table: N,
315
+ TableBody: g,
316
316
  TableCell: d,
317
- TableHead: G,
317
+ TableHead: Y,
318
318
  TableHeader: q,
319
319
  TableRow: O,
320
320
  Button: I,
@@ -322,96 +322,96 @@ function Nt({
322
322
  DropdownMenuTrigger: U,
323
323
  DropdownMenuContent: K,
324
324
  DropdownMenuItem: i,
325
- DropdownMenuSeparator: R,
326
- Skeleton: y,
325
+ DropdownMenuSeparator: C,
326
+ Skeleton: E,
327
327
  TableHeaderComponent: $,
328
328
  TablePaginationComponent: H
329
- } = E, ue = (m, _) => {
329
+ } = P, ue = (p, w) => {
330
330
  if (typeof u == "function")
331
- return u(m);
332
- const Y = m[u];
333
- return Y != null ? String(Y) : `row-${_}`;
334
- }, se = !!(p != null && p.searchValue && p.searchValue.trim().length > 0), Z = !!(l != null && l.render || (T = l == null ? void 0 : l.items) != null && T.length), re = (l == null ? void 0 : l.mode) ?? ((L = l == null ? void 0 : l.items) != null && L.length ? "collapsed" : "expanded"), t = (m) => m.separator === !0, r = (m, _) => !l || !Z ? null : re === "collapsed" && l.items && l.items.length > 0 ? /* @__PURE__ */ e.jsxs(S, { children: [
331
+ return u(p);
332
+ const B = p[u];
333
+ return B != null ? String(B) : `row-${w}`;
334
+ }, re = !!(h != null && h.searchValue && h.searchValue.trim().length > 0), Z = !!(l != null && l.render || (R = l == null ? void 0 : l.items) != null && R.length), se = (l == null ? void 0 : l.mode) ?? ((V = l == null ? void 0 : l.items) != null && V.length ? "collapsed" : "expanded"), t = (p) => p.separator === !0, s = (p, w) => !l || !Z ? null : se === "collapsed" && l.items && l.items.length > 0 ? /* @__PURE__ */ e.jsxs(S, { children: [
335
335
  /* @__PURE__ */ e.jsx(U, { asChild: !0, children: /* @__PURE__ */ e.jsx(
336
336
  I,
337
337
  {
338
338
  variant: "ghost",
339
339
  className: "h-8 w-8 p-0",
340
340
  "aria-label": "打开行操作菜单",
341
- children: /* @__PURE__ */ e.jsx(rt, { className: "h-4 w-4" })
341
+ children: /* @__PURE__ */ e.jsx(st, { className: "h-4 w-4" })
342
342
  }
343
343
  ) }),
344
344
  /* @__PURE__ */ e.jsx(K, { align: "end", children: l.items.map(
345
- (Y, de) => t(Y) ? /* @__PURE__ */ e.jsx(R, {}, `separator-${de}`) : /* @__PURE__ */ e.jsxs(
345
+ (B, de) => t(B) ? /* @__PURE__ */ e.jsx(C, {}, `separator-${de}`) : /* @__PURE__ */ e.jsxs(
346
346
  i,
347
347
  {
348
- onClick: () => Y.onClick(m, _),
349
- className: Y.className,
348
+ onClick: () => B.onClick(p, w),
349
+ className: B.className,
350
350
  children: [
351
- Y.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: Y.icon }),
352
- Y.label
351
+ B.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: B.icon }),
352
+ B.label
353
353
  ]
354
354
  },
355
355
  `action-${de}`
356
356
  )
357
357
  ) })
358
- ] }) : l.render ? l.render(m, _) : null, h = () => /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsxs(O, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
- c.map((m) => /* @__PURE__ */ e.jsx(
360
- G,
358
+ ] }) : l.render ? l.render(p, w) : null, x = () => /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsxs(O, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
+ c.map((p) => /* @__PURE__ */ e.jsx(
360
+ Y,
361
361
  {
362
- className: `font-semibold text-foreground ${m.align === "center" ? "text-center" : m.align === "right" ? "text-right" : "text-left"}`,
363
- style: { width: m.width },
364
- children: m.title
362
+ className: `font-semibold text-foreground ${p.align === "center" ? "text-center" : p.align === "right" ? "text-right" : "text-left"}`,
363
+ style: { width: p.width },
364
+ children: p.title
365
365
  },
366
- String(m.key)
366
+ String(p.key)
367
367
  )),
368
- Z && /* @__PURE__ */ e.jsx(G, { className: "text-right font-semibold text-foreground", children: (l == null ? void 0 : l.title) || "操作" })
369
- ] }) }), C = () => j ? /* @__PURE__ */ e.jsx(b, { children: Array.from({ length: 5 }).map((m, _) => /* @__PURE__ */ e.jsxs(O, { children: [
370
- c.map((Y) => /* @__PURE__ */ e.jsx(
368
+ Z && /* @__PURE__ */ e.jsx(Y, { className: "text-right font-semibold text-foreground", children: (l == null ? void 0 : l.title) || "操作" })
369
+ ] }) }), D = () => j ? /* @__PURE__ */ e.jsx(g, { children: Array.from({ length: 5 }).map((p, w) => /* @__PURE__ */ e.jsxs(O, { children: [
370
+ c.map((B) => /* @__PURE__ */ e.jsx(
371
371
  d,
372
372
  {
373
- style: { width: Y.width },
374
- className: Y.align === "center" ? "text-center" : Y.align === "right" ? "text-right" : "",
375
- children: /* @__PURE__ */ e.jsx(y, { className: "h-4 w-full" })
373
+ style: { width: B.width },
374
+ className: B.align === "center" ? "text-center" : B.align === "right" ? "text-right" : "",
375
+ children: /* @__PURE__ */ e.jsx(E, { className: "h-4 w-full" })
376
376
  },
377
- String(Y.key)
377
+ String(B.key)
378
378
  )),
379
- Z && /* @__PURE__ */ e.jsx(d, { children: /* @__PURE__ */ e.jsx(y, { className: "ml-auto h-4 w-8" }) })
380
- ] }, _)) }) : s.length === 0 ? /* @__PURE__ */ e.jsx(b, { children: /* @__PURE__ */ e.jsx(O, { children: /* @__PURE__ */ e.jsx(
379
+ Z && /* @__PURE__ */ e.jsx(d, { children: /* @__PURE__ */ e.jsx(E, { className: "ml-auto h-4 w-8" }) })
380
+ ] }, w)) }) : r.length === 0 ? /* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsx(O, { children: /* @__PURE__ */ e.jsx(
381
381
  d,
382
382
  {
383
383
  colSpan: c.length + (Z ? 1 : 0),
384
384
  className: "py-8 text-center text-muted-foreground",
385
- children: se ? x : a
385
+ children: re ? f : a
386
386
  }
387
- ) }) }) : /* @__PURE__ */ e.jsx(b, { children: s.map((m, _) => {
388
- const Y = ue(m, _), de = g == null ? void 0 : g(m, _), ie = D == null ? void 0 : D(m, _);
387
+ ) }) }) : /* @__PURE__ */ e.jsx(g, { children: r.map((p, w) => {
388
+ const B = ue(p, w), de = b == null ? void 0 : b(p, w), ie = _ == null ? void 0 : _(p, w);
389
389
  return /* @__PURE__ */ e.jsxs(
390
390
  O,
391
391
  {
392
392
  className: `${ie || ""} hover:bg-muted/50`,
393
393
  ...de,
394
394
  children: [
395
- c.map((te) => {
396
- const me = m[te.key], he = te.render ? te.render(me, m, _) : me;
395
+ c.map((ee) => {
396
+ const me = p[ee.key], fe = ee.render ? ee.render(me, p, w) : me;
397
397
  return /* @__PURE__ */ e.jsx(
398
398
  d,
399
399
  {
400
- className: te.align === "center" ? "text-center" : te.align === "right" ? "text-right" : "",
401
- children: he
400
+ className: ee.align === "center" ? "text-center" : ee.align === "right" ? "text-right" : "",
401
+ children: fe
402
402
  },
403
- String(te.key)
403
+ String(ee.key)
404
404
  );
405
405
  }),
406
- Z && /* @__PURE__ */ e.jsx(d, { className: "text-right", children: W ? W(m, _) : r(m, _) })
406
+ Z && /* @__PURE__ */ e.jsx(d, { className: "text-right", children: z ? z(p, w) : s(p, w) })
407
407
  ]
408
408
  },
409
- Y
409
+ B
410
410
  );
411
- }) }), Q = (m) => /* @__PURE__ */ e.jsxs(J, { children: [
412
- p && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx($, { ...p }) }),
413
- /* @__PURE__ */ e.jsx(V, { className: "p-0", children: m }),
414
- (o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ e.jsx(B, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
411
+ }) }), X = (p) => /* @__PURE__ */ e.jsxs(J, { children: [
412
+ h && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx($, { ...h }) }),
413
+ /* @__PURE__ */ e.jsx(L, { className: "p-0", children: p }),
414
+ (o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ e.jsx(W, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
415
415
  H,
416
416
  {
417
417
  currentPage: o.currentPage,
@@ -423,87 +423,87 @@ function Nt({
423
423
  showPageSizeSelector: o.showPageSizeSelector,
424
424
  showJumpToPage: o.showJumpToPage,
425
425
  showTotal: o.showTotal,
426
- searchActive: se
426
+ searchActive: re
427
427
  }
428
428
  ) })
429
- ] }), le = (m, _) => /* @__PURE__ */ e.jsxs(w, { children: [
430
- m,
431
- _
429
+ ] }), le = (p, w) => /* @__PURE__ */ e.jsxs(N, { children: [
430
+ p,
431
+ w
432
432
  ] });
433
433
  return A ? A(
434
- N ? N(h(), C()) : le(h(), C())
435
- ) : Q(
436
- N ? N(h(), C()) : le(h(), C())
434
+ y ? y(x(), D()) : le(x(), D())
435
+ ) : X(
436
+ y ? y(x(), D()) : le(x(), D())
437
437
  );
438
438
  }
439
439
  function wt({
440
- open: s,
440
+ open: r,
441
441
  onOpenChange: j,
442
442
  title: c,
443
443
  description: u,
444
444
  onConfirm: a,
445
- loading: x = !1,
446
- confirmText: p = "确认删除",
445
+ loading: f = !1,
446
+ confirmText: h = "确认删除",
447
447
  cancelText: o = "取消",
448
- confirmButtonVariant: D = "destructive",
449
- verification: g,
448
+ confirmButtonVariant: _ = "destructive",
449
+ verification: b,
450
450
  components: l,
451
- loadingIcon: E
451
+ loadingIcon: P
452
452
  }) {
453
- const [A, N] = M("");
454
- if (ee(() => {
455
- s && N("");
456
- }, [s, g == null ? void 0 : g.targetValue]), !l)
453
+ const [A, y] = M("");
454
+ if (te(() => {
455
+ r && y("");
456
+ }, [r, b == null ? void 0 : b.targetValue]), !l)
457
457
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
458
458
  const {
459
- Dialog: W,
459
+ Dialog: z,
460
460
  DialogContent: J,
461
- DialogHeader: V,
462
- DialogFooter: B,
463
- DialogTitle: w,
464
- DialogDescription: b,
461
+ DialogHeader: L,
462
+ DialogFooter: W,
463
+ DialogTitle: N,
464
+ DialogDescription: g,
465
465
  Button: d,
466
- Input: G,
466
+ Input: Y,
467
467
  Label: q
468
- } = l, O = g ? A !== g.targetValue : !1, I = () => {
468
+ } = l, O = b ? A !== b.targetValue : !1, I = () => {
469
469
  O || a();
470
470
  };
471
- return /* @__PURE__ */ e.jsx(W, { open: s, onOpenChange: j, children: /* @__PURE__ */ e.jsxs(J, { children: [
472
- /* @__PURE__ */ e.jsxs(V, { children: [
473
- /* @__PURE__ */ e.jsx(w, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: c }) }),
474
- /* @__PURE__ */ e.jsx(b, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: u }) })
471
+ return /* @__PURE__ */ e.jsx(z, { open: r, onOpenChange: j, children: /* @__PURE__ */ e.jsxs(J, { children: [
472
+ /* @__PURE__ */ e.jsxs(L, { children: [
473
+ /* @__PURE__ */ e.jsx(N, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: c }) }),
474
+ /* @__PURE__ */ e.jsx(g, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: u }) })
475
475
  ] }),
476
- g && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
477
- /* @__PURE__ */ e.jsx(q, { htmlFor: "confirm-input", children: g.label || "请输入以确认" }),
476
+ b && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
477
+ /* @__PURE__ */ e.jsx(q, { htmlFor: "confirm-input", children: b.label || "请输入以确认" }),
478
478
  /* @__PURE__ */ e.jsx(
479
- G,
479
+ Y,
480
480
  {
481
481
  id: "confirm-input",
482
482
  value: A,
483
- onChange: (S) => N(S.target.value),
484
- placeholder: g.placeholder,
485
- disabled: x
483
+ onChange: (S) => y(S.target.value),
484
+ placeholder: b.placeholder,
485
+ disabled: f
486
486
  }
487
487
  )
488
488
  ] }) }),
489
- /* @__PURE__ */ e.jsxs(B, { children: [
489
+ /* @__PURE__ */ e.jsxs(W, { children: [
490
490
  /* @__PURE__ */ e.jsx(
491
491
  d,
492
492
  {
493
493
  variant: "outline",
494
494
  onClick: () => j(!1),
495
- disabled: x,
495
+ disabled: f,
496
496
  children: o
497
497
  }
498
498
  ),
499
499
  /* @__PURE__ */ e.jsxs(
500
500
  d,
501
501
  {
502
- variant: D,
502
+ variant: _,
503
503
  onClick: I,
504
- disabled: O || x,
504
+ disabled: O || f,
505
505
  children: [
506
- x && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: E || /* @__PURE__ */ e.jsxs(
506
+ f && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: P || /* @__PURE__ */ e.jsxs(
507
507
  "svg",
508
508
  {
509
509
  className: "h-4 w-4 animate-spin",
@@ -532,7 +532,7 @@ function wt({
532
532
  ]
533
533
  }
534
534
  ) }),
535
- p
535
+ h
536
536
  ]
537
537
  }
538
538
  )
@@ -540,46 +540,46 @@ function wt({
540
540
  ] }) });
541
541
  }
542
542
  function kt({
543
- title: s,
543
+ title: r,
544
544
  searchPlaceholder: j = "搜索...",
545
545
  searchValue: c = "",
546
546
  onSearchChange: u,
547
547
  onSearch: a,
548
- showSearch: x = !0,
549
- action: p,
548
+ showSearch: f = !0,
549
+ action: h,
550
550
  actionLabel: o,
551
- onActionClick: D,
552
- loading: g = !1,
551
+ onActionClick: _,
552
+ loading: b = !1,
553
553
  components: l
554
554
  }) {
555
555
  if (!l)
556
556
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
557
- const { Input: E, Button: A } = l, N = (W) => {
558
- W.key === "Enter" && a && a();
557
+ const { Input: P, Button: A } = l, y = (z) => {
558
+ z.key === "Enter" && a && a();
559
559
  };
560
560
  return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
561
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: s }),
562
+ /* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: r }),
563
563
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
564
- p && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: p }),
565
- !p && o && D && /* @__PURE__ */ e.jsxs(A, { onClick: D, disabled: g, size: "sm", children: [
564
+ h && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: h }),
565
+ !h && o && _ && /* @__PURE__ */ e.jsxs(A, { onClick: _, disabled: b, size: "sm", children: [
566
566
  /* @__PURE__ */ e.jsx(nt, { className: "mr-2 h-4 w-4" }),
567
567
  o
568
568
  ] })
569
569
  ] })
570
570
  ] }),
571
- x && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
571
+ f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
572
572
  /* @__PURE__ */ e.jsxs("div", { className: "relative max-w-sm flex-1", children: [
573
573
  /* @__PURE__ */ e.jsx(lt, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
574
574
  /* @__PURE__ */ e.jsx(
575
- E,
575
+ P,
576
576
  {
577
577
  placeholder: j,
578
578
  value: c,
579
- onChange: (W) => u == null ? void 0 : u(W.target.value),
580
- onKeyPress: N,
579
+ onChange: (z) => u == null ? void 0 : u(z.target.value),
580
+ onKeyPress: y,
581
581
  className: "h-9 pl-8",
582
- disabled: g
582
+ disabled: b
583
583
  }
584
584
  )
585
585
  ] }),
@@ -587,7 +587,7 @@ function kt({
587
587
  A,
588
588
  {
589
589
  onClick: a,
590
- disabled: g,
590
+ disabled: b,
591
591
  variant: "secondary",
592
592
  size: "sm",
593
593
  children: "搜索"
@@ -597,35 +597,35 @@ function kt({
597
597
  ] });
598
598
  }
599
599
  function Tt({
600
- currentPage: s,
600
+ currentPage: r,
601
601
  pageSize: j,
602
602
  total: c,
603
603
  onPageChange: u,
604
604
  onPageSizeChange: a,
605
- pageSizeOptions: x = [10, 20, 50],
606
- showPageSizeSelector: p = !0,
605
+ pageSizeOptions: f = [10, 20, 50],
606
+ showPageSizeSelector: h = !0,
607
607
  showJumpToPage: o = !0,
608
- showTotal: D = !0,
609
- searchActive: g = !1,
608
+ showTotal: _ = !0,
609
+ searchActive: b = !1,
610
610
  components: l
611
611
  }) {
612
- const [E, A] = M(String(s + 1));
613
- if (ee(() => {
614
- A(String(s + 1));
615
- }, [s]), !l)
612
+ const [P, A] = M(String(r + 1));
613
+ if (te(() => {
614
+ A(String(r + 1));
615
+ }, [r]), !l)
616
616
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
617
617
  const {
618
- Button: N,
619
- Select: W,
618
+ Button: y,
619
+ Select: z,
620
620
  SelectTrigger: J,
621
- SelectContent: V,
622
- SelectItem: B,
623
- SelectValue: w
624
- } = l, b = Math.ceil(c / j), d = Math.max(b, 1), G = s * j + 1, q = Math.min((s + 1) * j, c), O = Array.from(
625
- /* @__PURE__ */ new Set([...x, j])
626
- ).sort((i, R) => i - R), I = p && !!a, S = d > 1, U = (i) => {
627
- const R = Math.max(0, Math.min(i, d - 1));
628
- R !== s && u(R);
621
+ SelectContent: L,
622
+ SelectItem: W,
623
+ SelectValue: N
624
+ } = l, g = Math.ceil(c / j), d = Math.max(g, 1), Y = r * j + 1, q = Math.min((r + 1) * j, c), O = Array.from(
625
+ /* @__PURE__ */ new Set([...f, j])
626
+ ).sort((i, C) => i - C), I = h && !!a, S = d > 1, U = (i) => {
627
+ const C = Math.max(0, Math.min(i, d - 1));
628
+ C !== r && u(C);
629
629
  }, K = (() => {
630
630
  if (d <= 7)
631
631
  return Array.from({ length: d }, ($, H) => H);
@@ -634,36 +634,36 @@ function Tt({
634
634
  1,
635
635
  d - 2,
636
636
  d - 1,
637
- s - 1,
638
- s,
639
- s + 1
640
- ]), R = Array.from(i).filter(($) => $ >= 0 && $ < d).sort(($, H) => $ - H), y = [];
641
- for (const $ of R) {
642
- const H = y[y.length - 1];
643
- typeof H == "number" && $ - H > 1 && y.push("ellipsis"), y.push($);
637
+ r - 1,
638
+ r,
639
+ r + 1
640
+ ]), C = Array.from(i).filter(($) => $ >= 0 && $ < d).sort(($, H) => $ - H), E = [];
641
+ for (const $ of C) {
642
+ const H = E[E.length - 1];
643
+ typeof H == "number" && $ - H > 1 && E.push("ellipsis"), E.push($);
644
644
  }
645
- return y;
645
+ return E;
646
646
  })();
647
647
  return c === 0 ? null : /* @__PURE__ */ e.jsxs(
648
648
  "div",
649
649
  {
650
- className: `flex w-full items-center gap-3 ${D ? "justify-between" : "justify-end"}`,
650
+ className: `flex w-full items-center gap-3 ${_ ? "justify-between" : "justify-end"}`,
651
651
  children: [
652
- D && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: g ? `找到 ${c} 条匹配记录` : c > 0 ? `显示 ${G} - ${q} 条,共 ${c} 条记录` : "暂无数据" }),
652
+ _ && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: b ? `找到 ${c} 条匹配记录` : c > 0 ? `显示 ${Y} - ${q} 条,共 ${c} 条记录` : "暂无数据" }),
653
653
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
654
654
  I && /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
655
655
  /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
656
656
  /* @__PURE__ */ e.jsxs(
657
- W,
657
+ z,
658
658
  {
659
659
  value: String(j),
660
660
  onValueChange: (i) => {
661
- const R = Number(i);
662
- Number.isNaN(R) || R === j || !a || a(R);
661
+ const C = Number(i);
662
+ Number.isNaN(C) || C === j || !a || a(C);
663
663
  },
664
664
  children: [
665
- /* @__PURE__ */ e.jsx(J, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(w, {}) }),
666
- /* @__PURE__ */ e.jsx(V, { children: O.map((i) => /* @__PURE__ */ e.jsx(B, { value: String(i), children: i }, i)) })
665
+ /* @__PURE__ */ e.jsx(J, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(N, {}) }),
666
+ /* @__PURE__ */ e.jsx(L, { children: O.map((i) => /* @__PURE__ */ e.jsx(W, { value: String(i), children: i }, i)) })
667
667
  ]
668
668
  }
669
669
  ),
@@ -671,50 +671,50 @@ function Tt({
671
671
  ] }),
672
672
  /* @__PURE__ */ e.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
673
673
  "第 ",
674
- s + 1,
674
+ r + 1,
675
675
  " 页,共 ",
676
676
  d,
677
677
  " 页"
678
678
  ] }),
679
679
  /* @__PURE__ */ e.jsx(
680
- N,
680
+ y,
681
681
  {
682
682
  variant: "outline",
683
683
  size: "icon",
684
- onClick: () => U(s - 1),
685
- disabled: s === 0 || !S,
684
+ onClick: () => U(r - 1),
685
+ disabled: r === 0 || !S,
686
686
  "aria-label": "上一页",
687
687
  children: /* @__PURE__ */ e.jsx(we, { className: "h-4 w-4" })
688
688
  }
689
689
  ),
690
690
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: K.map(
691
- (i, R) => i === "ellipsis" ? /* @__PURE__ */ e.jsx(
691
+ (i, C) => i === "ellipsis" ? /* @__PURE__ */ e.jsx(
692
692
  "span",
693
693
  {
694
694
  className: "inline-flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
695
695
  children: "..."
696
696
  },
697
- `ellipsis-${R}`
697
+ `ellipsis-${C}`
698
698
  ) : /* @__PURE__ */ e.jsx(
699
- N,
699
+ y,
700
700
  {
701
- variant: i === s ? "default" : "outline",
701
+ variant: i === r ? "default" : "outline",
702
702
  size: "sm",
703
703
  onClick: () => U(i),
704
- disabled: i === s,
705
- "aria-current": i === s ? "page" : void 0,
704
+ disabled: i === r,
705
+ "aria-current": i === r ? "page" : void 0,
706
706
  children: i + 1
707
707
  },
708
708
  i
709
709
  )
710
710
  ) }),
711
711
  /* @__PURE__ */ e.jsx(
712
- N,
712
+ y,
713
713
  {
714
714
  variant: "outline",
715
715
  size: "icon",
716
- onClick: () => U(s + 1),
717
- disabled: s >= d - 1 || !S,
716
+ onClick: () => U(r + 1),
717
+ disabled: r >= d - 1 || !S,
718
718
  "aria-label": "下一页",
719
719
  children: /* @__PURE__ */ e.jsx(ke, { className: "h-4 w-4" })
720
720
  }
@@ -725,8 +725,8 @@ function Tt({
725
725
  className: "ml-1 flex items-center gap-2",
726
726
  onSubmit: (i) => {
727
727
  i.preventDefault();
728
- const R = Number.parseInt(E, 10);
729
- Number.isNaN(R) || U(R - 1);
728
+ const C = Number.parseInt(P, 10);
729
+ Number.isNaN(C) || U(C - 1);
730
730
  },
731
731
  children: [
732
732
  /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "跳至" }),
@@ -736,7 +736,7 @@ function Tt({
736
736
  type: "number",
737
737
  min: 1,
738
738
  max: d,
739
- value: E,
739
+ value: P,
740
740
  disabled: !S,
741
741
  onChange: (i) => A(i.target.value),
742
742
  className: "h-8 w-16 rounded-md border border-input bg-background px-2 text-sm",
@@ -744,7 +744,7 @@ function Tt({
744
744
  }
745
745
  ),
746
746
  /* @__PURE__ */ e.jsx(
747
- N,
747
+ y,
748
748
  {
749
749
  type: "submit",
750
750
  variant: "outline",
@@ -838,48 +838,48 @@ const ft = [
838
838
  )
839
839
  }
840
840
  ];
841
- function Pt({
842
- value: s,
841
+ function Et({
842
+ value: r,
843
843
  onValueChange: j,
844
844
  themes: c = ft,
845
845
  triggerVariant: u = "ghost",
846
846
  triggerSize: a = "icon",
847
- triggerClassName: x,
848
- iconSize: p = 16,
847
+ triggerClassName: f,
848
+ iconSize: h = 16,
849
849
  showCurrentIcon: o = !0,
850
- enableSSRHandling: D = !0,
851
- triggerContent: g,
850
+ enableSSRHandling: _ = !0,
851
+ triggerContent: b,
852
852
  components: l,
853
- themeIcons: E
853
+ themeIcons: P
854
854
  }) {
855
- const [A, N] = M(!1);
856
- if (ee(() => {
857
- N(!0);
858
- }, []), D && !A)
855
+ const [A, y] = M(!1);
856
+ if (te(() => {
857
+ y(!0);
858
+ }, []), _ && !A)
859
859
  return null;
860
860
  if (!l)
861
861
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
862
862
  const {
863
- DropdownMenu: W,
863
+ DropdownMenu: z,
864
864
  DropdownMenuTrigger: J,
865
- DropdownMenuContent: V,
866
- DropdownMenuRadioGroup: B,
867
- DropdownMenuRadioItem: w,
868
- Button: b
865
+ DropdownMenuContent: L,
866
+ DropdownMenuRadioGroup: W,
867
+ DropdownMenuRadioItem: N,
868
+ Button: g
869
869
  } = l, d = (I) => {
870
- if (E && E[I])
871
- return E[I];
870
+ if (P && P[I])
871
+ return P[I];
872
872
  const S = c.find((U) => U.value === I);
873
873
  return S == null ? void 0 : S.icon;
874
- }, G = d(s), q = o ? G : null, O = p ? { width: p, height: p } : {};
875
- return /* @__PURE__ */ e.jsxs(W, { children: [
874
+ }, Y = d(r), q = o ? Y : null, O = h ? { width: h, height: h } : {};
875
+ return /* @__PURE__ */ e.jsxs(z, { children: [
876
876
  /* @__PURE__ */ e.jsx(J, { asChild: !0, children: /* @__PURE__ */ e.jsx(
877
- b,
877
+ g,
878
878
  {
879
879
  variant: u,
880
880
  size: a,
881
- className: x,
882
- children: g || /* @__PURE__ */ e.jsx(
881
+ className: f,
882
+ children: b || /* @__PURE__ */ e.jsx(
883
883
  "span",
884
884
  {
885
885
  style: O,
@@ -889,7 +889,7 @@ function Pt({
889
889
  )
890
890
  }
891
891
  ) }),
892
- /* @__PURE__ */ e.jsx(V, { children: /* @__PURE__ */ e.jsx(B, { value: s, onValueChange: j, children: c.map((I) => /* @__PURE__ */ e.jsxs(w, { value: I.value, children: [
892
+ /* @__PURE__ */ e.jsx(L, { children: /* @__PURE__ */ e.jsx(W, { value: r, onValueChange: j, children: c.map((I) => /* @__PURE__ */ e.jsxs(N, { value: I.value, children: [
893
893
  /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: d(I.value) }),
894
894
  /* @__PURE__ */ e.jsx("span", { children: I.label })
895
895
  ] }, I.value)) }) })
@@ -972,166 +972,166 @@ const xt = [
972
972
  )
973
973
  }
974
974
  ];
975
- function Et({
976
- value: s,
975
+ function Pt({
976
+ value: r,
977
977
  onValueChange: j,
978
978
  themes: c = xt,
979
979
  iconSize: u = 16,
980
980
  components: a,
981
- themeIcons: x
981
+ themeIcons: f
982
982
  }) {
983
983
  if (!a)
984
984
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
985
- const { DropdownMenuRadioGroup: p, DropdownMenuRadioItem: o } = a, D = (l) => {
986
- if (x && x[l])
987
- return x[l];
988
- const E = c.find((A) => A.value === l);
989
- return E == null ? void 0 : E.icon;
990
- }, g = u ? { width: u, height: u } : {};
991
- return /* @__PURE__ */ e.jsx(p, { value: s, onValueChange: j, children: c.map((l) => /* @__PURE__ */ e.jsxs(o, { value: l.value, children: [
992
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: g, children: D(l.value) }),
985
+ const { DropdownMenuRadioGroup: h, DropdownMenuRadioItem: o } = a, _ = (l) => {
986
+ if (f && f[l])
987
+ return f[l];
988
+ const P = c.find((A) => A.value === l);
989
+ return P == null ? void 0 : P.icon;
990
+ }, b = u ? { width: u, height: u } : {};
991
+ return /* @__PURE__ */ e.jsx(h, { value: r, onValueChange: j, children: c.map((l) => /* @__PURE__ */ e.jsxs(o, { value: l.value, children: [
992
+ /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: b, children: _(l.value) }),
993
993
  /* @__PURE__ */ e.jsx("span", { children: l.label })
994
994
  ] }, l.value)) });
995
995
  }
996
996
  function Rt({
997
- url: s,
997
+ url: r,
998
998
  initialPage: j = 1,
999
999
  initialScale: c = 1,
1000
1000
  scale: u,
1001
1001
  onScaleChange: a,
1002
- minScale: x = 0.5,
1003
- maxScale: p = 3,
1002
+ minScale: f = 0.5,
1003
+ maxScale: h = 3,
1004
1004
  currentPage: o,
1005
- onPageChange: D,
1006
- showToolbar: g = !0,
1005
+ onPageChange: _,
1006
+ showToolbar: b = !0,
1007
1007
  showPagination: l = !0,
1008
- enableHotkeys: E = !0,
1008
+ enableHotkeys: P = !0,
1009
1009
  className: A,
1010
- containerClassName: N,
1011
- pageClassName: W,
1010
+ containerClassName: y,
1011
+ pageClassName: z,
1012
1012
  components: J,
1013
- onLoadSuccess: V,
1014
- onLoadError: B,
1015
- loadingText: w = "加载中...",
1016
- errorText: b = "加载失败"
1013
+ onLoadSuccess: L,
1014
+ onLoadError: W,
1015
+ loadingText: N = "加载中...",
1016
+ errorText: g = "加载失败"
1017
1017
  }) {
1018
- const [d, G] = M(null), [q, O] = M(j), [I, S] = M(c), [U, K] = M(!0), [i, R] = M(null), [y, $] = M(0), [H, ue] = M(!1), se = ge(null), Z = ge(null), [re, t] = M(null), r = o ?? q, h = u ?? I, C = Oe(() => {
1019
- const f = [r];
1020
- return r > 1 && f.push(r - 1), r < y && f.push(r + 1), f;
1021
- }, [r, y]), Q = ne(
1022
- (f) => {
1023
- const P = Math.max(y, 1), v = Math.min(Math.max(f, 1), P);
1024
- o === void 0 && O(v), D == null || D(v);
1018
+ const [d, Y] = M(null), [q, O] = M(j), [I, S] = M(c), [U, K] = M(!0), [i, C] = M(null), [E, $] = M(0), [H, ue] = M(!1), re = je(null), Z = je(null), [se, t] = M(null), s = o ?? q, x = u ?? I, D = Oe(() => {
1019
+ const m = [s];
1020
+ return s > 1 && m.push(s - 1), s < E && m.push(s + 1), m;
1021
+ }, [s, E]), X = ne(
1022
+ (m) => {
1023
+ const k = Math.max(E, 1), v = Math.min(Math.max(m, 1), k);
1024
+ o === void 0 && O(v), _ == null || _(v);
1025
1025
  },
1026
- [y, o, D]
1026
+ [E, o, _]
1027
1027
  ), le = ne(() => {
1028
- r > 1 && Q(r - 1);
1029
- }, [r, Q]), T = ne(() => {
1030
- r < y && Q(r + 1);
1031
- }, [r, y, Q]), L = ne(() => {
1032
- const f = Math.min(h + 0.25, p);
1033
- u === void 0 && S(f), a == null || a(f);
1034
- }, [h, p, u, a]), m = ne(() => {
1035
- const f = Math.max(h - 0.25, x);
1036
- u === void 0 && S(f), a == null || a(f);
1037
- }, [h, x, u, a]), _ = ne(async () => {
1038
- var f, P, v;
1028
+ s > 1 && X(s - 1);
1029
+ }, [s, X]), R = ne(() => {
1030
+ s < E && X(s + 1);
1031
+ }, [s, E, X]), V = ne(() => {
1032
+ const m = Math.min(x + 0.25, h);
1033
+ u === void 0 && S(m), a == null || a(m);
1034
+ }, [x, h, u, a]), p = ne(() => {
1035
+ const m = Math.max(x - 0.25, f);
1036
+ u === void 0 && S(m), a == null || a(m);
1037
+ }, [x, f, u, a]), w = ne(async () => {
1038
+ var m, k, v;
1039
1039
  if (!(typeof document > "u")) {
1040
1040
  if (!document.fullscreenElement) {
1041
- await ((P = (f = se.current) == null ? void 0 : f.requestFullscreen) == null ? void 0 : P.call(f));
1041
+ await ((k = (m = re.current) == null ? void 0 : m.requestFullscreen) == null ? void 0 : k.call(m));
1042
1042
  return;
1043
1043
  }
1044
1044
  await ((v = document.exitFullscreen) == null ? void 0 : v.call(document));
1045
1045
  }
1046
1046
  }, []);
1047
- if (ee(() => {
1048
- let f = !0;
1047
+ if (te(() => {
1048
+ let m = !0;
1049
1049
  return (async () => {
1050
1050
  try {
1051
- const v = await import("./index-0y7GsdPm.js");
1051
+ const v = await import("./index-Ba1twkJn.js");
1052
1052
  if (typeof window < "u") {
1053
1053
  const F = v.pdfjs, ae = F == null ? void 0 : F.version;
1054
1054
  F != null && F.GlobalWorkerOptions && ae && (F.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${ae}/build/pdf.worker.min.mjs`);
1055
1055
  }
1056
- f && t(v);
1056
+ m && t(v);
1057
1057
  } catch (v) {
1058
- if (f) {
1058
+ if (m) {
1059
1059
  const F = v instanceof Error ? v : new Error("无法加载 react-pdf 库");
1060
- R(F), K(!1), B == null || B(F);
1060
+ C(F), K(!1), W == null || W(F);
1061
1061
  }
1062
1062
  }
1063
1063
  })(), () => {
1064
- f = !1;
1064
+ m = !1;
1065
1065
  };
1066
- }, []), ee(() => {
1067
- if (!re || !s) return;
1068
- let f = !0;
1066
+ }, []), te(() => {
1067
+ if (!se || !r) return;
1068
+ let m = !0;
1069
1069
  return (async () => {
1070
- K(!0), R(null);
1070
+ K(!0), C(null);
1071
1071
  try {
1072
- const { Document: v } = re;
1072
+ const { Document: v } = se;
1073
1073
  if (!v)
1074
1074
  throw new Error("react-pdf Document 组件不可用");
1075
- const F = re.pdfjs.getDocument(s);
1075
+ const F = se.pdfjs.getDocument(r);
1076
1076
  Z.current = F;
1077
1077
  const ae = await F.promise;
1078
- f && (G(ae), $(ae.numPages), o === void 0 && O(
1079
- (Ee) => Math.max(1, Math.min(Ee, ae.numPages))
1080
- ), K(!1), V == null || V(ae));
1078
+ m && (Y(ae), $(ae.numPages), o === void 0 && O(
1079
+ (Pe) => Math.max(1, Math.min(Pe, ae.numPages))
1080
+ ), K(!1), L == null || L(ae));
1081
1081
  } catch (v) {
1082
- if (f) {
1082
+ if (m) {
1083
1083
  const F = v instanceof Error ? v : new Error("PDF 加载失败");
1084
- R(F), K(!1), B == null || B(F);
1084
+ C(F), K(!1), W == null || W(F);
1085
1085
  }
1086
1086
  }
1087
1087
  })(), () => {
1088
- f = !1, Z.current && typeof Z.current.destroy == "function" && (Z.current.destroy(), Z.current = null);
1088
+ m = !1, Z.current && typeof Z.current.destroy == "function" && (Z.current.destroy(), Z.current = null);
1089
1089
  };
1090
- }, [re, s, V, B]), ee(() => {
1090
+ }, [se, r, o, L, W]), te(() => {
1091
1091
  if (typeof document > "u") return;
1092
- const f = () => {
1093
- ue(document.fullscreenElement === se.current);
1092
+ const m = () => {
1093
+ ue(document.fullscreenElement === re.current);
1094
1094
  };
1095
- return document.addEventListener("fullscreenchange", f), () => {
1096
- document.removeEventListener("fullscreenchange", f);
1095
+ return document.addEventListener("fullscreenchange", m), () => {
1096
+ document.removeEventListener("fullscreenchange", m);
1097
1097
  };
1098
- }, []), ee(() => {
1099
- if (!E) return;
1100
- const f = (P) => {
1098
+ }, []), te(() => {
1099
+ if (!P) return;
1100
+ const m = (k) => {
1101
1101
  const v = document.activeElement;
1102
- v && (v.tagName === "INPUT" || v.getAttribute("role") === "input") || ((P.ctrlKey || P.metaKey) && (P.key === "=" || P.key === "+") ? (P.preventDefault(), L()) : (P.ctrlKey || P.metaKey) && P.key === "-" ? (P.preventDefault(), m()) : P.key === "ArrowLeft" ? (P.preventDefault(), le()) : P.key === "ArrowRight" ? (P.preventDefault(), T()) : (P.key === "f" || P.key === "F") && (P.preventDefault(), _()));
1102
+ v && (v.tagName === "INPUT" || v.getAttribute("role") === "input") || ((k.ctrlKey || k.metaKey) && (k.key === "=" || k.key === "+") ? (k.preventDefault(), V()) : (k.ctrlKey || k.metaKey) && k.key === "-" ? (k.preventDefault(), p()) : k.key === "ArrowLeft" ? (k.preventDefault(), le()) : k.key === "ArrowRight" ? (k.preventDefault(), R()) : (k.key === "f" || k.key === "F") && (k.preventDefault(), w()));
1103
1103
  };
1104
- return document.addEventListener("keydown", f), () => {
1105
- document.removeEventListener("keydown", f);
1104
+ return document.addEventListener("keydown", m), () => {
1105
+ document.removeEventListener("keydown", m);
1106
1106
  };
1107
1107
  }, [
1108
- E,
1109
- L,
1110
- m,
1108
+ P,
1109
+ V,
1110
+ p,
1111
1111
  le,
1112
- T,
1113
- _
1112
+ R,
1113
+ w
1114
1114
  ]), !J)
1115
1115
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1116
1116
  const {
1117
- Card: Y,
1117
+ Card: B,
1118
1118
  CardContent: de,
1119
1119
  Button: ie,
1120
- Input: te,
1120
+ Input: ee,
1121
1121
  Skeleton: me
1122
- } = J, he = () => g ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1122
+ } = J, fe = () => b ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1123
1123
  /* @__PURE__ */ e.jsx(
1124
1124
  ie,
1125
1125
  {
1126
1126
  variant: "outline",
1127
1127
  size: "sm",
1128
- onClick: m,
1129
- disabled: h <= x,
1128
+ onClick: p,
1129
+ disabled: x <= f,
1130
1130
  children: /* @__PURE__ */ e.jsx(Ie, {})
1131
1131
  }
1132
1132
  ),
1133
1133
  /* @__PURE__ */ e.jsxs("span", { className: "text-sm", children: [
1134
- Math.round(h * 100),
1134
+ Math.round(x * 100),
1135
1135
  "%"
1136
1136
  ] }),
1137
1137
  /* @__PURE__ */ e.jsx(
@@ -1139,8 +1139,8 @@ function Rt({
1139
1139
  {
1140
1140
  variant: "outline",
1141
1141
  size: "sm",
1142
- onClick: L,
1143
- disabled: h >= p,
1142
+ onClick: V,
1143
+ disabled: x >= h,
1144
1144
  children: /* @__PURE__ */ e.jsx(Fe, {})
1145
1145
  }
1146
1146
  ),
@@ -1150,30 +1150,30 @@ function Rt({
1150
1150
  variant: "outline",
1151
1151
  size: "icon",
1152
1152
  onClick: () => {
1153
- _();
1153
+ w();
1154
1154
  },
1155
1155
  children: H ? /* @__PURE__ */ e.jsx(Se, {}) : /* @__PURE__ */ e.jsx($e, {})
1156
1156
  }
1157
1157
  )
1158
- ] }) : null, be = () => l ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1158
+ ] }) : null, ve = () => l ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1159
1159
  /* @__PURE__ */ e.jsx(
1160
1160
  ie,
1161
1161
  {
1162
1162
  variant: "outline",
1163
1163
  size: "icon",
1164
1164
  onClick: le,
1165
- disabled: r <= 1,
1165
+ disabled: s <= 1,
1166
1166
  children: /* @__PURE__ */ e.jsx(we, {})
1167
1167
  }
1168
1168
  ),
1169
- te ? /* @__PURE__ */ e.jsx(
1170
- te,
1169
+ ee ? /* @__PURE__ */ e.jsx(
1170
+ ee,
1171
1171
  {
1172
1172
  type: "number",
1173
1173
  min: 1,
1174
- max: Math.max(y, 1),
1175
- value: r,
1176
- onChange: (f) => Q(parseInt(f.target.value, 10) || 1),
1174
+ max: Math.max(E, 1),
1175
+ value: s,
1176
+ onChange: (m) => X(parseInt(m.target.value, 10) || 1),
1177
1177
  className: "w-16 text-center"
1178
1178
  }
1179
1179
  ) : /* @__PURE__ */ e.jsx(
@@ -1181,82 +1181,82 @@ function Rt({
1181
1181
  {
1182
1182
  type: "number",
1183
1183
  min: 1,
1184
- max: Math.max(y, 1),
1185
- value: r,
1186
- onChange: (f) => Q(parseInt(f.target.value, 10) || 1),
1184
+ max: Math.max(E, 1),
1185
+ value: s,
1186
+ onChange: (m) => X(parseInt(m.target.value, 10) || 1),
1187
1187
  className: "w-16 rounded-md border border-input bg-background px-2 text-center text-sm"
1188
1188
  }
1189
1189
  ),
1190
1190
  /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
1191
1191
  "/ ",
1192
- y
1192
+ E
1193
1193
  ] }),
1194
1194
  /* @__PURE__ */ e.jsx(
1195
1195
  ie,
1196
1196
  {
1197
1197
  variant: "outline",
1198
1198
  size: "icon",
1199
- onClick: T,
1200
- disabled: r >= y,
1199
+ onClick: R,
1200
+ disabled: s >= E,
1201
1201
  children: /* @__PURE__ */ e.jsx(ke, {})
1202
1202
  }
1203
1203
  )
1204
- ] }) : null, ye = () => !g && !l ? null : /* @__PURE__ */ e.jsxs(
1204
+ ] }) : null, be = () => !b && !l ? null : /* @__PURE__ */ e.jsxs(
1205
1205
  "div",
1206
1206
  {
1207
1207
  "data-testid": "pdf-operations-bar",
1208
1208
  className: "flex items-center justify-between gap-4 border-b px-4 py-2",
1209
1209
  children: [
1210
- he(),
1211
- be()
1210
+ fe(),
1211
+ ve()
1212
1212
  ]
1213
1213
  }
1214
1214
  ), Te = () => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: [
1215
1215
  /* @__PURE__ */ e.jsx(me, { className: "h-8 w-32" }),
1216
1216
  /* @__PURE__ */ e.jsx(me, { className: "h-64 w-full max-w-2xl" }),
1217
- /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: w })
1218
- ] }), fe = () => /* @__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: b }),
1217
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: N })
1218
+ ] }), ge = () => /* @__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: g }),
1220
1220
  i && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: i.message })
1221
- ] }) }), Pe = () => {
1222
- if (!re || !d) return null;
1223
- const { Page: f } = re;
1221
+ ] }) }), Ee = () => {
1222
+ if (!se || !d) return null;
1223
+ const { Page: m } = se;
1224
1224
  return /* @__PURE__ */ e.jsx(
1225
1225
  "div",
1226
1226
  {
1227
1227
  className: `flex flex-col items-center justify-center ${H ? "h-[calc(100vh-56px)] overflow-auto" : "overflow-visible"}`,
1228
- children: C.map((P) => /* @__PURE__ */ e.jsx(
1228
+ children: D.map((k) => /* @__PURE__ */ e.jsx(
1229
1229
  "div",
1230
1230
  {
1231
- className: W,
1231
+ className: z,
1232
1232
  style: {
1233
- display: P === r ? "block" : "none"
1233
+ display: k === s ? "block" : "none"
1234
1234
  },
1235
1235
  children: /* @__PURE__ */ e.jsx(
1236
- f,
1236
+ m,
1237
1237
  {
1238
1238
  pdf: d,
1239
- pageNumber: P,
1240
- scale: h,
1239
+ pageNumber: k,
1240
+ scale: x,
1241
1241
  renderTextLayer: !1,
1242
1242
  renderAnnotationLayer: !1,
1243
1243
  className: "shadow-md"
1244
1244
  }
1245
1245
  )
1246
1246
  },
1247
- P
1247
+ k
1248
1248
  ))
1249
1249
  }
1250
1250
  );
1251
1251
  };
1252
- return /* @__PURE__ */ e.jsx("div", { ref: se, children: /* @__PURE__ */ e.jsxs(Y, { className: A, children: [
1253
- ye(),
1254
- /* @__PURE__ */ e.jsx(de, { className: N, children: U ? Te() : i ? fe() : Pe() })
1252
+ return /* @__PURE__ */ e.jsx("div", { ref: re, children: /* @__PURE__ */ e.jsxs(B, { className: A, children: [
1253
+ be(),
1254
+ /* @__PURE__ */ e.jsx(de, { className: y, children: U ? Te() : i ? ge() : Ee() })
1255
1255
  ] }) });
1256
1256
  }
1257
- const ze = st(
1257
+ const ze = rt(
1258
1258
  ({
1259
- thumbnail: s,
1259
+ thumbnail: r,
1260
1260
  isCurrentPage: j,
1261
1261
  onClick: c
1262
1262
  }) => /* @__PURE__ */ e.jsxs(
@@ -1267,8 +1267,8 @@ const ze = st(
1267
1267
  /* @__PURE__ */ e.jsx(
1268
1268
  "img",
1269
1269
  {
1270
- src: s.url,
1271
- alt: `Page ${s.pageNumber}`,
1270
+ src: r.url,
1271
+ alt: `Page ${r.pageNumber}`,
1272
1272
  className: "w-48 cursor-pointer border transition-opacity hover:opacity-80",
1273
1273
  onClick: c,
1274
1274
  onKeyDown: (u) => {
@@ -1280,7 +1280,7 @@ const ze = st(
1280
1280
  ),
1281
1281
  /* @__PURE__ */ e.jsxs("span", { className: "mt-1 text-sm", children: [
1282
1282
  "第 ",
1283
- s.pageNumber,
1283
+ r.pageNumber,
1284
1284
  " 页"
1285
1285
  ] })
1286
1286
  ]
@@ -1289,145 +1289,145 @@ const ze = st(
1289
1289
  );
1290
1290
  ze.displayName = "PDFThumbnail";
1291
1291
  const We = ({
1292
- bookmark: s,
1292
+ bookmark: r,
1293
1293
  depth: j,
1294
1294
  onClick: c
1295
1295
  }) => /* @__PURE__ */ e.jsxs("div", { style: { paddingLeft: `${j * 16}px` }, children: [
1296
1296
  /* @__PURE__ */ e.jsx(
1297
1297
  "button",
1298
1298
  {
1299
- onClick: () => c(s),
1299
+ onClick: () => c(r),
1300
1300
  className: "w-full rounded px-2 py-1 text-left text-sm hover:bg-primary/10 hover:text-primary",
1301
- children: s.title
1301
+ children: r.title
1302
1302
  }
1303
1303
  ),
1304
- s.items && s.items.map((u, a) => /* @__PURE__ */ e.jsx(
1304
+ r.items && r.items.map((u, a) => /* @__PURE__ */ e.jsx(
1305
1305
  We,
1306
1306
  {
1307
1307
  bookmark: u,
1308
1308
  depth: j + 1,
1309
1309
  onClick: c
1310
1310
  },
1311
- `${s.title}-${a}`
1311
+ `${r.title}-${a}`
1312
1312
  ))
1313
1313
  ] });
1314
1314
  function ht({
1315
- pdfDocument: s,
1315
+ pdfDocument: r,
1316
1316
  currentPage: j,
1317
1317
  onPageClick: c,
1318
1318
  components: u
1319
1319
  }) {
1320
- const [a, x] = M([]), [p, o] = M([]), [D, g] = M(!0), { Tabs: l, TabsList: E, TabsTrigger: A, TabsContent: N, ScrollArea: W, Skeleton: J } = u;
1321
- ee(() => {
1320
+ const [a, f] = M([]), [h, o] = M([]), [_, b] = M(!0), { Tabs: l, TabsList: P, TabsTrigger: A, TabsContent: y, ScrollArea: z, Skeleton: J } = u;
1321
+ te(() => {
1322
1322
  (async () => {
1323
- if (!s) return;
1324
- g(!0);
1325
- const b = [];
1326
- for (let d = 1; d <= s.numPages; d++)
1323
+ if (!r) return;
1324
+ b(!0);
1325
+ const g = [];
1326
+ for (let d = 1; d <= r.numPages; d++)
1327
1327
  try {
1328
- const G = await s.getPage(d), q = G.getViewport({ scale: 0.2 }), O = document.createElement("canvas"), I = O.getContext("2d");
1328
+ const Y = await r.getPage(d), q = Y.getViewport({ scale: 0.2 }), O = document.createElement("canvas"), I = O.getContext("2d");
1329
1329
  if (!I) continue;
1330
- O.width = q.width, O.height = q.height, await G.render({
1330
+ O.width = q.width, O.height = q.height, await Y.render({
1331
1331
  canvasContext: I,
1332
1332
  viewport: q,
1333
1333
  canvas: O
1334
- }).promise, b.push({
1334
+ }).promise, g.push({
1335
1335
  pageNumber: d,
1336
1336
  url: O.toDataURL()
1337
1337
  });
1338
- } catch (G) {
1339
- console.error(`Error loading thumbnail for page ${d}:`, G);
1338
+ } catch (Y) {
1339
+ console.error(`Error loading thumbnail for page ${d}:`, Y);
1340
1340
  }
1341
- x(b), g(!1);
1341
+ f(g), b(!1);
1342
1342
  })();
1343
- }, [s]), ee(() => {
1343
+ }, [r]), te(() => {
1344
1344
  (async () => {
1345
- if (s)
1345
+ if (r)
1346
1346
  try {
1347
- const b = await s.getOutline();
1348
- o(b || []);
1349
- } catch (b) {
1350
- console.error("Error loading bookmarks:", b), o([]);
1347
+ const g = await r.getOutline();
1348
+ o(g || []);
1349
+ } catch (g) {
1350
+ console.error("Error loading bookmarks:", g), o([]);
1351
1351
  }
1352
1352
  })();
1353
- }, [s]);
1354
- const V = async (w) => {
1355
- if (s)
1353
+ }, [r]);
1354
+ const L = async (N) => {
1355
+ if (r)
1356
1356
  try {
1357
- let b;
1358
- if (w.dest)
1359
- if (typeof w.dest == "string") {
1360
- const d = await s.getDestination(w.dest);
1361
- d && d[0] && (b = await s.getPageIndex(d[0]));
1362
- } else Array.isArray(w.dest) && w.dest[0] && (b = await s.getPageIndex(w.dest[0]));
1363
- else w.pageNumber && (b = w.pageNumber - 1);
1364
- typeof b == "number" && c(b + 1);
1365
- } catch (b) {
1366
- console.error("Error navigating to bookmark:", b);
1357
+ let g;
1358
+ if (N.dest)
1359
+ if (typeof N.dest == "string") {
1360
+ const d = await r.getDestination(N.dest);
1361
+ d && d[0] && (g = await r.getPageIndex(d[0]));
1362
+ } else Array.isArray(N.dest) && N.dest[0] && (g = await r.getPageIndex(N.dest[0]));
1363
+ else N.pageNumber && (g = N.pageNumber - 1);
1364
+ typeof g == "number" && c(g + 1);
1365
+ } catch (g) {
1366
+ console.error("Error navigating to bookmark:", g);
1367
1367
  }
1368
- }, B = () => /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: Array.from({ length: (s == null ? void 0 : s.numPages) || 5 }, (w, b) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center p-1", children: [
1368
+ }, W = () => /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: Array.from({ length: (r == null ? void 0 : r.numPages) || 5 }, (N, g) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center p-1", children: [
1369
1369
  /* @__PURE__ */ e.jsx(J, { className: "h-32 w-48" }),
1370
1370
  /* @__PURE__ */ e.jsx(J, { className: "mt-1 h-4 w-16" })
1371
- ] }, b)) });
1371
+ ] }, g)) });
1372
1372
  return /* @__PURE__ */ e.jsx("div", { className: "w-64 border-r bg-muted", children: /* @__PURE__ */ e.jsxs(l, { defaultValue: "thumbnails", children: [
1373
- /* @__PURE__ */ e.jsxs(E, { className: "w-full p-2", children: [
1373
+ /* @__PURE__ */ e.jsxs(P, { className: "w-full p-2", children: [
1374
1374
  /* @__PURE__ */ e.jsx(A, { value: "thumbnails", className: "flex-1 bg-transparent", children: "缩略图" }),
1375
1375
  /* @__PURE__ */ e.jsx(A, { value: "bookmarks", className: "flex-1 bg-transparent", children: "书签" })
1376
1376
  ] }),
1377
- /* @__PURE__ */ e.jsx(N, { value: "thumbnails", children: /* @__PURE__ */ e.jsx(W, { className: "h-[calc(100vh-8rem)]", children: D ? B() : /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: a.map((w) => /* @__PURE__ */ e.jsx(
1377
+ /* @__PURE__ */ e.jsx(y, { value: "thumbnails", children: /* @__PURE__ */ e.jsx(z, { className: "h-[calc(100vh-8rem)]", children: _ ? W() : /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: a.map((N) => /* @__PURE__ */ e.jsx(
1378
1378
  ze,
1379
1379
  {
1380
- thumbnail: w,
1381
- isCurrentPage: j === w.pageNumber,
1382
- onClick: () => c(w.pageNumber)
1380
+ thumbnail: N,
1381
+ isCurrentPage: j === N.pageNumber,
1382
+ onClick: () => c(N.pageNumber)
1383
1383
  },
1384
- w.pageNumber
1384
+ N.pageNumber
1385
1385
  )) }) }) }),
1386
- /* @__PURE__ */ e.jsx(N, { value: "bookmarks", children: /* @__PURE__ */ e.jsx(W, { className: "h-[calc(100vh-8rem)]", children: /* @__PURE__ */ e.jsx("div", { className: "p-4", children: p.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: p.map((w, b) => /* @__PURE__ */ e.jsx(
1386
+ /* @__PURE__ */ e.jsx(y, { value: "bookmarks", children: /* @__PURE__ */ e.jsx(z, { className: "h-[calc(100vh-8rem)]", children: /* @__PURE__ */ e.jsx("div", { className: "p-4", children: h.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: h.map((N, g) => /* @__PURE__ */ e.jsx(
1387
1387
  We,
1388
1388
  {
1389
- bookmark: w,
1389
+ bookmark: N,
1390
1390
  depth: 0,
1391
- onClick: V
1391
+ onClick: L
1392
1392
  },
1393
- `${w.title}-${b}`
1393
+ `${N.title}-${g}`
1394
1394
  )) }) }) }) })
1395
1395
  ] }) });
1396
1396
  }
1397
- function pt(s, j) {
1398
- const c = ge(
1397
+ function pt(r, j) {
1398
+ const c = je(
1399
1399
  void 0
1400
1400
  );
1401
1401
  return ne(
1402
1402
  (...u) => {
1403
- c.current && clearTimeout(c.current), c.current = setTimeout(() => s(...u), j);
1403
+ c.current && clearTimeout(c.current), c.current = setTimeout(() => r(...u), j);
1404
1404
  },
1405
- [s, j]
1405
+ [r, j]
1406
1406
  );
1407
1407
  }
1408
1408
  function _t({
1409
- url: s,
1409
+ url: r,
1410
1410
  initialPage: j = 1,
1411
1411
  initialScale: c = 1,
1412
1412
  initialRotation: u = 0,
1413
1413
  currentPage: a,
1414
- onPageChange: x,
1415
- scale: p,
1414
+ onPageChange: f,
1415
+ scale: h,
1416
1416
  onScaleChange: o,
1417
- rotation: D,
1418
- onRotationChange: g,
1417
+ rotation: _,
1418
+ onRotationChange: b,
1419
1419
  minScale: l = 0.5,
1420
- maxScale: E = 2.5,
1420
+ maxScale: P = 2.5,
1421
1421
  showToolbar: A = !0,
1422
- showSidebar: N = !0,
1423
- showRotation: W = !0,
1422
+ showSidebar: y = !0,
1423
+ showRotation: z = !0,
1424
1424
  showModeToggle: J = !0,
1425
- showFullscreen: V = !0,
1426
- enableHotkeys: B = !0,
1427
- enableMobileNav: w = !0,
1428
- displayMode: b = "scroll",
1425
+ showFullscreen: L = !0,
1426
+ enableHotkeys: W = !0,
1427
+ enableMobileNav: N = !0,
1428
+ displayMode: g = "scroll",
1429
1429
  className: d,
1430
- toolbarClassName: G,
1430
+ toolbarClassName: Y,
1431
1431
  contentClassName: q,
1432
1432
  contentHeight: O = "80vh",
1433
1433
  pageClassName: I,
@@ -1435,123 +1435,103 @@ function _t({
1435
1435
  cMapUrl: U,
1436
1436
  standardFontDataUrl: K,
1437
1437
  components: i,
1438
- onLoadSuccess: R,
1439
- onLoadError: y,
1438
+ onLoadSuccess: C,
1439
+ onLoadError: E,
1440
1440
  onPageRender: $,
1441
1441
  loadingText: H = "正在加载PDF文档...",
1442
1442
  errorText: ue = "PDF加载失败"
1443
1443
  }) {
1444
- const [se, Z] = M(null), [re, t] = M(j), [r, h] = M(c), [C, Q] = M(u), [le, T] = M(!0), [L, m] = M(null), [_, Y] = M(0), [de, ie] = M(!1), [te, me] = M(
1445
- b === "scroll"
1446
- ), [he, be] = M(N);
1447
- ee(() => {
1448
- be(N);
1449
- }, [N]);
1450
- const [ye, Te] = M(void 0), [fe, Pe] = M(null), f = ge(null), P = ge(null), v = a ?? re, F = p ?? r, ae = D ?? C, { Card: Ee, CardContent: Be, Button: ce, Input: Ye, Skeleton: Ve } = i || {}, Ge = Oe(() => {
1444
+ const [re, Z] = M(null), [se, t] = M(j), [s, x] = M(c), [D, X] = M(u), [le, R] = M(!1), [V, p] = M(null), [w, B] = M(0), [de, ie] = M(!1), [ee, me] = M(
1445
+ g === "scroll"
1446
+ ), [fe, ve] = M(y);
1447
+ te(() => {
1448
+ ve(y);
1449
+ }, [y]);
1450
+ const [be, Te] = M(void 0), [ge, Ee] = M(null), m = je(null), k = je(null), v = a ?? se, F = h ?? s, ae = _ ?? D, { Card: Pe, CardContent: Be, Button: ce, Input: Le, Skeleton: Ye } = i || {}, Ve = Oe(() => {
1451
1451
  const n = {
1452
1452
  withCredentials: !1
1453
1453
  };
1454
1454
  return U && (n.cMapUrl = U, n.cMapPacked = !0), K && (n.standardFontDataUrl = K), n;
1455
1455
  }, [U, K]);
1456
- ee(() => {
1456
+ te(() => {
1457
1457
  let n = !0;
1458
1458
  return (async () => {
1459
1459
  try {
1460
- const X = await import("./index-0y7GsdPm.js");
1460
+ const Q = await import("./index-Ba1twkJn.js");
1461
1461
  if (typeof window < "u") {
1462
- const z = X.pdfjs, xe = z == null ? void 0 : z.version;
1463
- z != null && z.GlobalWorkerOptions && xe && (S ? z.GlobalWorkerOptions.workerSrc = S : z.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${xe}/build/pdf.worker.min.mjs`, !U && z.GlobalWorkerOptions && (z.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${xe}/cmaps/`), !K && z.GlobalWorkerOptions && (z.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${xe}/standard_fonts/`));
1462
+ const G = Q.pdfjs, ye = G == null ? void 0 : G.version;
1463
+ G != null && G.GlobalWorkerOptions && ye && (S ? G.GlobalWorkerOptions.workerSrc = S : G.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${ye}/build/pdf.worker.min.mjs`, !U && G.GlobalWorkerOptions && (G.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${ye}/cmaps/`), !K && G.GlobalWorkerOptions && (G.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${ye}/standard_fonts/`));
1464
1464
  }
1465
- n && Pe(X);
1466
- } catch (X) {
1465
+ n && Ee(Q);
1466
+ } catch (Q) {
1467
1467
  if (n) {
1468
- const z = X instanceof Error ? X : new Error("无法加载 react-pdf 库");
1469
- m(z), T(!1), y == null || y(z);
1468
+ const G = Q instanceof Error ? Q : new Error("无法加载 react-pdf 库");
1469
+ p(G), R(!1), E == null || E(G);
1470
1470
  }
1471
1471
  }
1472
1472
  })(), () => {
1473
1473
  n = !1;
1474
1474
  };
1475
- }, [S, U, K, y]), ee(() => {
1476
- if (!fe || !s) return;
1477
- let n = !0;
1478
- return (async () => {
1479
- T(!0), m(null);
1480
- try {
1481
- const { Document: X } = fe;
1482
- if (!X)
1483
- throw new Error("react-pdf Document 组件不可用");
1484
- const xe = await fe.pdfjs.getDocument(s).promise;
1485
- n && (Z(xe), Y(xe.numPages), T(!1), R == null || R(xe));
1486
- } catch (X) {
1487
- if (n) {
1488
- const z = X instanceof Error ? X : new Error("PDF 加载失败");
1489
- m(z), T(!1), y == null || y(z);
1490
- }
1491
- }
1492
- })(), () => {
1493
- n = !1;
1494
- };
1495
- }, [fe, s, R, y]);
1496
- const Le = ne(
1475
+ }, [S, U, K, E]);
1476
+ const Ge = ne(
1497
1477
  (n) => {
1498
- console.error("PDF加载失败:", n), console.error("PDF URL:", s), m(
1478
+ console.error("PDF加载失败:", n), console.error("PDF URL:", r), p(
1499
1479
  new Error(`${ue}: ${n.message || "请检查文件路径或网络连接"}`)
1500
- ), y == null || y(n);
1480
+ ), E == null || E(n);
1501
1481
  },
1502
- [s, ue, y]
1482
+ [r, ue, E]
1503
1483
  ), oe = ne(
1504
1484
  (n) => {
1505
- const k = Math.max(1, Math.min(n, _));
1506
- a === void 0 && t(k), x == null || x(k);
1485
+ const T = w > 0 ? Math.max(1, Math.min(n, w)) : n;
1486
+ a === void 0 && t(T), f == null || f(T);
1507
1487
  },
1508
- [_, a, x]
1509
- ), pe = ne(
1488
+ [w, a, f]
1489
+ ), xe = ne(
1510
1490
  (n) => {
1511
- const k = Math.max(l, Math.min(E, F + n));
1512
- p === void 0 && h(k), o == null || o(k);
1491
+ const T = Math.max(l, Math.min(P, F + n));
1492
+ h === void 0 && x(T), o == null || o(T);
1513
1493
  },
1514
- [F, l, E, p, o]
1494
+ [F, l, P, h, o]
1515
1495
  ), Ue = ne(() => {
1516
1496
  const n = (ae + 90) % 360;
1517
- D === void 0 && Q(n), g == null || g(n);
1518
- }, [ae, D, g]), _e = pt((n) => {
1497
+ _ === void 0 && X(n), b == null || b(n);
1498
+ }, [ae, _, b]), Ce = pt((n) => {
1519
1499
  Te(n);
1520
1500
  }, 100);
1521
- ee(() => {
1522
- if (!P.current) return;
1523
- const n = P.current, k = () => {
1524
- _e(n.clientWidth);
1501
+ te(() => {
1502
+ if (!k.current) return;
1503
+ const n = k.current, T = () => {
1504
+ Ce(n.clientWidth);
1525
1505
  };
1526
- k();
1527
- const X = new ResizeObserver(() => {
1528
- k();
1506
+ T();
1507
+ const Q = new ResizeObserver(() => {
1508
+ T();
1529
1509
  });
1530
- return X.observe(n), () => {
1531
- X.disconnect();
1510
+ return Q.observe(n), () => {
1511
+ Q.disconnect();
1532
1512
  };
1533
- }, [_e]), ee(() => {
1534
- if (!B) return;
1535
- const n = (k) => {
1536
- (k.ctrlKey || k.metaKey) && (k.key === "=" || k.key === "+") ? (k.preventDefault(), pe(0.1)) : (k.ctrlKey || k.metaKey) && k.key === "-" ? (k.preventDefault(), pe(-0.1)) : k.key === "ArrowLeft" ? (k.preventDefault(), oe(v - 1)) : k.key === "ArrowRight" && (k.preventDefault(), oe(v + 1));
1513
+ }, [Ce]), te(() => {
1514
+ if (!W) return;
1515
+ const n = (T) => {
1516
+ (T.ctrlKey || T.metaKey) && (T.key === "=" || T.key === "+") ? (T.preventDefault(), xe(0.1)) : (T.ctrlKey || T.metaKey) && T.key === "-" ? (T.preventDefault(), xe(-0.1)) : T.key === "ArrowLeft" ? (T.preventDefault(), oe(v - 1)) : T.key === "ArrowRight" && (T.preventDefault(), oe(v + 1));
1537
1517
  };
1538
1518
  return document.addEventListener("keydown", n), () => {
1539
1519
  document.removeEventListener("keydown", n);
1540
1520
  };
1541
- }, [B, v, oe, pe]);
1521
+ }, [W, v, oe, xe]);
1542
1522
  const Je = ne(async () => {
1543
- var n, k;
1523
+ var n, T;
1544
1524
  if (!(typeof document > "u"))
1545
1525
  if (document.fullscreenElement)
1546
1526
  document.exitFullscreen && (await document.exitFullscreen(), ie(!1));
1547
1527
  else
1548
1528
  try {
1549
- await ((k = (n = f.current) == null ? void 0 : n.requestFullscreen) == null ? void 0 : k.call(n)), ie(!0);
1550
- } catch (X) {
1551
- console.error("Error attempting to enable fullscreen:", X);
1529
+ await ((T = (n = m.current) == null ? void 0 : n.requestFullscreen) == null ? void 0 : T.call(n)), ie(!0);
1530
+ } catch (Q) {
1531
+ console.error("Error attempting to enable fullscreen:", Q);
1552
1532
  }
1553
1533
  }, []);
1554
- ee(() => {
1534
+ te(() => {
1555
1535
  if (typeof document > "u") return;
1556
1536
  const n = () => {
1557
1537
  ie(!!document.fullscreenElement);
@@ -1568,16 +1548,16 @@ function _t({
1568
1548
  ), Ke = () => A ? /* @__PURE__ */ e.jsxs(
1569
1549
  "div",
1570
1550
  {
1571
- className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${G || ""}`,
1551
+ className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${Y || ""}`,
1572
1552
  children: [
1573
1553
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1574
- N && /* @__PURE__ */ e.jsx(
1554
+ y && /* @__PURE__ */ e.jsx(
1575
1555
  ce,
1576
1556
  {
1577
1557
  variant: "outline",
1578
1558
  size: "icon",
1579
- onClick: () => be(!he),
1580
- title: he ? "隐藏侧边栏" : "显示侧边栏",
1559
+ onClick: () => ve(!fe),
1560
+ title: fe ? "隐藏侧边栏" : "显示侧边栏",
1581
1561
  children: /* @__PURE__ */ e.jsx(at, {})
1582
1562
  }
1583
1563
  ),
@@ -1586,7 +1566,7 @@ function _t({
1586
1566
  {
1587
1567
  variant: "outline",
1588
1568
  size: "icon",
1589
- onClick: () => pe(-0.1),
1569
+ onClick: () => xe(-0.1),
1590
1570
  disabled: F <= l,
1591
1571
  children: /* @__PURE__ */ e.jsx(Ie, {})
1592
1572
  }
@@ -1600,23 +1580,23 @@ function _t({
1600
1580
  {
1601
1581
  variant: "outline",
1602
1582
  size: "icon",
1603
- onClick: () => pe(0.1),
1604
- disabled: F >= E,
1583
+ onClick: () => xe(0.1),
1584
+ disabled: F >= P,
1605
1585
  children: /* @__PURE__ */ e.jsx(Fe, {})
1606
1586
  }
1607
1587
  ),
1608
- W && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Ue, children: /* @__PURE__ */ e.jsx(it, {}) }),
1588
+ z && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Ue, children: /* @__PURE__ */ e.jsx(it, {}) }),
1609
1589
  J && /* @__PURE__ */ e.jsx(
1610
1590
  ce,
1611
1591
  {
1612
1592
  variant: "outline",
1613
1593
  size: "icon",
1614
- onClick: () => me(!te),
1615
- title: te ? "单页模式" : "滚动模式",
1616
- children: te ? /* @__PURE__ */ e.jsx(ct, {}) : /* @__PURE__ */ e.jsx(ot, {})
1594
+ onClick: () => me(!ee),
1595
+ title: ee ? "单页模式" : "滚动模式",
1596
+ children: ee ? /* @__PURE__ */ e.jsx(ct, {}) : /* @__PURE__ */ e.jsx(ot, {})
1617
1597
  }
1618
1598
  ),
1619
- V && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Je, children: de ? /* @__PURE__ */ e.jsx(Se, {}) : /* @__PURE__ */ e.jsx($e, {}) })
1599
+ L && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Je, children: de ? /* @__PURE__ */ e.jsx(Se, {}) : /* @__PURE__ */ e.jsx($e, {}) })
1620
1600
  ] }),
1621
1601
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1622
1602
  /* @__PURE__ */ e.jsx(
@@ -1630,11 +1610,11 @@ function _t({
1630
1610
  }
1631
1611
  ),
1632
1612
  /* @__PURE__ */ e.jsx(
1633
- Ye,
1613
+ Le,
1634
1614
  {
1635
1615
  type: "number",
1636
1616
  min: 1,
1637
- max: _,
1617
+ max: w,
1638
1618
  value: v,
1639
1619
  onChange: (n) => oe(parseInt(n.target.value) || 1),
1640
1620
  className: "w-16 text-center"
@@ -1642,7 +1622,7 @@ function _t({
1642
1622
  ),
1643
1623
  /* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
1644
1624
  "/ ",
1645
- _
1625
+ w
1646
1626
  ] }),
1647
1627
  /* @__PURE__ */ e.jsx(
1648
1628
  ce,
@@ -1650,62 +1630,65 @@ function _t({
1650
1630
  variant: "outline",
1651
1631
  size: "icon",
1652
1632
  onClick: () => oe(v + 1),
1653
- disabled: v >= _,
1633
+ disabled: w > 0 && v >= w,
1654
1634
  children: /* @__PURE__ */ e.jsx(ke, {})
1655
1635
  }
1656
1636
  )
1657
1637
  ] })
1658
1638
  ]
1659
1639
  }
1660
- ) : null, De = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: H }) }), 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: [
1640
+ ) : null, Re = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: H }) }), _e = () => /* @__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: [
1661
1641
  /* @__PURE__ */ e.jsx("p", { className: "mb-2 text-lg font-medium", children: "文件加载失败" }),
1662
- /* @__PURE__ */ e.jsx("p", { className: "text-sm opacity-80", children: L == null ? void 0 : L.message })
1642
+ /* @__PURE__ */ e.jsx("p", { className: "text-sm opacity-80", children: V == null ? void 0 : V.message })
1663
1643
  ] }) }), He = () => {
1664
- if (!fe) return null;
1665
- const { Document: n, Page: k } = fe;
1644
+ if (!ge) return Re();
1645
+ const { Document: n, Page: T } = ge;
1666
1646
  return /* @__PURE__ */ e.jsx(
1667
1647
  "div",
1668
1648
  {
1669
- ref: P,
1649
+ ref: k,
1670
1650
  className: `pdf-container flex-1 overflow-y-auto ${q || ""}`,
1671
1651
  children: /* @__PURE__ */ e.jsx("div", { className: "flex min-h-full justify-center px-4", children: /* @__PURE__ */ e.jsx(
1672
1652
  n,
1673
1653
  {
1674
- pdf: se ?? void 0,
1675
- onLoadError: Le,
1676
- options: Ge,
1677
- loading: De(),
1678
- error: Re(),
1679
- children: L ? Re() : te ? (
1654
+ file: r,
1655
+ onLoadError: Ge,
1656
+ options: Ve,
1657
+ loading: Re(),
1658
+ error: _e(),
1659
+ onLoadSuccess: (Q) => {
1660
+ re || (Z(Q), B(Q.numPages), R(!1), C == null || C(Q));
1661
+ },
1662
+ children: V ? _e() : ee ? (
1680
1663
  // 显示所有页面模式
1681
- Array.from(new Array(_), (X, z) => /* @__PURE__ */ e.jsx(
1664
+ Array.from(new Array(w), (Q, G) => /* @__PURE__ */ e.jsx(
1682
1665
  "div",
1683
1666
  {
1684
1667
  className: `mb-4 ${I || ""}`,
1685
1668
  children: /* @__PURE__ */ e.jsx(
1686
- k,
1669
+ T,
1687
1670
  {
1688
- pageNumber: z + 1,
1671
+ pageNumber: G + 1,
1689
1672
  renderTextLayer: !1,
1690
1673
  renderAnnotationLayer: !1,
1691
- width: ye,
1674
+ width: be,
1692
1675
  scale: F,
1693
1676
  rotate: ae,
1694
- onRenderSuccess: () => $ == null ? void 0 : $(z + 1)
1677
+ onRenderSuccess: () => $ == null ? void 0 : $(G + 1)
1695
1678
  }
1696
1679
  )
1697
1680
  },
1698
- `page_${z + 1}`
1681
+ `page_${G + 1}`
1699
1682
  ))
1700
1683
  ) : (
1701
1684
  // 单页模式
1702
1685
  /* @__PURE__ */ e.jsx("div", { className: I || "", children: /* @__PURE__ */ e.jsx(
1703
- k,
1686
+ T,
1704
1687
  {
1705
1688
  pageNumber: v,
1706
1689
  renderTextLayer: !1,
1707
1690
  renderAnnotationLayer: !1,
1708
- width: ye,
1691
+ width: be,
1709
1692
  scale: F,
1710
1693
  rotate: ae,
1711
1694
  onRenderSuccess: () => $ == null ? void 0 : $(v)
@@ -1717,12 +1700,12 @@ function _t({
1717
1700
  }
1718
1701
  );
1719
1702
  }, Ze = () => {
1720
- if (!N || !he || !se) return null;
1703
+ if (!y || !fe || !re) return null;
1721
1704
  const n = ht;
1722
1705
  return /* @__PURE__ */ e.jsx(
1723
1706
  n,
1724
1707
  {
1725
- pdfDocument: se,
1708
+ pdfDocument: re,
1726
1709
  currentPage: v,
1727
1710
  onPageClick: qe,
1728
1711
  components: {
@@ -1731,11 +1714,11 @@ function _t({
1731
1714
  TabsTrigger: i.TabsTrigger,
1732
1715
  TabsContent: i.TabsContent,
1733
1716
  ScrollArea: i.ScrollArea,
1734
- Skeleton: Ve
1717
+ Skeleton: Ye
1735
1718
  }
1736
1719
  }
1737
1720
  );
1738
- }, Xe = () => w ? /* @__PURE__ */ e.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
1721
+ }, Xe = () => N ? /* @__PURE__ */ e.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
1739
1722
  /* @__PURE__ */ e.jsxs(
1740
1723
  ce,
1741
1724
  {
@@ -1755,7 +1738,7 @@ function _t({
1755
1738
  variant: "secondary",
1756
1739
  size: "sm",
1757
1740
  onClick: () => oe(v + 1),
1758
- disabled: v >= _,
1741
+ disabled: v >= w,
1759
1742
  children: [
1760
1743
  /* @__PURE__ */ e.jsx("span", { className: "mr-1", children: "下一页" }),
1761
1744
  /* @__PURE__ */ e.jsx(ke, {})
@@ -1765,19 +1748,19 @@ function _t({
1765
1748
  ] }) : null;
1766
1749
  if (!i)
1767
1750
  return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
1768
- if (N) {
1751
+ if (y) {
1769
1752
  const n = [];
1770
1753
  if (i.Tabs || n.push("Tabs"), i.TabsList || n.push("TabsList"), i.TabsTrigger || n.push("TabsTrigger"), i.TabsContent || n.push("TabsContent"), i.ScrollArea || n.push("ScrollArea"), n.length > 0) {
1771
- const k = n.length === 1 ? n[0] : `${n.slice(0, -1).join("、")} 和 ${n[n.length - 1]}`;
1754
+ const T = n.length === 1 ? n[0] : `${n.slice(0, -1).join("、")} 和 ${n[n.length - 1]}`;
1772
1755
  return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
1773
1756
  "错误:侧边栏功能需要注入 ",
1774
- k,
1757
+ T,
1775
1758
  " 组件"
1776
1759
  ] });
1777
1760
  }
1778
1761
  }
1779
- return /* @__PURE__ */ e.jsxs("div", { ref: f, children: [
1780
- /* @__PURE__ */ e.jsxs(Ee, { className: d, children: [
1762
+ return /* @__PURE__ */ e.jsxs("div", { ref: m, children: [
1763
+ /* @__PURE__ */ e.jsxs(Pe, { className: d, children: [
1781
1764
  Ke(),
1782
1765
  /* @__PURE__ */ e.jsx(
1783
1766
  Be,
@@ -1786,7 +1769,7 @@ function _t({
1786
1769
  style: { height: de ? "100vh" : O },
1787
1770
  children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
1788
1771
  Ze(),
1789
- le ? De() : L ? Re() : He()
1772
+ le ? Re() : V ? _e() : He()
1790
1773
  ] }) })
1791
1774
  }
1792
1775
  )
@@ -1802,9 +1785,9 @@ export {
1802
1785
  wt as a,
1803
1786
  ht as b,
1804
1787
  Tt as c,
1805
- Pt as d,
1806
- Et as e,
1788
+ Et as d,
1789
+ Pt as e,
1807
1790
  yt as f,
1808
1791
  e as j
1809
1792
  };
1810
- //# sourceMappingURL=index-DaMRZoHB.js.map
1793
+ //# sourceMappingURL=index-6lJCWESg.js.map