@pantograph/vue 0.29.4 → 0.29.6

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,18 +1,18 @@
1
- import { defineComponent as G, createElementBlock as N, openBlock as U, Fragment as fe, createBlock as L, createCommentVNode as P, createVNode as O, unref as a, normalizeClass as q, createSlots as ot, withCtx as te, withModifiers as D, computed as x, h as J, createElementVNode as Ce, mergeProps as _e, useSlots as ze, useAttrs as Ie, ref as se, watch as ue, nextTick as be, readonly as lt, renderSlot as Le, normalizeProps as Te, guardReactiveProps as Re } from "vue";
1
+ import { defineComponent as V, createElementBlock as G, openBlock as U, Fragment as fe, createBlock as R, createCommentVNode as j, createVNode as q, unref as i, normalizeClass as D, createSlots as lt, withCtx as te, withModifiers as M, computed as x, h as K, createElementVNode as _e, mergeProps as Ce, useSlots as ze, useAttrs as Ie, ref as Y, watch as ce, nextTick as be, readonly as it, renderSlot as Le, normalizeProps as Te, guardReactiveProps as Re } from "vue";
2
2
  import { createContext as me } from "reka-ui";
3
- import { getBemBlock as it, getBemElement as T, getComponentOptions as V, normCls as ge, generateVariantClassList as W, usePCId as de, getComponentName as ve } from "@pantograph/utils";
3
+ import { getBemBlock as at, getBemElement as B, getComponentOptions as W, normCls as ge, generateVariantClassList as H, usePCId as de, getComponentName as ve } from "@pantograph/utils";
4
4
  import { cva as Be } from "class-variance-authority";
5
5
  import { _ as Se } from "../Progress.vue_vue_type_style_index_0_lang-VcaWRb-o.js";
