@cling-se/widget 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.internal.md +82 -0
- package/README.md +14 -40
- package/README.public.md +14 -0
- package/dist/AddClientCallout-e8d19R3f.js +101 -0
- package/dist/AnswerModal-BGvB8IVV.js +3291 -0
- package/dist/AttachmentItem-CkHbAm4l.js +171 -0
- package/dist/BaseUpload-BiJBcWRu.js +2472 -0
- package/dist/BlockMedia-CW5wgipC.js +103 -0
- package/dist/CCallout-Cy2eeIYd.js +104 -0
- package/dist/{CCurrencyDropdown-qH-3m2eP.js → CCurrencyDropdown-DE_3CTjm.js} +91 -49
- package/dist/CDropdownItem-Dmq5gYzA.js +751 -0
- package/dist/CFormField.vue_vue_type_script_setup_true_lang-D_U9coAY.js +292 -0
- package/dist/{CPhoneFormat-CfQayFxw.js → CPhoneFormat-BS2nP9kc.js} +13 -21
- package/dist/CPhoneInput-Bf6329PO.js +207 -0
- package/dist/CPriceInput-d1yjuMQr.js +140 -0
- package/dist/CSelect-DgnT07Hk.js +98 -0
- package/dist/CSkeleton.vue_vue_type_script_setup_true_lang-Ckl--dyv.js +51 -0
- package/dist/ClientAutocomplete-9JzGcO9O.js +532 -0
- package/dist/ClientModal-BzWQtWSZ.js +1181 -0
- package/dist/ColorPicker-BvoFN8nu.js +1408 -0
- package/dist/CompanyModal-Bp4V_az9.js +250 -0
- package/dist/ContentWrapper-CuH6xKmo.js +265 -0
- package/dist/CoverBlockSettings-BA5L0Zee.js +861 -0
- package/dist/DocAnswer-BcNA_KEg.js +33 -0
- package/dist/DocDetails-CStEwWnU.js +448 -0
- package/dist/DocForm-BOoILf5E.js +6748 -0
- package/dist/DocFormSend-CQIf-HJY.js +171 -0
- package/dist/DocLinks-BRX5QzNe.js +36 -0
- package/dist/DocModalBase-D72yWj-x.js +29 -0
- package/dist/DocPrint-BI1LXUPE.js +399 -0
- package/dist/DocReceipt-DaZ4V76p.js +341 -0
- package/dist/DocSendReminder-DKGZlo7s.js +181 -0
- package/dist/DocTextEditor-Dm-cTZpA.js +19413 -0
- package/dist/DocTimeline-DCwofzuk.js +537 -0
- package/dist/DocumentClient-vJdxCB53.js +90 -0
- package/dist/DocumentLayout-CKSi42ev.js +1368 -0
- package/dist/DocumentLogotype-DbQlvQ-y.js +162 -0
- package/dist/DocumentVoided-CRX2WxWO.js +33 -0
- package/dist/EmbedInput-B-oeC4Wy.js +157 -0
- package/dist/EmbedSettings-B9Yka2yB.js +103 -0
- package/dist/ErrorCallout-B_ygH33E.js +34 -0
- package/dist/FilePreviewModal-Bf3ELTow.js +202 -0
- package/dist/Flag-BwTgCNHO.js +41 -0
- package/dist/HeaderSettings-DvC7nlyY.js +720 -0
- package/dist/ImageSelectModal-D3sP3lhR.js +119 -0
- package/dist/ImageUploadWrapper-RWNa-yIq.js +1585 -0
- package/dist/Index-0_3ULrWX.js +126 -0
- package/dist/Index-4NPe0sfX.js +629 -0
- package/dist/Index-B1uA0FF6.js +4 -0
- package/dist/Index-BBkCYm2q.js +201 -0
- package/dist/{Index-DIOiMm9f.js → Index-BBwvo7S9.js} +10 -18
- package/dist/Index-BEMlsYwJ.js +68 -0
- package/dist/Index-BRBhJ6kz.js +21 -0
- package/dist/{Index--qPMWUMT.js → Index-BTFmHjUt.js} +48 -61
- package/dist/Index-BcUNnxLC.js +1098 -0
- package/dist/Index-Bo6ExBUL.js +93 -0
- package/dist/Index-BvMPCgdH.js +102 -0
- package/dist/Index-Bx5TOI9k.js +74 -0
- package/dist/Index-C7GZS8EI.js +16 -0
- package/dist/Index-CNWhm07R.js +25 -0
- package/dist/{Index-DcQbh-z2.js → Index-CQpznMKV.js} +9 -17
- package/dist/Index-CRzsnIij.js +159 -0
- package/dist/Index-CeSG1C41.js +140 -0
- package/dist/Index-CjfjdZj5.js +52 -0
- package/dist/Index-CskKmZpd.js +363 -0
- package/dist/Index-D5qwbCo1.js +28 -0
- package/dist/Index-D8Ae1Txt.js +228 -0
- package/dist/Index-DE8aenDB.js +3452 -0
- package/dist/Index-DI5EB5Rt.js +39 -0
- package/dist/Index-DaV57YPP.js +163 -0
- package/dist/Index-DbwkmoyM.js +38 -0
- package/dist/Index-Df9skok6.js +70 -0
- package/dist/{Index-Bu0MGrj6.js → Index-DfLLA0ij.js} +313 -206
- package/dist/Index-Dw1CO5F9.js +76 -0
- package/dist/Index-PZXyOoVb.js +87 -0
- package/dist/{Index-D4XgxmbD.js → Index-ZUnH-BHj.js} +10 -18
- package/dist/Index-cjKGSiDi.js +136 -0
- package/dist/Index-m-goRuKD.js +49 -0
- package/dist/Index-rGeWbLcB.js +47 -0
- package/dist/Index-vrljNp6G.js +28 -0
- package/dist/Index.vue_vue_type_script_lang-aeVuChGF.js +671 -0
- package/dist/InputToggleRow-v6qAWPg6.js +99 -0
- package/dist/ManualPopover-BONBJIUA.js +57 -0
- package/dist/MediaWrapper-CXb2UGd9.js +18 -0
- package/dist/{NotBindingText-CNV2Wmdx.js → NotBindingText-BqESO13N.js} +13 -17
- package/dist/PackageGroup-AIysVmyh.js +1058 -0
- package/dist/PdfTerms-BlhHdTu3.js +34 -0
- package/dist/PdfViewer-DwZ1rwlN.js +392 -0
- package/dist/PlainHtml.vue_vue_type_script_setup_true_lang-D6NNUTz0.js +17 -0
- package/dist/PriceHeader-C4XhnoA3.js +488 -0
- package/dist/SearchApi-B7lXgUY6.js +137 -0
- package/dist/SendForm-BcD0xSvB.js +7031 -0
- package/dist/Setup-C2qaYDei.js +47 -0
- package/dist/{SmartList-Qgu0rMrI.js → SmartList-DqG7Q5t7.js} +16 -24
- package/dist/Sortable.vue_vue_type_script_setup_true_lang-CzMbr8AX.js +1303 -0
- package/dist/{TermsSettings-CE3h_xkm.js → TermsSettings-BOCONyM4.js} +169 -49
- package/dist/ThemeColorRow-sjGdMzGN.js +108 -0
- package/dist/ToggleBinding-7oq_oXPt.js +44 -0
- package/dist/UploadModal-C_X2NjVY.js +134 -0
- package/dist/VideoPlayerInput-BsUcmpl4.js +135 -0
- package/dist/VideoPlayerSettings-BXMmxaZQ.js +78 -0
- package/dist/VideoSelectModal-CW0OweCw.js +217 -0
- package/dist/{anime.es-BrPTThYb.js → anime.es-gdcpA-eY.js} +1 -2
- package/dist/{color-TdtKxwVa.js → color-HetJPhlA.js} +1 -2
- package/dist/{debounce-C1AuSpOZ.js → debounce-DNl99Gyo.js} +7 -7
- package/dist/dom-CkTGWrfu.js +69 -0
- package/dist/{focusDrawerMixin-Be6BAK8-.js → focusDrawerMixin-BwcErMDY.js} +1 -1
- package/dist/{formDrawerState-DRbg5rVI.js → formDrawerState-DaurePnd.js} +2 -2
- package/dist/helpers-CPW--XIz.js +44 -0
- package/dist/index-BjiGCJPI.js +149 -0
- package/dist/index-CFNv6OvX.js +188 -0
- package/dist/index-Cx71On5Z.js +508 -0
- package/dist/index-DKMxIBz_.js +270 -0
- package/dist/index-DKf5SGLD.js +125 -0
- package/dist/index-E32WgUp9.js +3525 -0
- package/dist/index-kp-GC5I0.js +513 -0
- package/dist/index.es.js +2 -5
- package/dist/index.umd.js +306 -1505
- package/dist/{main-WKzC-Dnu.js → main-Cb-nyil1.js} +33252 -33755
- package/dist/mapFormMixin-D3BihYWW.js +1544 -0
- package/dist/omit--YYr41Xp.js +31 -0
- package/dist/{publicSenderState-BujjYsZZ.js → publicSenderState-CdRW_Wwp.js} +4 -4
- package/dist/regions-BdZt9Srn.js +1250 -0
- package/dist/splitpanes-D-ThFkeR.js +342 -0
- package/dist/style.css +1 -4
- package/dist/template-BvaNnq-g.js +1493 -0
- package/dist/{throttle-CWPJmFid.js → throttle-D-bUGaVh.js} +2 -2
- package/dist/tippy.esm-BmKNqohP.js +1994 -0
- package/dist/useTermsModal-Dhf6_eYb.js +87 -0
- package/dist/{utils-CA_Zy6u1.js → utils-CBPcYdLv.js} +8 -11
- package/dist/validation-DOcUOoMe.js +40 -0
- package/package.json +25 -31
- package/.eslintrc.cjs +0 -4
- package/dist/AddClientCallout-BWnvyBcK.js +0 -46
- package/dist/AnswerModal-CLGRdSnK.js +0 -3874
- package/dist/AttachmentItem-BPS0-wyc.js +0 -78
- package/dist/BaseDatePicker-BbmV_GdD.js +0 -3183
- package/dist/BaseUpload-9gPgI7r6.js +0 -1977
- package/dist/BlockMedia-DkPFWiYL.js +0 -76
- package/dist/CCallout-T26jwUby.js +0 -59
- package/dist/CDropdownItem-BE8BAMD1.js +0 -636
- package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +0 -1
- package/dist/CFormField-DECEfoVq.js +0 -241
- package/dist/CPriceInput-C4SOB-P5.js +0 -112
- package/dist/CTabs.vue_vue_type_style_index_0_scoped_e02a6440_lang-l0sNRNKZ.js +0 -1
- package/dist/ClientAutocomplete-DSebA1Mx.js +0 -78
- package/dist/ClientModal-BXFYvYCF.js +0 -625
- package/dist/ColorPicker-CZ_bJabP.js +0 -2879
- package/dist/CompanyModal-CDr3t28n.js +0 -141
- package/dist/ContentWrapper-BwmMoe4W.js +0 -183
- package/dist/CoverBlockSettings-_F11-DGc.js +0 -275
- package/dist/DocAnswer-BR59xzkT.js +0 -36
- package/dist/DocDetails-D1qbCbps.js +0 -259
- package/dist/DocForm-DBc2a7z5.js +0 -7272
- package/dist/DocFormSend-Casix-yG.js +0 -144
- package/dist/DocLinks-DGTaewyX.js +0 -38
- package/dist/DocModalBase-BbS_qvSv.js +0 -28
- package/dist/DocPrint-0PqX3mbJ.js +0 -240
- package/dist/DocReceipt-CU3VD5pt.js +0 -210
- package/dist/DocSendReminder-CuycBspr.js +0 -137
- package/dist/DocTextEditor-CntS2Bd-.js +0 -17180
- package/dist/DocTimeline-DJuv3yBe.js +0 -481
- package/dist/DocumentClient-C25XXzz6.js +0 -136
- package/dist/DocumentLayout-B7afHRMr.js +0 -4909
- package/dist/DocumentLogotype-sqI51wvM.js +0 -87
- package/dist/DocumentVoided-TahdTSMn.js +0 -25
- package/dist/EmbedInput-BY-wHSfc.js +0 -113
- package/dist/EmbedSettings-8pfjk4NP.js +0 -72
- package/dist/ErrorCallout-Dsr8PNsU.js +0 -28
- package/dist/FilePreviewModal-CcEinEFg.js +0 -81
- package/dist/Flag-PJKrghi9.js +0 -114
- package/dist/HeaderSettings-BqczIOsG.js +0 -392
- package/dist/ImageSelectModal-Cd-HhKnH.js +0 -84
- package/dist/ImageUploadWrapper-Dv43rGdb.js +0 -1604
- package/dist/Index-6b5VBKE-.js +0 -107
- package/dist/Index-B4pRJnbw.js +0 -84
- package/dist/Index-B69f8qgZ.js +0 -62
- package/dist/Index-B79YN9RO.js +0 -25
- package/dist/Index-BBrlPoe8.js +0 -58
- package/dist/Index-BXfWJCuq.js +0 -52
- package/dist/Index-Bd76vb37.js +0 -55
- package/dist/Index-BmbtQO5F.js +0 -150
- package/dist/Index-ByV_kJaH.js +0 -77
- package/dist/Index-CDV5rhWS.js +0 -49
- package/dist/Index-CIx4OOK-.js +0 -144
- package/dist/Index-CL1OWLt6.js +0 -223
- package/dist/Index-Caow0eZu.js +0 -31
- package/dist/Index-Cd3-3PEK.js +0 -2402
- package/dist/Index-CdpZBEKU.js +0 -98
- package/dist/Index-CmU3Sys-.js +0 -754
- package/dist/Index-CtRtgnpm.js +0 -32
- package/dist/Index-Cukkr33D.js +0 -140
- package/dist/Index-Cuqw0ios.js +0 -57
- package/dist/Index-Czm_WdqC.js +0 -25
- package/dist/Index-DNdYXHgr.js +0 -33
- package/dist/Index-DcuBxutp.js +0 -642
- package/dist/Index-DpWNWiyY.js +0 -291
- package/dist/Index-DzS1rZdF.js +0 -24
- package/dist/Index-N6s5pZxv.js +0 -26
- package/dist/Index-g_DNu4mt.js +0 -69
- package/dist/Index-mJ8F41GY.js +0 -154
- package/dist/Index-q7W9KA8m.js +0 -21
- package/dist/Index-rtzblZp4.js +0 -70
- package/dist/InputToggleRow-CZjxsDOQ.js +0 -57
- package/dist/ManualPopover-CZrWiT-P.js +0 -58
- package/dist/MediaWrapper-D37qK4KR.js +0 -23
- package/dist/PackageGroup-Heo_s8ct.js +0 -699
- package/dist/PdfTerms-AB9tXAtU.js +0 -36
- package/dist/PdfViewer-CIVkvOBr.js +0 -373
- package/dist/PlainHtml-CPmIebjY.js +0 -20
- package/dist/PriceHeader-DhDAruwX.js +0 -339
- package/dist/SearchApi-BMgdaI4s.js +0 -161
- package/dist/Setup-VIaIV9uT.js +0 -50
- package/dist/ThemeColorRow-DYJNgk6S.js +0 -67
- package/dist/ToggleBinding-CuwCeYpO.js +0 -38
- package/dist/UploadModal-BITcxG-J.js +0 -95
- package/dist/VideoPlayerInput-8szEX_8L.js +0 -93
- package/dist/VideoPlayerSettings-BIPytm6w.js +0 -61
- package/dist/VideoSelectModal-B-Pe34nb.js +0 -100
- package/dist/answerDocumentMixin-W7vE1Gp4.js +0 -51
- package/dist/formComponentsInstall-Bm3VMOh6.js +0 -2507
- package/dist/formValidationMixin-COkY8COk.js +0 -49
- package/dist/index-BFvjENMH.js +0 -81
- package/dist/index-BV2nGWay.js +0 -492
- package/dist/index-BgJ05dYc.js +0 -165
- package/dist/index-CMPAXxzs.js +0 -347
- package/dist/index-DNDjI5uI.js +0 -3916
- package/dist/index-aoff9oUi.js +0 -102
- package/dist/mapFormMixin-QbevCwJK.js +0 -72
- package/dist/omit-CTp9CXoU.js +0 -31
- package/dist/splitpanes-BHUVsCZF.js +0 -382
- package/dist/tinycolor-kTl0yxzz.js +0 -633
- package/dist/tippy.esm-sS5koDSU.js +0 -1799
- package/dist/vuedraggable.umd-BA3ZDRAp.js +0 -3161
- package/dist/vuex.esm-DKGl8mcw.js +0 -467
- package/public/favicon.ico +0 -0
- package/tsconfig.json +0 -26
- package/tsconfig.node.json +0 -10
- package/tsconfig.paths.json +0 -17
- package/vite.config.ts +0 -60
|
@@ -0,0 +1,2472 @@
|
|
|
1
|
+
import { be as Ie, bf as je, aC as Me, bg as ze, bh as Ne, bi as Le, bj as $e, F as He, bk as _e, bl as We, aE as Ve, bm as qe, bn as Fe, aD as Xe, bo as Ke, aj as Ge, bp as Je, bq as Ye, br as Qe, bs as Ze, bt as et, bu as tt, bv as rt, bw as nt, bx as it, by as at, i as st, bz as ot, c as ae, f as se, d as pe, s as he, bA as ut, bB as lt, bC as ct, bD as ft, bE as dt, bF as pt, B as oe, e as ue, bG as ht, z as De, h as mt, bH as vt, bI as gt, bJ as yt, bK as bt, bL as Et, bM as wt, bN as kt, bO as Ot, bP as Dt, bQ as St, bR as Ct, H as xt, bS as At, bT as Tt, bU as Pt, bV as Rt, ai as Ut, bW as Bt, bX as It, bY as jt, bZ as Mt, b_ as zt, b$ as Nt, c0 as Lt, c1 as $t, c2 as Ht, P as _t, c3 as Wt, c4 as Vt, N as qt, O as Ft, L as Xt, c5 as Kt, c6 as Gt, at as Jt, c7 as Yt, c8 as Qt, c9 as Zt, Z as er, Q as tr, n as Se, ca as rr, l as nr, cb as ir, J as ar, M as sr, cc as or, cd as ur, ce as lr, a0 as cr, cf as fr, cg as dr, ch as pr, ci as hr, cj as mr, ck as vr, cl as gr, o as G, cm as yr, x as br, cn as Er, co as wr, cp as kr, r as Or, cq as Dr, I as Sr, cr as Cr, cs as xr, k as Ar, S as Ce, b as Q, a3 as Tr, aq as xe, ct as Pr, cu as Rr, cv as Ur, cw as Br, cx as Ir, cy as jr, cz as Mr, bd as zr, cA as Nr, cB as Lr, cC as $r, v as me, cD as Hr, cE as _r, cF as Wr, cG as Vr, t as qr, cH as Fr, cI as Xr, cJ as Kr, j as Gr, u as Jr, cK as Yr, cL as Qr, cM as Zr, cN as en, cO as tn, cP as rn, cQ as nn, cR as an, $ as sn, cS as on, bc as un, cT as ln, b6 as cn, am as fn, cU as dn, G as Ae, cV as pn, cW as hn, K as mn, cX as vn, cY as gn, cZ as yn, c_ as bn, w as le, c$ as En, E as Te, af as wn, d0 as kn, ao as Pe, d1 as On, d2 as Dn, d3 as Sn, a1 as Cn, _ as xn, d4 as ge, aA as de } from "./main-Cb-nyil1.js";
|
|
2
|
+
/**
|
|
3
|
+
* vue v3.5.12
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/
|
|
7
|
+
const An = () => {
|
|
8
|
+
}, Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9
|
+
__proto__: null,
|
|
10
|
+
BaseTransition: Ie,
|
|
11
|
+
BaseTransitionPropsValidators: je,
|
|
12
|
+
Comment: Me,
|
|
13
|
+
DeprecationTypes: ze,
|
|
14
|
+
EffectScope: Ne,
|
|
15
|
+
ErrorCodes: Le,
|
|
16
|
+
ErrorTypeStrings: $e,
|
|
17
|
+
Fragment: He,
|
|
18
|
+
KeepAlive: _e,
|
|
19
|
+
ReactiveEffect: We,
|
|
20
|
+
Static: Ve,
|
|
21
|
+
Suspense: qe,
|
|
22
|
+
Teleport: Fe,
|
|
23
|
+
Text: Xe,
|
|
24
|
+
TrackOpTypes: Ke,
|
|
25
|
+
Transition: Ge,
|
|
26
|
+
TransitionGroup: Je,
|
|
27
|
+
TriggerOpTypes: Ye,
|
|
28
|
+
VueElement: Qe,
|
|
29
|
+
assertNumber: Ze,
|
|
30
|
+
callWithAsyncErrorHandling: et,
|
|
31
|
+
callWithErrorHandling: tt,
|
|
32
|
+
camelize: rt,
|
|
33
|
+
capitalize: nt,
|
|
34
|
+
cloneVNode: it,
|
|
35
|
+
compatUtils: at,
|
|
36
|
+
compile: An,
|
|
37
|
+
computed: st,
|
|
38
|
+
createApp: ot,
|
|
39
|
+
createBlock: ae,
|
|
40
|
+
createCommentVNode: se,
|
|
41
|
+
createElementBlock: pe,
|
|
42
|
+
createElementVNode: he,
|
|
43
|
+
createHydrationRenderer: ut,
|
|
44
|
+
createPropsRestProxy: lt,
|
|
45
|
+
createRenderer: ct,
|
|
46
|
+
createSSRApp: ft,
|
|
47
|
+
createSlots: dt,
|
|
48
|
+
createStaticVNode: pt,
|
|
49
|
+
createTextVNode: oe,
|
|
50
|
+
createVNode: ue,
|
|
51
|
+
customRef: ht,
|
|
52
|
+
defineAsyncComponent: De,
|
|
53
|
+
defineComponent: mt,
|
|
54
|
+
defineCustomElement: vt,
|
|
55
|
+
defineEmits: gt,
|
|
56
|
+
defineExpose: yt,
|
|
57
|
+
defineModel: bt,
|
|
58
|
+
defineOptions: Et,
|
|
59
|
+
defineProps: wt,
|
|
60
|
+
defineSSRCustomElement: kt,
|
|
61
|
+
defineSlots: Ot,
|
|
62
|
+
devtools: Dt,
|
|
63
|
+
effect: St,
|
|
64
|
+
effectScope: Ct,
|
|
65
|
+
getCurrentInstance: xt,
|
|
66
|
+
getCurrentScope: At,
|
|
67
|
+
getCurrentWatcher: Tt,
|
|
68
|
+
getTransitionRawChildren: Pt,
|
|
69
|
+
guardReactiveProps: Rt,
|
|
70
|
+
h: Ut,
|
|
71
|
+
handleError: Bt,
|
|
72
|
+
hasInjectionContext: It,
|
|
73
|
+
hydrate: jt,
|
|
74
|
+
hydrateOnIdle: Mt,
|
|
75
|
+
hydrateOnInteraction: zt,
|
|
76
|
+
hydrateOnMediaQuery: Nt,
|
|
77
|
+
hydrateOnVisible: Lt,
|
|
78
|
+
initCustomFormatter: $t,
|
|
79
|
+
initDirectivesForSSR: Ht,
|
|
80
|
+
inject: _t,
|
|
81
|
+
isMemoSame: Wt,
|
|
82
|
+
isProxy: Vt,
|
|
83
|
+
isReactive: qt,
|
|
84
|
+
isReadonly: Ft,
|
|
85
|
+
isRef: Xt,
|
|
86
|
+
isRuntimeOnly: Kt,
|
|
87
|
+
isShallow: Gt,
|
|
88
|
+
isVNode: Jt,
|
|
89
|
+
markRaw: Yt,
|
|
90
|
+
mergeDefaults: Qt,
|
|
91
|
+
mergeModels: Zt,
|
|
92
|
+
mergeProps: er,
|
|
93
|
+
nextTick: tr,
|
|
94
|
+
normalizeClass: Se,
|
|
95
|
+
normalizeProps: rr,
|
|
96
|
+
normalizeStyle: nr,
|
|
97
|
+
onActivated: ir,
|
|
98
|
+
onBeforeMount: ar,
|
|
99
|
+
onBeforeUnmount: sr,
|
|
100
|
+
onBeforeUpdate: or,
|
|
101
|
+
onDeactivated: ur,
|
|
102
|
+
onErrorCaptured: lr,
|
|
103
|
+
onMounted: cr,
|
|
104
|
+
onRenderTracked: fr,
|
|
105
|
+
onRenderTriggered: dr,
|
|
106
|
+
onScopeDispose: pr,
|
|
107
|
+
onServerPrefetch: hr,
|
|
108
|
+
onUnmounted: mr,
|
|
109
|
+
onUpdated: vr,
|
|
110
|
+
onWatcherCleanup: gr,
|
|
111
|
+
openBlock: G,
|
|
112
|
+
popScopeId: yr,
|
|
113
|
+
provide: br,
|
|
114
|
+
proxyRefs: Er,
|
|
115
|
+
pushScopeId: wr,
|
|
116
|
+
queuePostFlushCb: kr,
|
|
117
|
+
reactive: Or,
|
|
118
|
+
readonly: Dr,
|
|
119
|
+
ref: Sr,
|
|
120
|
+
registerRuntimeCompiler: Cr,
|
|
121
|
+
render: xr,
|
|
122
|
+
renderList: Ar,
|
|
123
|
+
renderSlot: Ce,
|
|
124
|
+
resolveComponent: Q,
|
|
125
|
+
resolveDirective: Tr,
|
|
126
|
+
resolveDynamicComponent: xe,
|
|
127
|
+
resolveFilter: Pr,
|
|
128
|
+
resolveTransitionHooks: Rr,
|
|
129
|
+
setBlockTracking: Ur,
|
|
130
|
+
setDevtoolsHook: Br,
|
|
131
|
+
setTransitionHooks: Ir,
|
|
132
|
+
shallowReactive: jr,
|
|
133
|
+
shallowReadonly: Mr,
|
|
134
|
+
shallowRef: zr,
|
|
135
|
+
ssrContextKey: Nr,
|
|
136
|
+
ssrUtils: Lr,
|
|
137
|
+
stop: $r,
|
|
138
|
+
toDisplayString: me,
|
|
139
|
+
toHandlerKey: Hr,
|
|
140
|
+
toHandlers: _r,
|
|
141
|
+
toRaw: Wr,
|
|
142
|
+
toRef: Vr,
|
|
143
|
+
toRefs: qr,
|
|
144
|
+
toValue: Fr,
|
|
145
|
+
transformVNodeArgs: Xr,
|
|
146
|
+
triggerRef: Kr,
|
|
147
|
+
unref: Gr,
|
|
148
|
+
useAttrs: Jr,
|
|
149
|
+
useCssModule: Yr,
|
|
150
|
+
useCssVars: Qr,
|
|
151
|
+
useHost: Zr,
|
|
152
|
+
useId: en,
|
|
153
|
+
useModel: tn,
|
|
154
|
+
useSSRContext: rn,
|
|
155
|
+
useShadowRoot: nn,
|
|
156
|
+
useSlots: an,
|
|
157
|
+
useTemplateRef: sn,
|
|
158
|
+
useTransitionState: on,
|
|
159
|
+
vModelCheckbox: un,
|
|
160
|
+
vModelDynamic: ln,
|
|
161
|
+
vModelRadio: cn,
|
|
162
|
+
vModelSelect: fn,
|
|
163
|
+
vModelText: dn,
|
|
164
|
+
vShow: Ae,
|
|
165
|
+
version: pn,
|
|
166
|
+
warn: hn,
|
|
167
|
+
watch: mn,
|
|
168
|
+
watchEffect: vn,
|
|
169
|
+
watchPostEffect: gn,
|
|
170
|
+
watchSyncEffect: yn,
|
|
171
|
+
withAsyncContext: bn,
|
|
172
|
+
withCtx: le,
|
|
173
|
+
withDefaults: En,
|
|
174
|
+
withDirectives: Te,
|
|
175
|
+
withKeys: wn,
|
|
176
|
+
withMemo: kn,
|
|
177
|
+
withModifiers: Pe,
|
|
178
|
+
withScopeId: On
|
|
179
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
180
|
+
/*!
|
|
181
|
+
* Compressor.js v1.1.1
|
|
182
|
+
* https://fengyuanchen.github.io/compressorjs
|
|
183
|
+
*
|
|
184
|
+
* Copyright 2018-present Chen Fengyuan
|
|
185
|
+
* Released under the MIT license
|
|
186
|
+
*
|
|
187
|
+
* Date: 2021-10-05T02:32:40.212Z
|
|
188
|
+
*/
|
|
189
|
+
function ye(u, l) {
|
|
190
|
+
var s = Object.keys(u);
|
|
191
|
+
if (Object.getOwnPropertySymbols) {
|
|
192
|
+
var c = Object.getOwnPropertySymbols(u);
|
|
193
|
+
l && (c = c.filter(function(d) {
|
|
194
|
+
return Object.getOwnPropertyDescriptor(u, d).enumerable;
|
|
195
|
+
})), s.push.apply(s, c);
|
|
196
|
+
}
|
|
197
|
+
return s;
|
|
198
|
+
}
|
|
199
|
+
function ie(u) {
|
|
200
|
+
for (var l = 1; l < arguments.length; l++) {
|
|
201
|
+
var s = arguments[l] != null ? arguments[l] : {};
|
|
202
|
+
l % 2 ? ye(Object(s), !0).forEach(function(c) {
|
|
203
|
+
Un(u, c, s[c]);
|
|
204
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(u, Object.getOwnPropertyDescriptors(s)) : ye(Object(s)).forEach(function(c) {
|
|
205
|
+
Object.defineProperty(u, c, Object.getOwnPropertyDescriptor(s, c));
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return u;
|
|
209
|
+
}
|
|
210
|
+
function Pn(u, l) {
|
|
211
|
+
if (!(u instanceof l))
|
|
212
|
+
throw new TypeError("Cannot call a class as a function");
|
|
213
|
+
}
|
|
214
|
+
function be(u, l) {
|
|
215
|
+
for (var s = 0; s < l.length; s++) {
|
|
216
|
+
var c = l[s];
|
|
217
|
+
c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(u, c.key, c);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function Rn(u, l, s) {
|
|
221
|
+
return l && be(u.prototype, l), s && be(u, s), u;
|
|
222
|
+
}
|
|
223
|
+
function Un(u, l, s) {
|
|
224
|
+
return l in u ? Object.defineProperty(u, l, {
|
|
225
|
+
value: s,
|
|
226
|
+
enumerable: !0,
|
|
227
|
+
configurable: !0,
|
|
228
|
+
writable: !0
|
|
229
|
+
}) : u[l] = s, u;
|
|
230
|
+
}
|
|
231
|
+
function ce() {
|
|
232
|
+
return ce = Object.assign || function(u) {
|
|
233
|
+
for (var l = 1; l < arguments.length; l++) {
|
|
234
|
+
var s = arguments[l];
|
|
235
|
+
for (var c in s)
|
|
236
|
+
Object.prototype.hasOwnProperty.call(s, c) && (u[c] = s[c]);
|
|
237
|
+
}
|
|
238
|
+
return u;
|
|
239
|
+
}, ce.apply(this, arguments);
|
|
240
|
+
}
|
|
241
|
+
var Re = { exports: {} };
|
|
242
|
+
(function(u) {
|
|
243
|
+
typeof window > "u" || function(l) {
|
|
244
|
+
var s = l.HTMLCanvasElement && l.HTMLCanvasElement.prototype, c = l.Blob && function() {
|
|
245
|
+
try {
|
|
246
|
+
return !!new Blob();
|
|
247
|
+
} catch {
|
|
248
|
+
return !1;
|
|
249
|
+
}
|
|
250
|
+
}(), d = c && l.Uint8Array && function() {
|
|
251
|
+
try {
|
|
252
|
+
return new Blob([new Uint8Array(100)]).size === 100;
|
|
253
|
+
} catch {
|
|
254
|
+
return !1;
|
|
255
|
+
}
|
|
256
|
+
}(), p = l.BlobBuilder || l.WebKitBlobBuilder || l.MozBlobBuilder || l.MSBlobBuilder, b = /^data:((.*?)(;charset=.*?)?)(;base64)?,/, O = (c || p) && l.atob && l.ArrayBuffer && l.Uint8Array && function(v) {
|
|
257
|
+
var k, E, C, A, B, h, I, T, $;
|
|
258
|
+
if (k = v.match(b), !k)
|
|
259
|
+
throw new Error("invalid data URI");
|
|
260
|
+
for (E = k[2] ? k[1] : "text/plain" + (k[3] || ";charset=US-ASCII"), C = !!k[4], A = v.slice(k[0].length), C ? B = atob(A) : B = decodeURIComponent(A), h = new ArrayBuffer(B.length), I = new Uint8Array(h), T = 0; T < B.length; T += 1)
|
|
261
|
+
I[T] = B.charCodeAt(T);
|
|
262
|
+
return c ? new Blob([d ? I : h], {
|
|
263
|
+
type: E
|
|
264
|
+
}) : ($ = new p(), $.append(h), $.getBlob(E));
|
|
265
|
+
};
|
|
266
|
+
l.HTMLCanvasElement && !s.toBlob && (s.mozGetAsFile ? s.toBlob = function(v, k, E) {
|
|
267
|
+
var C = this;
|
|
268
|
+
setTimeout(function() {
|
|
269
|
+
E && s.toDataURL && O ? v(O(C.toDataURL(k, E))) : v(C.mozGetAsFile("blob", k));
|
|
270
|
+
});
|
|
271
|
+
} : s.toDataURL && O && (s.msToBlob ? s.toBlob = function(v, k, E) {
|
|
272
|
+
var C = this;
|
|
273
|
+
setTimeout(function() {
|
|
274
|
+
(k && k !== "image/png" || E) && s.toDataURL && O ? v(O(C.toDataURL(k, E))) : v(C.msToBlob(k));
|
|
275
|
+
});
|
|
276
|
+
} : s.toBlob = function(v, k, E) {
|
|
277
|
+
var C = this;
|
|
278
|
+
setTimeout(function() {
|
|
279
|
+
v(O(C.toDataURL(k, E)));
|
|
280
|
+
});
|
|
281
|
+
})), u.exports ? u.exports = O : l.dataURLtoBlob = O;
|
|
282
|
+
}(window);
|
|
283
|
+
})(Re);
|
|
284
|
+
var Bn = Re.exports, In = function(l) {
|
|
285
|
+
return typeof Blob > "u" ? !1 : l instanceof Blob || Object.prototype.toString.call(l) === "[object Blob]";
|
|
286
|
+
}, Ee = {
|
|
287
|
+
/**
|
|
288
|
+
* Indicates if output the original image instead of the compressed one
|
|
289
|
+
* when the size of the compressed image is greater than the original one's
|
|
290
|
+
* @type {boolean}
|
|
291
|
+
*/
|
|
292
|
+
strict: !0,
|
|
293
|
+
/**
|
|
294
|
+
* Indicates if read the image's Exif Orientation information,
|
|
295
|
+
* and then rotate or flip the image automatically.
|
|
296
|
+
* @type {boolean}
|
|
297
|
+
*/
|
|
298
|
+
checkOrientation: !0,
|
|
299
|
+
/**
|
|
300
|
+
* The max width of the output image.
|
|
301
|
+
* @type {number}
|
|
302
|
+
*/
|
|
303
|
+
maxWidth: 1 / 0,
|
|
304
|
+
/**
|
|
305
|
+
* The max height of the output image.
|
|
306
|
+
* @type {number}
|
|
307
|
+
*/
|
|
308
|
+
maxHeight: 1 / 0,
|
|
309
|
+
/**
|
|
310
|
+
* The min width of the output image.
|
|
311
|
+
* @type {number}
|
|
312
|
+
*/
|
|
313
|
+
minWidth: 0,
|
|
314
|
+
/**
|
|
315
|
+
* The min height of the output image.
|
|
316
|
+
* @type {number}
|
|
317
|
+
*/
|
|
318
|
+
minHeight: 0,
|
|
319
|
+
/**
|
|
320
|
+
* The width of the output image.
|
|
321
|
+
* If not specified, the natural width of the source image will be used.
|
|
322
|
+
* @type {number}
|
|
323
|
+
*/
|
|
324
|
+
width: void 0,
|
|
325
|
+
/**
|
|
326
|
+
* The height of the output image.
|
|
327
|
+
* If not specified, the natural height of the source image will be used.
|
|
328
|
+
* @type {number}
|
|
329
|
+
*/
|
|
330
|
+
height: void 0,
|
|
331
|
+
/**
|
|
332
|
+
* Sets how the size of the image should be resized to the container
|
|
333
|
+
* specified by the `width` and `height` options.
|
|
334
|
+
* @type {string}
|
|
335
|
+
*/
|
|
336
|
+
resize: "none",
|
|
337
|
+
/**
|
|
338
|
+
* The quality of the output image.
|
|
339
|
+
* It must be a number between `0` and `1`,
|
|
340
|
+
* and only available for `image/jpeg` and `image/webp` images.
|
|
341
|
+
* Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.
|
|
342
|
+
* @type {number}
|
|
343
|
+
*/
|
|
344
|
+
quality: 0.8,
|
|
345
|
+
/**
|
|
346
|
+
* The mime type of the output image.
|
|
347
|
+
* By default, the original mime type of the source image file will be used.
|
|
348
|
+
* @type {string}
|
|
349
|
+
*/
|
|
350
|
+
mimeType: "auto",
|
|
351
|
+
/**
|
|
352
|
+
* Files whose file type is included in this list,
|
|
353
|
+
* and whose file size exceeds the `convertSize` value will be converted to JPEGs.
|
|
354
|
+
* @type {string|Array}
|
|
355
|
+
*/
|
|
356
|
+
convertTypes: ["image/png"],
|
|
357
|
+
/**
|
|
358
|
+
* PNG files over this size (5 MB by default) will be converted to JPEGs.
|
|
359
|
+
* To disable this, just set the value to `Infinity`.
|
|
360
|
+
* @type {number}
|
|
361
|
+
*/
|
|
362
|
+
convertSize: 5e6,
|
|
363
|
+
/**
|
|
364
|
+
* The hook function to execute before draw the image into the canvas for compression.
|
|
365
|
+
* @type {Function}
|
|
366
|
+
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
367
|
+
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
368
|
+
* @example
|
|
369
|
+
* function (context, canvas) {
|
|
370
|
+
* context.fillStyle = '#fff';
|
|
371
|
+
* }
|
|
372
|
+
*/
|
|
373
|
+
beforeDraw: null,
|
|
374
|
+
/**
|
|
375
|
+
* The hook function to execute after drew the image into the canvas for compression.
|
|
376
|
+
* @type {Function}
|
|
377
|
+
* @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.
|
|
378
|
+
* @param {HTMLCanvasElement} canvas - The canvas for compression.
|
|
379
|
+
* @example
|
|
380
|
+
* function (context, canvas) {
|
|
381
|
+
* context.filter = 'grayscale(100%)';
|
|
382
|
+
* }
|
|
383
|
+
*/
|
|
384
|
+
drew: null,
|
|
385
|
+
/**
|
|
386
|
+
* The hook function to execute when success to compress the image.
|
|
387
|
+
* @type {Function}
|
|
388
|
+
* @param {File} file - The compressed image File object.
|
|
389
|
+
* @example
|
|
390
|
+
* function (file) {
|
|
391
|
+
* console.log(file);
|
|
392
|
+
* }
|
|
393
|
+
*/
|
|
394
|
+
success: null,
|
|
395
|
+
/**
|
|
396
|
+
* The hook function to execute when fail to compress the image.
|
|
397
|
+
* @type {Function}
|
|
398
|
+
* @param {Error} err - An Error object.
|
|
399
|
+
* @example
|
|
400
|
+
* function (err) {
|
|
401
|
+
* console.log(err.message);
|
|
402
|
+
* }
|
|
403
|
+
*/
|
|
404
|
+
error: null
|
|
405
|
+
}, jn = typeof window < "u" && typeof window.document < "u", V = jn ? window : {}, fe = function(l) {
|
|
406
|
+
return l > 0 && l < 1 / 0;
|
|
407
|
+
}, Mn = Array.prototype.slice;
|
|
408
|
+
function zn(u) {
|
|
409
|
+
return Array.from ? Array.from(u) : Mn.call(u);
|
|
410
|
+
}
|
|
411
|
+
var Nn = /^image\/.+$/;
|
|
412
|
+
function ve(u) {
|
|
413
|
+
return Nn.test(u);
|
|
414
|
+
}
|
|
415
|
+
function Ln(u) {
|
|
416
|
+
var l = ve(u) ? u.substr(6) : "";
|
|
417
|
+
return l === "jpeg" && (l = "jpg"), ".".concat(l);
|
|
418
|
+
}
|
|
419
|
+
var Ue = String.fromCharCode;
|
|
420
|
+
function $n(u, l, s) {
|
|
421
|
+
var c = "", d;
|
|
422
|
+
for (s += l, d = l; d < s; d += 1)
|
|
423
|
+
c += Ue(u.getUint8(d));
|
|
424
|
+
return c;
|
|
425
|
+
}
|
|
426
|
+
var Hn = V.btoa;
|
|
427
|
+
function _n(u, l) {
|
|
428
|
+
for (var s = [], c = 8192, d = new Uint8Array(u); d.length > 0; )
|
|
429
|
+
s.push(Ue.apply(null, zn(d.subarray(0, c)))), d = d.subarray(c);
|
|
430
|
+
return "data:".concat(l, ";base64,").concat(Hn(s.join("")));
|
|
431
|
+
}
|
|
432
|
+
function Wn(u) {
|
|
433
|
+
var l = new DataView(u), s;
|
|
434
|
+
try {
|
|
435
|
+
var c, d, p;
|
|
436
|
+
if (l.getUint8(0) === 255 && l.getUint8(1) === 216)
|
|
437
|
+
for (var b = l.byteLength, O = 2; O + 1 < b; ) {
|
|
438
|
+
if (l.getUint8(O) === 255 && l.getUint8(O + 1) === 225) {
|
|
439
|
+
d = O;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
O += 1;
|
|
443
|
+
}
|
|
444
|
+
if (d) {
|
|
445
|
+
var v = d + 4, k = d + 10;
|
|
446
|
+
if ($n(l, v, 4) === "Exif") {
|
|
447
|
+
var E = l.getUint16(k);
|
|
448
|
+
if (c = E === 18761, (c || E === 19789) && l.getUint16(k + 2, c) === 42) {
|
|
449
|
+
var C = l.getUint32(k + 4, c);
|
|
450
|
+
C >= 8 && (p = k + C);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (p) {
|
|
455
|
+
var A = l.getUint16(p, c), B, h;
|
|
456
|
+
for (h = 0; h < A; h += 1)
|
|
457
|
+
if (B = p + h * 12 + 2, l.getUint16(B, c) === 274) {
|
|
458
|
+
B += 8, s = l.getUint16(B, c), l.setUint16(B, 1, c);
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} catch {
|
|
463
|
+
s = 1;
|
|
464
|
+
}
|
|
465
|
+
return s;
|
|
466
|
+
}
|
|
467
|
+
function Vn(u) {
|
|
468
|
+
var l = 0, s = 1, c = 1;
|
|
469
|
+
switch (u) {
|
|
470
|
+
case 2:
|
|
471
|
+
s = -1;
|
|
472
|
+
break;
|
|
473
|
+
case 3:
|
|
474
|
+
l = -180;
|
|
475
|
+
break;
|
|
476
|
+
case 4:
|
|
477
|
+
c = -1;
|
|
478
|
+
break;
|
|
479
|
+
case 5:
|
|
480
|
+
l = 90, c = -1;
|
|
481
|
+
break;
|
|
482
|
+
case 6:
|
|
483
|
+
l = 90;
|
|
484
|
+
break;
|
|
485
|
+
case 7:
|
|
486
|
+
l = 90, s = -1;
|
|
487
|
+
break;
|
|
488
|
+
case 8:
|
|
489
|
+
l = -90;
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
rotate: l,
|
|
494
|
+
scaleX: s,
|
|
495
|
+
scaleY: c
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
var qn = /\.\d*(?:0|9){12}\d*$/;
|
|
499
|
+
function we(u) {
|
|
500
|
+
var l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e11;
|
|
501
|
+
return qn.test(u) ? Math.round(u * l) / l : u;
|
|
502
|
+
}
|
|
503
|
+
function Y(u) {
|
|
504
|
+
var l = u.aspectRatio, s = u.height, c = u.width, d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "none", p = fe(c), b = fe(s);
|
|
505
|
+
if (p && b) {
|
|
506
|
+
var O = s * l;
|
|
507
|
+
(d === "contain" || d === "none") && O > c || d === "cover" && O < c ? s = c / l : c = s * l;
|
|
508
|
+
} else p ? s = c / l : b && (c = s * l);
|
|
509
|
+
return {
|
|
510
|
+
width: c,
|
|
511
|
+
height: s
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
var Fn = V.ArrayBuffer, ke = V.FileReader, K = V.URL || V.webkitURL, Xn = /\.\w+$/, Kn = V.Compressor, Oe = /* @__PURE__ */ function() {
|
|
515
|
+
function u(l, s) {
|
|
516
|
+
Pn(this, u), this.file = l, this.image = new Image(), this.options = ie(ie({}, Ee), s), this.aborted = !1, this.result = null, this.init();
|
|
517
|
+
}
|
|
518
|
+
return Rn(u, [{
|
|
519
|
+
key: "init",
|
|
520
|
+
value: function() {
|
|
521
|
+
var s = this, c = this.file, d = this.options;
|
|
522
|
+
if (!In(c)) {
|
|
523
|
+
this.fail(new Error("The first argument must be a File or Blob object."));
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
var p = c.type;
|
|
527
|
+
if (!ve(p)) {
|
|
528
|
+
this.fail(new Error("The first argument must be an image File or Blob object."));
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (!K || !ke) {
|
|
532
|
+
this.fail(new Error("The current browser does not support image compression."));
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (Fn || (d.checkOrientation = !1), K && !d.checkOrientation)
|
|
536
|
+
this.load({
|
|
537
|
+
url: K.createObjectURL(c)
|
|
538
|
+
});
|
|
539
|
+
else {
|
|
540
|
+
var b = new ke(), O = d.checkOrientation && p === "image/jpeg";
|
|
541
|
+
this.reader = b, b.onload = function(v) {
|
|
542
|
+
var k = v.target, E = k.result, C = {};
|
|
543
|
+
if (O) {
|
|
544
|
+
var A = Wn(E);
|
|
545
|
+
A > 1 || !K ? (C.url = _n(E, p), A > 1 && ce(C, Vn(A))) : C.url = K.createObjectURL(c);
|
|
546
|
+
} else
|
|
547
|
+
C.url = E;
|
|
548
|
+
s.load(C);
|
|
549
|
+
}, b.onabort = function() {
|
|
550
|
+
s.fail(new Error("Aborted to read the image with FileReader."));
|
|
551
|
+
}, b.onerror = function() {
|
|
552
|
+
s.fail(new Error("Failed to read the image with FileReader."));
|
|
553
|
+
}, b.onloadend = function() {
|
|
554
|
+
s.reader = null;
|
|
555
|
+
}, O ? b.readAsArrayBuffer(c) : b.readAsDataURL(c);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}, {
|
|
559
|
+
key: "load",
|
|
560
|
+
value: function(s) {
|
|
561
|
+
var c = this, d = this.file, p = this.image;
|
|
562
|
+
p.onload = function() {
|
|
563
|
+
c.draw(ie(ie({}, s), {}, {
|
|
564
|
+
naturalWidth: p.naturalWidth,
|
|
565
|
+
naturalHeight: p.naturalHeight
|
|
566
|
+
}));
|
|
567
|
+
}, p.onabort = function() {
|
|
568
|
+
c.fail(new Error("Aborted to load the image."));
|
|
569
|
+
}, p.onerror = function() {
|
|
570
|
+
c.fail(new Error("Failed to load the image."));
|
|
571
|
+
}, V.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(V.navigator.userAgent) && (p.crossOrigin = "anonymous"), p.alt = d.name, p.src = s.url;
|
|
572
|
+
}
|
|
573
|
+
}, {
|
|
574
|
+
key: "draw",
|
|
575
|
+
value: function(s) {
|
|
576
|
+
var c = this, d = s.naturalWidth, p = s.naturalHeight, b = s.rotate, O = b === void 0 ? 0 : b, v = s.scaleX, k = v === void 0 ? 1 : v, E = s.scaleY, C = E === void 0 ? 1 : E, A = this.file, B = this.image, h = this.options, I = document.createElement("canvas"), T = I.getContext("2d"), $ = Math.abs(O) % 180 === 90, J = (h.resize === "contain" || h.resize === "cover") && fe(h.width) && fe(h.height), H = Math.max(h.maxWidth, 0) || 1 / 0, q = Math.max(h.maxHeight, 0) || 1 / 0, F = Math.max(h.minWidth, 0) || 0, _ = Math.max(h.minHeight, 0) || 0, W = d / p, P = h.width, R = h.height;
|
|
577
|
+
if ($) {
|
|
578
|
+
var Z = [q, H];
|
|
579
|
+
H = Z[0], q = Z[1];
|
|
580
|
+
var ee = [_, F];
|
|
581
|
+
F = ee[0], _ = ee[1];
|
|
582
|
+
var te = [R, P];
|
|
583
|
+
P = te[0], R = te[1];
|
|
584
|
+
}
|
|
585
|
+
J && (W = P / R);
|
|
586
|
+
var re = Y({
|
|
587
|
+
aspectRatio: W,
|
|
588
|
+
width: H,
|
|
589
|
+
height: q
|
|
590
|
+
}, "contain");
|
|
591
|
+
H = re.width, q = re.height;
|
|
592
|
+
var ne = Y({
|
|
593
|
+
aspectRatio: W,
|
|
594
|
+
width: F,
|
|
595
|
+
height: _
|
|
596
|
+
}, "cover");
|
|
597
|
+
if (F = ne.width, _ = ne.height, J) {
|
|
598
|
+
var i = Y({
|
|
599
|
+
aspectRatio: W,
|
|
600
|
+
width: P,
|
|
601
|
+
height: R
|
|
602
|
+
}, h.resize);
|
|
603
|
+
P = i.width, R = i.height;
|
|
604
|
+
} else {
|
|
605
|
+
var t = Y({
|
|
606
|
+
aspectRatio: W,
|
|
607
|
+
width: P,
|
|
608
|
+
height: R
|
|
609
|
+
}), r = t.width;
|
|
610
|
+
P = r === void 0 ? d : r;
|
|
611
|
+
var n = t.height;
|
|
612
|
+
R = n === void 0 ? p : n;
|
|
613
|
+
}
|
|
614
|
+
P = Math.floor(we(Math.min(Math.max(P, F), H))), R = Math.floor(we(Math.min(Math.max(R, _), q)));
|
|
615
|
+
var a = -P / 2, o = -R / 2, f = P, g = R, w = [];
|
|
616
|
+
if (J) {
|
|
617
|
+
var D = 0, y = 0, x = d, m = p, S = Y({
|
|
618
|
+
aspectRatio: W,
|
|
619
|
+
width: d,
|
|
620
|
+
height: p
|
|
621
|
+
}, {
|
|
622
|
+
contain: "cover",
|
|
623
|
+
cover: "contain"
|
|
624
|
+
}[h.resize]);
|
|
625
|
+
x = S.width, m = S.height, D = (d - x) / 2, y = (p - m) / 2, w.push(D, y, x, m);
|
|
626
|
+
}
|
|
627
|
+
if (w.push(a, o, f, g), $) {
|
|
628
|
+
var j = [R, P];
|
|
629
|
+
P = j[0], R = j[1];
|
|
630
|
+
}
|
|
631
|
+
I.width = P, I.height = R, ve(h.mimeType) || (h.mimeType = A.type);
|
|
632
|
+
var M = "transparent";
|
|
633
|
+
if (A.size > h.convertSize && h.convertTypes.indexOf(h.mimeType) >= 0 && (h.mimeType = "image/jpeg"), h.mimeType === "image/jpeg" && (M = "#fff"), T.fillStyle = M, T.fillRect(0, 0, P, R), h.beforeDraw && h.beforeDraw.call(this, T, I), !this.aborted && (T.save(), T.translate(P / 2, R / 2), T.rotate(O * Math.PI / 180), T.scale(k, C), T.drawImage.apply(T, [B].concat(w)), T.restore(), h.drew && h.drew.call(this, T, I), !this.aborted)) {
|
|
634
|
+
var U = function(X) {
|
|
635
|
+
c.aborted || c.done({
|
|
636
|
+
naturalWidth: d,
|
|
637
|
+
naturalHeight: p,
|
|
638
|
+
result: X
|
|
639
|
+
});
|
|
640
|
+
};
|
|
641
|
+
I.toBlob ? I.toBlob(U, h.mimeType, h.quality) : U(Bn(I.toDataURL(h.mimeType, h.quality)));
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}, {
|
|
645
|
+
key: "done",
|
|
646
|
+
value: function(s) {
|
|
647
|
+
var c = s.naturalWidth, d = s.naturalHeight, p = s.result, b = this.file, O = this.image, v = this.options;
|
|
648
|
+
if (K && !v.checkOrientation && K.revokeObjectURL(O.src), p)
|
|
649
|
+
if (v.strict && p.size > b.size && v.mimeType === b.type && !(v.width > c || v.height > d || v.minWidth > c || v.minHeight > d || v.maxWidth < c || v.maxHeight < d))
|
|
650
|
+
p = b;
|
|
651
|
+
else {
|
|
652
|
+
var k = /* @__PURE__ */ new Date();
|
|
653
|
+
p.lastModified = k.getTime(), p.lastModifiedDate = k, p.name = b.name, p.name && p.type !== b.type && (p.name = p.name.replace(Xn, Ln(p.type)));
|
|
654
|
+
}
|
|
655
|
+
else
|
|
656
|
+
p = b;
|
|
657
|
+
this.result = p, v.success && v.success.call(this, p);
|
|
658
|
+
}
|
|
659
|
+
}, {
|
|
660
|
+
key: "fail",
|
|
661
|
+
value: function(s) {
|
|
662
|
+
var c = this.options;
|
|
663
|
+
if (c.error)
|
|
664
|
+
c.error.call(this, s);
|
|
665
|
+
else
|
|
666
|
+
throw s;
|
|
667
|
+
}
|
|
668
|
+
}, {
|
|
669
|
+
key: "abort",
|
|
670
|
+
value: function() {
|
|
671
|
+
this.aborted || (this.aborted = !0, this.reader ? this.reader.abort() : this.image.complete ? this.fail(new Error("The compression process has been aborted.")) : (this.image.onload = null, this.image.onabort()));
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Get the no conflict compressor class.
|
|
675
|
+
* @returns {Compressor} The compressor class.
|
|
676
|
+
*/
|
|
677
|
+
}], [{
|
|
678
|
+
key: "noConflict",
|
|
679
|
+
value: function() {
|
|
680
|
+
return window.Compressor = Kn, u;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Change the default options.
|
|
684
|
+
* @param {Object} options - The new default options.
|
|
685
|
+
*/
|
|
686
|
+
}, {
|
|
687
|
+
key: "setDefaults",
|
|
688
|
+
value: function(s) {
|
|
689
|
+
ce(Ee, s);
|
|
690
|
+
}
|
|
691
|
+
}]), u;
|
|
692
|
+
}(), Be = { exports: {} };
|
|
693
|
+
const Gn = /* @__PURE__ */ Dn(Tn);
|
|
694
|
+
/*!
|
|
695
|
+
Name: vue-upload-component
|
|
696
|
+
Component URI: https://github.com/lian-yue/vue-upload-component#readme
|
|
697
|
+
Version: 3.1.16
|
|
698
|
+
Author: LianYue
|
|
699
|
+
License: Apache-2.0
|
|
700
|
+
Description: Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter
|
|
701
|
+
*/
|
|
702
|
+
(function(u, l) {
|
|
703
|
+
(function(s, c) {
|
|
704
|
+
u.exports = c(Gn);
|
|
705
|
+
})(Sn, function(s) {
|
|
706
|
+
function c(i) {
|
|
707
|
+
return O(i) || b(i) || p(i) || d();
|
|
708
|
+
}
|
|
709
|
+
function d() {
|
|
710
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
711
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
712
|
+
}
|
|
713
|
+
function p(i, t) {
|
|
714
|
+
if (i) {
|
|
715
|
+
if (typeof i == "string") return v(i, t);
|
|
716
|
+
var r = Object.prototype.toString.call(i).slice(8, -1);
|
|
717
|
+
if (r === "Object" && i.constructor && (r = i.constructor.name), r === "Map" || r === "Set") return Array.from(i);
|
|
718
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return v(i, t);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
function b(i) {
|
|
722
|
+
if (typeof Symbol < "u" && i[Symbol.iterator] != null || i["@@iterator"] != null) return Array.from(i);
|
|
723
|
+
}
|
|
724
|
+
function O(i) {
|
|
725
|
+
if (Array.isArray(i)) return v(i);
|
|
726
|
+
}
|
|
727
|
+
function v(i, t) {
|
|
728
|
+
(t == null || t > i.length) && (t = i.length);
|
|
729
|
+
for (var r = 0, n = new Array(t); r < t; r++)
|
|
730
|
+
n[r] = i[r];
|
|
731
|
+
return n;
|
|
732
|
+
}
|
|
733
|
+
function k(i, t) {
|
|
734
|
+
var r = Object.keys(i);
|
|
735
|
+
if (Object.getOwnPropertySymbols) {
|
|
736
|
+
var n = Object.getOwnPropertySymbols(i);
|
|
737
|
+
t && (n = n.filter(function(a) {
|
|
738
|
+
return Object.getOwnPropertyDescriptor(i, a).enumerable;
|
|
739
|
+
})), r.push.apply(r, n);
|
|
740
|
+
}
|
|
741
|
+
return r;
|
|
742
|
+
}
|
|
743
|
+
function E(i) {
|
|
744
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
745
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
746
|
+
t % 2 ? k(Object(r), !0).forEach(function(n) {
|
|
747
|
+
C(i, n, r[n]);
|
|
748
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(r)) : k(Object(r)).forEach(function(n) {
|
|
749
|
+
Object.defineProperty(i, n, Object.getOwnPropertyDescriptor(r, n));
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
return i;
|
|
753
|
+
}
|
|
754
|
+
function C(i, t, r) {
|
|
755
|
+
return t in i ? Object.defineProperty(i, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : i[t] = r, i;
|
|
756
|
+
}
|
|
757
|
+
function A(i) {
|
|
758
|
+
"@babel/helpers - typeof";
|
|
759
|
+
return A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
760
|
+
return typeof t;
|
|
761
|
+
} : function(t) {
|
|
762
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
763
|
+
}, A(i);
|
|
764
|
+
}
|
|
765
|
+
function B(i, t) {
|
|
766
|
+
var r = Object.keys(i);
|
|
767
|
+
if (Object.getOwnPropertySymbols) {
|
|
768
|
+
var n = Object.getOwnPropertySymbols(i);
|
|
769
|
+
t && (n = n.filter(function(a) {
|
|
770
|
+
return Object.getOwnPropertyDescriptor(i, a).enumerable;
|
|
771
|
+
})), r.push.apply(r, n);
|
|
772
|
+
}
|
|
773
|
+
return r;
|
|
774
|
+
}
|
|
775
|
+
function h(i) {
|
|
776
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
777
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
778
|
+
t % 2 ? B(Object(r), !0).forEach(function(n) {
|
|
779
|
+
J(i, n, r[n]);
|
|
780
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(i, Object.getOwnPropertyDescriptors(r)) : B(Object(r)).forEach(function(n) {
|
|
781
|
+
Object.defineProperty(i, n, Object.getOwnPropertyDescriptor(r, n));
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
return i;
|
|
785
|
+
}
|
|
786
|
+
function I(i, t) {
|
|
787
|
+
if (!(i instanceof t))
|
|
788
|
+
throw new TypeError("Cannot call a class as a function");
|
|
789
|
+
}
|
|
790
|
+
function T(i, t) {
|
|
791
|
+
for (var r = 0; r < t.length; r++) {
|
|
792
|
+
var n = t[r];
|
|
793
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(i, n.key, n);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
function $(i, t, r) {
|
|
797
|
+
return t && T(i.prototype, t), Object.defineProperty(i, "prototype", {
|
|
798
|
+
writable: !1
|
|
799
|
+
}), i;
|
|
800
|
+
}
|
|
801
|
+
function J(i, t, r) {
|
|
802
|
+
return t in i ? Object.defineProperty(i, t, {
|
|
803
|
+
value: r,
|
|
804
|
+
enumerable: !0,
|
|
805
|
+
configurable: !0,
|
|
806
|
+
writable: !0
|
|
807
|
+
}) : i[t] = r, i;
|
|
808
|
+
}
|
|
809
|
+
var H = function(t) {
|
|
810
|
+
var r = new XMLHttpRequest();
|
|
811
|
+
return r.open(t.method || "GET", t.url), r.responseType = "json", t.headers && Object.keys(t.headers).forEach(function(n) {
|
|
812
|
+
r.setRequestHeader(n, t.headers[n]);
|
|
813
|
+
}), r;
|
|
814
|
+
}, q = function(t, r) {
|
|
815
|
+
return new Promise(function(n, a) {
|
|
816
|
+
t.onload = function() {
|
|
817
|
+
if (t.status >= 200 && t.status < 300) {
|
|
818
|
+
var o;
|
|
819
|
+
try {
|
|
820
|
+
o = JSON.parse(t.response);
|
|
821
|
+
} catch {
|
|
822
|
+
o = t.response;
|
|
823
|
+
}
|
|
824
|
+
n(o);
|
|
825
|
+
} else
|
|
826
|
+
a(t.response);
|
|
827
|
+
}, t.onerror = function() {
|
|
828
|
+
return a(t.response);
|
|
829
|
+
}, t.send(JSON.stringify(r));
|
|
830
|
+
});
|
|
831
|
+
}, F = function(t, r) {
|
|
832
|
+
var n = new FormData();
|
|
833
|
+
for (var a in r)
|
|
834
|
+
n.append(a, r[a]);
|
|
835
|
+
return new Promise(function(o, f) {
|
|
836
|
+
t.onload = function() {
|
|
837
|
+
if (t.status >= 200 && t.status < 300) {
|
|
838
|
+
var g;
|
|
839
|
+
try {
|
|
840
|
+
g = JSON.parse(t.response);
|
|
841
|
+
} catch {
|
|
842
|
+
g = t.response;
|
|
843
|
+
}
|
|
844
|
+
o(g);
|
|
845
|
+
} else
|
|
846
|
+
f(t.response);
|
|
847
|
+
}, t.onerror = function() {
|
|
848
|
+
return f(t.response);
|
|
849
|
+
}, t.send(n);
|
|
850
|
+
});
|
|
851
|
+
};
|
|
852
|
+
function _(i) {
|
|
853
|
+
var t = H(i);
|
|
854
|
+
return q(t, i.body);
|
|
855
|
+
}
|
|
856
|
+
var W = /* @__PURE__ */ function() {
|
|
857
|
+
function i(t, r) {
|
|
858
|
+
I(this, i), this.file = t, this.options = r, this.chunks = [], this.sessionId = null, this.chunkSize = null, this.speedInterval = null;
|
|
859
|
+
}
|
|
860
|
+
return $(i, [{
|
|
861
|
+
key: "maxRetries",
|
|
862
|
+
get: function() {
|
|
863
|
+
return parseInt(this.options.maxRetries, 10);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Gets the max number of active chunks being uploaded at once from options
|
|
867
|
+
*/
|
|
868
|
+
}, {
|
|
869
|
+
key: "maxActiveChunks",
|
|
870
|
+
get: function() {
|
|
871
|
+
return parseInt(this.options.maxActive, 10);
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Gets the file type
|
|
875
|
+
*/
|
|
876
|
+
}, {
|
|
877
|
+
key: "fileType",
|
|
878
|
+
get: function() {
|
|
879
|
+
return this.file.type;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Gets the file size
|
|
883
|
+
*/
|
|
884
|
+
}, {
|
|
885
|
+
key: "fileSize",
|
|
886
|
+
get: function() {
|
|
887
|
+
return this.file.size;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Gets the file name
|
|
891
|
+
*/
|
|
892
|
+
}, {
|
|
893
|
+
key: "fileName",
|
|
894
|
+
get: function() {
|
|
895
|
+
return this.file.name;
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Gets action (url) to upload the file
|
|
899
|
+
*/
|
|
900
|
+
}, {
|
|
901
|
+
key: "action",
|
|
902
|
+
get: function() {
|
|
903
|
+
return this.options.action || null;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Gets the body to be merged when sending the request in start phase
|
|
907
|
+
*/
|
|
908
|
+
}, {
|
|
909
|
+
key: "startBody",
|
|
910
|
+
get: function() {
|
|
911
|
+
return this.options.startBody || {};
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Gets the body to be merged when sending the request in upload phase
|
|
915
|
+
*/
|
|
916
|
+
}, {
|
|
917
|
+
key: "uploadBody",
|
|
918
|
+
get: function() {
|
|
919
|
+
return this.options.uploadBody || {};
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Gets the body to be merged when sending the request in finish phase
|
|
923
|
+
*/
|
|
924
|
+
}, {
|
|
925
|
+
key: "finishBody",
|
|
926
|
+
get: function() {
|
|
927
|
+
return this.options.finishBody || {};
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Gets the headers of the requests from options
|
|
931
|
+
*/
|
|
932
|
+
}, {
|
|
933
|
+
key: "headers",
|
|
934
|
+
get: function() {
|
|
935
|
+
return this.options.headers || {};
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Whether it's ready to upload files or not
|
|
939
|
+
*/
|
|
940
|
+
}, {
|
|
941
|
+
key: "readyToUpload",
|
|
942
|
+
get: function() {
|
|
943
|
+
return !!this.chunks;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Gets the progress of the chunk upload
|
|
947
|
+
* - Gets all the completed chunks
|
|
948
|
+
* - Gets the progress of all the chunks that are being uploaded
|
|
949
|
+
*/
|
|
950
|
+
}, {
|
|
951
|
+
key: "progress",
|
|
952
|
+
get: function() {
|
|
953
|
+
var r = this, n = this.chunksUploaded.length / this.chunks.length * 100, a = this.chunksUploading.reduce(function(o, f) {
|
|
954
|
+
return o + (f.progress | 0) / r.chunks.length;
|
|
955
|
+
}, 0);
|
|
956
|
+
return Math.min(n + a, 100);
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Gets all the chunks that are pending to be uploaded
|
|
960
|
+
*/
|
|
961
|
+
}, {
|
|
962
|
+
key: "chunksToUpload",
|
|
963
|
+
get: function() {
|
|
964
|
+
return this.chunks.filter(function(r) {
|
|
965
|
+
return !r.active && !r.uploaded;
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Whether there are chunks to upload or not
|
|
970
|
+
*/
|
|
971
|
+
}, {
|
|
972
|
+
key: "hasChunksToUpload",
|
|
973
|
+
get: function() {
|
|
974
|
+
return this.chunksToUpload.length > 0;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Gets all the chunks that are uploading
|
|
978
|
+
*/
|
|
979
|
+
}, {
|
|
980
|
+
key: "chunksUploading",
|
|
981
|
+
get: function() {
|
|
982
|
+
return this.chunks.filter(function(r) {
|
|
983
|
+
return !!r.xhr && !!r.active;
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Gets all the chunks that have finished uploading
|
|
988
|
+
*/
|
|
989
|
+
}, {
|
|
990
|
+
key: "chunksUploaded",
|
|
991
|
+
get: function() {
|
|
992
|
+
return this.chunks.filter(function(r) {
|
|
993
|
+
return !!r.uploaded;
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Creates all the chunks in the initial state
|
|
998
|
+
*/
|
|
999
|
+
}, {
|
|
1000
|
+
key: "createChunks",
|
|
1001
|
+
value: function() {
|
|
1002
|
+
this.chunks = [];
|
|
1003
|
+
for (var r = 0, n = this.chunkSize; r < this.fileSize; )
|
|
1004
|
+
this.chunks.push({
|
|
1005
|
+
blob: this.file.file.slice(r, n),
|
|
1006
|
+
startOffset: r,
|
|
1007
|
+
active: !1,
|
|
1008
|
+
retries: this.maxRetries
|
|
1009
|
+
}), r = n, n = r + this.chunkSize;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Updates the progress of the file with the handler's progress
|
|
1013
|
+
*/
|
|
1014
|
+
}, {
|
|
1015
|
+
key: "updateFileProgress",
|
|
1016
|
+
value: function() {
|
|
1017
|
+
this.file.progress = this.progress;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Paues the upload process
|
|
1021
|
+
* - Stops all active requests
|
|
1022
|
+
* - Sets the file not active
|
|
1023
|
+
*/
|
|
1024
|
+
}, {
|
|
1025
|
+
key: "pause",
|
|
1026
|
+
value: function() {
|
|
1027
|
+
this.file.active = !1, this.stopChunks();
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Stops all the current chunks
|
|
1031
|
+
*/
|
|
1032
|
+
}, {
|
|
1033
|
+
key: "stopChunks",
|
|
1034
|
+
value: function() {
|
|
1035
|
+
this.chunksUploading.forEach(function(r) {
|
|
1036
|
+
r.xhr.abort(), r.active = !1;
|
|
1037
|
+
}), this.stopSpeedCalc();
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Resumes the file upload
|
|
1041
|
+
* - Sets the file active
|
|
1042
|
+
* - Starts the following chunks
|
|
1043
|
+
*/
|
|
1044
|
+
}, {
|
|
1045
|
+
key: "resume",
|
|
1046
|
+
value: function() {
|
|
1047
|
+
this.file.active = !0, this.startChunking();
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Starts the file upload
|
|
1051
|
+
*
|
|
1052
|
+
* @returns Promise
|
|
1053
|
+
* - resolve The file was uploaded
|
|
1054
|
+
* - reject The file upload failed
|
|
1055
|
+
*/
|
|
1056
|
+
}, {
|
|
1057
|
+
key: "upload",
|
|
1058
|
+
value: function() {
|
|
1059
|
+
var r = this;
|
|
1060
|
+
return this.promise = new Promise(function(n, a) {
|
|
1061
|
+
r.resolve = n, r.reject = a;
|
|
1062
|
+
}), this.start(), this.promise;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Start phase
|
|
1066
|
+
* Sends a request to the backend to initialise the chunks
|
|
1067
|
+
*/
|
|
1068
|
+
}, {
|
|
1069
|
+
key: "start",
|
|
1070
|
+
value: function() {
|
|
1071
|
+
var r = this;
|
|
1072
|
+
_({
|
|
1073
|
+
method: "POST",
|
|
1074
|
+
headers: h(h({}, this.headers), {}, {
|
|
1075
|
+
"Content-Type": "application/json"
|
|
1076
|
+
}),
|
|
1077
|
+
url: this.action,
|
|
1078
|
+
body: Object.assign(this.startBody, {
|
|
1079
|
+
phase: "start",
|
|
1080
|
+
mime_type: this.fileType,
|
|
1081
|
+
size: this.fileSize,
|
|
1082
|
+
name: this.fileName
|
|
1083
|
+
})
|
|
1084
|
+
}).then(function(n) {
|
|
1085
|
+
if (n.status !== "success")
|
|
1086
|
+
return r.file.response = n, r.reject("server");
|
|
1087
|
+
r.sessionId = n.data.session_id, r.chunkSize = n.data.end_offset, r.createChunks(), r.startChunking();
|
|
1088
|
+
}).catch(function(n) {
|
|
1089
|
+
r.file.response = n, r.reject("server");
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Starts to upload chunks
|
|
1094
|
+
*/
|
|
1095
|
+
}, {
|
|
1096
|
+
key: "startChunking",
|
|
1097
|
+
value: function() {
|
|
1098
|
+
for (var r = 0; r < this.maxActiveChunks; r++)
|
|
1099
|
+
this.uploadNextChunk();
|
|
1100
|
+
this.startSpeedCalc();
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Uploads the next chunk
|
|
1104
|
+
* - Won't do anything if the process is paused
|
|
1105
|
+
* - Will start finish phase if there are no more chunks to upload
|
|
1106
|
+
*/
|
|
1107
|
+
}, {
|
|
1108
|
+
key: "uploadNextChunk",
|
|
1109
|
+
value: function() {
|
|
1110
|
+
if (this.file.active) {
|
|
1111
|
+
if (this.hasChunksToUpload)
|
|
1112
|
+
return this.uploadChunk(this.chunksToUpload[0]);
|
|
1113
|
+
if (this.chunksUploading.length === 0)
|
|
1114
|
+
return this.finish();
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Uploads a chunk
|
|
1119
|
+
* - Sends the chunk to the backend
|
|
1120
|
+
* - Sets the chunk as uploaded if everything went well
|
|
1121
|
+
* - Decreases the number of retries if anything went wrong
|
|
1122
|
+
* - Fails if there are no more retries
|
|
1123
|
+
*
|
|
1124
|
+
* @param {Object} chunk
|
|
1125
|
+
*/
|
|
1126
|
+
}, {
|
|
1127
|
+
key: "uploadChunk",
|
|
1128
|
+
value: function(r) {
|
|
1129
|
+
var n = this;
|
|
1130
|
+
r.progress = 0, r.active = !0, this.updateFileProgress(), r.xhr = H({
|
|
1131
|
+
method: "POST",
|
|
1132
|
+
headers: this.headers,
|
|
1133
|
+
url: this.action
|
|
1134
|
+
}), r.xhr.upload.addEventListener("progress", function(a) {
|
|
1135
|
+
a.lengthComputable && (r.progress = Math.round(a.loaded / a.total * 100));
|
|
1136
|
+
}, !1), F(r.xhr, Object.assign(this.uploadBody, {
|
|
1137
|
+
phase: "upload",
|
|
1138
|
+
session_id: this.sessionId,
|
|
1139
|
+
start_offset: r.startOffset,
|
|
1140
|
+
chunk: r.blob
|
|
1141
|
+
})).then(function(a) {
|
|
1142
|
+
if (r.active = !1, a.status === "success")
|
|
1143
|
+
r.uploaded = !0;
|
|
1144
|
+
else if (r.retries-- <= 0)
|
|
1145
|
+
return n.stopChunks(), n.reject("upload");
|
|
1146
|
+
n.uploadNextChunk();
|
|
1147
|
+
}).catch(function() {
|
|
1148
|
+
if (r.active = !1, r.retries-- <= 0)
|
|
1149
|
+
return n.stopChunks(), n.reject("upload");
|
|
1150
|
+
n.uploadNextChunk();
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Finish phase
|
|
1155
|
+
* Sends a request to the backend to finish the process
|
|
1156
|
+
*/
|
|
1157
|
+
}, {
|
|
1158
|
+
key: "finish",
|
|
1159
|
+
value: function() {
|
|
1160
|
+
var r = this;
|
|
1161
|
+
this.updateFileProgress(), this.stopSpeedCalc(), _({
|
|
1162
|
+
method: "POST",
|
|
1163
|
+
headers: h(h({}, this.headers), {}, {
|
|
1164
|
+
"Content-Type": "application/json"
|
|
1165
|
+
}),
|
|
1166
|
+
url: this.action,
|
|
1167
|
+
body: Object.assign(this.finishBody, {
|
|
1168
|
+
phase: "finish",
|
|
1169
|
+
session_id: this.sessionId
|
|
1170
|
+
})
|
|
1171
|
+
}).then(function(n) {
|
|
1172
|
+
if (r.file.response = n, n.status !== "success")
|
|
1173
|
+
return r.reject("server");
|
|
1174
|
+
r.resolve(n);
|
|
1175
|
+
}).catch(function(n) {
|
|
1176
|
+
r.file.response = n, r.reject("server");
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Sets an interval to calculate and
|
|
1181
|
+
* set upload speed every 3 seconds
|
|
1182
|
+
*/
|
|
1183
|
+
}, {
|
|
1184
|
+
key: "startSpeedCalc",
|
|
1185
|
+
value: function() {
|
|
1186
|
+
var r = this;
|
|
1187
|
+
this.file.speed = 0;
|
|
1188
|
+
var n = 0;
|
|
1189
|
+
this.speedInterval || (this.speedInterval = window.setInterval(function() {
|
|
1190
|
+
var a = r.progress / 100 * r.fileSize;
|
|
1191
|
+
r.file.speed = a - n, n = a;
|
|
1192
|
+
}, 1e3));
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Removes the upload speed interval
|
|
1196
|
+
*/
|
|
1197
|
+
}, {
|
|
1198
|
+
key: "stopSpeedCalc",
|
|
1199
|
+
value: function() {
|
|
1200
|
+
this.speedInterval && window.clearInterval(this.speedInterval), this.speedInterval = null, this.file.speed = 0;
|
|
1201
|
+
}
|
|
1202
|
+
}]), i;
|
|
1203
|
+
}(), P = {
|
|
1204
|
+
headers: {},
|
|
1205
|
+
action: "",
|
|
1206
|
+
minSize: 1048576,
|
|
1207
|
+
maxActive: 3,
|
|
1208
|
+
maxRetries: 5,
|
|
1209
|
+
handler: W
|
|
1210
|
+
}, R = s.defineComponent({
|
|
1211
|
+
compatConfig: {
|
|
1212
|
+
MODE: 3
|
|
1213
|
+
},
|
|
1214
|
+
props: {
|
|
1215
|
+
inputId: {
|
|
1216
|
+
type: String
|
|
1217
|
+
},
|
|
1218
|
+
name: {
|
|
1219
|
+
type: String,
|
|
1220
|
+
default: "file"
|
|
1221
|
+
},
|
|
1222
|
+
accept: {
|
|
1223
|
+
type: String
|
|
1224
|
+
},
|
|
1225
|
+
capture: {},
|
|
1226
|
+
disabled: {
|
|
1227
|
+
default: !1
|
|
1228
|
+
},
|
|
1229
|
+
multiple: {
|
|
1230
|
+
type: Boolean,
|
|
1231
|
+
default: !1
|
|
1232
|
+
},
|
|
1233
|
+
maximum: {
|
|
1234
|
+
type: Number
|
|
1235
|
+
},
|
|
1236
|
+
addIndex: {
|
|
1237
|
+
type: [Boolean, Number]
|
|
1238
|
+
},
|
|
1239
|
+
directory: {
|
|
1240
|
+
type: Boolean
|
|
1241
|
+
},
|
|
1242
|
+
createDirectory: {
|
|
1243
|
+
type: Boolean,
|
|
1244
|
+
default: !1
|
|
1245
|
+
},
|
|
1246
|
+
postAction: {
|
|
1247
|
+
type: String
|
|
1248
|
+
},
|
|
1249
|
+
putAction: {
|
|
1250
|
+
type: String
|
|
1251
|
+
},
|
|
1252
|
+
customAction: {
|
|
1253
|
+
type: Function
|
|
1254
|
+
},
|
|
1255
|
+
headers: {
|
|
1256
|
+
type: Object,
|
|
1257
|
+
default: function() {
|
|
1258
|
+
return {};
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
data: {
|
|
1262
|
+
type: Object,
|
|
1263
|
+
default: function() {
|
|
1264
|
+
return {};
|
|
1265
|
+
}
|
|
1266
|
+
},
|
|
1267
|
+
timeout: {
|
|
1268
|
+
type: Number,
|
|
1269
|
+
default: 0
|
|
1270
|
+
},
|
|
1271
|
+
drop: {
|
|
1272
|
+
type: [Boolean, String, HTMLElement],
|
|
1273
|
+
default: function() {
|
|
1274
|
+
return !1;
|
|
1275
|
+
}
|
|
1276
|
+
},
|
|
1277
|
+
dropDirectory: {
|
|
1278
|
+
type: Boolean,
|
|
1279
|
+
default: !0
|
|
1280
|
+
},
|
|
1281
|
+
size: {
|
|
1282
|
+
type: Number,
|
|
1283
|
+
default: 0
|
|
1284
|
+
},
|
|
1285
|
+
extensions: {
|
|
1286
|
+
type: [RegExp, String, Array],
|
|
1287
|
+
default: function() {
|
|
1288
|
+
return [];
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1291
|
+
modelValue: {
|
|
1292
|
+
type: Array,
|
|
1293
|
+
default: function() {
|
|
1294
|
+
return [];
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
thread: {
|
|
1298
|
+
type: Number,
|
|
1299
|
+
default: 1
|
|
1300
|
+
},
|
|
1301
|
+
// Chunk upload enabled
|
|
1302
|
+
chunkEnabled: {
|
|
1303
|
+
type: Boolean,
|
|
1304
|
+
default: !1
|
|
1305
|
+
},
|
|
1306
|
+
// Chunk upload properties
|
|
1307
|
+
chunk: {
|
|
1308
|
+
type: Object,
|
|
1309
|
+
default: function() {
|
|
1310
|
+
return P;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
emits: ["update:modelValue", "input-filter", "input-file"],
|
|
1315
|
+
data: function() {
|
|
1316
|
+
return {
|
|
1317
|
+
files: this.modelValue,
|
|
1318
|
+
features: {
|
|
1319
|
+
html5: !0,
|
|
1320
|
+
directory: !1,
|
|
1321
|
+
drop: !1
|
|
1322
|
+
},
|
|
1323
|
+
active: !1,
|
|
1324
|
+
dropActive: !1,
|
|
1325
|
+
dropElementActive: !1,
|
|
1326
|
+
uploading: 0,
|
|
1327
|
+
destroy: !1,
|
|
1328
|
+
maps: {},
|
|
1329
|
+
dropElement: null,
|
|
1330
|
+
dropTimeout: null,
|
|
1331
|
+
reload: !1
|
|
1332
|
+
};
|
|
1333
|
+
},
|
|
1334
|
+
/**
|
|
1335
|
+
* mounted
|
|
1336
|
+
* @return {[type]} [description]
|
|
1337
|
+
*/
|
|
1338
|
+
mounted: function() {
|
|
1339
|
+
var t = this, r = document.createElement("input");
|
|
1340
|
+
if (r.type = "file", r.multiple = !0, window.FormData && r.files ? ((typeof r.webkitdirectory == "boolean" || typeof r.directory == "boolean") && (this.features.directory = !0), this.features.html5 && typeof r.ondrop < "u" && this.isRelatedTargetSupported() && (this.features.drop = !0)) : this.features.html5 = !1, this.maps = {}, this.files)
|
|
1341
|
+
for (var n = 0; n < this.files.length; n++) {
|
|
1342
|
+
var a = this.files[n];
|
|
1343
|
+
this.maps[a.id] = a;
|
|
1344
|
+
}
|
|
1345
|
+
this.$nextTick(function() {
|
|
1346
|
+
t.$parent ? (t.$parent.$forceUpdate(), t.$parent.$nextTick(function() {
|
|
1347
|
+
t.watchDrop(t.drop);
|
|
1348
|
+
})) : t.watchDrop(t.drop);
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
/**
|
|
1352
|
+
* beforeUnmount
|
|
1353
|
+
* @return {[type]} [description]
|
|
1354
|
+
*/
|
|
1355
|
+
beforeUnmount: function() {
|
|
1356
|
+
this.destroy = !0, this.active = !1, this.watchDrop(!1), this.watchActive(!1);
|
|
1357
|
+
},
|
|
1358
|
+
computed: {
|
|
1359
|
+
/**
|
|
1360
|
+
* uploading 正在上传的线程
|
|
1361
|
+
* @return {[type]} [description]
|
|
1362
|
+
*/
|
|
1363
|
+
/**
|
|
1364
|
+
* uploaded 文件列表是否全部已上传
|
|
1365
|
+
* @return {[type]} [description]
|
|
1366
|
+
*/
|
|
1367
|
+
uploaded: function() {
|
|
1368
|
+
for (var t, r = 0; r < this.files.length; r++)
|
|
1369
|
+
if (t = this.files[r], t.fileObject && !t.error && !t.success)
|
|
1370
|
+
return !1;
|
|
1371
|
+
return !0;
|
|
1372
|
+
},
|
|
1373
|
+
chunkOptions: function() {
|
|
1374
|
+
return Object.assign(P, this.chunk);
|
|
1375
|
+
},
|
|
1376
|
+
className: function() {
|
|
1377
|
+
return ["file-uploads", this.features.html5 ? "file-uploads-html5" : "file-uploads-html4", this.features.directory && this.directory ? "file-uploads-directory" : void 0, this.features.drop && this.drop ? "file-uploads-drop" : void 0, this.disabled ? "file-uploads-disabled" : void 0];
|
|
1378
|
+
},
|
|
1379
|
+
forId: function() {
|
|
1380
|
+
return this.inputId || this.name;
|
|
1381
|
+
},
|
|
1382
|
+
iMaximum: function() {
|
|
1383
|
+
return this.maximum === void 0 ? this.multiple ? 0 : 1 : this.maximum;
|
|
1384
|
+
},
|
|
1385
|
+
iExtensions: function() {
|
|
1386
|
+
if (this.extensions) {
|
|
1387
|
+
if (this.extensions instanceof RegExp)
|
|
1388
|
+
return this.extensions;
|
|
1389
|
+
if (this.extensions.length) {
|
|
1390
|
+
var t = [];
|
|
1391
|
+
return typeof this.extensions == "string" ? t = this.extensions.split(",") : t = this.extensions, t = t.map(function(r) {
|
|
1392
|
+
return r.trim();
|
|
1393
|
+
}).filter(function(r) {
|
|
1394
|
+
return r;
|
|
1395
|
+
}), new RegExp("\\.(" + t.join("|").replace(/\./g, "\\.") + ")$", "i");
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
},
|
|
1399
|
+
iDirectory: function() {
|
|
1400
|
+
if (this.directory && this.features.directory)
|
|
1401
|
+
return !0;
|
|
1402
|
+
}
|
|
1403
|
+
},
|
|
1404
|
+
watch: {
|
|
1405
|
+
active: function(t) {
|
|
1406
|
+
this.watchActive(t);
|
|
1407
|
+
},
|
|
1408
|
+
dropActive: function(t) {
|
|
1409
|
+
this.watchDropActive(t), this.$parent && this.$parent.$forceUpdate();
|
|
1410
|
+
},
|
|
1411
|
+
drop: function(t) {
|
|
1412
|
+
this.watchDrop(t);
|
|
1413
|
+
},
|
|
1414
|
+
modelValue: function(t) {
|
|
1415
|
+
if (this.files !== t) {
|
|
1416
|
+
this.files = t;
|
|
1417
|
+
var r = this.maps;
|
|
1418
|
+
this.maps = {};
|
|
1419
|
+
for (var n = 0; n < this.files.length; n++) {
|
|
1420
|
+
var a = this.files[n];
|
|
1421
|
+
this.maps[a.id] = a;
|
|
1422
|
+
}
|
|
1423
|
+
for (var o in this.maps) {
|
|
1424
|
+
var f = this.maps[o], g = r[o];
|
|
1425
|
+
f !== g && this.emitFile(f, g);
|
|
1426
|
+
}
|
|
1427
|
+
for (var w in r)
|
|
1428
|
+
this.maps[w] || this.emitFile(void 0, r[w]);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
},
|
|
1432
|
+
methods: {
|
|
1433
|
+
newId: function() {
|
|
1434
|
+
return Math.random().toString(36).substr(2);
|
|
1435
|
+
},
|
|
1436
|
+
// 清空
|
|
1437
|
+
clear: function() {
|
|
1438
|
+
if (this.files.length) {
|
|
1439
|
+
var t = this.files;
|
|
1440
|
+
this.files = [], this.maps = {}, this.emitInput();
|
|
1441
|
+
for (var r = 0; r < t.length; r++)
|
|
1442
|
+
this.emitFile(void 0, t[r]);
|
|
1443
|
+
}
|
|
1444
|
+
return !0;
|
|
1445
|
+
},
|
|
1446
|
+
// 选择
|
|
1447
|
+
get: function(t) {
|
|
1448
|
+
return t ? A(t) === "object" ? this.maps[t.id || ""] || !1 : this.maps[t] || !1 : !1;
|
|
1449
|
+
},
|
|
1450
|
+
// 添加
|
|
1451
|
+
add: function(t, r) {
|
|
1452
|
+
var n;
|
|
1453
|
+
t instanceof Array ? n = t : n = [t], r === void 0 && (r = this.addIndex);
|
|
1454
|
+
for (var a = [], o = 0; o < n.length; o++) {
|
|
1455
|
+
var f = n[o];
|
|
1456
|
+
this.features.html5 && f instanceof Blob && (f = {
|
|
1457
|
+
id: "",
|
|
1458
|
+
file: f,
|
|
1459
|
+
size: f.size,
|
|
1460
|
+
// @ts-ignore
|
|
1461
|
+
name: f.webkitRelativePath || f.relativePath || f.name || "unknown",
|
|
1462
|
+
type: f.type
|
|
1463
|
+
}), f = f;
|
|
1464
|
+
var g = !1;
|
|
1465
|
+
if (f.fileObject === !1 || (f.fileObject || typeof Element < "u" && f.el instanceof HTMLInputElement || typeof Blob < "u" && f.file instanceof Blob) && (g = !0), g && (f = E(E({
|
|
1466
|
+
fileObject: !0,
|
|
1467
|
+
size: -1,
|
|
1468
|
+
name: "Filename",
|
|
1469
|
+
type: "",
|
|
1470
|
+
active: !1,
|
|
1471
|
+
error: "",
|
|
1472
|
+
success: !1,
|
|
1473
|
+
putAction: this.putAction,
|
|
1474
|
+
postAction: this.postAction,
|
|
1475
|
+
timeout: this.timeout
|
|
1476
|
+
}, f), {}, {
|
|
1477
|
+
response: {},
|
|
1478
|
+
progress: "0.00",
|
|
1479
|
+
speed: 0
|
|
1480
|
+
// 只读
|
|
1481
|
+
// file: undefined,
|
|
1482
|
+
// xhr: undefined,
|
|
1483
|
+
// el: undefined,
|
|
1484
|
+
// iframe: undefined,
|
|
1485
|
+
}), f.data = E(E({}, this.data), f.data ? f.data : {}), f.headers = E(E({}, this.headers), f.headers ? f.headers : {})), f.id || (f.id = this.newId()), !this.emitFilter(f, void 0) && (this.iMaximum > 1 && a.length + this.files.length >= this.iMaximum || (a.push(f), this.iMaximum === 1)))
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
if (a.length) {
|
|
1489
|
+
this.iMaximum === 1 && this.clear();
|
|
1490
|
+
var w;
|
|
1491
|
+
if (r === !0 || r === 0)
|
|
1492
|
+
w = a.concat(this.files);
|
|
1493
|
+
else if (r) {
|
|
1494
|
+
var D;
|
|
1495
|
+
w = this.files.concat([]), (D = w).splice.apply(D, [r, 0].concat(c(a)));
|
|
1496
|
+
} else
|
|
1497
|
+
w = this.files.concat(a);
|
|
1498
|
+
this.files = w;
|
|
1499
|
+
var y = 0;
|
|
1500
|
+
r === !0 || r === 0 ? y = 0 : r ? r >= 0 ? r + a.length > this.files.length ? y = this.files.length - a.length : y = r : (y = this.files.length - a.length + r, y < 0 && (y = 0)) : y = this.files.length - a.length, a = this.files.slice(y, y + a.length);
|
|
1501
|
+
for (var x = 0; x < a.length; x++) {
|
|
1502
|
+
var m = a[x];
|
|
1503
|
+
this.maps[m.id] = m;
|
|
1504
|
+
}
|
|
1505
|
+
this.emitInput();
|
|
1506
|
+
for (var S = 0; S < a.length; S++)
|
|
1507
|
+
this.emitFile(a[S], void 0);
|
|
1508
|
+
return t instanceof Array ? a : a[0];
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
// 添加表单文件
|
|
1512
|
+
addInputFile: function(t) {
|
|
1513
|
+
var r = this, n = [];
|
|
1514
|
+
this.iMaximum;
|
|
1515
|
+
var a = t.webkitEntries || t.entries || void 0;
|
|
1516
|
+
if (a != null && a.length)
|
|
1517
|
+
return this.getFileSystemEntry(a).then(function(w) {
|
|
1518
|
+
return r.add(w);
|
|
1519
|
+
});
|
|
1520
|
+
if (t.files)
|
|
1521
|
+
for (var o = 0; o < t.files.length; o++) {
|
|
1522
|
+
var f = t.files[o];
|
|
1523
|
+
n.push({
|
|
1524
|
+
id: "",
|
|
1525
|
+
size: f.size,
|
|
1526
|
+
// @ts-ignore
|
|
1527
|
+
name: f.webkitRelativePath || f.relativePath || f.name,
|
|
1528
|
+
type: f.type,
|
|
1529
|
+
file: f
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
else {
|
|
1533
|
+
var g = t.value.replace(/\\/g, "/").split("/");
|
|
1534
|
+
(!g || !g.length) && (g = [t.value]), delete t.__vuex__, n.push({
|
|
1535
|
+
id: "",
|
|
1536
|
+
name: g[g.length - 1],
|
|
1537
|
+
el: t
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
return Promise.resolve(this.add(n));
|
|
1541
|
+
},
|
|
1542
|
+
// 添加 DataTransfer
|
|
1543
|
+
addDataTransfer: function(t) {
|
|
1544
|
+
var r, n = this;
|
|
1545
|
+
if (t != null && (r = t.items) !== null && r !== void 0 && r.length) {
|
|
1546
|
+
for (var a = [], o = 0; o < t.items.length; o++) {
|
|
1547
|
+
var f = t.items[o], g = void 0;
|
|
1548
|
+
f.getAsEntry ? g = f.getAsEntry() || f.getAsFile() : f.webkitGetAsEntry ? g = f.webkitGetAsEntry() || f.getAsFile() : g = f.getAsFile(), g && a.push(g);
|
|
1549
|
+
}
|
|
1550
|
+
return this.getFileSystemEntry(a).then(function(x) {
|
|
1551
|
+
return n.add(x);
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
var w = this.iMaximum, D = [];
|
|
1555
|
+
if (t.files.length) {
|
|
1556
|
+
for (var y = 0; y < t.files.length && (D.push(t.files[y]), !(w > 0 && D.length >= w)); y++)
|
|
1557
|
+
;
|
|
1558
|
+
return Promise.resolve(this.add(D));
|
|
1559
|
+
}
|
|
1560
|
+
return Promise.resolve([]);
|
|
1561
|
+
},
|
|
1562
|
+
// 获得 entrys
|
|
1563
|
+
getFileSystemEntry: function(t) {
|
|
1564
|
+
var r = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
1565
|
+
return new Promise(function(a) {
|
|
1566
|
+
var o = r.iMaximum;
|
|
1567
|
+
if (!t) {
|
|
1568
|
+
a([]);
|
|
1569
|
+
return;
|
|
1570
|
+
}
|
|
1571
|
+
if (t instanceof Array) {
|
|
1572
|
+
var f = [], g = function S(j) {
|
|
1573
|
+
var M = t[j];
|
|
1574
|
+
if (!M || o > 0 && f.length >= o)
|
|
1575
|
+
return a(f);
|
|
1576
|
+
r.getFileSystemEntry(M, n).then(function(U) {
|
|
1577
|
+
f.push.apply(f, c(U)), S(j + 1);
|
|
1578
|
+
});
|
|
1579
|
+
};
|
|
1580
|
+
g(0);
|
|
1581
|
+
return;
|
|
1582
|
+
}
|
|
1583
|
+
if (t instanceof Blob) {
|
|
1584
|
+
a([{
|
|
1585
|
+
id: "",
|
|
1586
|
+
size: t.size,
|
|
1587
|
+
// @ts-ignore
|
|
1588
|
+
name: n + t.name,
|
|
1589
|
+
type: t.type,
|
|
1590
|
+
file: t
|
|
1591
|
+
}]);
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (t.isFile) {
|
|
1595
|
+
var w = t;
|
|
1596
|
+
w.file(function(S) {
|
|
1597
|
+
a([{
|
|
1598
|
+
id: "",
|
|
1599
|
+
size: S.size,
|
|
1600
|
+
name: n + S.name,
|
|
1601
|
+
type: S.type,
|
|
1602
|
+
file: S
|
|
1603
|
+
}]);
|
|
1604
|
+
});
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
if (t.isDirectory && r.dropDirectory) {
|
|
1608
|
+
var D = t, y = [];
|
|
1609
|
+
r.createDirectory && y.push({
|
|
1610
|
+
id: "",
|
|
1611
|
+
name: n + D.name,
|
|
1612
|
+
size: 0,
|
|
1613
|
+
type: "text/directory",
|
|
1614
|
+
file: new File([], n + D.name, {
|
|
1615
|
+
type: "text/directory"
|
|
1616
|
+
})
|
|
1617
|
+
});
|
|
1618
|
+
var x = D.createReader(), m = function S() {
|
|
1619
|
+
x.readEntries(function(j) {
|
|
1620
|
+
var M = function U(z) {
|
|
1621
|
+
if (!j[z] && z === 0 || o > 0 && y.length >= o)
|
|
1622
|
+
return a(y);
|
|
1623
|
+
if (!j[z])
|
|
1624
|
+
return S();
|
|
1625
|
+
r.getFileSystemEntry(j[z], n + D.name + "/").then(function(X) {
|
|
1626
|
+
y.push.apply(y, c(X)), U(z + 1);
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1629
|
+
M(0);
|
|
1630
|
+
});
|
|
1631
|
+
};
|
|
1632
|
+
m();
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
a([]);
|
|
1636
|
+
});
|
|
1637
|
+
},
|
|
1638
|
+
// 替换
|
|
1639
|
+
replace: function(t, r) {
|
|
1640
|
+
var n = this.get(t), a = this.get(r);
|
|
1641
|
+
if (!n || !a || n === a)
|
|
1642
|
+
return !1;
|
|
1643
|
+
var o = this.files.concat([]), f = o.indexOf(n), g = o.indexOf(a);
|
|
1644
|
+
return f === -1 || g === -1 ? !1 : (o[f] = a, o[g] = n, this.files = o, this.emitInput(), !0);
|
|
1645
|
+
},
|
|
1646
|
+
// 移除
|
|
1647
|
+
remove: function(t) {
|
|
1648
|
+
var r = this.get(t);
|
|
1649
|
+
if (r) {
|
|
1650
|
+
if (this.emitFilter(void 0, r))
|
|
1651
|
+
return !1;
|
|
1652
|
+
var n = this.files.concat([]), a = n.indexOf(r);
|
|
1653
|
+
if (a === -1)
|
|
1654
|
+
return console.error("remove", r), !1;
|
|
1655
|
+
n.splice(a, 1), this.files = n, delete this.maps[r.id], this.emitInput(), this.emitFile(void 0, r);
|
|
1656
|
+
}
|
|
1657
|
+
return r;
|
|
1658
|
+
},
|
|
1659
|
+
// 更新
|
|
1660
|
+
update: function(t, r) {
|
|
1661
|
+
var n = this.get(t);
|
|
1662
|
+
if (n) {
|
|
1663
|
+
var a = E(E({}, n), r);
|
|
1664
|
+
if (n.fileObject && n.active && !a.active && !a.error && !a.success && (a.error = "abort"), this.emitFilter(a, n))
|
|
1665
|
+
return !1;
|
|
1666
|
+
var o = this.files.concat([]), f = o.indexOf(n);
|
|
1667
|
+
return f === -1 ? (console.error("update", n), !1) : (o.splice(f, 1, a), this.files = o, a = this.files[f], delete this.maps[n.id], this.maps[a.id] = a, this.emitInput(), this.emitFile(a, n), a);
|
|
1668
|
+
}
|
|
1669
|
+
return !1;
|
|
1670
|
+
},
|
|
1671
|
+
// 预处理 事件 过滤器
|
|
1672
|
+
emitFilter: function(t, r) {
|
|
1673
|
+
var n = !1;
|
|
1674
|
+
return this.$emit("input-filter", t, r, function() {
|
|
1675
|
+
var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0;
|
|
1676
|
+
return n = a, n;
|
|
1677
|
+
}), n;
|
|
1678
|
+
},
|
|
1679
|
+
// 处理后 事件 分发
|
|
1680
|
+
emitFile: function(t, r) {
|
|
1681
|
+
var n, a = this;
|
|
1682
|
+
this.$emit("input-file", t, r), (n = t) !== null && n !== void 0 && n.fileObject && t.active && (!r || !r.active) ? (this.uploading++, this.$nextTick(function() {
|
|
1683
|
+
setTimeout(function() {
|
|
1684
|
+
t && a.upload(t).then(function() {
|
|
1685
|
+
var o;
|
|
1686
|
+
t && (t = a.get(t) || void 0), (o = t) !== null && o !== void 0 && o.fileObject && a.update(t, {
|
|
1687
|
+
active: !1,
|
|
1688
|
+
success: !t.error
|
|
1689
|
+
});
|
|
1690
|
+
}).catch(function(o) {
|
|
1691
|
+
t && a.update(t, {
|
|
1692
|
+
active: !1,
|
|
1693
|
+
success: !1,
|
|
1694
|
+
error: o.code || o.error || o.message || o
|
|
1695
|
+
});
|
|
1696
|
+
});
|
|
1697
|
+
}, Math.ceil(Math.random() * 50 + 50));
|
|
1698
|
+
})) : (!t || !t.fileObject || !t.active) && r && r.fileObject && r.active && this.uploading--, this.active && (!!t != !!r || t.active !== r.active) && this.watchActive(!0);
|
|
1699
|
+
},
|
|
1700
|
+
emitInput: function() {
|
|
1701
|
+
this.$emit("update:modelValue", this.files);
|
|
1702
|
+
},
|
|
1703
|
+
// 上传
|
|
1704
|
+
upload: function(t) {
|
|
1705
|
+
var r = this.get(t);
|
|
1706
|
+
if (!r)
|
|
1707
|
+
return Promise.reject(new Error("not_exists"));
|
|
1708
|
+
if (!r.fileObject)
|
|
1709
|
+
return Promise.reject(new Error("file_object"));
|
|
1710
|
+
if (r.error)
|
|
1711
|
+
return r.error instanceof Error ? Promise.reject(r.error) : Promise.reject(new Error(r.error));
|
|
1712
|
+
if (r.success)
|
|
1713
|
+
return Promise.resolve(r);
|
|
1714
|
+
if (r.name && this.iExtensions && r.type !== "text/directory" && r.name.search(this.iExtensions) === -1)
|
|
1715
|
+
return Promise.reject(new Error("extension"));
|
|
1716
|
+
if (this.size > 0 && r.size !== void 0 && r.size >= 0 && r.size > this.size && r.type !== "text/directory")
|
|
1717
|
+
return Promise.reject(new Error("size"));
|
|
1718
|
+
if (this.customAction)
|
|
1719
|
+
return this.customAction(r, this);
|
|
1720
|
+
if (this.features.html5) {
|
|
1721
|
+
if (this.shouldUseChunkUpload(r))
|
|
1722
|
+
return this.uploadChunk(r);
|
|
1723
|
+
if (r.putAction)
|
|
1724
|
+
return this.uploadPut(r);
|
|
1725
|
+
if (r.postAction)
|
|
1726
|
+
return this.uploadHtml5(r);
|
|
1727
|
+
}
|
|
1728
|
+
return r.postAction ? this.uploadHtml4(r) : Promise.reject(new Error("No action configured"));
|
|
1729
|
+
},
|
|
1730
|
+
/**
|
|
1731
|
+
* Whether this file should be uploaded using chunk upload or not
|
|
1732
|
+
*
|
|
1733
|
+
* @param Object file
|
|
1734
|
+
*/
|
|
1735
|
+
shouldUseChunkUpload: function(t) {
|
|
1736
|
+
return this.chunkEnabled && !!this.chunkOptions.handler && t.size && t.size > this.chunkOptions.minSize;
|
|
1737
|
+
},
|
|
1738
|
+
/**
|
|
1739
|
+
* Upload a file using Chunk method
|
|
1740
|
+
*
|
|
1741
|
+
* @param File file
|
|
1742
|
+
*/
|
|
1743
|
+
uploadChunk: function(t) {
|
|
1744
|
+
var r = this.chunkOptions.handler;
|
|
1745
|
+
return t.chunk = new r(t, this.chunkOptions), t.chunk.upload().then(function(n) {
|
|
1746
|
+
return t;
|
|
1747
|
+
});
|
|
1748
|
+
},
|
|
1749
|
+
uploadPut: function(t) {
|
|
1750
|
+
var r = [], n;
|
|
1751
|
+
for (var a in t.data)
|
|
1752
|
+
n = t.data[a], n != null && r.push(encodeURIComponent(a) + "=" + encodeURIComponent(n));
|
|
1753
|
+
var o = t.putAction || "", f = r.length ? (o.indexOf("?") === -1 ? "?" : "&") + r.join("&") : "", g = new XMLHttpRequest();
|
|
1754
|
+
return g.open("PUT", o + f), this.uploadXhr(g, t, t.file);
|
|
1755
|
+
},
|
|
1756
|
+
uploadHtml5: function(t) {
|
|
1757
|
+
var r = new window.FormData(), n;
|
|
1758
|
+
for (var a in t.data)
|
|
1759
|
+
n = t.data[a], n && A(n) === "object" && typeof n.toString != "function" ? n instanceof File ? r.append(a, n, n.name) : r.append(a, JSON.stringify(n)) : n != null && r.append(a, n);
|
|
1760
|
+
r.append(this.name, t.file, t.name || t.file.name || t.file.filename);
|
|
1761
|
+
var o = new XMLHttpRequest();
|
|
1762
|
+
return o.open("POST", t.postAction || ""), this.uploadXhr(o, t, r);
|
|
1763
|
+
},
|
|
1764
|
+
uploadXhr: function(t, r, n) {
|
|
1765
|
+
var a = this, o = r, f = 0, g = 0;
|
|
1766
|
+
t.upload.onprogress = function(D) {
|
|
1767
|
+
if (o && (o = a.get(o), !(!D.lengthComputable || !o || !o.fileObject || !o.active))) {
|
|
1768
|
+
var y = Math.round(Date.now() / 1e3);
|
|
1769
|
+
y !== f && (f = y, o = a.update(o, {
|
|
1770
|
+
progress: (D.loaded / D.total * 100).toFixed(2),
|
|
1771
|
+
speed: D.loaded - g
|
|
1772
|
+
}), g = D.loaded);
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
var w = window.setInterval(function() {
|
|
1776
|
+
if (o && (o = a.get(o))) {
|
|
1777
|
+
var D;
|
|
1778
|
+
if ((D = o) !== null && D !== void 0 && D.fileObject && !o.success && !o.error && o.active)
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
w && (clearInterval(w), w = void 0);
|
|
1782
|
+
try {
|
|
1783
|
+
t.abort(), t.timeout = 1;
|
|
1784
|
+
} catch {
|
|
1785
|
+
}
|
|
1786
|
+
}, 100);
|
|
1787
|
+
return new Promise(function(D, y) {
|
|
1788
|
+
if (!o) {
|
|
1789
|
+
y(new Error("not_exists"));
|
|
1790
|
+
return;
|
|
1791
|
+
}
|
|
1792
|
+
var x, m = function(M) {
|
|
1793
|
+
if (!x) {
|
|
1794
|
+
if (x = !0, w && (clearInterval(w), w = void 0), !o)
|
|
1795
|
+
return y(new Error("not_exists"));
|
|
1796
|
+
if (o = a.get(o), !o)
|
|
1797
|
+
return y(new Error("not_exists"));
|
|
1798
|
+
if (!o.fileObject)
|
|
1799
|
+
return y(new Error("file_object"));
|
|
1800
|
+
if (o.error)
|
|
1801
|
+
return o.error instanceof Error ? y(o.error) : y(new Error(o.error));
|
|
1802
|
+
if (!o.active)
|
|
1803
|
+
return y(new Error("abort"));
|
|
1804
|
+
if (o.success)
|
|
1805
|
+
return D(o);
|
|
1806
|
+
var U = {};
|
|
1807
|
+
switch (M.type) {
|
|
1808
|
+
case "timeout":
|
|
1809
|
+
case "abort":
|
|
1810
|
+
U.error = M.type;
|
|
1811
|
+
break;
|
|
1812
|
+
case "error":
|
|
1813
|
+
t.status ? t.status >= 500 ? U.error = "server" : t.status >= 400 && (U.error = "denied") : U.error = "network";
|
|
1814
|
+
break;
|
|
1815
|
+
default:
|
|
1816
|
+
t.status >= 500 ? U.error = "server" : t.status >= 400 ? U.error = "denied" : U.progress = "100.00";
|
|
1817
|
+
}
|
|
1818
|
+
if (t.responseText) {
|
|
1819
|
+
var z = t.getResponseHeader("Content-Type");
|
|
1820
|
+
z && z.indexOf("/json") !== -1 ? U.response = JSON.parse(t.responseText) : U.response = t.responseText;
|
|
1821
|
+
}
|
|
1822
|
+
return o = a.update(o, U), o ? o.error ? o.error instanceof Error ? y(o.error) : y(new Error(o.error)) : D(o) : y(new Error("abort"));
|
|
1823
|
+
}
|
|
1824
|
+
};
|
|
1825
|
+
t.onload = m, t.onerror = m, t.onabort = m, t.ontimeout = m, o.timeout && (t.timeout = o.timeout);
|
|
1826
|
+
for (var S in o.headers)
|
|
1827
|
+
t.setRequestHeader(S, o.headers[S]);
|
|
1828
|
+
o = a.update(o, {
|
|
1829
|
+
xhr: t
|
|
1830
|
+
}), o && t.send(n);
|
|
1831
|
+
});
|
|
1832
|
+
},
|
|
1833
|
+
uploadHtml4: function(t) {
|
|
1834
|
+
var r = this, n = t;
|
|
1835
|
+
if (!n)
|
|
1836
|
+
return Promise.reject(new Error("not_exists"));
|
|
1837
|
+
var a = function(m) {
|
|
1838
|
+
m.keyCode === 27 && m.preventDefault();
|
|
1839
|
+
}, o = document.createElement("iframe");
|
|
1840
|
+
o.id = "upload-iframe-" + n.id, o.name = "upload-iframe-" + n.id, o.src = "about:blank", o.setAttribute("style", "width:1px;height:1px;top:-999em;position:absolute; margin-top:-999em;");
|
|
1841
|
+
var f = document.createElement("form");
|
|
1842
|
+
f.setAttribute("action", n.postAction || ""), f.name = "upload-form-" + n.id, f.setAttribute("method", "POST"), f.setAttribute("target", "upload-iframe-" + n.id), f.setAttribute("enctype", "multipart/form-data");
|
|
1843
|
+
for (var g in n.data) {
|
|
1844
|
+
var w = n.data[g];
|
|
1845
|
+
if (w && A(w) === "object" && typeof w.toString != "function" && (w = JSON.stringify(w)), w != null) {
|
|
1846
|
+
var D = document.createElement("input");
|
|
1847
|
+
D.type = "hidden", D.name = g, D.value = w, f.appendChild(D);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
f.appendChild(n.el), document.body.appendChild(o).appendChild(f);
|
|
1851
|
+
var y = function() {
|
|
1852
|
+
var m, S;
|
|
1853
|
+
try {
|
|
1854
|
+
o.contentWindow && (S = o.contentWindow.document);
|
|
1855
|
+
} catch {
|
|
1856
|
+
}
|
|
1857
|
+
if (!S)
|
|
1858
|
+
try {
|
|
1859
|
+
S = o.contentDocument ? o.contentDocument : o.document;
|
|
1860
|
+
} catch {
|
|
1861
|
+
S = o.document;
|
|
1862
|
+
}
|
|
1863
|
+
return (m = S) !== null && m !== void 0 && m.body ? S.body.innerHTML : null;
|
|
1864
|
+
};
|
|
1865
|
+
return new Promise(function(x, m) {
|
|
1866
|
+
setTimeout(function() {
|
|
1867
|
+
if (!n) {
|
|
1868
|
+
m(new Error("not_exists"));
|
|
1869
|
+
return;
|
|
1870
|
+
}
|
|
1871
|
+
if (n = r.update(n, {
|
|
1872
|
+
iframe: o
|
|
1873
|
+
}), !n)
|
|
1874
|
+
return m(new Error("not_exists"));
|
|
1875
|
+
var S = window.setInterval(function() {
|
|
1876
|
+
n && (n = r.get(n)) && n.fileObject && !n.success && !n.error && n.active || (S && (clearInterval(S), S = void 0), o.onabort({
|
|
1877
|
+
type: n ? "abort" : "not_exists"
|
|
1878
|
+
}));
|
|
1879
|
+
}, 100), j, M = function(z) {
|
|
1880
|
+
var X;
|
|
1881
|
+
if (!j) {
|
|
1882
|
+
if (j = !0, S && (clearInterval(S), S = void 0), document.body.removeEventListener("keydown", a), !n)
|
|
1883
|
+
return m(new Error("not_exists"));
|
|
1884
|
+
if (n = r.get(n), !n)
|
|
1885
|
+
return m(new Error("not_exists"));
|
|
1886
|
+
if (!n.fileObject)
|
|
1887
|
+
return m(new Error("file_object"));
|
|
1888
|
+
if (n.error)
|
|
1889
|
+
return n.error instanceof Error ? m(n.error) : m(new Error(n.error));
|
|
1890
|
+
if (!n.active)
|
|
1891
|
+
return m(new Error("abort"));
|
|
1892
|
+
if (n.success)
|
|
1893
|
+
return x(n);
|
|
1894
|
+
var N = y(), L = {};
|
|
1895
|
+
if (typeof z == "string")
|
|
1896
|
+
return m(new Error(z));
|
|
1897
|
+
switch (z.type) {
|
|
1898
|
+
case "abort":
|
|
1899
|
+
L.error = "abort";
|
|
1900
|
+
break;
|
|
1901
|
+
case "error":
|
|
1902
|
+
n.error ? L.error = n.error : N === null ? L.error = "network" : L.error = "denied";
|
|
1903
|
+
break;
|
|
1904
|
+
default:
|
|
1905
|
+
n.error ? L.error = n.error : N === null ? L.error = "network" : L.progress = "100.00";
|
|
1906
|
+
}
|
|
1907
|
+
if (N !== null) {
|
|
1908
|
+
if (N && N.substr(0, 1) === "{" && N.substr(N.length - 1, 1) === "}")
|
|
1909
|
+
try {
|
|
1910
|
+
N = JSON.parse(N);
|
|
1911
|
+
} catch {
|
|
1912
|
+
}
|
|
1913
|
+
L.response = N;
|
|
1914
|
+
}
|
|
1915
|
+
return n = r.update(n, L), n ? (X = n) !== null && X !== void 0 && X.error ? n.error instanceof Error ? m(n.error) : m(new Error(n.error)) : x(n) : m(new Error("not_exists"));
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
o.onload = M, o.onerror = M, o.onabort = M, document.body.addEventListener("keydown", a), f.submit();
|
|
1919
|
+
}, 50);
|
|
1920
|
+
}).then(function(x) {
|
|
1921
|
+
var m;
|
|
1922
|
+
return o == null || (m = o.parentNode) === null || m === void 0 || m.removeChild(o), x;
|
|
1923
|
+
}).catch(function(x) {
|
|
1924
|
+
var m;
|
|
1925
|
+
return o == null || (m = o.parentNode) === null || m === void 0 || m.removeChild(o), x;
|
|
1926
|
+
});
|
|
1927
|
+
},
|
|
1928
|
+
watchActive: function(t) {
|
|
1929
|
+
for (var r, n = 0; r = this.files[n]; )
|
|
1930
|
+
if (n++, r.fileObject) if (t && !this.destroy) {
|
|
1931
|
+
if (this.uploading >= this.thread || this.uploading && !this.features.html5)
|
|
1932
|
+
break;
|
|
1933
|
+
!r.active && !r.error && !r.success && this.update(r, {
|
|
1934
|
+
active: !0
|
|
1935
|
+
});
|
|
1936
|
+
} else
|
|
1937
|
+
r.active && this.update(r, {
|
|
1938
|
+
active: !1
|
|
1939
|
+
});
|
|
1940
|
+
this.uploading === 0 && (this.active = !1);
|
|
1941
|
+
},
|
|
1942
|
+
watchDrop: function(t) {
|
|
1943
|
+
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
|
|
1944
|
+
if (this.features.drop && t !== r) {
|
|
1945
|
+
if (this.dropElement)
|
|
1946
|
+
try {
|
|
1947
|
+
document.removeEventListener("dragenter", this.onDocumentDragenter, !1), document.removeEventListener("dragleave", this.onDocumentDragleave, !1), document.removeEventListener("dragover", this.onDocumentDragover, !1), document.removeEventListener("drop", this.onDocumentDrop, !1), this.dropElement.removeEventListener("dragenter", this.onDragenter, !1), this.dropElement.removeEventListener("dragleave", this.onDragleave, !1), this.dropElement.removeEventListener("dragover", this.onDragover, !1), this.dropElement.removeEventListener("drop", this.onDrop, !1);
|
|
1948
|
+
} catch {
|
|
1949
|
+
}
|
|
1950
|
+
var n = null;
|
|
1951
|
+
if (t) if (typeof t == "string")
|
|
1952
|
+
n = document.querySelector(t) || this.$root.$el.querySelector(t);
|
|
1953
|
+
else if (t === !0) {
|
|
1954
|
+
var a;
|
|
1955
|
+
if (n = this.$parent.$el, !n || ((a = n) === null || a === void 0 ? void 0 : a.nodeType) === 8) {
|
|
1956
|
+
var o;
|
|
1957
|
+
n = this.$root.$el, (!n || ((o = n) === null || o === void 0 ? void 0 : o.nodeType) === 8) && (n = document.body);
|
|
1958
|
+
}
|
|
1959
|
+
} else
|
|
1960
|
+
n = t;
|
|
1961
|
+
this.dropElement = n, this.dropElement && (document.addEventListener("dragenter", this.onDocumentDragenter, !1), document.addEventListener("dragleave", this.onDocumentDragleave, !1), document.addEventListener("dragover", this.onDocumentDragover, !1), document.addEventListener("drop", this.onDocumentDrop, !1), this.dropElement.addEventListener("dragenter", this.onDragenter, !1), this.dropElement.addEventListener("dragleave", this.onDragleave, !1), this.dropElement.addEventListener("dragover", this.onDragover, !1), this.dropElement.addEventListener("drop", this.onDrop, !1));
|
|
1962
|
+
}
|
|
1963
|
+
},
|
|
1964
|
+
watchDropActive: function(t, r) {
|
|
1965
|
+
t !== r && (!t && this.dropElementActive && (this.dropElementActive = !1), this.dropTimeout && (clearTimeout(this.dropTimeout), this.dropTimeout = null), t && (this.dropTimeout = setTimeout(this.onDocumentDrop, 1e3)));
|
|
1966
|
+
},
|
|
1967
|
+
onDocumentDragenter: function(t) {
|
|
1968
|
+
var r, n;
|
|
1969
|
+
if (!this.dropActive && t.dataTransfer) {
|
|
1970
|
+
var a = t.dataTransfer;
|
|
1971
|
+
a != null && (r = a.files) !== null && r !== void 0 && r.length ? this.dropActive = !0 : a.types ? a.types.indexOf && a.types.indexOf("Files") !== -1 ? this.dropActive = !0 : (n = a.types) !== null && n !== void 0 && n.contains && a.types.contains("Files") && (this.dropActive = !0) : this.dropActive = !0, this.dropActive && this.watchDropActive(!0);
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1974
|
+
onDocumentDragleave: function(t) {
|
|
1975
|
+
this.dropActive && (t.target === t.explicitOriginalTarget || !t.fromElement && (t.clientX <= 0 || t.clientY <= 0 || t.clientX >= window.innerWidth || t.clientY >= window.innerHeight)) && (this.dropActive = !1, this.watchDropActive(!1));
|
|
1976
|
+
},
|
|
1977
|
+
onDocumentDragover: function() {
|
|
1978
|
+
this.watchDropActive(!0);
|
|
1979
|
+
},
|
|
1980
|
+
onDocumentDrop: function() {
|
|
1981
|
+
this.dropActive = !1, this.watchDropActive(!1);
|
|
1982
|
+
},
|
|
1983
|
+
onDragenter: function(t) {
|
|
1984
|
+
!this.dropActive || this.dropElementActive || (this.dropElementActive = !0);
|
|
1985
|
+
},
|
|
1986
|
+
onDragleave: function(t) {
|
|
1987
|
+
var r;
|
|
1988
|
+
if (this.dropElementActive) {
|
|
1989
|
+
var n = t.relatedTarget;
|
|
1990
|
+
if (!n)
|
|
1991
|
+
this.dropElementActive = !1;
|
|
1992
|
+
else if ((r = this.dropElement) !== null && r !== void 0 && r.contains)
|
|
1993
|
+
this.dropElement.contains(n) || (this.dropElementActive = !1);
|
|
1994
|
+
else {
|
|
1995
|
+
for (var a = n; a && a !== this.dropElement; )
|
|
1996
|
+
a = a.parentNode;
|
|
1997
|
+
a !== this.dropElement && (this.dropElementActive = !1);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
},
|
|
2001
|
+
onDragover: function(t) {
|
|
2002
|
+
t.preventDefault();
|
|
2003
|
+
},
|
|
2004
|
+
onDrop: function(t) {
|
|
2005
|
+
t.preventDefault(), t.dataTransfer && this.addDataTransfer(t.dataTransfer);
|
|
2006
|
+
},
|
|
2007
|
+
inputOnChange: async function(t) {
|
|
2008
|
+
var r = this;
|
|
2009
|
+
if (!(t.target instanceof HTMLInputElement))
|
|
2010
|
+
return Promise.reject(new Error("not HTMLInputElement"));
|
|
2011
|
+
t.target;
|
|
2012
|
+
var n = function(o) {
|
|
2013
|
+
return r.reload = !0, r.$nextTick(function() {
|
|
2014
|
+
r.reload = !1;
|
|
2015
|
+
}), o;
|
|
2016
|
+
};
|
|
2017
|
+
return this.addInputFile(t.target).then(n).catch(n);
|
|
2018
|
+
},
|
|
2019
|
+
isRelatedTargetSupported: function() {
|
|
2020
|
+
try {
|
|
2021
|
+
var t = new MouseEvent("mouseout", {
|
|
2022
|
+
relatedTarget: document.body
|
|
2023
|
+
});
|
|
2024
|
+
return "relatedTarget" in t;
|
|
2025
|
+
} catch {
|
|
2026
|
+
return !1;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
}), Z = ["for"], ee = ["name", "id", "accept", "capture", "disabled", "webkitdirectory", "allowdirs", "directory", "multiple"];
|
|
2031
|
+
function te(i, t, r, n, a, o) {
|
|
2032
|
+
return s.openBlock(), s.createElementBlock("span", {
|
|
2033
|
+
class: s.normalizeClass(i.className)
|
|
2034
|
+
}, [s.renderSlot(i.$slots, "default"), s.createElementVNode("label", {
|
|
2035
|
+
for: i.forId
|
|
2036
|
+
}, null, 8, Z), i.reload ? s.createCommentVNode("", !0) : (s.openBlock(), s.createElementBlock("input", {
|
|
2037
|
+
key: 0,
|
|
2038
|
+
ref: "input",
|
|
2039
|
+
type: "file",
|
|
2040
|
+
name: i.name,
|
|
2041
|
+
id: i.forId,
|
|
2042
|
+
accept: i.accept,
|
|
2043
|
+
capture: i.capture,
|
|
2044
|
+
disabled: i.disabled,
|
|
2045
|
+
webkitdirectory: i.iDirectory,
|
|
2046
|
+
allowdirs: i.iDirectory,
|
|
2047
|
+
directory: i.iDirectory,
|
|
2048
|
+
multiple: i.multiple && i.features.html5,
|
|
2049
|
+
onChange: t[0] || (t[0] = function() {
|
|
2050
|
+
return i.inputOnChange && i.inputOnChange.apply(i, arguments);
|
|
2051
|
+
})
|
|
2052
|
+
}, null, 40, ee))], 2);
|
|
2053
|
+
}
|
|
2054
|
+
function re(i, t) {
|
|
2055
|
+
t === void 0 && (t = {});
|
|
2056
|
+
var r = t.insertAt;
|
|
2057
|
+
if (!(typeof document > "u")) {
|
|
2058
|
+
var n = document.head || document.getElementsByTagName("head")[0], a = document.createElement("style");
|
|
2059
|
+
a.type = "text/css", r === "top" && n.firstChild ? n.insertBefore(a, n.firstChild) : n.appendChild(a), a.styleSheet ? a.styleSheet.cssText = i : a.appendChild(document.createTextNode(i));
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
var ne = `
|
|
2063
|
+
.file-uploads {
|
|
2064
|
+
overflow: hidden;
|
|
2065
|
+
position: relative;
|
|
2066
|
+
text-align: center;
|
|
2067
|
+
display: inline-block;
|
|
2068
|
+
}
|
|
2069
|
+
.file-uploads.file-uploads-html4 input,
|
|
2070
|
+
.file-uploads.file-uploads-html5 label {
|
|
2071
|
+
/* background fix ie click */
|
|
2072
|
+
background: #fff;
|
|
2073
|
+
opacity: 0;
|
|
2074
|
+
font-size: 20em;
|
|
2075
|
+
z-index: 1;
|
|
2076
|
+
top: 0;
|
|
2077
|
+
left: 0;
|
|
2078
|
+
right: 0;
|
|
2079
|
+
bottom: 0;
|
|
2080
|
+
position: absolute;
|
|
2081
|
+
width: 100%;
|
|
2082
|
+
height: 100%;
|
|
2083
|
+
}
|
|
2084
|
+
.file-uploads.file-uploads-html5 input,
|
|
2085
|
+
.file-uploads.file-uploads-html4 label {
|
|
2086
|
+
/* background fix ie click */
|
|
2087
|
+
position: absolute;
|
|
2088
|
+
background: rgba(255, 255, 255, 0);
|
|
2089
|
+
overflow: hidden;
|
|
2090
|
+
position: fixed;
|
|
2091
|
+
width: 1px;
|
|
2092
|
+
height: 1px;
|
|
2093
|
+
z-index: -1;
|
|
2094
|
+
opacity: 0;
|
|
2095
|
+
}
|
|
2096
|
+
`;
|
|
2097
|
+
return re(ne), R.render = te, R;
|
|
2098
|
+
});
|
|
2099
|
+
})(Be);
|
|
2100
|
+
var Jn = Be.exports;
|
|
2101
|
+
const Yn = /* @__PURE__ */ Cn(Jn), Qn = {
|
|
2102
|
+
i18nOptions: {
|
|
2103
|
+
namespaces: "baseUpload",
|
|
2104
|
+
messages: {
|
|
2105
|
+
en: {
|
|
2106
|
+
dropActive: "Drag & drop files to upload",
|
|
2107
|
+
errors: {
|
|
2108
|
+
thumbnail: "Could not create thumbnail",
|
|
2109
|
+
compress: "Could not upload photo",
|
|
2110
|
+
general: "File could not be uploaded",
|
|
2111
|
+
extension: "Unsupported file format. Supported types are: {{extensions}}",
|
|
2112
|
+
size: "File is too large. Max file size is {{maxFileSize}}",
|
|
2113
|
+
ECONNREFUSED: "File could not be uploaded, no internet connection"
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
sv: {
|
|
2117
|
+
dropActive: "Släpp filer för att ladda upp",
|
|
2118
|
+
errors: {
|
|
2119
|
+
thumbnail: "Kunde inte skapa tumnagel",
|
|
2120
|
+
compress: "Kunde inte ladda upp bild",
|
|
2121
|
+
general: "Kunde inte ladda upp fil",
|
|
2122
|
+
extension: "Ogiltigt format. Tillåtna format: {{extensions}}",
|
|
2123
|
+
size: "För stor fil. Max filstorlek är {{maxFileSize}}",
|
|
2124
|
+
ECONNREFUSED: "Kunde inte ladda upp fil, ingen internetanslutning"
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
},
|
|
2129
|
+
name: "BaseUpload",
|
|
2130
|
+
components: {
|
|
2131
|
+
FileUpload: Yn,
|
|
2132
|
+
UploadModal: De(
|
|
2133
|
+
() => import("./UploadModal-C_X2NjVY.js")
|
|
2134
|
+
)
|
|
2135
|
+
},
|
|
2136
|
+
emits: ["input", "upload-success", "has-mounted"],
|
|
2137
|
+
props: {
|
|
2138
|
+
// Optional function to handle any errors
|
|
2139
|
+
// If not supplied a default errorHandler is used
|
|
2140
|
+
onError: {
|
|
2141
|
+
type: Function,
|
|
2142
|
+
default: void 0
|
|
2143
|
+
},
|
|
2144
|
+
autostartUpload: {
|
|
2145
|
+
type: Boolean,
|
|
2146
|
+
default: !1
|
|
2147
|
+
},
|
|
2148
|
+
multiple: {
|
|
2149
|
+
type: Boolean,
|
|
2150
|
+
default: !0
|
|
2151
|
+
},
|
|
2152
|
+
// max file size in bytes
|
|
2153
|
+
maxSize: {
|
|
2154
|
+
type: Number,
|
|
2155
|
+
default: 1e3 * 1e3 * 10
|
|
2156
|
+
// 10 MB
|
|
2157
|
+
},
|
|
2158
|
+
// Compression (0 - 1)
|
|
2159
|
+
// Only for image/jpeg and image/webp
|
|
2160
|
+
quality: {
|
|
2161
|
+
type: Number,
|
|
2162
|
+
default: 0.8
|
|
2163
|
+
// Be careful to use 1 as it may make the size of the output image become larger
|
|
2164
|
+
},
|
|
2165
|
+
// Resize
|
|
2166
|
+
maxHeight: {
|
|
2167
|
+
type: Number,
|
|
2168
|
+
default: 1 / 0
|
|
2169
|
+
},
|
|
2170
|
+
maxWidth: {
|
|
2171
|
+
type: Number,
|
|
2172
|
+
default: 1 / 0
|
|
2173
|
+
},
|
|
2174
|
+
// Thumbnail props
|
|
2175
|
+
createThumbnails: {
|
|
2176
|
+
type: Boolean,
|
|
2177
|
+
default: !1
|
|
2178
|
+
},
|
|
2179
|
+
thumbnailMaxWidth: {
|
|
2180
|
+
type: Number,
|
|
2181
|
+
default: 120
|
|
2182
|
+
},
|
|
2183
|
+
thumbnailMaxHeight: {
|
|
2184
|
+
type: Number,
|
|
2185
|
+
default: 120
|
|
2186
|
+
},
|
|
2187
|
+
drop: {
|
|
2188
|
+
type: Boolean,
|
|
2189
|
+
default: !1
|
|
2190
|
+
},
|
|
2191
|
+
maximum: {
|
|
2192
|
+
type: Number,
|
|
2193
|
+
default: null
|
|
2194
|
+
},
|
|
2195
|
+
extensions: {
|
|
2196
|
+
type: String,
|
|
2197
|
+
default: "gif,jpg,jpeg,png,webp,heic,heif"
|
|
2198
|
+
},
|
|
2199
|
+
accept: {
|
|
2200
|
+
type: String,
|
|
2201
|
+
default: "image/png,image/gif,image/jpeg,image/webp,image/heic,image/heif,image/tiff"
|
|
2202
|
+
},
|
|
2203
|
+
recentModal: {
|
|
2204
|
+
type: Boolean,
|
|
2205
|
+
default: !1
|
|
2206
|
+
}
|
|
2207
|
+
},
|
|
2208
|
+
data() {
|
|
2209
|
+
return {
|
|
2210
|
+
files: [],
|
|
2211
|
+
modalOpen: !1
|
|
2212
|
+
};
|
|
2213
|
+
},
|
|
2214
|
+
mounted() {
|
|
2215
|
+
this.$emit("has-mounted", !0);
|
|
2216
|
+
},
|
|
2217
|
+
methods: {
|
|
2218
|
+
open() {
|
|
2219
|
+
this.recentModal ? this.modalOpen = !0 : this.openFilePicker();
|
|
2220
|
+
},
|
|
2221
|
+
openFilePicker() {
|
|
2222
|
+
this.$refs.upload && this.$refs.upload.$el.querySelector("input[type='file']").click();
|
|
2223
|
+
},
|
|
2224
|
+
closeRecentModal() {
|
|
2225
|
+
this.$modal.hide("recent-modal");
|
|
2226
|
+
},
|
|
2227
|
+
async postAction(u) {
|
|
2228
|
+
const l = new FormData();
|
|
2229
|
+
l.append("file", u.file, u.file.name);
|
|
2230
|
+
const { data: s } = await ge.post("/file", l, {
|
|
2231
|
+
onUploadProgress: (d) => {
|
|
2232
|
+
const p = this.files.filter(
|
|
2233
|
+
(b) => b.id === u.id
|
|
2234
|
+
);
|
|
2235
|
+
if (p.length) {
|
|
2236
|
+
const b = p[0], O = b, v = Math.round(
|
|
2237
|
+
d.loaded * 100 / d.total
|
|
2238
|
+
);
|
|
2239
|
+
O.progress = v, this.$refs.upload.update(b, O);
|
|
2240
|
+
}
|
|
2241
|
+
},
|
|
2242
|
+
timeout: 6e4
|
|
2243
|
+
}), c = u;
|
|
2244
|
+
return c.response = s, this.$refs.upload.update(u, c), s;
|
|
2245
|
+
},
|
|
2246
|
+
// Pre-treatment when files are added
|
|
2247
|
+
inputFilter(u, l) {
|
|
2248
|
+
if (u && (!l || u.file !== l.file)) {
|
|
2249
|
+
u.url = "";
|
|
2250
|
+
const s = window.URL || window.webkitURL;
|
|
2251
|
+
s && s.createObjectURL && (u.url = s.createObjectURL(u.file));
|
|
2252
|
+
}
|
|
2253
|
+
},
|
|
2254
|
+
// Method to start uploading
|
|
2255
|
+
startUpload() {
|
|
2256
|
+
this.$refs.upload.active = !0;
|
|
2257
|
+
},
|
|
2258
|
+
// Clear any uploads
|
|
2259
|
+
undoFileUpload() {
|
|
2260
|
+
this.$refs.upload.clear();
|
|
2261
|
+
},
|
|
2262
|
+
remove(u) {
|
|
2263
|
+
this.$refs.upload.remove(u);
|
|
2264
|
+
},
|
|
2265
|
+
// When a file is changed
|
|
2266
|
+
inputFile(u, l) {
|
|
2267
|
+
if (this.modalOpen && (this.modalOpen = !1), this.createThumbnails && u && !u.thumbnailId && u.file && u.type.substr(0, 6) === "image/" && !["image/heic", "image/heif"].includes(u.type) && !l)
|
|
2268
|
+
return u.error = "thumbnail", new Promise(async (s, c) => {
|
|
2269
|
+
try {
|
|
2270
|
+
const { id: d } = await this.generateThumbnail(
|
|
2271
|
+
u.file
|
|
2272
|
+
), p = u;
|
|
2273
|
+
return p.thumbnailId = d, p.error = "", this.$refs.upload.update(u, p), s();
|
|
2274
|
+
} catch (d) {
|
|
2275
|
+
return c(d);
|
|
2276
|
+
}
|
|
2277
|
+
}).catch((s) => {
|
|
2278
|
+
this.$refs.upload.update(u, {
|
|
2279
|
+
error: s.code || s.error || s.message || s
|
|
2280
|
+
});
|
|
2281
|
+
});
|
|
2282
|
+
if (u && u.file && u.type.substr(0, 6) === "image/" && !["image/heic", "image/heif"].includes(u.type) && !u.hasCompressed)
|
|
2283
|
+
return u.error = "compressor", new Promise(async (s, c) => {
|
|
2284
|
+
try {
|
|
2285
|
+
const d = await this.compressFile(u.file);
|
|
2286
|
+
return this.$refs.upload.update(u, { ...d, error: "" }), s();
|
|
2287
|
+
} catch (d) {
|
|
2288
|
+
return c(d);
|
|
2289
|
+
}
|
|
2290
|
+
}).catch((s) => {
|
|
2291
|
+
this.$refs.upload.update(u, {
|
|
2292
|
+
error: s.code || s.error || s.message || s
|
|
2293
|
+
});
|
|
2294
|
+
});
|
|
2295
|
+
if (u && !u.active && !u.success && !u.error && this.autostartUpload && (u.active = !0), u && u.success && !l.success && this.$emit("upload-success", u), u && u.error && u.error !== "thumbnail" && u.error !== "compressor" && (!l || !l.error)) {
|
|
2296
|
+
if (this.onError)
|
|
2297
|
+
this.onError(u);
|
|
2298
|
+
else {
|
|
2299
|
+
let s = null;
|
|
2300
|
+
switch (u.error) {
|
|
2301
|
+
case "extension": {
|
|
2302
|
+
const c = this.extensions.replace(/,/g, ", ");
|
|
2303
|
+
s = this.$t("errors.extension", {
|
|
2304
|
+
extensions: c
|
|
2305
|
+
});
|
|
2306
|
+
break;
|
|
2307
|
+
}
|
|
2308
|
+
case "size": {
|
|
2309
|
+
s = this.$t("errors.size", {
|
|
2310
|
+
maxFileSize: `${this.maxSize / 1e6} MB`
|
|
2311
|
+
});
|
|
2312
|
+
break;
|
|
2313
|
+
}
|
|
2314
|
+
case "ECONNREFUSED": {
|
|
2315
|
+
s = this.$t("errors.ECONNREFUSED");
|
|
2316
|
+
break;
|
|
2317
|
+
}
|
|
2318
|
+
default:
|
|
2319
|
+
s = `${this.$t("errors.general")}: ${u.error}`;
|
|
2320
|
+
}
|
|
2321
|
+
de("error", s);
|
|
2322
|
+
}
|
|
2323
|
+
this.remove(u);
|
|
2324
|
+
}
|
|
2325
|
+
return !0;
|
|
2326
|
+
},
|
|
2327
|
+
async generateThumbnail(u) {
|
|
2328
|
+
try {
|
|
2329
|
+
return new Promise((l, s) => {
|
|
2330
|
+
new Oe(u, {
|
|
2331
|
+
quality: this.quality,
|
|
2332
|
+
maxWidth: this.thumbnailMaxWidth,
|
|
2333
|
+
maxHeight: this.thumbnailMaxHeight,
|
|
2334
|
+
success: (c) => {
|
|
2335
|
+
const d = new FormData(), p = this.appendToFilename(
|
|
2336
|
+
c.name,
|
|
2337
|
+
"_thumbnail"
|
|
2338
|
+
);
|
|
2339
|
+
return d.append("file", c, p), ge.post("/file", d).then((b) => l(b.data)).catch((b) => s(b));
|
|
2340
|
+
},
|
|
2341
|
+
error: (c) => s(c)
|
|
2342
|
+
});
|
|
2343
|
+
});
|
|
2344
|
+
} catch (l) {
|
|
2345
|
+
return de("error", this.$t("errors.thumbnail")), Promise.reject(l);
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
/**
|
|
2349
|
+
* Helper to compress file
|
|
2350
|
+
*
|
|
2351
|
+
* @param {Object} originalFile
|
|
2352
|
+
*
|
|
2353
|
+
* @returns {Promise} Resolves with a new fileObj when done
|
|
2354
|
+
*/
|
|
2355
|
+
async compressFile(u) {
|
|
2356
|
+
let l;
|
|
2357
|
+
try {
|
|
2358
|
+
return new Promise((s, c) => {
|
|
2359
|
+
l = new Oe(u, {
|
|
2360
|
+
quality: this.quality,
|
|
2361
|
+
maxWidth: this.maxWidth,
|
|
2362
|
+
maxHeight: this.maxHeight,
|
|
2363
|
+
success: (d) => {
|
|
2364
|
+
const p = {
|
|
2365
|
+
file: d,
|
|
2366
|
+
size: d.size,
|
|
2367
|
+
type: d.type,
|
|
2368
|
+
hasCompressed: !0
|
|
2369
|
+
};
|
|
2370
|
+
return s(p);
|
|
2371
|
+
},
|
|
2372
|
+
error: (d) => c(d)
|
|
2373
|
+
});
|
|
2374
|
+
});
|
|
2375
|
+
} catch (s) {
|
|
2376
|
+
return de("error", this.$t("errors.compress")), this.$refs.upload.update(u, { error: e.message }), Promise.reject(s);
|
|
2377
|
+
} finally {
|
|
2378
|
+
l = null;
|
|
2379
|
+
}
|
|
2380
|
+
},
|
|
2381
|
+
appendToFilename(u, l) {
|
|
2382
|
+
const s = u.lastIndexOf(".");
|
|
2383
|
+
return s === -1 ? u + l : u.substring(0, s) + l + u.substring(s);
|
|
2384
|
+
},
|
|
2385
|
+
handleSelect(u) {
|
|
2386
|
+
this.$emit("upload-success", { response: u }), this.modalOpen = !1;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
}, Zn = { class: "modal-container" }, ei = {
|
|
2390
|
+
key: 0,
|
|
2391
|
+
class: "drop-active font-inter",
|
|
2392
|
+
style: { "pointer-events": "none" }
|
|
2393
|
+
};
|
|
2394
|
+
function ti(u, l, s, c, d, p) {
|
|
2395
|
+
const b = Q("CIcon"), O = Q("UploadModal"), v = Q("portal"), k = Q("FileUpload");
|
|
2396
|
+
return G(), ae(k, {
|
|
2397
|
+
ref: "upload",
|
|
2398
|
+
modelValue: d.files,
|
|
2399
|
+
"onUpdate:modelValue": l[1] || (l[1] = (E) => d.files = E),
|
|
2400
|
+
maximum: s.maximum,
|
|
2401
|
+
"custom-action": p.postAction,
|
|
2402
|
+
extensions: s.extensions,
|
|
2403
|
+
multiple: s.multiple,
|
|
2404
|
+
drop: s.drop || d.modalOpen,
|
|
2405
|
+
size: s.maxSize,
|
|
2406
|
+
thread: 1,
|
|
2407
|
+
accept: s.accept,
|
|
2408
|
+
class: "btn btn-primary white-list",
|
|
2409
|
+
onInput: l[2] || (l[2] = (E) => u.$emit("input", d.files)),
|
|
2410
|
+
onInputFilter: p.inputFilter,
|
|
2411
|
+
onInputFile: p.inputFile
|
|
2412
|
+
}, {
|
|
2413
|
+
default: le(() => {
|
|
2414
|
+
var E, C;
|
|
2415
|
+
return [
|
|
2416
|
+
Ce(u.$slots, "default", { openFilePicker: p.open }, void 0, !0),
|
|
2417
|
+
s.drop || d.modalOpen ? Te((G(), pe("div", {
|
|
2418
|
+
key: 0,
|
|
2419
|
+
class: Se([{ transparent: d.modalOpen }, "drop-active font-inter white-list"])
|
|
2420
|
+
}, [
|
|
2421
|
+
ue(b, {
|
|
2422
|
+
type: "upload-cloud",
|
|
2423
|
+
size: "60"
|
|
2424
|
+
}),
|
|
2425
|
+
oe(" " + me(u.$t("dropActive")), 1)
|
|
2426
|
+
], 2)), [
|
|
2427
|
+
[Ae, (C = (E = u.$refs) == null ? void 0 : E.upload) == null ? void 0 : C.dropActive]
|
|
2428
|
+
]) : se("", !0),
|
|
2429
|
+
d.modalOpen ? (G(), ae(v, {
|
|
2430
|
+
key: 1,
|
|
2431
|
+
to: "modal"
|
|
2432
|
+
}, {
|
|
2433
|
+
default: le(() => {
|
|
2434
|
+
var A;
|
|
2435
|
+
return [
|
|
2436
|
+
he("div", {
|
|
2437
|
+
class: "modal-overlay",
|
|
2438
|
+
onClick: l[0] || (l[0] = Pe((B) => d.modalOpen = !1, ["self"]))
|
|
2439
|
+
}, [
|
|
2440
|
+
he("div", Zn, [
|
|
2441
|
+
ue(O, {
|
|
2442
|
+
onOpenPicker: p.openFilePicker,
|
|
2443
|
+
onSelect: p.handleSelect
|
|
2444
|
+
}, null, 8, ["onOpenPicker", "onSelect"])
|
|
2445
|
+
])
|
|
2446
|
+
]),
|
|
2447
|
+
(A = u.$refs.upload) != null && A.dropActive ? (G(), pe("div", ei, [
|
|
2448
|
+
(G(), ae(xe("style"), { type: "text/css" }, {
|
|
2449
|
+
default: le(() => l[3] || (l[3] = [
|
|
2450
|
+
oe(" * { pointer-events: none !important; } .white-list { pointer-events: initial !important; } ")
|
|
2451
|
+
])),
|
|
2452
|
+
_: 1
|
|
2453
|
+
})),
|
|
2454
|
+
ue(b, {
|
|
2455
|
+
type: "upload-cloud",
|
|
2456
|
+
size: "60"
|
|
2457
|
+
}),
|
|
2458
|
+
oe(" " + me(u.$t("dropActive")), 1)
|
|
2459
|
+
])) : se("", !0)
|
|
2460
|
+
];
|
|
2461
|
+
}),
|
|
2462
|
+
_: 1
|
|
2463
|
+
})) : se("", !0)
|
|
2464
|
+
];
|
|
2465
|
+
}),
|
|
2466
|
+
_: 3
|
|
2467
|
+
}, 8, ["modelValue", "maximum", "custom-action", "extensions", "multiple", "drop", "size", "accept", "onInputFilter", "onInputFile"]);
|
|
2468
|
+
}
|
|
2469
|
+
const ii = /* @__PURE__ */ xn(Qn, [["render", ti], ["__scopeId", "data-v-8fe2d4c5"]]);
|
|
2470
|
+
export {
|
|
2471
|
+
ii as default
|
|
2472
|
+
};
|