@flyfish-group/file-viewer3 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.vscode/extensions.json +3 -0
  2. package/README.md +149 -0
  3. package/dist/components/ImageViewer.js +1898 -0
  4. package/dist/components/MarkdownViewer.js +1577 -0
  5. package/dist/components/PdfView.js +21660 -0
  6. package/dist/components/PptxRender.js +21165 -0
  7. package/dist/components/XlsxTable.js +69881 -0
  8. package/dist/components/_commonjs-dynamic-modules.js +6 -0
  9. package/dist/components/_commonjsHelpers.js +36 -0
  10. package/dist/components/docx-preview.min.js +5287 -0
  11. package/dist/components/index.js +1717 -0
  12. package/dist/components/worker-ref.js +21 -0
  13. package/dist/favicon.ico +0 -0
  14. package/dist/index.mjs +6 -0
  15. package/dist/index.umd.js +436 -0
  16. package/dist/src/package/common/type.d.ts +30 -0
  17. package/dist/src/package/common/util.d.ts +5 -0
  18. package/dist/src/package/common/worker-ref.d.ts +12 -0
  19. package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +25 -0
  20. package/dist/src/package/components/FileViewer/index.d.ts +2 -0
  21. package/dist/src/package/components/FileViewer/util.d.ts +2 -0
  22. package/dist/src/package/index.d.ts +12 -0
  23. package/dist/src/package/use/index.d.ts +1 -0
  24. package/dist/src/package/use/worker.d.ts +24 -0
  25. package/dist/src/package/vendors/docx/index.d.ts +4 -0
  26. package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +13 -0
  27. package/dist/src/package/vendors/image/index.d.ts +4 -0
  28. package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +13 -0
  29. package/dist/src/package/vendors/md/index.d.ts +4 -0
  30. package/dist/src/package/vendors/mp4/index.d.ts +4 -0
  31. package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +13 -0
  32. package/dist/src/package/vendors/pdf/index.d.ts +1 -0
  33. package/dist/src/package/vendors/pdf/worker/index.d.ts +4 -0
  34. package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +81 -0
  35. package/dist/src/package/vendors/pptx/index.d.ts +6 -0
  36. package/dist/src/package/vendors/pptx/options.d.ts +39 -0
  37. package/dist/src/package/vendors/pptx/support/chart.d.ts +4 -0
  38. package/dist/src/package/vendors/pptx/worker/index.d.ts +4 -0
  39. package/dist/src/package/vendors/renders.d.ts +3 -0
  40. package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +13 -0
  41. package/dist/src/package/vendors/text/index.d.ts +6 -0
  42. package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +21 -0
  43. package/dist/src/package/vendors/xlsx/index.d.ts +5 -0
  44. package/dist/src/package/vendors/xlsx/render.d.ts +6 -0
  45. package/dist/src/package/vendors/xlsx/util.d.ts +8 -0
  46. package/dist/src/package/vendors/xlsx/worker/index.d.ts +6 -0
  47. package/dist/src/package/vendors/xlsx/worker/xls/SheetJsModel.d.ts +36 -0
  48. package/dist/src/package/vendors/xlsx/worker/xls/index.d.ts +4 -0
  49. package/dist/src/package/vendors/xlsx/worker/xlsx/ExcelJsModel.d.ts +39 -0
  50. package/dist/src/package/vendors/xlsx/worker/xlsx/color.d.ts +2 -0
  51. package/dist/src/package/vendors/xlsx/worker/xlsx/context.d.ts +7 -0
  52. package/dist/src/package/vendors/xlsx/worker/xlsx/index.d.ts +4 -0
  53. package/dist/src/package/vendors/xlsx/worker/xlsx/util.d.ts +10 -0
  54. package/dist/style.css +57 -0
  55. package/dist/worker/pdf.worker.js +66 -0
  56. package/dist/worker/pptx.worker.js +21 -0
  57. package/dist/worker/sheet.worker.js +38 -0
  58. package/dist/worker/xlsx.worker.js +65 -0
  59. package/package.json +85 -0