6
- import { _ as at } from "../FloatButton.vue_vue_type_script_setup_true_lang-CjWleMQR.js";
7
- import { _ as H } from "../IconButton.vue_vue_type_script_setup_true_lang-DBDmWePu.js";
8
- import { _ as rt } from "../Image.vue_vue_type_style_index_0_lang-DyZjQGcE.js";
9
- import { isFunction as Y, isEqual as ct, throttle as ut, pick as pt, cloneDeep as C } from "es-toolkit";
10
- import { _ as dt } from "../GraphicalObject.vue_vue_type_script_setup_true_lang-Cw-dYlrK.js";
11
- import { isEmptyElement as M, useFormInput as ft, installComponent as he } from "@pantograph/utils-vue";
12
- import { _ as mt } from "../FormValidation.vue_vue_type_style_index_0_lang-4DQfQtme.js";
13
- import { i as ne } from "../isObject-vmP43YLW.js";
14
- import { i as gt } from "../isArray-QlWcxgml.js";
15
- const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("BaseUpload"), yt = () => vt(null), [le, kt] = me("Upload"), wt = ["error", "paused", "done", "uploading", "waiting"], $e = ["md", "lg", "xlg"], je = ["image", "card"], bt = ["outline", "transparent"], pe = {
6
+ import { _ as rt } from "../FloatButton.vue_vue_type_script_setup_true_lang-CjWleMQR.js";
7
+ import { _ as J } from "../IconButton.vue_vue_type_script_setup_true_lang-DBDmWePu.js";
8
+ import { _ as ut } from "../Image.vue_vue_type_style_index_0_lang-DyZjQGcE.js";
9
+ import { isFunction as Z, isEqual as ct, throttle as pt, pick as dt, cloneDeep as C } from "es-toolkit";
10
+ import { _ as ft } from "../GraphicalObject.vue_vue_type_script_setup_true_lang-Cw-dYlrK.js";
11
+ import { isEmptyElement as N, useFormInput as mt, installComponent as he } from "@pantograph/utils-vue";
12
+ import { _ as gt } from "../FormValidation.vue_vue_type_style_index_0_lang-4DQfQtme.js";
13
+ import { i as se } from "../isObject-vmP43YLW.js";
14
+ import { i as vt } from "../isArray-QlWcxgml.js";
15
+ const Pe = at("upload"), ee = B(Pe, "list"), L = B(ee, "item"), [ht, yt] = me("BaseUpload"), kt = () => ht(null), [oe, wt] = me("Upload"), bt = ["error", "paused", "done", "uploading", "waiting"], $e = ["md", "lg", "xlg"], je = ["image", "card"], xt = ["outline", "transparent"], pe = {
16
16
  other: {
17
17
  icon: "tabler:file-text",
18
18
  fg: "primary",
@@ -179,222 +179,222 @@ const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("B
179
179
  }, Ee = (e = "") => {
180
180
  const s = e.split("/"), d = s[s.length - 1].split(/#|\?/)[0];
181
181
  return (/\.[^./\\]*$/.exec(d) || [""])[0];
182
- }, ie = (e) => {
182
+ }, le = (e) => {
183
183
  var s, t, d;
184
184
  return (d = (t = (s = e == null ? void 0 : e.split) == null ? void 0 : s.call(e, "/")) == null ? void 0 : t.pop) == null ? void 0 : d.call(t);
185
- }, xt = (e) => {
185
+ }, Ut = (e) => {
186
186
  var t;
187
- let s = ie((e == null ? void 0 : e.type) || ((t = e == null ? void 0 : e.originFileObj) == null ? void 0 : t.type));
187
+ let s = le((e == null ? void 0 : e.type) || ((t = e == null ? void 0 : e.originFileObj) == null ? void 0 : t.type));
188
188
  if (e != null && e.url && !s)
189
189
  try {
190
190
  s = Ee(e == null ? void 0 : e.url);
191
191
  } catch {
192
192
  }
193
193
  return s;
194
- }, Ut = (e) => {
194
+ }, Ft = (e) => {
195
195
  var s, t;
196
196
  return (t = (s = e == null ? void 0 : e.split) == null ? void 0 : s.call(e, "/")) == null ? void 0 : t[0];
197
- }, Ft = (e) => {
197
+ }, _t = (e) => {
198
198
  var s;
199
- return Ut((e == null ? void 0 : e.type) || ((s = e == null ? void 0 : e.originFileObj) == null ? void 0 : s.type));
200
- }, oe = (e) => Ae(e) === "image", Oe = (e) => {
199
+ return Ft((e == null ? void 0 : e.type) || ((s = e == null ? void 0 : e.originFileObj) == null ? void 0 : s.type));
200
+ }, ne = (e) => Ae(e) === "image", Oe = (e) => {
201
201
  if (e.type && !e.thumbUrl)
202
- return oe(ie(e.type));
202
+ return ne(le(e.type));
203
203
  const s = e.thumbUrl || e.url || "", t = Ee(s);
204
- return /^data:image\//.test(s) || oe(t) ? !0 : !(/^data:/.test(s) || t);
205
- }, Ct = /* @__PURE__ */ G({
206
- ...V("UploadListItemImage"),
204
+ return /^data:image\//.test(s) || ne(t) ? !0 : !(/^data:/.test(s) || t);
205
+ }, Ct = /* @__PURE__ */ V({
206
+ ...W("UploadListItemImage"),
207
207
  __name: "UploadListItemImage",
208
208
  setup(e) {
209
- const s = le(), t = ye(), d = () => {
210
- var n, u, v;
211
- Y((n = t.props.uploadFile) == null ? void 0 : n.cancel) && ((v = (u = t.props.uploadFile).cancel) == null || v.call(u)), s.remove(t.props.uploadFile.uid);
209
+ const s = oe(), t = ye(), d = () => {
210
+ var n, r, g;
211
+ Z((n = t.props.uploadFile) == null ? void 0 : n.cancel) && ((g = (r = t.props.uploadFile).cancel) == null || g.call(r)), s.remove(t.props.uploadFile.uid);
212
212
  };
213
- return (n, u) => {
214
- var v;
215
- return U(), N(fe, null, [
216
- a(t).props.uploadFile.status !== "waiting" ? (U(), L(rt, {
213
+ return (n, r) => {
214
+ var g;
215
+ return U(), G(fe, null, [
216
+ i(t).props.uploadFile.status !== "waiting" ? (U(), R(ut, {
217
217
  key: 0,
218
- src: a(Oe)(a(t).props.uploadFile) ? a(t).props.uploadFile.thumbUrl ?? a(t).props.uploadFile.url : void 0,
218
+ src: i(Oe)(i(t).props.uploadFile) ? i(t).props.uploadFile.thumbUrl ?? i(t).props.uploadFile.url : void 0,
219
219
  aspectRatio: "1:1",
220
- class: q(a(T)(a(z), "image")),
220
+ class: D(i(B)(i(L), "image")),
221
221
  sizeRange: "xsm",
222
- alt: a(t).label.value,
223
- hovered: a(t).props.uploadFile.status === "uploading",
222
+ alt: i(t).label.value,
223
+ hovered: i(t).props.uploadFile.status === "uploading",
224
224
  width: "100%"
225
- }, ot({ _: 2 }, [
226
- ["error", "done"].includes(a(t).props.uploadFile.status) ? {
225
+ }, lt({ _: 2 }, [
226
+ ["error", "done"].includes(i(t).props.uploadFile.status) ? {
227
227
  name: "actions",
228
228
  fn: te(() => [
229
- a(t).props.uploadFile.status === "done" ? (U(), L(H, {
229
+ i(t).props.uploadFile.status === "done" ? (U(), R(J, {
230
230
  key: 0,
231
231
  color: "neutral",
232
232
  type: "ghost",
233
233
  icon: "tabler:eye",
234
234
  size: "sm",
235
- onClick: u[0] || (u[0] = D((p) => a(s).emit("preview", a(t).props.uploadFile), ["stop"]))
236
- })) : a(t).props.uploadFile.status === "error" ? (U(), L(H, {
235
+ onClick: r[0] || (r[0] = M((p) => i(s).emit("preview", i(t).props.uploadFile), ["stop"]))
236
+ })) : i(t).props.uploadFile.status === "error" ? (U(), R(J, {
237
237
  key: 1,
238
238
  color: "neutral",
239
239
  type: "ghost",
240
240
  icon: "tabler:reload",
241
241
  size: "sm",
242
- onClick: u[1] || (u[1] = D((p) => a(s).resetRequest(a(t).props.uploadFile.uid), ["stop"]))
243
- })) : P("", !0)
242
+ onClick: r[1] || (r[1] = M((p) => i(s).resetRequest(i(t).props.uploadFile.uid), ["stop"]))
243
+ })) : j("", !0)
244
244
  ]),
245
245
  key: "0"
246
246
  } : void 0
247
- ]), 1032, ["src", "class", "alt", "hovered"])) : P("", !0),
248
- ["uploading", "waiting"].includes(a(t).props.uploadFile.status) ? (U(), L(Se, {
247
+ ]), 1032, ["src", "class", "alt", "hovered"])) : j("", !0),
248
+ ["uploading", "waiting"].includes(i(t).props.uploadFile.status) ? (U(), R(Se, {
249
249
  key: 1,
250
250
  type: "circle",
251
- size: a(s).progressSize.value,
252
- class: q(a(T)(a(z), "progress")),
253
- indeterminate: a(t).props.uploadFile.status === "waiting",
254
- percent: ((v = a(t).props.uploadFile) == null ? void 0 : v.percent) ?? 0
255
- }, null, 8, ["size", "class", "indeterminate", "percent"])) : P("", !0),
256
- O(at, {
257
- class: q(
258
- a(ge)(a(T)(a(z), "cancel"), "pantograph-tokens pantograph-dark")
251
+ size: i(s).progressSize.value,
252
+ class: D(i(B)(i(L), "progress")),
253
+ indeterminate: i(t).props.uploadFile.status === "waiting",
254
+ percent: ((g = i(t).props.uploadFile) == null ? void 0 : g.percent) ?? 0
255
+ }, null, 8, ["size", "class", "indeterminate", "percent"])) : j("", !0),
256
+ q(rt, {
257
+ class: D(
258
+ i(ge)(i(B)(i(L), "cancel"), "pantograph-tokens pantograph-dark")
259
259
  ),
260
260
  color: "neutral",
261
261
  icon: "tabler:x",
262
262
  size: "sm",
263
- onClick: D(d, ["stop"])
263
+ onClick: M(d, ["stop"])
264
264
  }, null, 8, ["class"])
265
265
  ], 64);
266
266
  };
267
267
  }
268
- }), _t = /* @__PURE__ */ G({
269
- ...V("UploadFileGO"),
268
+ }), zt = /* @__PURE__ */ V({
269
+ ...W("UploadFileGO"),
270
270
  __name: "UploadFileGO",
271
271
  setup(e) {
272
- const s = ye(), t = le(), d = x(() => Ae(
273
- xt(s.props.uploadFile),
274
- Ft(s.props.uploadFile)
275
- )), n = x(() => Y(t.props.getFileIcon) ? t.props.getFileIcon(s.props.uploadFile) : pe[d.value].icon), u = x(() => pe[d.value].fg), v = x(() => pe[d.value].bg), p = () => {
276
- var h, r, k, B;
277
- const o = (r = (h = t.slots).go) == null ? void 0 : r.call(h, { uploadFile: s.props.uploadFile });
278
- return M(o) ? Oe(s.props.uploadFile) ? J("img", {
279
- class: T(z, "thumb"),
272
+ const s = ye(), t = oe(), d = x(() => Ae(
273
+ Ut(s.props.uploadFile),
274
+ _t(s.props.uploadFile)
275
+ )), n = x(() => Z(t.props.getFileIcon) ? t.props.getFileIcon(s.props.uploadFile) : pe[d.value].icon), r = x(() => pe[d.value].fg), g = x(() => pe[d.value].bg), p = () => {
276
+ var h, v, f, I;
277
+ const o = (v = (h = t.slots).go) == null ? void 0 : v.call(h, { uploadFile: s.props.uploadFile });
278
+ return N(o) ? Oe(s.props.uploadFile) ? K("img", {
279
+ class: B(L, "thumb"),
280
280
  alt: s.props.uploadFile.name ?? "",
281
- src: ((k = s.props.uploadFile) == null ? void 0 : k.thumbUrl) ?? ((B = s.props.uploadFile) == null ? void 0 : B.url)
281
+ src: ((f = s.props.uploadFile) == null ? void 0 : f.thumbUrl) ?? ((I = s.props.uploadFile) == null ? void 0 : I.url)
282
282
  }) : null : o;
283
- }, l = () => {
284
- var h, r;
285
- const o = (r = (h = t.slots).goIcon) == null ? void 0 : r.call(h, { uploadFile: s.props.uploadFile });
286
- return M(o) ? null : o;
287
- }, m = () => J(
288
- dt,
283
+ }, u = () => {
284
+ var h, v;
285
+ const o = (v = (h = t.slots).goIcon) == null ? void 0 : v.call(h, { uploadFile: s.props.uploadFile });
286
+ return N(o) ? null : o;
287
+ }, c = () => K(
288
+ ft,
289
289
  {
290
290
  size: t.goSize.value,
291
291
  icon: n.value,
292
- fg: u.value,
293
- bg: v.value
292
+ fg: r.value,
293
+ bg: g.value
294
294
  },
295
295
  {
296
296
  default: p,
297
- icon: l
297
+ icon: u
298
298
  }
299
299
  );
300
- return (o, h) => (U(), L(m));
300
+ return (o, h) => (U(), R(c));
301
301
  }
302
- }), zt = /* @__PURE__ */ G({
303
- ...V("UploadListItemCard"),
302
+ }), It = /* @__PURE__ */ V({
303
+ ...W("UploadListItemCard"),
304
304
  __name: "UploadListItemCard",
305
305
  setup(e) {
306
- const s = le(), t = ye(), d = () => {
306
+ const s = oe(), t = ye(), d = () => {
307
307
  var o, h;
308
- const l = (h = (o = s.slots).description) == null ? void 0 : h.call(o, { uploadFile: t.props.uploadFile });
309
- let m;
310
- if (M(l) || (m = l), t.props.uploadFile.description && (m = t.props.uploadFile.description), m)
311
- return J("div", { class: T(z, "description") }, m);
308
+ const u = (h = (o = s.slots).description) == null ? void 0 : h.call(o, { uploadFile: t.props.uploadFile });
309
+ let c;
310
+ if (N(u) || (c = u), t.props.uploadFile.description && (c = t.props.uploadFile.description), c)
311
+ return K("div", { class: B(L, "description") }, c);
312
312
  }, n = () => {
313
- var m, o;
314
- const l = (o = (m = s.slots).title) == null ? void 0 : o.call(m, { uploadFile: t.props.uploadFile });
315
- return M(l) ? t.label.value : l;
316
- }, u = () => {
317
- var l;
318
- if (Y(s.props.onDownload))
313
+ var c, o;
314
+ const u = (o = (c = s.slots).title) == null ? void 0 : o.call(c, { uploadFile: t.props.uploadFile });
315
+ return N(u) ? t.label.value : u;
316
+ }, r = () => {
317
+ var u;
318
+ if (Z(s.props.onDownload))
319
319
  return s.props.onDownload(t.props.uploadFile);
320
- if ((l = t.props.uploadFile) != null && l.url && typeof window < "u")
320
+ if ((u = t.props.uploadFile) != null && u.url && typeof window < "u")
321
321
  return window.open(t.props.uploadFile.url);
322
- }, v = x(() => {
323
- var l, m;
324
- return (l = t.props.uploadFile) != null && l.percent && ((m = t.props.uploadFile) == null ? void 0 : m.status) !== "waiting" ? `${(t.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
325
- }), p = (l, m) => {
326
- var h, r, k, B;
327
- const o = (r = (h = s.slots) == null ? void 0 : h.actions) == null ? void 0 : r.call(h, {
322
+ }, g = x(() => {
323
+ var u, c;
324
+ return (u = t.props.uploadFile) != null && u.percent && ((c = t.props.uploadFile) == null ? void 0 : c.status) !== "waiting" ? `${(t.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
325
+ }), p = (u, c) => {
326
+ var h, v, f, I;
327
+ const o = (v = (h = s.slots) == null ? void 0 : h.actions) == null ? void 0 : v.call(h, {
328
328
  ...s,
329
329
  uploadFile: t.props.uploadFile,
330
- downloadFile: u
330
+ downloadFile: r
331
331
  });
332
- return M(o) ? (B = (k = m.slots) == null ? void 0 : k.default) == null ? void 0 : B.call(k, {}) : o;
332
+ return N(o) ? (I = (f = c.slots) == null ? void 0 : f.default) == null ? void 0 : I.call(f, {}) : o;
333
333
  };
334
- return (l, m) => {
334
+ return (u, c) => {
335
335
  var o;
336
- return U(), N(fe, null, [
337
- a(s).props.go ? (U(), L(_t, { key: 0 })) : P("", !0),
338
- ["error", "done"].includes(a(t).props.uploadFile.status) ? (U(), N("div", {
336
+ return U(), G(fe, null, [
337
+ i(s).props.go ? (U(), R(zt, { key: 0 })) : j("", !0),
338
+ ["error", "done"].includes(i(t).props.uploadFile.status) ? (U(), G("div", {
339
339
  key: 2,
340
- class: q(a(T)(a(z), "content"))
340
+ class: D(i(B)(i(L), "content"))
341
341
  }, [
342
- Ce("div", {
343
- class: q(a(T)(a(z), "title"))
342
+ _e("div", {
343
+ class: D(i(B)(i(L), "title"))
344
344
  }, [
345
- O(n)
345
+ q(n)
346
346
  ], 2),
347
- a(t).props.uploadFile.status === "error" ? (U(), L(mt, {
347
+ i(t).props.uploadFile.status === "error" ? (U(), R(gt, {
348
348
  key: 0,
349
349
  message: "Failed",
350
350
  status: "error"
351
- })) : a(s).props.size !== "md" ? (U(), L(d, { key: 1 })) : P("", !0)
352
- ], 2)) : (U(), L(Se, {
351
+ })) : i(s).props.size !== "md" ? (U(), R(d, { key: 1 })) : j("", !0)
352
+ ], 2)) : (U(), R(Se, {
353
353
  key: 1,
354
- class: q(a(T)(a(z), "progress")),
355
- percent: ((o = a(t).props.uploadFile) == null ? void 0 : o.percent) ?? 0,
356
- label: a(t).label.value,
357
- helperText: v.value,
358
- helperTextCls: a(T)(a(z), "percent")
354
+ class: D(i(B)(i(L), "progress")),
355
+ percent: ((o = i(t).props.uploadFile) == null ? void 0 : o.percent) ?? 0,
356
+ label: i(t).label.value,
357
+ helperText: g.value,
358
+ helperTextCls: i(B)(i(L), "percent")
359
359
  }, {
360
360
  label: te(() => [
361
- O(n)
361
+ q(n)
362
362
  ]),
363
363
  _: 1
364
364
  }, 8, ["class", "percent", "label", "helperText", "helperTextCls"])),
365
- O(p, null, {
365
+ q(p, null, {
366
366
  default: te(() => {
367
367
  var h;
368
368
  return [
369
- a(t).props.uploadFile.status === "done" ? (U(), L(H, {
369
+ i(t).props.uploadFile.status === "done" ? (U(), R(J, {
370
370
  key: 0,
371
371
  icon: "tabler:download",
372
372
  size: "sm",
373
373
  type: "ghost",
374
374
  color: "neutral",
375
- onClick: D(u, ["stop"])
376
- })) : P("", !0),
377
- a(s).props.pausableChunked && a(t).props.uploadFile.status === "uploading" && ((h = a(t).props.uploadFile.chunks) != null && h.length) && a(Y)(a(t).props.uploadFile.cancel) ? (U(), L(H, {
375
+ onClick: M(r, ["stop"])
376
+ })) : j("", !0),
377
+ i(s).props.pausableChunked && i(t).props.uploadFile.status === "uploading" && ((h = i(t).props.uploadFile.chunks) != null && h.length) && i(Z)(i(t).props.uploadFile.cancel) ? (U(), R(J, {
378
378
  key: 1,
379
379
  icon: "tabler:pause",
380
380
  size: "sm",
381
381
  type: "ghost",
382
382
  color: "neutral",
383
- onClick: D(a(t).props.uploadFile.cancel, ["stop"])
384
- }, null, 8, ["onClick"])) : a(s).canRunUpload(a(t).props.uploadFile.uid) ? (U(), L(H, {
383
+ onClick: M(i(t).props.uploadFile.cancel, ["stop"])
384
+ }, null, 8, ["onClick"])) : i(s).canRunUpload(i(t).props.uploadFile.uid) ? (U(), R(J, {
385
385
  key: 2,
386
- icon: ["paused", "waiting"].includes(a(t).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
386
+ icon: ["paused", "waiting"].includes(i(t).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
387
387
  size: "sm",
388
388
  type: "ghost",
389
389
  color: "neutral",
390
- onClick: m[0] || (m[0] = D((r) => a(s).resetRequest(a(t).props.uploadFile.uid), ["stop"]))
391
- }, null, 8, ["icon"])) : P("", !0),
392
- O(H, {
393
- icon: ["done", "error"].includes(a(t).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
390
+ onClick: c[0] || (c[0] = M((v) => i(s).resetRequest(i(t).props.uploadFile.uid), ["stop"]))
391
+ }, null, 8, ["icon"])) : j("", !0),
392
+ q(J, {
393
+ icon: ["done", "error"].includes(i(t).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
394
394
  size: "sm",
395
395
  type: "ghost",
396
396
  color: "neutral",
397
- onClick: m[1] || (m[1] = D((r) => a(s).remove(a(t).props.uploadFile.uid), ["stop"]))
397
+ onClick: c[1] || (c[1] = M((v) => i(s).remove(i(t).props.uploadFile.uid), ["stop"]))
398
398
  }, null, 8, ["icon"])
399
399
  ];
400
400
  }),
@@ -403,66 +403,66 @@ const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("B
403
403
  ], 64);
404
404
  };
405
405
  }
406
- }), [ye, It] = me("UploadItem"), Lt = /* @__PURE__ */ G({
407
- ...V("UploadListItem"),
406
+ }), [ye, Lt] = me("UploadItem"), Tt = /* @__PURE__ */ V({
407
+ ...W("UploadListItem"),
408
408
  __name: "UploadListItem",
409
409
  props: {
410
410
  uploadFile: {}
411
411
  },
412
412
  setup(e) {
413
- const s = e, t = Be(z, {
413
+ const s = e, t = Be(L, {
414
414
  variants: {
415
- size: W($e, z),
416
- listType: W(
415
+ size: H($e, L),
416
+ listType: H(
417
417
  je,
418
- z
418
+ L
419
419
  ),
420
- type: W(bt, z),
421
- status: W(wt, z)
420
+ type: H(xt, L),
421
+ status: H(bt, L)
422
422
  }
423
423
  }), d = x(() => {
424
- var v, p, l;
425
- return ((v = s.uploadFile) == null ? void 0 : v.name) ?? ((l = (p = s.uploadFile) == null ? void 0 : p.originFileObj) == null ? void 0 : l.name);
426
- }), n = le();
427
- It({
424
+ var g, p, u;
425
+ return ((g = s.uploadFile) == null ? void 0 : g.name) ?? ((u = (p = s.uploadFile) == null ? void 0 : p.originFileObj) == null ? void 0 : u.name);
426
+ }), n = oe();
427
+ Lt({
428
428
  props: s,
429
429
  label: d
430
430
  });
431
- const u = () => {
432
- var p, l;
433
- const v = (l = (p = n.slots).listItem) == null ? void 0 : l.call(p, { ...n, uploadFile: s.uploadFile });
434
- return M(v) ? n.props.listType === "card" ? J(zt) : J(Ct) : v;
431
+ const r = () => {
432
+ var p, u;
433
+ const g = (u = (p = n.slots).listItem) == null ? void 0 : u.call(p, { ...n, uploadFile: s.uploadFile });
434
+ return N(g) ? n.props.listType === "card" ? K(It) : K(Ct) : g;
435
435
  };
436
- return (v, p) => {
437
- var l, m, o;
438
- return U(), N("div", _e({
439
- class: a(t)({
440
- size: a(n).props.size,
441
- listType: a(n).props.listType,
442
- type: a(n).props.type,
443
- status: (l = v.uploadFile) == null ? void 0 : l.status
436
+ return (g, p) => {
437
+ var u, c, o;
438
+ return U(), G("div", Ce({
439
+ class: i(t)({
440
+ size: i(n).props.size,
441
+ listType: i(n).props.listType,
442
+ type: i(n).props.type,
443
+ status: (u = g.uploadFile) == null ? void 0 : u.status
444
444
  })
445
- }, { ...((o = (m = a(n).props).getUploadItemProps) == null ? void 0 : o.call(m, v.uploadFile)) ?? {} }), [
446
- O(u)
445
+ }, { ...((o = (c = i(n).props).getUploadItemProps) == null ? void 0 : o.call(c, g.uploadFile)) ?? {} }), [
446
+ q(r)
447
447
  ], 16);
448
448
  };
449
449
  }
450
- }), Tt = (e, s, t = 1024 * 1024) => {
450
+ }), Rt = (e, s, t = 1024 * 1024) => {
451
451
  const d = [];
452
- let n = 0, u = 0;
452
+ let n = 0, r = 0;
453
453
  for (; n < e.size; ) {
454
- const v = Math.min(n + t, e.size), p = e.slice(n, v);
454
+ const g = Math.min(n + t, e.size), p = e.slice(n, g);
455
455
  d.push({
456
456
  chunk: p,
457
- chunkSize: v - n,
458
- index: u,
457
+ chunkSize: g - n,
458
+ index: r,
459
459
  uid: s(),
460
460
  status: "waiting"
461
- }), n = v, u++;
461
+ }), n = g, r++;
462
462
  }
463
463
  return d;
464
464
  }, qe = (e, { getUid: s, chunkFile: t, chunkSize: d }) => {
465
- if (ne(e)) {
465
+ if (se(e)) {
466
466
  let n;
467
467
  if (e instanceof File)
468
468
  n = e;
@@ -480,9 +480,9 @@ const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("B
480
480
  type: e.type ?? ""
481
481
  }), n.lastModified = (/* @__PURE__ */ new Date()).getTime(), n.name = e.name ?? "", n.webkitRelativePath = "";
482
482
  }
483
- if (ne(n) && n instanceof Blob) {
484
- let u = [];
485
- return t && (u = Tt(
483
+ if (se(n) && n instanceof Blob) {
484
+ let r = [];
485
+ return t && (r = Rt(
486
486
  n,
487
487
  () => (s == null ? void 0 : s(!0)) ?? de(void 0, !0),
488
488
  d
@@ -490,8 +490,8 @@ const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("B
490
490
  uid: e.uid ?? (s == null ? void 0 : s()) ?? de(void 0, !0),
491
491
  originFileObj: n,
492
492
  status: "waiting",
493
- chunks: u != null && u.length && (u == null ? void 0 : u.length) > 1 ? u : void 0,
494
- chunksCount: u != null && u.length && (u == null ? void 0 : u.length) > 1 ? u.length : void 0,
493
+ chunks: r != null && r.length && (r == null ? void 0 : r.length) > 1 ? r : void 0,
494
+ chunksCount: r != null && r.length && (r == null ? void 0 : r.length) > 1 ? r.length : void 0,
495
495
  name: n == null ? void 0 : n.name,
496
496
  type: n == null ? void 0 : n.type,
497
497
  size: n == null ? void 0 : n.size,
@@ -500,52 +500,52 @@ const Pe = it("upload"), ee = T(Pe, "list"), z = T(ee, "item"), [vt, ht] = me("B
500
500
  };
501
501
  }
502
502
  }
503
- }, Rt = (e, s) => {
504
- if (ne(e))
503
+ }, Bt = (e, s) => {
504
+ if (se(e))
505
505
  return e instanceof Blob || e instanceof File ? qe(e, s) : (!e.uid && !Object.isFrozen(e) && (e.uid = s.getUid()), e);
506
506
  }, De = (e, s) => {
507
507
  if (e && s) {
508
- const t = Array.isArray(s) ? s : s.split(","), d = (e == null ? void 0 : e.name) || "", n = (e == null ? void 0 : e.type) || "", u = n.replace(/\/.*$/, "");
509
- return t.some((v) => {
510
- const p = v.trim();
511
- if (/^\*(?<temp1>\/\*)?$/.test(v))
508
+ const t = Array.isArray(s) ? s : s.split(","), d = (e == null ? void 0 : e.name) || "", n = (e == null ? void 0 : e.type) || "", r = n.replace(/\/.*$/, "");
509
+ return t.some((g) => {
510
+ const p = g.trim();
511
+ if (/^\*(?<temp1>\/\*)?$/.test(g))
512
512
  return !0;
513
513
  if (p.charAt(0) === ".") {
514
- const l = d.toLowerCase(), m = p.toLowerCase();
515
- let o = [m];
516
- return (m === ".jpg" || m === ".jpeg") && (o = [".jpg", ".jpeg"]), o.some((h) => l.endsWith(h));
514
+ const u = d.toLowerCase(), c = p.toLowerCase();
515
+ let o = [c];
516
+ return (c === ".jpg" || c === ".jpeg") && (o = [".jpg", ".jpeg"]), o.some((h) => u.endsWith(h));
517
517
  }
518
- return /\/\*$/.test(p) ? u === p.replace(/\/.*$/, "") : !!(n === p || /^\w+$/.test(p));
518
+ return /\/\*$/.test(p) ? r === p.replace(/\/.*$/, "") : !!(n === p || /^\w+$/.test(p));
519
519
  });
520
520
  }
521
521
  return !0;
522
- }, E = 200;
523
- function Bt(e) {
522
+ }, O = 200;
523
+ function St(e) {
524
524
  return new Promise((s) => {
525
- if (!e.type || !oe(ie(e.type))) {
525
+ if (!e.type || !ne(le(e.type))) {
526
526
  s("");
527
527
  return;
528
528
  }
529
529
  const t = document.createElement("canvas");
530
- t.width = E, t.height = E, t.style.cssText = `position: fixed; left: 0; top: 0; width: ${E}px; height: ${E}px; z-index: 9999; display: none;`, document.body.appendChild(t);
530
+ t.width = O, t.height = O, t.style.cssText = `position: fixed; left: 0; top: 0; width: ${O}px; height: ${O}px; z-index: 9999; display: none;`, document.body.appendChild(t);
531
531
  const d = t.getContext("2d"), n = new Image();
532
532
  if (n.onload = () => {
533
- const { width: u, height: v } = n;
534
- let p = E, l = E, m = 0, o = 0;
535
- u > v ? (l = v * (E / u), o = -(l - p) / 2) : (p = u * (E / v), m = -(p - l) / 2), d.drawImage(n, m, o, p, l);
533
+ const { width: r, height: g } = n;
534
+ let p = O, u = O, c = 0, o = 0;
535
+ r > g ? (u = g * (O / r), o = -(u - p) / 2) : (p = r * (O / g), c = -(p - u) / 2), d.drawImage(n, c, o, p, u);
536
536
  const h = t.toDataURL();
537
537
  document.body.removeChild(t), s(h);
538
538
  }, n.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
539
- const u = new FileReader();
540
- u.addEventListener("load", () => {
541
- u.result && (n.src = u.result);
542
- }), u.readAsDataURL(e);
539
+ const r = new FileReader();
540
+ r.addEventListener("load", () => {
541
+ r.result && (n.src = r.result);
542
+ }), r.readAsDataURL(e);
543
543
  } else
544
544
  n.src = window.URL.createObjectURL(e);
545
545
  });
546
546
  }
547
- const Me = /* @__PURE__ */ G({
548
- ...V("UploadList"),
547
+ const Me = /* @__PURE__ */ V({
548
+ ...W("UploadList"),
549
549
  __name: "UploadList",
550
550
  props: {
551
551
  onDownload: {},
@@ -572,130 +572,130 @@ const Me = /* @__PURE__ */ G({
572
572
  },
573
573
  emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
574
574
  setup(e, { expose: s, emit: t }) {
575
- const d = e, n = t, u = ze(), v = Ie(), p = yt(), l = x(() => (p == null ? void 0 : p.props) ?? d), m = x(() => l.value.maxCount ? Number(l.value.maxCount) : 0), o = x(
576
- () => l.value.listType !== "image" && l.value.pausableChunked
577
- ), h = x(
578
- () => l.value.accept ?? l.value.listType === "image" ? "image/*" : void 0
579
- ), r = se([]);
580
- let k = !1;
581
- ue(
582
- () => l.value.fileList,
583
- (i) => {
584
- var f, b;
585
- if (!k) {
586
- const _ = (b = (f = i ?? []) == null ? void 0 : f.map) == null ? void 0 : b.call(f, (I) => {
587
- if (I && ne(I))
588
- return Rt(I, {
575
+ const d = e, n = t, r = ze(), g = Ie(), p = kt(), u = (...l) => {
576
+ n(...l), p == null || p.emit(...l);
577
+ }, c = x(() => (p == null ? void 0 : p.props) ?? d), o = x(() => c.value.maxCount ? Number(c.value.maxCount) : 0), h = x(
578
+ () => c.value.listType !== "image" && c.value.pausableChunked
579
+ ), v = x(
580
+ () => c.value.accept ?? c.value.listType === "image" ? "image/*" : void 0
581
+ ), f = Y([]);
582
+ let I = !1;
583
+ ce(
584
+ () => c.value.fileList,
585
+ (l) => {
586
+ var m, b;
587
+ if (!I) {
588
+ const z = (b = (m = l ?? []) == null ? void 0 : m.map) == null ? void 0 : b.call(m, (T) => {
589
+ if (T && se(T))
590
+ return Bt(T, {
589
591
  getUid: Fe,
590
- chunkFile: o.value,
591
- chunkSize: l.value.chunkSize
592
+ chunkFile: h.value,
593
+ chunkSize: c.value.chunkSize
592
594
  });
593
595
  }).filter(Boolean);
594
- ct(_, r.value) || (k = !0, r.value = _, be(() => k = !1));
596
+ ct(z, f.value) || (I = !0, f.value = z, be(() => I = !1));
595
597
  }
596
598
  },
597
599
  { immediate: !0, deep: !0 }
598
- ), ue(
599
- r,
600
- (i) => {
601
- k || (k = !0, n("update:fileList", i ?? []), be(() => k = !1));
600
+ ), ce(
601
+ f,
602
+ (l) => {
603
+ I || (I = !0, u("update:fileList", l ?? []), be(() => I = !1));
602
604
  },
603
605
  { immediate: !0, deep: !0 }
604
606
  );
605
- const B = (i) => r.value.find((f) => i && f.uid === i), ae = (i) => r.value.findIndex((f) => i && f.uid === i), Ge = (i) => {
606
- if (i) {
607
- const f = ae(i.uid);
608
- f === -1 && (!m.value || m.value > r.value.length) ? r.value.push(i) : f > -1 && r.value.splice(f, 0, i), n("change", {
609
- file: C(i),
610
- fileList: C(r.value),
607
+ const ie = (l) => f.value.find((m) => l && m.uid === l), ae = (l) => f.value.findIndex((m) => l && m.uid === l), Ge = (l) => {
608
+ if (l) {
609
+ const m = ae(l.uid);
610
+ m === -1 && (!o.value || o.value > f.value.length) ? f.value.push(l) : m > -1 && f.value.splice(m, 0, l), u("change", {
611
+ file: C(l),
612
+ fileList: C(f.value),
611
613
  event: "add"
612
614
  });
613
615
  }
614
- }, Ve = (i) => {
615
- gt(i) && i.filter((f) => !l.value.directory || De(f, h.value)).forEach((f) => {
616
+ }, Ve = (l) => {
617
+ vt(l) && l.filter((m) => !c.value.directory || De(m, v.value)).forEach((m) => {
616
618
  Ge(
617
- qe(f, {
619
+ qe(m, {
618
620
  getUid: Fe,
619
- chunkFile: o.value,
620
- chunkSize: l.value.chunkSize
621
+ chunkFile: h.value,
622
+ chunkSize: c.value.chunkSize
621
623
  })
622
624
  );
623
625
  });
624
- };
625
- let $ = [];
626
- const ke = () => {
627
- var i;
628
- return l.value.uploadOnSelect || l.value.listType === "image" ? ((i = r.value) == null ? void 0 : i.filter((f) => $.includes(f.uid) ? !1 : f.status === "waiting" && f.originFileObj)) ?? [] : [];
629
- }, j = (i, f) => {
630
- if (i && f) {
631
- const b = ae(i);
632
- b > -1 && (r.value[b] = {
633
- ...r.value[b],
634
- ...f
626
+ }, S = Y([]), ke = () => {
627
+ var l;
628
+ return c.value.uploadOnSelect || c.value.listType === "image" ? ((l = f.value) == null ? void 0 : l.filter((m) => S.value.includes(m.uid) ? !1 : m.status === "waiting" && m.originFileObj)) ?? [] : [];
629
+ }, A = (l, m) => {
630
+ if (l && m) {
631
+ const b = ae(l);
632
+ b > -1 && (f.value[b] = {
633
+ ...f.value[b],
634
+ ...m
635
635
  });
636
636
  }
637
- }, Z = (i) => {
638
- $ = $.filter((f) => f !== i);
639
- }, re = async (i) => {
640
- var f, b, _, I;
641
- if (i && r.value) {
642
- const y = B(i), et = o.value && ((f = y == null ? void 0 : y.chunks) == null ? void 0 : f.length) && (y == null ? void 0 : y.chunks.length) > 1 && (y == null ? void 0 : y.status) === "uploading" && (y == null ? void 0 : y.chunks.some((Q) => Q.status === "waiting"));
643
- if (y && Y(l.value.action) && (!$.length || l.value.parallelUpload || et)) {
644
- $.includes(i) || $.push(i);
645
- const Q = new AbortController(), tt = () => {
646
- const w = () => {
647
- Z(i), Q.abort();
648
- }, c = C(y);
649
- if (o.value && c.chunks && c.chunks.length > 1) {
650
- const g = c.chunks.findIndex((R) => R.status === "waiting");
651
- g > -1 && (c.chunks[g] = {
652
- ...c.chunks[g],
637
+ }, We = (l) => {
638
+ S.value = S.value.filter((m) => m !== l);
639
+ }, re = async (l) => {
640
+ var m, b, z, T;
641
+ if (l && f.value) {
642
+ const k = ie(l), tt = h.value && ((m = k == null ? void 0 : k.chunks) == null ? void 0 : m.length) && (k == null ? void 0 : k.chunks.length) > 1 && (k == null ? void 0 : k.status) === "uploading" && (k == null ? void 0 : k.chunks.some((Q) => Q.status === "waiting"));
643
+ if (k && Z(c.value.action) && (!S.value.length || c.value.parallelUpload || tt)) {
644
+ S.value.includes(l) || S.value.push(l);
645
+ const Q = new AbortController(), st = () => {
646
+ const _ = () => {
647
+ Q.abort();
648
+ }, y = C(k);
649
+ if (h.value && y.chunks && y.chunks.length > 1) {
650
+ const a = y.chunks.findIndex((w) => w.status === "waiting");
651
+ a > -1 && (y.chunks[a] = {
652
+ ...y.chunks[a],
653
653
  status: "uploading",
654
- cancel: w
654
+ cancel: _
655
655
  });
656
656
  }
657
- j(c.uid, {
657
+ A(y.uid, {
658
658
  status: "uploading",
659
- cancel: w
659
+ cancel: _
660
660
  });
661
661
  };
662
662
  let F = {
663
663
  signal: Q.signal,
664
664
  onUploadProgress() {
665
665
  },
666
- uid: y.uid
666
+ uid: k.uid
667
667
  };
668
- if (o.value && y.chunks && y.chunks.length > 1 && y.chunks.some((w) => w.status === "waiting")) {
669
- const w = y.chunks.find((c) => c.status === "waiting");
670
- w != null && w.uid && (F = {
668
+ if (h.value && k.chunks && k.chunks.length > 1 && k.chunks.some((_) => _.status === "waiting")) {
669
+ const _ = k.chunks.find((y) => y.status === "waiting");
670
+ _ != null && _.uid && (F = {
671
671
  ...F,
672
- ...pt(w, ["chunk", "chunkSize", "index"]),
673
- chunkUid: w.uid,
674
- onUploadProgress(c) {
675
- var R, K, A, we;
676
- const g = C(
677
- r.value.find((X) => X.uid === y.uid)
672
+ ...dt(_, ["chunk", "chunkSize", "index"]),
673
+ chunkUid: _.uid,
674
+ onUploadProgress(y) {
675
+ var w, $, E, we;
676
+ const a = C(
677
+ f.value.find((X) => X.uid === k.uid)
678
678
  );
679
- if (g) {
680
- const X = (R = g.chunks) == null ? void 0 : R.findIndex(
681
- (ce) => ce.uid === w.uid
679
+ if (a) {
680
+ const X = (w = a.chunks) == null ? void 0 : w.findIndex(
681
+ (ue) => ue.uid === _.uid
682
682
  );
683
- if (X !== void 0 && ((K = g.chunks) != null && K[X]) && (g.chunks[X].percent = Math.round(
684
- c.loaded * 100 / c.total
685
- )), (A = g.chunks) != null && A.length && ((we = g.chunks) == null ? void 0 : we.length) > 1) {
686
- const ce = g.chunks.reduce((st, nt) => st + (nt.percent ?? 0), 0);
687
- g.percent = Math.min(
688
- Math.max(
689
- ce / g.chunks.length,
690
- 0
691
- ),
683
+ if (X !== void 0 && (($ = a.chunks) != null && $[X]) && (a.chunks[X].percent = Math.round(
684
+ y.loaded * 100 / y.total
685
+ )), (E = a.chunks) != null && E.length && ((we = a.chunks) == null ? void 0 : we.length) > 1) {
686
+ const ue = a.chunks.reduce(
687
+ (nt, ot) => nt + (ot.percent ?? 0),
688
+ 0
689
+ );
690
+ a.percent = Math.min(
691
+ Math.max(ue / a.chunks.length, 0),
692
692
  100
693
693
  );
694
694
  } else
695
- g.percent = Math.round(c.loaded * 100 / c.total);
696
- j(g.uid, {
697
- chunks: g.chunks,
698
- percent: g.percent
695
+ a.percent = Math.round(y.loaded * 100 / y.total);
696
+ A(a.uid, {
697
+ chunks: a.chunks,
698
+ percent: a.percent
699
699
  });
700
700
  }
701
701
  }
@@ -703,168 +703,170 @@ const Me = /* @__PURE__ */ G({
703
703
  } else
704
704
  F = {
705
705
  ...F,
706
- file: y.originFileObj,
707
- onUploadProgress(w) {
708
- const c = C(
709
- r.value.find((g) => g.uid === y.uid)
706
+ file: k.originFileObj,
707
+ onUploadProgress(_) {
708
+ const y = C(
709
+ f.value.find((a) => a.uid === k.uid)
710
710
  );
711
- c && j(c.uid, {
712
- percent: Math.round(w.loaded * 100 / w.total)
711
+ y && A(y.uid, {
712
+ percent: Math.round(_.loaded * 100 / _.total)
713
713
  });
714
714
  }
715
715
  };
716
- if (tt(), F.file || F.chunk) {
717
- n("createRequest", y), n("change", {
718
- file: C(y),
719
- fileList: C(r.value),
716
+ if (st(), F.file || F.chunk) {
717
+ u("createRequest", k), u("change", {
718
+ file: C(k),
719
+ fileList: C(f.value),
720
720
  event: "upload"
721
721
  });
722
+ let _ = !1;
722
723
  try {
723
- let w = await l.value.action(F);
724
+ let y = await c.value.action(F);
724
725
  try {
725
- typeof w == "string" && (w = JSON.parse(w));
726
+ typeof y == "string" && (y = JSON.parse(y));
726
727
  } catch {
727
728
  }
728
- let c = C(
729
- r.value.find((g) => g.uid === F.uid)
729
+ let a = C(
730
+ f.value.find((w) => w.uid === F.uid)
730
731
  );
731
- if (c) {
732
- let g = !1;
733
- if (F.chunkUid && ((b = c.chunks) != null && b.length) && c.chunks.length > 1) {
734
- const R = c.chunks.findIndex(
735
- (A) => A.uid === F.chunkUid
732
+ if (a) {
733
+ if (F.chunkUid && ((b = a.chunks) != null && b.length) && a.chunks.length > 1) {
734
+ const w = a.chunks.findIndex(
735
+ (E) => E.uid === F.chunkUid
736
736
  );
737
- c.chunks[R] && (c.chunks[R] = {
738
- ...c.chunks[R],
737
+ a.chunks[w] && (a.chunks[w] = {
738
+ ...a.chunks[w],
739
739
  cancel: void 0,
740
740
  status: "done",
741
- response: w ?? void 0
741
+ response: y ?? void 0
742
742
  });
743
- const K = c.chunks.every((A) => A.status === "done") ? "done" : "uploading";
744
- K === "done" ? c = {
745
- ...c,
743
+ const $ = a.chunks.every((E) => E.status === "done") ? "done" : "uploading";
744
+ $ === "done" ? a = {
745
+ ...a,
746
746
  cancel: void 0,
747
- status: K
748
- } : c.chunks.some((A) => A.status === "waiting") && (g = !0);
747
+ status: $
748
+ } : a.chunks.some((E) => E.status === "waiting") && (_ = !0);
749
749
  } else
750
- c = {
751
- ...c,
750
+ a = {
751
+ ...a,
752
752
  cancel: void 0,
753
753
  status: "done",
754
- response: w ?? void 0
754
+ response: y ?? void 0
755
755
  };
756
- j(F.uid, c), g ? await re(i) : Z(i);
756
+ A(F.uid, a), _ && await re(l);
757
757
  }
758
- } catch (w) {
759
- if (w.name === "CanceledError") {
760
- let c = C(
761
- r.value.find((g) => g.uid === F.uid)
758
+ } catch (y) {
759
+ if (y.name === "CanceledError") {
760
+ let a = C(
761
+ f.value.find((w) => w.uid === F.uid)
762
762
  );
763
- if (c) {
764
- if (F.chunkUid && ((_ = c.chunks) != null && _.length) && c.chunks.length > 1) {
765
- const g = c.chunks.findIndex(
766
- (R) => R.uid === F.chunkUid
763
+ if (a) {
764
+ if (F.chunkUid && ((z = a.chunks) != null && z.length) && a.chunks.length > 1) {
765
+ const w = a.chunks.findIndex(
766
+ ($) => $.uid === F.chunkUid
767
767
  );
768
- c.chunks[g] && (c.chunks[g] = {
769
- ...c.chunks[g],
768
+ a.chunks[w] && (a.chunks[w] = {
769
+ ...a.chunks[w],
770
770
  cancel: void 0,
771
771
  status: "waiting"
772
- }), c = {
773
- ...c,
772
+ }), a = {
773
+ ...a,
774
774
  cancel: void 0,
775
775
  status: "paused"
776
- }, n("change", {
777
- file: C(c),
778
- fileList: C(r.value),
776
+ }, u("change", {
777
+ file: C(a),
778
+ fileList: C(f.value),
779
779
  event: "paused"
780
780
  });
781
781
  } else
782
- c = {
783
- ...c,
782
+ a = {
783
+ ...a,
784
784
  cancel: void 0,
785
785
  status: "error"
786
- }, n("change", {
787
- file: C(c),
788
- fileList: C(r.value),
786
+ }, u("change", {
787
+ file: C(a),
788
+ fileList: C(f.value),
789
789
  event: "cancel"
790
790
  });
791
- j(F.uid, c), Z(i);
791
+ A(F.uid, a);
792
792
  }
793
793
  } else {
794
- let c = C(
795
- r.value.find((g) => g.uid === F.uid)
794
+ let a = C(
795
+ f.value.find((w) => w.uid === F.uid)
796
796
  );
797
- if (c) {
798
- if (F.chunkUid && ((I = c.chunks) != null && I.length) && c.chunks.length > 1) {
799
- const g = c.chunks.findIndex(
800
- (R) => R.uid === F.chunkUid
797
+ if (a) {
798
+ if (F.chunkUid && ((T = a.chunks) != null && T.length) && a.chunks.length > 1) {
799
+ const w = a.chunks.findIndex(
800
+ ($) => $.uid === F.chunkUid
801
801
  );
802
- c.chunks[g] && (c.chunks[g] = {
803
- ...c.chunks[g],
802
+ a.chunks[w] && (a.chunks[w] = {
803
+ ...a.chunks[w],
804
804
  cancel: void 0,
805
805
  status: "waiting"
806
806
  });
807
807
  }
808
- c = {
809
- ...c,
808
+ a = {
809
+ ...a,
810
810
  cancel: void 0,
811
811
  status: "error",
812
- error: w,
812
+ error: y,
813
813
  percent: 0
814
- }, n("change", {
815
- file: C(c),
816
- fileList: C(r.value),
814
+ }, u("change", {
815
+ file: C(a),
816
+ fileList: C(f.value),
817
817
  event: "failed"
818
- }), j(F.uid, c), Z(i);
818
+ }), A(F.uid, a);
819
819
  }
820
820
  }
821
+ } finally {
822
+ _ || We(l);
821
823
  }
822
824
  }
823
825
  }
824
826
  }
825
- }, We = async (i) => {
826
- if (i && r.value) {
827
- const f = B(i);
828
- if (f)
829
- return j(i, { status: "waiting" }), n("resetRequest", f), re(i);
827
+ }, He = async (l) => {
828
+ if (l && f.value) {
829
+ const m = ie(l);
830
+ if (m)
831
+ return A(l, { status: "waiting" }), u("resetRequest", m), re(l);
830
832
  }
831
- }, He = async (i) => {
832
- var f, b;
833
- if (i && r.value) {
834
- const _ = ae(i), I = C(r.value ?? []);
835
- _ > -1 && I[_] && ((b = (f = I[_]).cancel) == null || b.call(f), I.splice(_, 1), r.value = I, n("remove", I[_]), n("change", {
836
- file: I[_],
837
- fileList: C(r.value),
833
+ }, Je = async (l) => {
834
+ var m, b;
835
+ if (l && f.value) {
836
+ const z = ae(l), T = C(f.value ?? []);
837
+ z > -1 && T[z] && ((b = (m = T[z]).cancel) == null || b.call(m), T.splice(z, 1), f.value = T, u("remove", T[z]), u("change", {
838
+ file: T[z],
839
+ fileList: C(f.value),
838
840
  event: "remove"
839
841
  }));
840
842
  }
841
- }, Je = (i) => {
842
- if (l.value.parallelUpload || !$.length) {
843
- const f = B(i);
844
- if (f && (f.status === "paused" || f.status === "error" || (!l.value.uploadOnSelect || l.value.listType === "image") && f.status === "waiting"))
843
+ }, Ke = (l) => {
844
+ if (c.value.parallelUpload || !S.value.length) {
845
+ const m = ie(l);
846
+ if (m && (m.status === "paused" || m.status === "error" || (!c.value.uploadOnSelect || c.value.listType === "image") && m.status === "waiting"))
845
847
  return !0;
846
848
  }
847
849
  return !1;
848
- }, Ke = x(() => {
849
- switch (l.value.size) {
850
+ }, Xe = x(() => {
851
+ switch (c.value.size) {
850
852
  case "xlg":
851
853
  return "md";
852
854
  default:
853
855
  return "sm";
854
856
  }
855
- }), Xe = ut(() => {
856
- (l.value.parallelUpload && ke().length || !$.length) && ke().forEach((i) => re(i.uid)), (r.value || []).forEach((i) => {
857
- typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(i.originFileObj instanceof File || i.originFileObj instanceof Blob) || i.thumbUrl !== void 0 || !i.type || !oe(ie(i.type)) || (i.thumbUrl = "", Bt(i.originFileObj).then((f) => {
858
- const b = f || "";
859
- b !== i.thumbUrl && j(i == null ? void 0 : i.uid, {
857
+ }), Ye = pt(() => {
858
+ (c.value.parallelUpload && ke().length || !S.value.length) && ke().forEach((l) => re(l.uid)), (f.value || []).forEach((l) => {
859
+ typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(l.originFileObj instanceof File || l.originFileObj instanceof Blob) || l.thumbUrl !== void 0 || !l.type || !ne(le(l.type)) || (l.thumbUrl = "", St(l.originFileObj).then((m) => {
860
+ const b = m || "";
861
+ b !== l.thumbUrl && A(l == null ? void 0 : l.uid, {
860
862
  thumbUrl: b
861
863
  });
862
864
  }));
863
865
  });
864
866
  }, 50);
865
- ue(r, Xe, { deep: !0 });
866
- const Ye = x(() => {
867
- switch (l.value.size) {
867
+ ce([f, S], Ye, { deep: !0 });
868
+ const Ze = x(() => {
869
+ switch (c.value.size) {
868
870
  case "xlg":
869
871
  return "sm";
870
872
  case "lg":
@@ -872,88 +874,88 @@ const Me = /* @__PURE__ */ G({
872
874
  default:
873
875
  return "x2sm";
874
876
  }
875
- }), S = {
877
+ }), P = {
876
878
  props: (p == null ? void 0 : p.props) ?? d,
877
- attrs: (p == null ? void 0 : p.attrs) ?? v,
878
- slots: (p == null ? void 0 : p.slots) ?? u,
879
- emit: (p == null ? void 0 : p.emit) ?? n,
880
- fileList: lt(r),
881
- progressSize: Ye,
882
- getAccept: h,
883
- goSize: Ke,
884
- resetRequest: We,
885
- canRunUpload: Je,
886
- remove: He,
879
+ attrs: (p == null ? void 0 : p.attrs) ?? g,
880
+ slots: (p == null ? void 0 : p.slots) ?? r,
881
+ emit: (p == null ? void 0 : p.emit) ?? u,
882
+ fileList: it(f),
883
+ progressSize: Ze,
884
+ getAccept: v,
885
+ goSize: Xe,
886
+ resetRequest: He,
887
+ canRunUpload: Ke,
888
+ remove: Je,
887
889
  addFiles: Ve
888
890
  };
889
- kt(S);
890
- const Ze = Be(ee, {
891
+ wt(P);
892
+ const Qe = Be(ee, {
891
893
  variants: {
892
- size: W($e, ee),
893
- listType: W(je, ee)
894
+ size: H($e, ee),
895
+ listType: H(je, ee)
894
896
  }
895
- }), Qe = () => {
896
- var f, b;
897
- const i = (b = (f = S.slots).list) == null ? void 0 : b.call(f, S);
898
- return M(i) ? S.fileList.value.map(
899
- (_) => J(Lt, { uploadFile: _, key: _.uid })
900
- ) : i;
897
+ }), et = () => {
898
+ var m, b;
899
+ const l = (b = (m = P.slots).list) == null ? void 0 : b.call(m, P);
900
+ return N(l) ? P.fileList.value.map(
901
+ (z) => K(Tt, { uploadFile: z, key: z.uid })
902
+ ) : l;
901
903
  };
902
- return s(S), (i, f) => {
904
+ return s(P), (l, m) => {
903
905
  var b;
904
- return (b = S.fileList.value) != null && b.length ? (U(), N("div", {
906
+ return (b = P.fileList.value) != null && b.length ? (U(), G("div", {
905
907
  key: 0,
906
- class: q(
907
- a(ge)(
908
- a(Ze)({
909
- size: S.props.size,
910
- listType: S.props.listType
908
+ class: D(
909
+ i(ge)(
910
+ i(Qe)({
911
+ size: P.props.size,
912
+ listType: P.props.listType
911
913
  }),
912
- S.props.fileListCls
914
+ P.props.fileListCls
913
915
  )
914
916
  )
915
917
  }, [
916
- O(Qe)
917
- ], 2)) : P("", !0);
918
+ q(et)
919
+ ], 2)) : j("", !0);
918
920
  };
919
921
  }
920
- }), St = (e) => new Promise((s) => {
922
+ }), Pt = (e) => new Promise((s) => {
921
923
  e.file((t) => {
922
924
  e.fullPath && !t.webkitRelativePath && Object.defineProperty(t, "webkitRelativePath", {
923
925
  value: e.fullPath.replace(/^\//, ""),
924
926
  writable: !1
925
927
  }), s(t);
926
928
  });
927
- }), Pt = (e) => {
929
+ }), $t = (e) => {
928
930
  const s = e.createReader(), t = [];
929
931
  return new Promise((d) => {
930
932
  const n = () => {
931
- s.readEntries((u) => {
932
- u.length === 0 ? d(t) : (t.push(...u), n());
933
+ s.readEntries((r) => {
934
+ r.length === 0 ? d(t) : (t.push(...r), n());
933
935
  });
934
936
  };
935
937
  n();
936
938
  });
937
- }, $t = async (e) => {
939
+ }, jt = async (e) => {
938
940
  const s = [], t = async (d) => {
939
941
  if (d.isFile) {
940
- const n = await St(d);
942
+ const n = await Pt(d);
941
943
  s.push(n);
942
944
  } else if (d.isDirectory) {
943
- const n = await Pt(d);
945
+ const n = await $t(d);
944
946
  await Promise.all(n.map(t));
945
947
  }
946
948
  };
947
949
  return await Promise.all(
948
950
  e.map((d) => {
949
- var u;
950
- const n = (u = d.webkitGetAsEntry) == null ? void 0 : u.call(d);
951
+ var r;
952
+ const n = (r = d.webkitGetAsEntry) == null ? void 0 : r.call(d);
951
953
  if (n)
952
954
  return t(n);
953
955
  }).filter(Boolean)
954
956
  ), s;
955
- }, jt = ["accept", "webkitdirectory", "multiple", "value", "disabled"], Ne = /* @__PURE__ */ G({
956
- ...V("UploadTrigger"),
957
+ }, At = ["accept", "webkitdirectory", "multiple", "value", "disabled"], Ne = /* @__PURE__ */ V({
958
+ ...W("UploadTrigger"),
957
959
  __name: "UploadTrigger",
958
960
  props: {
959
961
  directory: { type: Boolean },
@@ -964,48 +966,48 @@ const Me = /* @__PURE__ */ G({
964
966
  },
965
967
  emits: ["addFiles"],
966
968
  setup(e, { emit: s }) {
967
- const t = s, d = e, { getDisabled: n } = ft(), u = se(), v = (r) => {
968
- const { files: k } = r.target;
969
- t("addFiles", Array.prototype.slice.call(k)), p.value && (p.value.value = "");
970
- }, p = se(), l = () => {
971
- var r;
972
- (r = p.value) == null || r.click();
973
- }, m = (r) => {
974
- r.key === "Enter" && l();
975
- }, o = async (r) => {
976
- if (r.preventDefault(), r.type === "dragover")
969
+ const t = s, d = e, { getDisabled: n } = mt(), r = Y(), g = (v) => {
970
+ const { files: f } = v.target;
971
+ t("addFiles", Array.prototype.slice.call(f)), p.value && (p.value.value = "");
972
+ }, p = Y(), u = () => {
973
+ var v;
974
+ (v = p.value) == null || v.click();
975
+ }, c = (v) => {
976
+ v.key === "Enter" && u();
977
+ }, o = async (v) => {
978
+ if (v.preventDefault(), v.type === "dragover")
977
979
  return;
978
- let k = [];
979
- r.dataTransfer && (d.directory ? k = await $t(Array.prototype.slice.call(r.dataTransfer.items)) : k = Array.prototype.slice.call(r.dataTransfer.files)), d.multiple || (k = k.slice(0, 1)), t(
980
+ let f = [];
981
+ v.dataTransfer && (d.directory ? f = await jt(Array.prototype.slice.call(v.dataTransfer.items)) : f = Array.prototype.slice.call(v.dataTransfer.files)), d.multiple || (f = f.slice(0, 1)), t(
980
982
  "addFiles",
981
- k.filter((B) => De(B, d.accept))
983
+ f.filter((I) => De(I, d.accept))
982
984
  );
983
985
  }, h = x(() => n.value ? {} : {
984
- onClick: l,
985
- onKeydown: m,
986
+ onClick: u,
987
+ onKeydown: c,
986
988
  onDrop: o,
987
989
  onDragover: o
988
990
  });
989
- return (r, k) => (U(), N("div", _e({
990
- class: a(ge)(d.class)
991
+ return (v, f) => (U(), G("div", Ce({
992
+ class: i(ge)(d.class)
991
993
  }, h.value), [
992
- Le(r.$slots, "default", Te(Re({ ...h.value, disabled: a(n), tabindex: "0" }))),
993
- Ce("input", {
994
+ Le(v.$slots, "default", Te(Re({ ...h.value, disabled: i(n), tabindex: "0" }))),
995
+ _e("input", {
994
996
  type: "file",
995
- accept: r.accept,
996
- webkitdirectory: r.directory,
997
- multiple: r.multiple,
998
- value: u.value,
999
- disabled: a(n),
1000
- onChange: v,
997
+ accept: v.accept,
998
+ webkitdirectory: v.directory,
999
+ multiple: v.multiple,
1000
+ value: r.value,
1001
+ disabled: i(n),
1002
+ onChange: g,
1001
1003
  ref_key: "inputRef",
1002
1004
  ref: p,
1003
1005
  style: { display: "none" }
1004
- }, null, 40, jt)
1006
+ }, null, 40, At)
1005
1007
  ], 16));
1006
1008
  }
1007
- }), Ue = T(Pe, "file"), Fe = (e) => de(e ? T(Ue, "chunk") : Ue, !0), At = /* @__PURE__ */ G({
1008
- ...V("Upload", !1),
1009
+ }), Ue = B(Pe, "file"), Fe = (e) => de(e ? B(Ue, "chunk") : Ue, !0), Et = /* @__PURE__ */ V({
1010
+ ...W("Upload", !1),
1009
1011
  __name: "Upload",
1010
1012
  props: {
1011
1013
  onDownload: {},
@@ -1032,86 +1034,86 @@ const Me = /* @__PURE__ */ G({
1032
1034
  },
1033
1035
  emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
1034
1036
  setup(e, { expose: s, emit: t }) {
1035
- const d = e, n = t, u = ze(), v = Ie(), p = {
1037
+ const d = e, n = t, r = ze(), g = Ie(), p = {
1036
1038
  props: d,
1037
- attrs: v,
1038
- slots: u,
1039
+ attrs: g,
1040
+ slots: r,
1039
1041
  emit: n
1040
1042
  };
1041
- ht(p);
1042
- const l = se(), m = {
1043
+ yt(p);
1044
+ const u = Y(), c = {
1043
1045
  progressSize: x(() => {
1044
1046
  var o;
1045
- return (o = l.value) == null ? void 0 : o.progressSize;
1047
+ return (o = u.value) == null ? void 0 : o.progressSize;
1046
1048
  }),
1047
1049
  resetRequest: x(() => {
1048
1050
  var o;
1049
- return (o = l.value) == null ? void 0 : o.resetRequest;
1051
+ return (o = u.value) == null ? void 0 : o.resetRequest;
1050
1052
  }),
1051
1053
  canRunUpload: x(() => {
1052
1054
  var o;
1053
- return (o = l.value) == null ? void 0 : o.canRunUpload;
1055
+ return (o = u.value) == null ? void 0 : o.canRunUpload;
1054
1056
  }),
1055
1057
  remove: x(() => {
1056
1058
  var o;
1057
- return (o = l.value) == null ? void 0 : o.remove;
1059
+ return (o = u.value) == null ? void 0 : o.remove;
1058
1060
  }),
1059
1061
  goSize: x(() => {
1060
1062
  var o;
1061
- return (o = l.value) == null ? void 0 : o.goSize;
1063
+ return (o = u.value) == null ? void 0 : o.goSize;
1062
1064
  }),
1063
1065
  addFiles: x(() => {
1064
1066
  var o;
1065
- return (o = l.value) == null ? void 0 : o.addFiles;
1067
+ return (o = u.value) == null ? void 0 : o.addFiles;
1066
1068
  }),
1067
1069
  fileList: x(() => {
1068
1070
  var o;
1069
- return (o = l.value) == null ? void 0 : o.fileList;
1071
+ return (o = u.value) == null ? void 0 : o.fileList;
1070
1072
  }),
1071
1073
  getAccept: x(() => {
1072
1074
  var o;
1073
- return (o = l.value) == null ? void 0 : o.getAccept;
1075
+ return (o = u.value) == null ? void 0 : o.getAccept;
1074
1076
  })
1075
1077
  };
1076
- return s({ ...p, ...m, listRef: l }), (o, h) => (U(), N(fe, null, [
1077
- o.noTrigger ? P("", !0) : (U(), L(Ne, {
1078
+ return s({ ...p, ...c, listRef: u }), (o, h) => (U(), G(fe, null, [
1079
+ o.noTrigger ? j("", !0) : (U(), R(Ne, {
1078
1080
  key: 0,
1079
1081
  multiple: o.multiple,
1080
1082
  directory: o.directory,
1081
1083
  disabled: o.disabled,
1082
- accept: m.getAccept.value,
1083
- onAddFiles: m.addFiles.value,
1084
- class: q(o.triggerCls)
1084
+ accept: c.getAccept.value,
1085
+ onAddFiles: c.addFiles.value,
1086
+ class: D(o.triggerCls)
1085
1087
  }, {
1086
- default: te((r) => [
1087
- Le(o.$slots, "default", Te(Re(r)))
1088
+ default: te((v) => [
1089
+ Le(o.$slots, "default", Te(Re(v)))
1088
1090
  ]),
1089
1091
  _: 3
1090
1092
  }, 8, ["multiple", "directory", "disabled", "accept", "onAddFiles", "class"])),
1091
- O(Me, {
1093
+ q(Me, {
1092
1094
  action: o.action,
1093
1095
  ref_key: "listRef",
1094
- ref: l
1096
+ ref: u
1095
1097
  }, null, 8, ["action"])
1096
1098
  ], 64));
1097
1099
  }
1098
- }), Zt = he(At, ve("Upload")), Qt = he(Me, ve("UploadList")), es = he(Ne, ve("UploadTrigger"));
1100
+ }), Qt = he(Et, ve("Upload")), es = he(Me, ve("UploadList")), ts = he(Ne, ve("UploadTrigger"));
1099
1101
  export {
1100
- At as Upload,
1102
+ Et as Upload,
1101
1103
  Me as UploadList,
1102
- Qt as UploadListPlugin,
1104
+ es as UploadListPlugin,
1103
1105
  je as UploadListTypes,
1104
- Zt as UploadPlugin,
1106
+ Qt as UploadPlugin,
1105
1107
  $e as UploadSizes,
1106
- wt as UploadStatuses,
1108
+ bt as UploadStatuses,
1107
1109
  Ne as UploadTrigger,
1108
- es as UploadTriggerPlugin,
1109
- bt as UploadTypes,
1110
- yt as injectBaseUploadContext,
1111
- le as injectUploadContext,
1112
- ht as provideBaseUploadContext,
1113
- kt as provideUploadContext,
1114
- z as uploadListItemPrefix,
1110
+ ts as UploadTriggerPlugin,
1111
+ xt as UploadTypes,
1112
+ kt as injectBaseUploadContext,
1113
+ oe as injectUploadContext,
1114
+ yt as provideBaseUploadContext,
1115
+ wt as provideUploadContext,
1116
+ L as uploadListItemPrefix,
1115
1117
  ee as uploadListPrefix,
1116
1118
  Pe as uploadPrefix
1117
1119
  };