@@ -0,0 +1,1717 @@
1
+ var et = Object.defineProperty;
2
+ var tt = (e, t, n) => t in e ? et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var pe = (e, t, n) => (tt(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { defineAsyncComponent as D, createApp as P, createVNode as N, defineComponent as Ne, openBlock as I, createElementBlock as M, toDisplayString as H, ref as F, onMounted as nt, watch as he, createElementVNode as Q, Fragment as rt, withDirectives as me, vShow as ye } from "vue";
5
+ const st = (() => {
6
+ const e = {
7
+ module: null,
8
+ async load() {
9
+ return this.module || (this.module = import("./docx-preview.min.js").then((t) => t.d)), this.module;
10
+ }
11
+ };
12
+ return async () => await e.load();
13
+ })();
14
+ async function ot(e, t) {
15
+ const { defaultOptions: n, renderAsync: r } = await st(), s = Object.assign(n, {
16
+ debug: !0,
17
+ experimental: !0
18
+ });
19
+ await r(e, t, void 0, s);
20
+ }
21
+ const it = D(() => import("./PptxRender.js"));
22
+ async function at(e, t) {
23
+ return P({
24
+ render: () => N(it, {
25
+ data: e
26
+ }, null)
27
+ }).mount(t);
28
+ }
29
+ const ct = D(() => import("./XlsxTable.js"));
30
+ async function we(e, t, n) {
31
+ const r = P({
32
+ render: () => N(ct, {
33
+ data: e,
34
+ type: n
35
+ }, null)
36
+ });
37
+ return r.mount(t), r;
38
+ }
39
+ const ut = D(() => import("./PdfView.js"));
40
+ async function lt(e, t) {
41
+ const n = P({
42
+ render: () => N(ut, {
43
+ data: e
44
+ }, null)
45
+ });
46
+ return n.mount(t), n;
47
+ }
48
+ async function ft(e) {
49
+ return new Promise((t, n) => {
50
+ const r = new FileReader();
51
+ r.onload = (s) => {
52
+ var o;
53
+ return t((o = s.target) == null ? void 0 : o.result);
54
+ }, r.onerror = (s) => n(s), r.readAsArrayBuffer(e);
55
+ });
56
+ }
57
+ async function dt(e) {
58
+ return new Promise((t, n) => {
59
+ const r = new FileReader();
60
+ r.onload = (s) => {
61
+ var i;
62
+ const o = (i = s.target) == null ? void 0 : i.result;
63
+ typeof o == "string" && t(o);
64
+ }, r.onerror = (s) => n(s), r.readAsDataURL(new Blob([e]));
65
+ });
66
+ }
67
+ async function Ce(e) {
68
+ return new Promise((t, n) => {
69
+ const r = new FileReader();
70
+ r.onload = (s) => {
71
+ var i;
72
+ const o = (i = s.target) == null ? void 0 : i.result;
73
+ typeof o == "string" && t(o);
74
+ }, r.onerror = (s) => n(s), r.readAsText(new Blob([e]), "utf-8");
75
+ });
76
+ }
77
+ const pt = D(() => import("./ImageViewer.js"));
78
+ async function ht(e, t) {
79
+ const n = await dt(e), r = P({
80
+ render: () => N(pt, {
81
+ image: n
82
+ }, null)
83
+ });
84
+ return r.mount(t), r;
85
+ }
86
+ const mt = D(() => import("./MarkdownViewer.js"));
87
+ async function yt(e, t) {
88
+ const n = await Ce(e), r = P({
89
+ render: () => N(mt, {
90
+ data: n
91
+ }, null)
92
+ });
93
+ return r.mount(t), r;
94
+ }
95
+ const wt = { class: "code-area" }, Et = /* @__PURE__ */ Ne({
96
+ __name: "CodeViewer",
97
+ props: {
98
+ value: null
99
+ },
100
+ setup(e) {
101
+ return (t, n) => (I(), M("pre", wt, " " + H(e.value) + `
102
+ `, 1));
103
+ }
104
+ });
105
+ const Fe = (e, t) => {
106
+ const n = e.__vccOpts || e;
107
+ for (const [r, s] of t)
108
+ n[r] = s;
109
+ return n;
110
+ }, bt = /* @__PURE__ */ Fe(Et, [["__scopeId", "data-v-3be501eb"]]);
111
+ async function Rt(e, t) {
112
+ const n = await Ce(e), r = P({
113
+ render: () => N(bt, {
114
+ value: n
115
+ }, null)
116
+ });
117
+ return r.mount(t), r;
118
+ }
119
+ function St(e, t) {
120
+ const n = document.createElement("video");
121
+ n.width = 840, n.height = 480, n.controls = !0;
122
+ const r = document.createElement("source");
123
+ r.src = URL.createObjectURL(new Blob([e])), n.appendChild(r), t.appendChild(n);
124
+ }
125
+ const v = (e) => ({
126
+ $el: e,
127
+ unmount() {
128
+ }
129
+ }), gt = [
130
+ // 使用docxjs支持,目前效果最好的渲染器
131
+ {
132
+ accepts: ["docx"],
133
+ handler: async (e, t) => (await ot(e, t), window.dispatchEvent(new Event("resize")), v(t))
134
+ },
135
+ // 使用pptx2html,已通过默认值更替
136
+ {
137
+ accepts: ["pptx"],
138
+ handler: async (e, t) => (await at(e, t), window.dispatchEvent(new Event("resize")), v(t))
139
+ },
140
+ // 使用exceljs + handsontable,全部样式
141
+ {
142
+ accepts: ["xlsx"],
143
+ handler: async (e, t) => we(e, t, "xml")
144
+ },
145
+ // 使用js-xlsx + handsontable,无样式
146
+ {
147
+ accepts: ["xlsm", "xlsb", "xls", "csv", "ods", "fods", "numbers"],
148
+ handler: async (e, t) => we(e, t, "binary")
149
+ },
150
+ // 使用pdfjs,渲染pdf,效果最好
151
+ {
152
+ accepts: ["pdf"],
153
+ handler: async (e, t) => lt(e, t)
154
+ },
155
+ // 图片过滤器
156
+ {
157
+ accepts: ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg"],
158
+ handler: async (e, t) => ht(e, t)
159
+ },
160
+ {
161
+ accepts: ["md", "markdown"],
162
+ handler: async (e, t) => yt(e, t)
163
+ },
164
+ // 纯文本预览
165
+ {
166
+ accepts: ["txt", "json", "js", "css", "java", "py", "html", "jsx", "ts", "tsx", "xml", "log"],
167
+ handler: async (e, t) => Rt(e, t)
168
+ },
169
+ // 视频预览,仅支持MP4
170
+ {
171
+ accepts: ["mp4"],
172
+ handler: async (e, t) => (St(e, t), v(t))
173
+ },
174
+ // 错误处理
175
+ {
176
+ accepts: ["error"],
177
+ handler: async (e, t, n) => (t.innerHTML = `<div style='text-align: center; margin-top: 80px'>不支持.${n}格式的在线预览,请下载后预览或转换为支持的格式</div>
178
+ <div style='text-align: center'>支持docx, xlsx, pptx, pdf, 以及纯文本格式和各种图片格式的在线预览</div>`, v(t))
179
+ }
180
+ ], Le = gt.reduce((e, { accepts: t, handler: n }) => (t.forEach((r) => e.set(r, n)), e), /* @__PURE__ */ new Map()), Ee = Le.get("error");
181
+ function Ot(e) {
182
+ const t = e.lastIndexOf(".");
183
+ return e.substring(t + 1);
184
+ }
185
+ async function xt(e, t, n) {
186
+ const r = Le.get(t.toLowerCase());
187
+ if (r)
188
+ return r(e, n);
189
+ if (Ee)
190
+ return Ee(e, n, t);
191
+ }
192
+ function Be(e, t) {
193
+ return function() {
194
+ return e.apply(t, arguments);
195
+ };
196
+ }
197
+ const { toString: De } = Object.prototype, { getPrototypeOf: ie } = Object, ae = ((e) => (t) => {
198
+ const n = De.call(t);
199
+ return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
200
+ })(/* @__PURE__ */ Object.create(null)), O = (e) => (e = e.toLowerCase(), (t) => ae(t) === e), W = (e) => (t) => typeof t === e, { isArray: C } = Array, B = W("undefined");
201
+ function At(e) {
202
+ return e !== null && !B(e) && e.constructor !== null && !B(e.constructor) && _(e.constructor.isBuffer) && e.constructor.isBuffer(e);
203
+ }
204
+ const Ue = O("ArrayBuffer");
205
+ function _t(e) {
206
+ let t;
207
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ue(e.buffer), t;
208
+ }
209
+ const Tt = W("string"), _ = W("function"), je = W("number"), ce = (e) => e !== null && typeof e == "object", Pt = (e) => e === !0 || e === !1, q = (e) => {
210
+ if (ae(e) !== "object")
211
+ return !1;
212
+ const t = ie(e);
213
+ return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
214
+ }, Nt = O("Date"), Ct = O("File"), Ft = O("Blob"), Lt = O("FileList"), Bt = (e) => ce(e) && _(e.pipe), Dt = (e) => {
215
+ const t = "[object FormData]";
216
+ return e && (typeof FormData == "function" && e instanceof FormData || De.call(e) === t || _(e.toString) && e.toString() === t);
217
+ }, Ut = O("URLSearchParams"), jt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
218
+ function U(e, t, { allOwnKeys: n = !1 } = {}) {
219
+ if (e === null || typeof e > "u")
220
+ return;
221
+ let r, s;
222
+ if (typeof e != "object" && (e = [e]), C(e))
223
+ for (r = 0, s = e.length; r < s; r++)
224
+ t.call(null, e[r], r, e);
225
+ else {
226
+ const o = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = o.length;
227
+ let u;
228
+ for (r = 0; r < i; r++)
229
+ u = o[r], t.call(null, e[u], u, e);
230
+ }
231
+ }
232
+ function ke(e, t) {
233
+ t = t.toLowerCase();
234
+ const n = Object.keys(e);
235
+ let r = n.length, s;
236
+ for (; r-- > 0; )
237
+ if (s = n[r], t === s.toLowerCase())
238
+ return s;
239
+ return null;
240
+ }
241
+ const ve = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), Ie = (e) => !B(e) && e !== ve;
242
+ function ne() {
243
+ const { caseless: e } = Ie(this) && this || {}, t = {}, n = (r, s) => {
244
+ const o = e && ke(t, s) || s;
245
+ q(t[o]) && q(r) ? t[o] = ne(t[o], r) : q(r) ? t[o] = ne({}, r) : C(r) ? t[o] = r.slice() : t[o] = r;
246
+ };
247
+ for (let r = 0, s = arguments.length; r < s; r++)
248
+ arguments[r] && U(arguments[r], n);
249
+ return t;
250
+ }
251
+ const kt = (e, t, n, { allOwnKeys: r } = {}) => (U(t, (s, o) => {
252
+ n && _(s) ? e[o] = Be(s, n) : e[o] = s;
253
+ }, { allOwnKeys: r }), e), vt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), It = (e, t, n, r) => {
254
+ e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
255
+ value: t.prototype
256
+ }), n && Object.assign(e.prototype, n);
257
+ }, Mt = (e, t, n, r) => {
258
+ let s, o, i;
259
+ const u = {};
260
+ if (t = t || {}, e == null)
261
+ return t;
262
+ do {
263
+ for (s = Object.getOwnPropertyNames(e), o = s.length; o-- > 0; )
264
+ i = s[o], (!r || r(i, e, t)) && !u[i] && (t[i] = e[i], u[i] = !0);
265
+ e = n !== !1 && ie(e);
266
+ } while (e && (!n || n(e, t)) && e !== Object.prototype);
267
+ return t;
268
+ }, Ht = (e, t, n) => {
269
+ e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
270
+ const r = e.indexOf(t, n);
271
+ return r !== -1 && r === n;
272
+ }, qt = (e) => {
273
+ if (!e)
274
+ return null;
275
+ if (C(e))
276
+ return e;
277
+ let t = e.length;
278
+ if (!je(t))
279
+ return null;
280
+ const n = new Array(t);
281
+ for (; t-- > 0; )
282
+ n[t] = e[t];
283
+ return n;
284
+ }, Vt = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ie(Uint8Array)), zt = (e, t) => {
285
+ const r = (e && e[Symbol.iterator]).call(e);
286
+ let s;
287
+ for (; (s = r.next()) && !s.done; ) {
288
+ const o = s.value;
289
+ t.call(e, o[0], o[1]);
290
+ }
291
+ }, Jt = (e, t) => {
292
+ let n;
293
+ const r = [];
294
+ for (; (n = e.exec(t)) !== null; )
295
+ r.push(n);
296
+ return r;
297
+ }, $t = O("HTMLFormElement"), Wt = (e) => e.toLowerCase().replace(
298
+ /[-_\s]([a-z\d])(\w*)/g,
299
+ function(n, r, s) {
300
+ return r.toUpperCase() + s;
301
+ }
302
+ ), be = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Kt = O("RegExp"), Me = (e, t) => {
303
+ const n = Object.getOwnPropertyDescriptors(e), r = {};
304
+ U(n, (s, o) => {
305
+ t(s, o, e) !== !1 && (r[o] = s);
306
+ }), Object.defineProperties(e, r);
307
+ }, Gt = (e) => {
308
+ Me(e, (t, n) => {
309
+ if (_(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
310
+ return !1;
311
+ const r = e[n];
312
+ if (_(r)) {
313
+ if (t.enumerable = !1, "writable" in t) {
314
+ t.writable = !1;
315
+ return;
316
+ }
317
+ t.set || (t.set = () => {
318
+ throw Error("Can not rewrite read-only method '" + n + "'");
319
+ });
320
+ }
321
+ });
322
+ }, Xt = (e, t) => {
323
+ const n = {}, r = (s) => {
324
+ s.forEach((o) => {
325
+ n[o] = !0;
326
+ });
327
+ };
328
+ return C(e) ? r(e) : r(String(e).split(t)), n;
329
+ }, Qt = () => {
330
+ }, Yt = (e, t) => (e = +e, Number.isFinite(e) ? e : t), Y = "abcdefghijklmnopqrstuvwxyz", Re = "0123456789", He = {
331
+ DIGIT: Re,
332
+ ALPHA: Y,
333
+ ALPHA_DIGIT: Y + Y.toUpperCase() + Re
334
+ }, Zt = (e = 16, t = He.ALPHA_DIGIT) => {
335
+ let n = "";
336
+ const { length: r } = t;
337
+ for (; e--; )
338
+ n += t[Math.random() * r | 0];
339
+ return n;
340
+ };
341
+ function en(e) {
342
+ return !!(e && _(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
343
+ }
344
+ const tn = (e) => {
345
+ const t = new Array(10), n = (r, s) => {
346
+ if (ce(r)) {
347
+ if (t.indexOf(r) >= 0)
348
+ return;
349
+ if (!("toJSON" in r)) {
350
+ t[s] = r;
351
+ const o = C(r) ? [] : {};
352
+ return U(r, (i, u) => {
353
+ const p = n(i, s + 1);
354
+ !B(p) && (o[u] = p);
355
+ }), t[s] = void 0, o;
356
+ }
357
+ }
358
+ return r;
359
+ };
360
+ return n(e, 0);
361
+ }, a = {
362
+ isArray: C,
363
+ isArrayBuffer: Ue,
364
+ isBuffer: At,
365
+ isFormData: Dt,
366
+ isArrayBufferView: _t,
367
+ isString: Tt,
368
+ isNumber: je,
369
+ isBoolean: Pt,
370
+ isObject: ce,
371
+ isPlainObject: q,
372
+ isUndefined: B,
373
+ isDate: Nt,
374
+ isFile: Ct,
375
+ isBlob: Ft,
376
+ isRegExp: Kt,
377
+ isFunction: _,
378
+ isStream: Bt,
379
+ isURLSearchParams: Ut,
380
+ isTypedArray: Vt,
381
+ isFileList: Lt,
382
+ forEach: U,
383
+ merge: ne,
384
+ extend: kt,
385
+ trim: jt,
386
+ stripBOM: vt,
387
+ inherits: It,
388
+ toFlatObject: Mt,
389
+ kindOf: ae,
390
+ kindOfTest: O,
391
+ endsWith: Ht,
392
+ toArray: qt,
393
+ forEachEntry: zt,
394
+ matchAll: Jt,
395
+ isHTMLForm: $t,
396
+ hasOwnProperty: be,
397
+ hasOwnProp: be,
398
+ // an alias to avoid ESLint no-prototype-builtins detection
399
+ reduceDescriptors: Me,
400
+ freezeMethods: Gt,
401
+ toObjectSet: Xt,
402
+ toCamelCase: Wt,
403
+ noop: Qt,
404
+ toFiniteNumber: Yt,
405
+ findKey: ke,
406
+ global: ve,
407
+ isContextDefined: Ie,
408
+ ALPHABET: He,
409
+ generateString: Zt,
410
+ isSpecCompliantForm: en,
411
+ toJSONObject: tn
412
+ };
413
+ function m(e, t, n, r, s) {
414
+ Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), s && (this.response = s);
415
+ }
416
+ a.inherits(m, Error, {
417
+ toJSON: function() {
418
+ return {
419
+ // Standard
420
+ message: this.message,
421
+ name: this.name,
422
+ // Microsoft
423
+ description: this.description,
424
+ number: this.number,
425
+ // Mozilla
426
+ fileName: this.fileName,
427
+ lineNumber: this.lineNumber,
428
+ columnNumber: this.columnNumber,
429
+ stack: this.stack,
430
+ // Axios
431
+ config: a.toJSONObject(this.config),
432
+ code: this.code,
433
+ status: this.response && this.response.status ? this.response.status : null
434
+ };
435
+ }
436
+ });
437
+ const qe = m.prototype, Ve = {};
438
+ [
439
+ "ERR_BAD_OPTION_VALUE",
440
+ "ERR_BAD_OPTION",
441
+ "ECONNABORTED",
442
+ "ETIMEDOUT",
443
+ "ERR_NETWORK",
444
+ "ERR_FR_TOO_MANY_REDIRECTS",
445
+ "ERR_DEPRECATED",
446
+ "ERR_BAD_RESPONSE",
447
+ "ERR_BAD_REQUEST",
448
+ "ERR_CANCELED",
449
+ "ERR_NOT_SUPPORT",
450
+ "ERR_INVALID_URL"
451
+ // eslint-disable-next-line func-names
452
+ ].forEach((e) => {
453
+ Ve[e] = { value: e };
454
+ });
455
+ Object.defineProperties(m, Ve);
456
+ Object.defineProperty(qe, "isAxiosError", { value: !0 });
457
+ m.from = (e, t, n, r, s, o) => {
458
+ const i = Object.create(qe);
459
+ return a.toFlatObject(e, i, function(p) {
460
+ return p !== Error.prototype;
461
+ }, (u) => u !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
462
+ };
463
+ const nn = null;
464
+ function re(e) {
465
+ return a.isPlainObject(e) || a.isArray(e);
466
+ }
467
+ function ze(e) {
468
+ return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
469
+ }
470
+ function Se(e, t, n) {
471
+ return e ? e.concat(t).map(function(s, o) {
472
+ return s = ze(s), !n && o ? "[" + s + "]" : s;
473
+ }).join(n ? "." : "") : t;
474
+ }
475
+ function rn(e) {
476
+ return a.isArray(e) && !e.some(re);
477
+ }
478
+ const sn = a.toFlatObject(a, {}, null, function(t) {
479
+ return /^is[A-Z]/.test(t);
480
+ });
481
+ function K(e, t, n) {
482
+ if (!a.isObject(e))
483
+ throw new TypeError("target must be an object");
484
+ t = t || new FormData(), n = a.toFlatObject(n, {
485
+ metaTokens: !0,
486
+ dots: !1,
487
+ indexes: !1
488
+ }, !1, function(h, R) {
489
+ return !a.isUndefined(R[h]);
490
+ });
491
+ const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, p = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
492
+ if (!a.isFunction(s))
493
+ throw new TypeError("visitor must be a function");
494
+ function c(f) {
495
+ if (f === null)
496
+ return "";
497
+ if (a.isDate(f))
498
+ return f.toISOString();
499
+ if (!p && a.isBlob(f))
500
+ throw new m("Blob is not supported. Use a Buffer instead.");
501
+ return a.isArrayBuffer(f) || a.isTypedArray(f) ? p && typeof Blob == "function" ? new Blob([f]) : Buffer.from(f) : f;
502
+ }
503
+ function l(f, h, R) {
504
+ let b = f;
505
+ if (f && !R && typeof f == "object") {
506
+ if (a.endsWith(h, "{}"))
507
+ h = r ? h : h.slice(0, -2), f = JSON.stringify(f);
508
+ else if (a.isArray(f) && rn(f) || (a.isFileList(f) || a.endsWith(h, "[]")) && (b = a.toArray(f)))
509
+ return h = ze(h), b.forEach(function(k, Ze) {
510
+ !(a.isUndefined(k) || k === null) && t.append(
511
+ // eslint-disable-next-line no-nested-ternary
512
+ i === !0 ? Se([h], Ze, o) : i === null ? h : h + "[]",
513
+ c(k)
514
+ );
515
+ }), !1;
516
+ }
517
+ return re(f) ? !0 : (t.append(Se(R, h, o), c(f)), !1);
518
+ }
519
+ const d = [], y = Object.assign(sn, {
520
+ defaultVisitor: l,
521
+ convertValue: c,
522
+ isVisitable: re
523
+ });
524
+ function w(f, h) {
525
+ if (!a.isUndefined(f)) {
526
+ if (d.indexOf(f) !== -1)
527
+ throw Error("Circular reference detected in " + h.join("."));
528
+ d.push(f), a.forEach(f, function(b, x) {
529
+ (!(a.isUndefined(b) || b === null) && s.call(
530
+ t,
531
+ b,
532
+ a.isString(x) ? x.trim() : x,
533
+ h,
534
+ y
535
+ )) === !0 && w(b, h ? h.concat(x) : [x]);
536
+ }), d.pop();
537
+ }
538
+ }
539
+ if (!a.isObject(e))
540
+ throw new TypeError("data must be an object");
541
+ return w(e), t;
542
+ }
543
+ function ge(e) {
544
+ const t = {
545
+ "!": "%21",
546
+ "'": "%27",
547
+ "(": "%28",
548
+ ")": "%29",
549
+ "~": "%7E",
550
+ "%20": "+",
551
+ "%00": "\0"
552
+ };
553
+ return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
554
+ return t[r];
555
+ });
556
+ }
557
+ function ue(e, t) {
558
+ this._pairs = [], e && K(e, this, t);
559
+ }
560
+ const Je = ue.prototype;
561
+ Je.append = function(t, n) {
562
+ this._pairs.push([t, n]);
563
+ };
564
+ Je.toString = function(t) {
565
+ const n = t ? function(r) {
566
+ return t.call(this, r, ge);
567
+ } : ge;
568
+ return this._pairs.map(function(s) {
569
+ return n(s[0]) + "=" + n(s[1]);
570
+ }, "").join("&");
571
+ };
572
+ function on(e) {
573
+ return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
574
+ }
575
+ function $e(e, t, n) {
576
+ if (!t)
577
+ return e;
578
+ const r = n && n.encode || on, s = n && n.serialize;
579
+ let o;
580
+ if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new ue(t, n).toString(r), o) {
581
+ const i = e.indexOf("#");
582
+ i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + o;
583
+ }
584
+ return e;
585
+ }
586
+ class an {
587
+ constructor() {
588
+ this.handlers = [];
589
+ }
590
+ /**
591
+ * Add a new interceptor to the stack
592
+ *
593
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
594
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
595
+ *
596
+ * @return {Number} An ID used to remove interceptor later
597
+ */
598
+ use(t, n, r) {
599
+ return this.handlers.push({
600
+ fulfilled: t,
601
+ rejected: n,
602
+ synchronous: r ? r.synchronous : !1,
603
+ runWhen: r ? r.runWhen : null
604
+ }), this.handlers.length - 1;
605
+ }
606
+ /**
607
+ * Remove an interceptor from the stack
608
+ *
609
+ * @param {Number} id The ID that was returned by `use`
610
+ *
611
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
612
+ */
613
+ eject(t) {
614
+ this.handlers[t] && (this.handlers[t] = null);
615
+ }
616
+ /**
617
+ * Clear all interceptors from the stack
618
+ *
619
+ * @returns {void}
620
+ */
621
+ clear() {
622
+ this.handlers && (this.handlers = []);
623
+ }
624
+ /**
625
+ * Iterate over all the registered interceptors
626
+ *
627
+ * This method is particularly useful for skipping over any
628
+ * interceptors that may have become `null` calling `eject`.
629
+ *
630
+ * @param {Function} fn The function to call for each interceptor
631
+ *
632
+ * @returns {void}
633
+ */
634
+ forEach(t) {
635
+ a.forEach(this.handlers, function(r) {
636
+ r !== null && t(r);
637
+ });
638
+ }
639
+ }
640
+ const Oe = an, We = {
641
+ silentJSONParsing: !0,
642
+ forcedJSONParsing: !0,
643
+ clarifyTimeoutError: !1
644
+ }, cn = typeof URLSearchParams < "u" ? URLSearchParams : ue, un = typeof FormData < "u" ? FormData : null, ln = typeof Blob < "u" ? Blob : null, fn = (() => {
645
+ let e;
646
+ return typeof navigator < "u" && ((e = navigator.product) === "ReactNative" || e === "NativeScript" || e === "NS") ? !1 : typeof window < "u" && typeof document < "u";
647
+ })(), dn = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
648
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), S = {
649
+ isBrowser: !0,
650
+ classes: {
651
+ URLSearchParams: cn,
652
+ FormData: un,
653
+ Blob: ln
654
+ },
655
+ isStandardBrowserEnv: fn,
656
+ isStandardBrowserWebWorkerEnv: dn,
657
+ protocols: ["http", "https", "file", "blob", "url", "data"]
658
+ };
659
+ function pn(e, t) {
660
+ return K(e, new S.classes.URLSearchParams(), Object.assign({
661
+ visitor: function(n, r, s, o) {
662
+ return S.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
663
+ }
664
+ }, t));
665
+ }
666
+ function hn(e) {
667
+ return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
668
+ }
669
+ function mn(e) {
670
+ const t = {}, n = Object.keys(e);
671
+ let r;
672
+ const s = n.length;
673
+ let o;
674
+ for (r = 0; r < s; r++)
675
+ o = n[r], t[o] = e[o];
676
+ return t;
677
+ }
678
+ function Ke(e) {
679
+ function t(n, r, s, o) {
680
+ let i = n[o++];
681
+ const u = Number.isFinite(+i), p = o >= n.length;
682
+ return i = !i && a.isArray(s) ? s.length : i, p ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !u) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = mn(s[i])), !u);
683
+ }
684
+ if (a.isFormData(e) && a.isFunction(e.entries)) {
685
+ const n = {};
686
+ return a.forEachEntry(e, (r, s) => {
687
+ t(hn(r), s, n, 0);
688
+ }), n;
689
+ }
690
+ return null;
691
+ }
692
+ const yn = {
693
+ "Content-Type": void 0
694
+ };
695
+ function wn(e, t, n) {
696
+ if (a.isString(e))
697
+ try {
698
+ return (t || JSON.parse)(e), a.trim(e);
699
+ } catch (r) {
700
+ if (r.name !== "SyntaxError")
701
+ throw r;
702
+ }
703
+ return (n || JSON.stringify)(e);
704
+ }
705
+ const G = {
706
+ transitional: We,
707
+ adapter: ["xhr", "http"],
708
+ transformRequest: [function(t, n) {
709
+ const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = a.isObject(t);
710
+ if (o && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
711
+ return s && s ? JSON.stringify(Ke(t)) : t;
712
+ if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t))
713
+ return t;
714
+ if (a.isArrayBufferView(t))
715
+ return t.buffer;
716
+ if (a.isURLSearchParams(t))
717
+ return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
718
+ let u;
719
+ if (o) {
720
+ if (r.indexOf("application/x-www-form-urlencoded") > -1)
721
+ return pn(t, this.formSerializer).toString();
722
+ if ((u = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
723
+ const p = this.env && this.env.FormData;
724
+ return K(
725
+ u ? { "files[]": t } : t,
726
+ p && new p(),
727
+ this.formSerializer
728
+ );
729
+ }
730
+ }
731
+ return o || s ? (n.setContentType("application/json", !1), wn(t)) : t;
732
+ }],
733
+ transformResponse: [function(t) {
734
+ const n = this.transitional || G.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
735
+ if (t && a.isString(t) && (r && !this.responseType || s)) {
736
+ const i = !(n && n.silentJSONParsing) && s;
737
+ try {
738
+ return JSON.parse(t);
739
+ } catch (u) {
740
+ if (i)
741
+ throw u.name === "SyntaxError" ? m.from(u, m.ERR_BAD_RESPONSE, this, null, this.response) : u;
742
+ }
743
+ }
744
+ return t;
745
+ }],
746
+ /**
747
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
748
+ * timeout is not created.
749
+ */
750
+ timeout: 0,
751
+ xsrfCookieName: "XSRF-TOKEN",
752
+ xsrfHeaderName: "X-XSRF-TOKEN",
753
+ maxContentLength: -1,
754
+ maxBodyLength: -1,
755
+ env: {
756
+ FormData: S.classes.FormData,
757
+ Blob: S.classes.Blob
758
+ },
759
+ validateStatus: function(t) {
760
+ return t >= 200 && t < 300;
761
+ },
762
+ headers: {
763
+ common: {
764
+ Accept: "application/json, text/plain, */*"
765
+ }
766
+ }
767
+ };
768
+ a.forEach(["delete", "get", "head"], function(t) {
769
+ G.headers[t] = {};
770
+ });
771
+ a.forEach(["post", "put", "patch"], function(t) {
772
+ G.headers[t] = a.merge(yn);
773
+ });
774
+ const le = G, En = a.toObjectSet([
775
+ "age",
776
+ "authorization",
777
+ "content-length",
778
+ "content-type",
779
+ "etag",
780
+ "expires",
781
+ "from",
782
+ "host",
783
+ "if-modified-since",
784
+ "if-unmodified-since",
785
+ "last-modified",
786
+ "location",
787
+ "max-forwards",
788
+ "proxy-authorization",
789
+ "referer",
790
+ "retry-after",
791
+ "user-agent"
792
+ ]), bn = (e) => {
793
+ const t = {};
794
+ let n, r, s;
795
+ return e && e.split(`
796
+ `).forEach(function(i) {
797
+ s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && En[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
798
+ }), t;
799
+ }, xe = Symbol("internals");
800
+ function L(e) {
801
+ return e && String(e).trim().toLowerCase();
802
+ }
803
+ function V(e) {
804
+ return e === !1 || e == null ? e : a.isArray(e) ? e.map(V) : String(e);
805
+ }
806
+ function Rn(e) {
807
+ const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
808
+ let r;
809
+ for (; r = n.exec(e); )
810
+ t[r[1]] = r[2];
811
+ return t;
812
+ }
813
+ function Sn(e) {
814
+ return /^[-_a-zA-Z]+$/.test(e.trim());
815
+ }
816
+ function Z(e, t, n, r, s) {
817
+ if (a.isFunction(r))
818
+ return r.call(this, t, n);
819
+ if (s && (t = n), !!a.isString(t)) {
820
+ if (a.isString(r))
821
+ return t.indexOf(r) !== -1;
822
+ if (a.isRegExp(r))
823
+ return r.test(t);
824
+ }
825
+ }
826
+ function gn(e) {
827
+ return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
828
+ }
829
+ function On(e, t) {
830
+ const n = a.toCamelCase(" " + t);
831
+ ["get", "set", "has"].forEach((r) => {
832
+ Object.defineProperty(e, r + n, {
833
+ value: function(s, o, i) {
834
+ return this[r].call(this, t, s, o, i);
835
+ },
836
+ configurable: !0
837
+ });
838
+ });
839
+ }
840
+ class X {
841
+ constructor(t) {
842
+ t && this.set(t);
843
+ }
844
+ set(t, n, r) {
845
+ const s = this;
846
+ function o(u, p, c) {
847
+ const l = L(p);
848
+ if (!l)
849
+ throw new Error("header name must be a non-empty string");
850
+ const d = a.findKey(s, l);
851
+ (!d || s[d] === void 0 || c === !0 || c === void 0 && s[d] !== !1) && (s[d || p] = V(u));
852
+ }
853
+ const i = (u, p) => a.forEach(u, (c, l) => o(c, l, p));
854
+ return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Sn(t) ? i(bn(t), n) : t != null && o(n, t, r), this;
855
+ }
856
+ get(t, n) {
857
+ if (t = L(t), t) {
858
+ const r = a.findKey(this, t);
859
+ if (r) {
860
+ const s = this[r];
861
+ if (!n)
862
+ return s;
863
+ if (n === !0)
864
+ return Rn(s);
865
+ if (a.isFunction(n))
866
+ return n.call(this, s, r);
867
+ if (a.isRegExp(n))
868
+ return n.exec(s);
869
+ throw new TypeError("parser must be boolean|regexp|function");
870
+ }
871
+ }
872
+ }
873
+ has(t, n) {
874
+ if (t = L(t), t) {
875
+ const r = a.findKey(this, t);
876
+ return !!(r && this[r] !== void 0 && (!n || Z(this, this[r], r, n)));
877
+ }
878
+ return !1;
879
+ }
880
+ delete(t, n) {
881
+ const r = this;
882
+ let s = !1;
883
+ function o(i) {
884
+ if (i = L(i), i) {
885
+ const u = a.findKey(r, i);
886
+ u && (!n || Z(r, r[u], u, n)) && (delete r[u], s = !0);
887
+ }
888
+ }
889
+ return a.isArray(t) ? t.forEach(o) : o(t), s;
890
+ }
891
+ clear(t) {
892
+ const n = Object.keys(this);
893
+ let r = n.length, s = !1;
894
+ for (; r--; ) {
895
+ const o = n[r];
896
+ (!t || Z(this, this[o], o, t, !0)) && (delete this[o], s = !0);
897
+ }
898
+ return s;
899
+ }
900
+ normalize(t) {
901
+ const n = this, r = {};
902
+ return a.forEach(this, (s, o) => {
903
+ const i = a.findKey(r, o);
904
+ if (i) {
905
+ n[i] = V(s), delete n[o];
906
+ return;
907
+ }
908
+ const u = t ? gn(o) : String(o).trim();
909
+ u !== o && delete n[o], n[u] = V(s), r[u] = !0;
910
+ }), this;
911
+ }
912
+ concat(...t) {
913
+ return this.constructor.concat(this, ...t);
914
+ }
915
+ toJSON(t) {
916
+ const n = /* @__PURE__ */ Object.create(null);
917
+ return a.forEach(this, (r, s) => {
918
+ r != null && r !== !1 && (n[s] = t && a.isArray(r) ? r.join(", ") : r);
919
+ }), n;
920
+ }
921
+ [Symbol.iterator]() {
922
+ return Object.entries(this.toJSON())[Symbol.iterator]();
923
+ }
924
+ toString() {
925
+ return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
926
+ `);
927
+ }
928
+ get [Symbol.toStringTag]() {
929
+ return "AxiosHeaders";
930
+ }
931
+ static from(t) {
932
+ return t instanceof this ? t : new this(t);
933
+ }
934
+ static concat(t, ...n) {
935
+ const r = new this(t);
936
+ return n.forEach((s) => r.set(s)), r;
937
+ }
938
+ static accessor(t) {
939
+ const r = (this[xe] = this[xe] = {
940
+ accessors: {}
941
+ }).accessors, s = this.prototype;
942
+ function o(i) {
943
+ const u = L(i);
944
+ r[u] || (On(s, i), r[u] = !0);
945
+ }
946
+ return a.isArray(t) ? t.forEach(o) : o(t), this;
947
+ }
948
+ }
949
+ X.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
950
+ a.freezeMethods(X.prototype);
951
+ a.freezeMethods(X);
952
+ const g = X;
953
+ function ee(e, t) {
954
+ const n = this || le, r = t || n, s = g.from(r.headers);
955
+ let o = r.data;
956
+ return a.forEach(e, function(u) {
957
+ o = u.call(n, o, s.normalize(), t ? t.status : void 0);
958
+ }), s.normalize(), o;
959
+ }
960
+ function Ge(e) {
961
+ return !!(e && e.__CANCEL__);
962
+ }
963
+ function j(e, t, n) {
964
+ m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError";
965
+ }
966
+ a.inherits(j, m, {
967
+ __CANCEL__: !0
968
+ });
969
+ function xn(e, t, n) {
970
+ const r = n.config.validateStatus;
971
+ !n.status || !r || r(n.status) ? e(n) : t(new m(
972
+ "Request failed with status code " + n.status,
973
+ [m.ERR_BAD_REQUEST, m.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
974
+ n.config,
975
+ n.request,
976
+ n
977
+ ));
978
+ }
979
+ const An = S.isStandardBrowserEnv ? (
980
+ // Standard browser envs support document.cookie
981
+ function() {
982
+ return {
983
+ write: function(n, r, s, o, i, u) {
984
+ const p = [];
985
+ p.push(n + "=" + encodeURIComponent(r)), a.isNumber(s) && p.push("expires=" + new Date(s).toGMTString()), a.isString(o) && p.push("path=" + o), a.isString(i) && p.push("domain=" + i), u === !0 && p.push("secure"), document.cookie = p.join("; ");
986
+ },
987
+ read: function(n) {
988
+ const r = document.cookie.match(new RegExp("(^|;\\s*)(" + n + ")=([^;]*)"));
989
+ return r ? decodeURIComponent(r[3]) : null;
990
+ },
991
+ remove: function(n) {
992
+ this.write(n, "", Date.now() - 864e5);
993
+ }
994
+ };
995
+ }()
996
+ ) : (
997
+ // Non standard browser env (web workers, react-native) lack needed support.
998
+ function() {
999
+ return {
1000
+ write: function() {
1001
+ },
1002
+ read: function() {
1003
+ return null;
1004
+ },
1005
+ remove: function() {
1006
+ }
1007
+ };
1008
+ }()
1009
+ );
1010
+ function _n(e) {
1011
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
1012
+ }
1013
+ function Tn(e, t) {
1014
+ return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
1015
+ }
1016
+ function Xe(e, t) {
1017
+ return e && !_n(t) ? Tn(e, t) : t;
1018
+ }
1019
+ const Pn = S.isStandardBrowserEnv ? (
1020
+ // Standard browser envs have full support of the APIs needed to test
1021
+ // whether the request URL is of the same origin as current location.
1022
+ function() {
1023
+ const t = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a");
1024
+ let r;
1025
+ function s(o) {
1026
+ let i = o;
1027
+ return t && (n.setAttribute("href", i), i = n.href), n.setAttribute("href", i), {
1028
+ href: n.href,
1029
+ protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
1030
+ host: n.host,
1031
+ search: n.search ? n.search.replace(/^\?/, "") : "",
1032
+ hash: n.hash ? n.hash.replace(/^#/, "") : "",
1033
+ hostname: n.hostname,
1034
+ port: n.port,
1035
+ pathname: n.pathname.charAt(0) === "/" ? n.pathname : "/" + n.pathname
1036
+ };
1037
+ }
1038
+ return r = s(window.location.href), function(i) {
1039
+ const u = a.isString(i) ? s(i) : i;
1040
+ return u.protocol === r.protocol && u.host === r.host;
1041
+ };
1042
+ }()
1043
+ ) : (
1044
+ // Non standard browser envs (web workers, react-native) lack needed support.
1045
+ function() {
1046
+ return function() {
1047
+ return !0;
1048
+ };
1049
+ }()
1050
+ );
1051
+ function Nn(e) {
1052
+ const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
1053
+ return t && t[1] || "";
1054
+ }
1055
+ function Cn(e, t) {
1056
+ e = e || 10;
1057
+ const n = new Array(e), r = new Array(e);
1058
+ let s = 0, o = 0, i;
1059
+ return t = t !== void 0 ? t : 1e3, function(p) {
1060
+ const c = Date.now(), l = r[o];
1061
+ i || (i = c), n[s] = p, r[s] = c;
1062
+ let d = o, y = 0;
1063
+ for (; d !== s; )
1064
+ y += n[d++], d = d % e;
1065
+ if (s = (s + 1) % e, s === o && (o = (o + 1) % e), c - i < t)
1066
+ return;
1067
+ const w = l && c - l;
1068
+ return w ? Math.round(y * 1e3 / w) : void 0;
1069
+ };
1070
+ }
1071
+ function Ae(e, t) {
1072
+ let n = 0;
1073
+ const r = Cn(50, 250);
1074
+ return (s) => {
1075
+ const o = s.loaded, i = s.lengthComputable ? s.total : void 0, u = o - n, p = r(u), c = o <= i;
1076
+ n = o;
1077
+ const l = {
1078
+ loaded: o,
1079
+ total: i,
1080
+ progress: i ? o / i : void 0,
1081
+ bytes: u,
1082
+ rate: p || void 0,
1083
+ estimated: p && i && c ? (i - o) / p : void 0,
1084
+ event: s
1085
+ };
1086
+ l[t ? "download" : "upload"] = !0, e(l);
1087
+ };
1088
+ }
1089
+ const Fn = typeof XMLHttpRequest < "u", Ln = Fn && function(e) {
1090
+ return new Promise(function(n, r) {
1091
+ let s = e.data;
1092
+ const o = g.from(e.headers).normalize(), i = e.responseType;
1093
+ let u;
1094
+ function p() {
1095
+ e.cancelToken && e.cancelToken.unsubscribe(u), e.signal && e.signal.removeEventListener("abort", u);
1096
+ }
1097
+ a.isFormData(s) && (S.isStandardBrowserEnv || S.isStandardBrowserWebWorkerEnv) && o.setContentType(!1);
1098
+ let c = new XMLHttpRequest();
1099
+ if (e.auth) {
1100
+ const w = e.auth.username || "", f = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
1101
+ o.set("Authorization", "Basic " + btoa(w + ":" + f));
1102
+ }
1103
+ const l = Xe(e.baseURL, e.url);
1104
+ c.open(e.method.toUpperCase(), $e(l, e.params, e.paramsSerializer), !0), c.timeout = e.timeout;
1105
+ function d() {
1106
+ if (!c)
1107
+ return;
1108
+ const w = g.from(
1109
+ "getAllResponseHeaders" in c && c.getAllResponseHeaders()
1110
+ ), h = {
1111
+ data: !i || i === "text" || i === "json" ? c.responseText : c.response,
1112
+ status: c.status,
1113
+ statusText: c.statusText,
1114
+ headers: w,
1115
+ config: e,
1116
+ request: c
1117
+ };
1118
+ xn(function(b) {
1119
+ n(b), p();
1120
+ }, function(b) {
1121
+ r(b), p();
1122
+ }, h), c = null;
1123
+ }
1124
+ if ("onloadend" in c ? c.onloadend = d : c.onreadystatechange = function() {
1125
+ !c || c.readyState !== 4 || c.status === 0 && !(c.responseURL && c.responseURL.indexOf("file:") === 0) || setTimeout(d);
1126
+ }, c.onabort = function() {
1127
+ c && (r(new m("Request aborted", m.ECONNABORTED, e, c)), c = null);
1128
+ }, c.onerror = function() {
1129
+ r(new m("Network Error", m.ERR_NETWORK, e, c)), c = null;
1130
+ }, c.ontimeout = function() {
1131
+ let f = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded";
1132
+ const h = e.transitional || We;
1133
+ e.timeoutErrorMessage && (f = e.timeoutErrorMessage), r(new m(
1134
+ f,
1135
+ h.clarifyTimeoutError ? m.ETIMEDOUT : m.ECONNABORTED,
1136
+ e,
1137
+ c
1138
+ )), c = null;
1139
+ }, S.isStandardBrowserEnv) {
1140
+ const w = (e.withCredentials || Pn(l)) && e.xsrfCookieName && An.read(e.xsrfCookieName);
1141
+ w && o.set(e.xsrfHeaderName, w);
1142
+ }
1143
+ s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(f, h) {
1144
+ c.setRequestHeader(h, f);
1145
+ }), a.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials), i && i !== "json" && (c.responseType = e.responseType), typeof e.onDownloadProgress == "function" && c.addEventListener("progress", Ae(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && c.upload && c.upload.addEventListener("progress", Ae(e.onUploadProgress)), (e.cancelToken || e.signal) && (u = (w) => {
1146
+ c && (r(!w || w.type ? new j(null, e, c) : w), c.abort(), c = null);
1147
+ }, e.cancelToken && e.cancelToken.subscribe(u), e.signal && (e.signal.aborted ? u() : e.signal.addEventListener("abort", u)));
1148
+ const y = Nn(l);
1149
+ if (y && S.protocols.indexOf(y) === -1) {
1150
+ r(new m("Unsupported protocol " + y + ":", m.ERR_BAD_REQUEST, e));
1151
+ return;
1152
+ }
1153
+ c.send(s || null);
1154
+ });
1155
+ }, z = {
1156
+ http: nn,
1157
+ xhr: Ln
1158
+ };
1159
+ a.forEach(z, (e, t) => {
1160
+ if (e) {
1161
+ try {
1162
+ Object.defineProperty(e, "name", { value: t });
1163
+ } catch {
1164
+ }
1165
+ Object.defineProperty(e, "adapterName", { value: t });
1166
+ }
1167
+ });
1168
+ const Bn = {
1169
+ getAdapter: (e) => {
1170
+ e = a.isArray(e) ? e : [e];
1171
+ const { length: t } = e;
1172
+ let n, r;
1173
+ for (let s = 0; s < t && (n = e[s], !(r = a.isString(n) ? z[n.toLowerCase()] : n)); s++)
1174
+ ;
1175
+ if (!r)
1176
+ throw r === !1 ? new m(
1177
+ `Adapter ${n} is not supported by the environment`,
1178
+ "ERR_NOT_SUPPORT"
1179
+ ) : new Error(
1180
+ a.hasOwnProp(z, n) ? `Adapter '${n}' is not available in the build` : `Unknown adapter '${n}'`
1181
+ );
1182
+ if (!a.isFunction(r))
1183
+ throw new TypeError("adapter is not a function");
1184
+ return r;
1185
+ },
1186
+ adapters: z
1187
+ };
1188
+ function te(e) {
1189
+ if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1190
+ throw new j(null, e);
1191
+ }
1192
+ function _e(e) {
1193
+ return te(e), e.headers = g.from(e.headers), e.data = ee.call(
1194
+ e,
1195
+ e.transformRequest
1196
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Bn.getAdapter(e.adapter || le.adapter)(e).then(function(r) {
1197
+ return te(e), r.data = ee.call(
1198
+ e,
1199
+ e.transformResponse,
1200
+ r
1201
+ ), r.headers = g.from(r.headers), r;
1202
+ }, function(r) {
1203
+ return Ge(r) || (te(e), r && r.response && (r.response.data = ee.call(
1204
+ e,
1205
+ e.transformResponse,
1206
+ r.response
1207
+ ), r.response.headers = g.from(r.response.headers))), Promise.reject(r);
1208
+ });
1209
+ }
1210
+ const Te = (e) => e instanceof g ? e.toJSON() : e;
1211
+ function T(e, t) {
1212
+ t = t || {};
1213
+ const n = {};
1214
+ function r(c, l, d) {
1215
+ return a.isPlainObject(c) && a.isPlainObject(l) ? a.merge.call({ caseless: d }, c, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
1216
+ }
1217
+ function s(c, l, d) {
1218
+ if (a.isUndefined(l)) {
1219
+ if (!a.isUndefined(c))
1220
+ return r(void 0, c, d);
1221
+ } else
1222
+ return r(c, l, d);
1223
+ }
1224
+ function o(c, l) {
1225
+ if (!a.isUndefined(l))
1226
+ return r(void 0, l);
1227
+ }
1228
+ function i(c, l) {
1229
+ if (a.isUndefined(l)) {
1230
+ if (!a.isUndefined(c))
1231
+ return r(void 0, c);
1232
+ } else
1233
+ return r(void 0, l);
1234
+ }
1235
+ function u(c, l, d) {
1236
+ if (d in t)
1237
+ return r(c, l);
1238
+ if (d in e)
1239
+ return r(void 0, c);
1240
+ }
1241
+ const p = {
1242
+ url: o,
1243
+ method: o,
1244
+ data: o,
1245
+ baseURL: i,
1246
+ transformRequest: i,
1247
+ transformResponse: i,
1248
+ paramsSerializer: i,
1249
+ timeout: i,
1250
+ timeoutMessage: i,
1251
+ withCredentials: i,
1252
+ adapter: i,
1253
+ responseType: i,
1254
+ xsrfCookieName: i,
1255
+ xsrfHeaderName: i,
1256
+ onUploadProgress: i,
1257
+ onDownloadProgress: i,
1258
+ decompress: i,
1259
+ maxContentLength: i,
1260
+ maxBodyLength: i,
1261
+ beforeRedirect: i,
1262
+ transport: i,
1263
+ httpAgent: i,
1264
+ httpsAgent: i,
1265
+ cancelToken: i,
1266
+ socketPath: i,
1267
+ responseEncoding: i,
1268
+ validateStatus: u,
1269
+ headers: (c, l) => s(Te(c), Te(l), !0)
1270
+ };
1271
+ return a.forEach(Object.keys(e).concat(Object.keys(t)), function(l) {
1272
+ const d = p[l] || s, y = d(e[l], t[l], l);
1273
+ a.isUndefined(y) && d !== u || (n[l] = y);
1274
+ }), n;
1275
+ }
1276
+ const Qe = "1.3.4", fe = {};
1277
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1278
+ fe[e] = function(r) {
1279
+ return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1280
+ };
1281
+ });
1282
+ const Pe = {};
1283
+ fe.transitional = function(t, n, r) {
1284
+ function s(o, i) {
1285
+ return "[Axios v" + Qe + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
1286
+ }
1287
+ return (o, i, u) => {
1288
+ if (t === !1)
1289
+ throw new m(
1290
+ s(i, " has been removed" + (n ? " in " + n : "")),
1291
+ m.ERR_DEPRECATED
1292
+ );
1293
+ return n && !Pe[i] && (Pe[i] = !0, console.warn(
1294
+ s(
1295
+ i,
1296
+ " has been deprecated since v" + n + " and will be removed in the near future"
1297
+ )
1298
+ )), t ? t(o, i, u) : !0;
1299
+ };
1300
+ };
1301
+ function Dn(e, t, n) {
1302
+ if (typeof e != "object")
1303
+ throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1304
+ const r = Object.keys(e);
1305
+ let s = r.length;
1306
+ for (; s-- > 0; ) {
1307
+ const o = r[s], i = t[o];
1308
+ if (i) {
1309
+ const u = e[o], p = u === void 0 || i(u, o, e);
1310
+ if (p !== !0)
1311
+ throw new m("option " + o + " must be " + p, m.ERR_BAD_OPTION_VALUE);
1312
+ continue;
1313
+ }
1314
+ if (n !== !0)
1315
+ throw new m("Unknown option " + o, m.ERR_BAD_OPTION);
1316
+ }
1317
+ }
1318
+ const se = {
1319
+ assertOptions: Dn,
1320
+ validators: fe
1321
+ }, A = se.validators;
1322
+ class $ {
1323
+ constructor(t) {
1324
+ this.defaults = t, this.interceptors = {
1325
+ request: new Oe(),
1326
+ response: new Oe()
1327
+ };
1328
+ }
1329
+ /**
1330
+ * Dispatch a request
1331
+ *
1332
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1333
+ * @param {?Object} config
1334
+ *
1335
+ * @returns {Promise} The Promise to be fulfilled
1336
+ */
1337
+ request(t, n) {
1338
+ typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = T(this.defaults, n);
1339
+ const { transitional: r, paramsSerializer: s, headers: o } = n;
1340
+ r !== void 0 && se.assertOptions(r, {
1341
+ silentJSONParsing: A.transitional(A.boolean),
1342
+ forcedJSONParsing: A.transitional(A.boolean),
1343
+ clarifyTimeoutError: A.transitional(A.boolean)
1344
+ }, !1), s !== void 0 && se.assertOptions(s, {
1345
+ encode: A.function,
1346
+ serialize: A.function
1347
+ }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1348
+ let i;
1349
+ i = o && a.merge(
1350
+ o.common,
1351
+ o[n.method]
1352
+ ), i && a.forEach(
1353
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1354
+ (f) => {
1355
+ delete o[f];
1356
+ }
1357
+ ), n.headers = g.concat(i, o);
1358
+ const u = [];
1359
+ let p = !0;
1360
+ this.interceptors.request.forEach(function(h) {
1361
+ typeof h.runWhen == "function" && h.runWhen(n) === !1 || (p = p && h.synchronous, u.unshift(h.fulfilled, h.rejected));
1362
+ });
1363
+ const c = [];
1364
+ this.interceptors.response.forEach(function(h) {
1365
+ c.push(h.fulfilled, h.rejected);
1366
+ });
1367
+ let l, d = 0, y;
1368
+ if (!p) {
1369
+ const f = [_e.bind(this), void 0];
1370
+ for (f.unshift.apply(f, u), f.push.apply(f, c), y = f.length, l = Promise.resolve(n); d < y; )
1371
+ l = l.then(f[d++], f[d++]);
1372
+ return l;
1373
+ }
1374
+ y = u.length;
1375
+ let w = n;
1376
+ for (d = 0; d < y; ) {
1377
+ const f = u[d++], h = u[d++];
1378
+ try {
1379
+ w = f(w);
1380
+ } catch (R) {
1381
+ h.call(this, R);
1382
+ break;
1383
+ }
1384
+ }
1385
+ try {
1386
+ l = _e.call(this, w);
1387
+ } catch (f) {
1388
+ return Promise.reject(f);
1389
+ }
1390
+ for (d = 0, y = c.length; d < y; )
1391
+ l = l.then(c[d++], c[d++]);
1392
+ return l;
1393
+ }
1394
+ getUri(t) {
1395
+ t = T(this.defaults, t);
1396
+ const n = Xe(t.baseURL, t.url);
1397
+ return $e(n, t.params, t.paramsSerializer);
1398
+ }
1399
+ }
1400
+ a.forEach(["delete", "get", "head", "options"], function(t) {
1401
+ $.prototype[t] = function(n, r) {
1402
+ return this.request(T(r || {}, {
1403
+ method: t,
1404
+ url: n,
1405
+ data: (r || {}).data
1406
+ }));
1407
+ };
1408
+ });
1409
+ a.forEach(["post", "put", "patch"], function(t) {
1410
+ function n(r) {
1411
+ return function(o, i, u) {
1412
+ return this.request(T(u || {}, {
1413
+ method: t,
1414
+ headers: r ? {
1415
+ "Content-Type": "multipart/form-data"
1416
+ } : {},
1417
+ url: o,
1418
+ data: i
1419
+ }));
1420
+ };
1421
+ }
1422
+ $.prototype[t] = n(), $.prototype[t + "Form"] = n(!0);
1423
+ });
1424
+ const J = $;
1425
+ class de {
1426
+ constructor(t) {
1427
+ if (typeof t != "function")
1428
+ throw new TypeError("executor must be a function.");
1429
+ let n;
1430
+ this.promise = new Promise(function(o) {
1431
+ n = o;
1432
+ });
1433
+ const r = this;
1434
+ this.promise.then((s) => {
1435
+ if (!r._listeners)
1436
+ return;
1437
+ let o = r._listeners.length;
1438
+ for (; o-- > 0; )
1439
+ r._listeners[o](s);
1440
+ r._listeners = null;
1441
+ }), this.promise.then = (s) => {
1442
+ let o;
1443
+ const i = new Promise((u) => {
1444
+ r.subscribe(u), o = u;
1445
+ }).then(s);
1446
+ return i.cancel = function() {
1447
+ r.unsubscribe(o);
1448
+ }, i;
1449
+ }, t(function(o, i, u) {
1450
+ r.reason || (r.reason = new j(o, i, u), n(r.reason));
1451
+ });
1452
+ }
1453
+ /**
1454
+ * Throws a `CanceledError` if cancellation has been requested.
1455
+ */
1456
+ throwIfRequested() {
1457
+ if (this.reason)
1458
+ throw this.reason;
1459
+ }
1460
+ /**
1461
+ * Subscribe to the cancel signal
1462
+ */
1463
+ subscribe(t) {
1464
+ if (this.reason) {
1465
+ t(this.reason);
1466
+ return;
1467
+ }
1468
+ this._listeners ? this._listeners.push(t) : this._listeners = [t];
1469
+ }
1470
+ /**
1471
+ * Unsubscribe from the cancel signal
1472
+ */
1473
+ unsubscribe(t) {
1474
+ if (!this._listeners)
1475
+ return;
1476
+ const n = this._listeners.indexOf(t);
1477
+ n !== -1 && this._listeners.splice(n, 1);
1478
+ }
1479
+ /**
1480
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1481
+ * cancels the `CancelToken`.
1482
+ */
1483
+ static source() {
1484
+ let t;
1485
+ return {
1486
+ token: new de(function(s) {
1487
+ t = s;
1488
+ }),
1489
+ cancel: t
1490
+ };
1491
+ }
1492
+ }
1493
+ const Un = de;
1494
+ function jn(e) {
1495
+ return function(n) {
1496
+ return e.apply(null, n);
1497
+ };
1498
+ }
1499
+ function kn(e) {
1500
+ return a.isObject(e) && e.isAxiosError === !0;
1501
+ }
1502
+ const oe = {
1503
+ Continue: 100,
1504
+ SwitchingProtocols: 101,
1505
+ Processing: 102,
1506
+ EarlyHints: 103,
1507
+ Ok: 200,
1508
+ Created: 201,
1509
+ Accepted: 202,
1510
+ NonAuthoritativeInformation: 203,
1511
+ NoContent: 204,
1512
+ ResetContent: 205,
1513
+ PartialContent: 206,
1514
+ MultiStatus: 207,
1515
+ AlreadyReported: 208,
1516
+ ImUsed: 226,
1517
+ MultipleChoices: 300,
1518
+ MovedPermanently: 301,
1519
+ Found: 302,
1520
+ SeeOther: 303,
1521
+ NotModified: 304,
1522
+ UseProxy: 305,
1523
+ Unused: 306,
1524
+ TemporaryRedirect: 307,
1525
+ PermanentRedirect: 308,
1526
+ BadRequest: 400,
1527
+ Unauthorized: 401,
1528
+ PaymentRequired: 402,
1529
+ Forbidden: 403,
1530
+ NotFound: 404,
1531
+ MethodNotAllowed: 405,
1532
+ NotAcceptable: 406,
1533
+ ProxyAuthenticationRequired: 407,
1534
+ RequestTimeout: 408,
1535
+ Conflict: 409,
1536
+ Gone: 410,
1537
+ LengthRequired: 411,
1538
+ PreconditionFailed: 412,
1539
+ PayloadTooLarge: 413,
1540
+ UriTooLong: 414,
1541
+ UnsupportedMediaType: 415,
1542
+ RangeNotSatisfiable: 416,
1543
+ ExpectationFailed: 417,
1544
+ ImATeapot: 418,
1545
+ MisdirectedRequest: 421,
1546
+ UnprocessableEntity: 422,
1547
+ Locked: 423,
1548
+ FailedDependency: 424,
1549
+ TooEarly: 425,
1550
+ UpgradeRequired: 426,
1551
+ PreconditionRequired: 428,
1552
+ TooManyRequests: 429,
1553
+ RequestHeaderFieldsTooLarge: 431,
1554
+ UnavailableForLegalReasons: 451,
1555
+ InternalServerError: 500,
1556
+ NotImplemented: 501,
1557
+ BadGateway: 502,
1558
+ ServiceUnavailable: 503,
1559
+ GatewayTimeout: 504,
1560
+ HttpVersionNotSupported: 505,
1561
+ VariantAlsoNegotiates: 506,
1562
+ InsufficientStorage: 507,
1563
+ LoopDetected: 508,
1564
+ NotExtended: 510,
1565
+ NetworkAuthenticationRequired: 511
1566
+ };
1567
+ Object.entries(oe).forEach(([e, t]) => {
1568
+ oe[t] = e;
1569
+ });
1570
+ const vn = oe;
1571
+ function Ye(e) {
1572
+ const t = new J(e), n = Be(J.prototype.request, t);
1573
+ return a.extend(n, J.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1574
+ return Ye(T(e, s));
1575
+ }, n;
1576
+ }
1577
+ const E = Ye(le);
1578
+ E.Axios = J;
1579
+ E.CanceledError = j;
1580
+ E.CancelToken = Un;
1581
+ E.isCancel = Ge;
1582
+ E.VERSION = Qe;
1583
+ E.toFormData = K;
1584
+ E.AxiosError = m;
1585
+ E.Cancel = E.CanceledError;
1586
+ E.all = function(t) {
1587
+ return Promise.all(t);
1588
+ };
1589
+ E.spread = jn;
1590
+ E.isAxiosError = kn;
1591
+ E.mergeConfig = T;
1592
+ E.AxiosHeaders = g;
1593
+ E.formToJSON = (e) => Ke(a.isHTMLForm(e) ? new FormData(e) : e);
1594
+ E.HttpStatusCode = vn;
1595
+ E.default = E;
1596
+ const In = E, Mn = { class: "file-viewer" }, Hn = { class: "name" }, qn = {
1597
+ key: 0,
1598
+ class: "content loading"
1599
+ }, Vn = /* @__PURE__ */ Ne({
1600
+ __name: "FileViewer",
1601
+ props: {
1602
+ file: null,
1603
+ url: null
1604
+ },
1605
+ setup(e) {
1606
+ const t = e, n = F(!1), r = F(""), s = F(""), o = F(""), i = F();
1607
+ return (() => {
1608
+ const u = {
1609
+ loading: "正在加载中,请耐心等待...",
1610
+ reading: "正在努力解析文件...",
1611
+ errorLoading: (l) => `加载文件异常:${l}`,
1612
+ errorReading: (l) => `读取文件异常:${l}`
1613
+ };
1614
+ let p;
1615
+ const c = {
1616
+ // 从url加载
1617
+ async loadFromUrl() {
1618
+ const { url: l } = t;
1619
+ if (!l)
1620
+ return;
1621
+ this.startLoading(u.loading);
1622
+ const d = l.substring(l.lastIndexOf("/") + 1);
1623
+ try {
1624
+ const { data: y } = await In({ url: l, method: "get", responseType: "blob" });
1625
+ if (!y)
1626
+ return this.showError("文件下载失败");
1627
+ const w = this.wrap(y, d);
1628
+ return this.resolveFile(w);
1629
+ } catch (y) {
1630
+ this.showError(u.errorLoading(y));
1631
+ } finally {
1632
+ this.endLoading();
1633
+ }
1634
+ },
1635
+ // 包装file
1636
+ wrap(l, d) {
1637
+ if (l instanceof File)
1638
+ return l;
1639
+ if (l instanceof Blob && d)
1640
+ return new File([l], d, {});
1641
+ if (l instanceof ArrayBuffer)
1642
+ return this.wrap(new Blob([l]));
1643
+ throw new Error("不支持的文件类型格式!");
1644
+ },
1645
+ // 处理并解析文件
1646
+ async resolveFile(l) {
1647
+ n.value && this.endLoading();
1648
+ const d = this.wrap(l);
1649
+ this.startLoading(u.reading);
1650
+ try {
1651
+ o.value = d.name && decodeURIComponent(d.name) || "";
1652
+ const y = await ft(d);
1653
+ y instanceof ArrayBuffer && (p = await this.displayResult(y, d));
1654
+ } catch (y) {
1655
+ console.error(y), this.showError(u.errorReading(y));
1656
+ } finally {
1657
+ this.endLoading();
1658
+ }
1659
+ },
1660
+ // 展示渲染最终效果
1661
+ displayResult(l, d) {
1662
+ const { name: y } = d, w = Ot(y), f = i.value;
1663
+ if (!f)
1664
+ return Promise.resolve();
1665
+ p && (f.lastChild && f.removeChild(f.lastChild), p.unmount());
1666
+ const h = document.createElement("div");
1667
+ h.className = "file-render";
1668
+ const R = f.appendChild(h);
1669
+ return new Promise((b, x) => xt(l, w, R).then(b).catch(x));
1670
+ },
1671
+ showError(l) {
1672
+ r.value = l;
1673
+ },
1674
+ startLoading(l) {
1675
+ n.value = !0, s.value = l, r.value = "";
1676
+ },
1677
+ endLoading() {
1678
+ n.value = !1, s.value = "";
1679
+ }
1680
+ };
1681
+ nt(() => {
1682
+ t.file && c.resolveFile(t.file), c.loadFromUrl();
1683
+ }), he(() => t.url, () => c.loadFromUrl()), he(() => t.file, (l) => l && c.resolveFile(l));
1684
+ })(), (u, p) => (I(), M("div", Mn, [
1685
+ Q("div", Hn, H(o.value), 1),
1686
+ r.value ? (I(), M("div", qn, H(r.value), 1)) : (I(), M(rt, { key: 1 }, [
1687
+ me(Q("div", { class: "content loading" }, H(s.value), 513), [
1688
+ [ye, n.value]
1689
+ ]),
1690
+ me(Q("div", {
1691
+ class: "content",
1692
+ ref_key: "output",
1693
+ ref: i
1694
+ }, null, 512), [
1695
+ [ye, !n.value]
1696
+ ])
1697
+ ], 64))
1698
+ ]));
1699
+ }
1700
+ });
1701
+ const zn = /* @__PURE__ */ Fe(Vn, [["__scopeId", "data-v-4732f9f2"]]), Jn = [
1702
+ ["file-viewer", zn]
1703
+ ];
1704
+ class $n {
1705
+ constructor() {
1706
+ pe(this, "installed", !1);
1707
+ }
1708
+ install(t) {
1709
+ this.installed || (Jn.forEach(([n, r]) => t.component(n, r)), this.installed = !0);
1710
+ }
1711
+ }
1712
+ const Gn = new $n();
1713
+ export {
1714
+ zn as F,
1715
+ Fe as _,
1716
+ Gn as i
1717
+ };