@verbb/formie-browser 1.0.17-next.8.g031176b155cf → 4.0.7
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 +7 -0
- package/dist/chunks/{api-BR2Gqy37.js → api-DlW6054X.js} +3 -1
- package/dist/chunks/{bpoint-GvYfyPjD.js → bpoint-BKRpTj1e.js} +1 -1
- package/dist/chunks/{eway-BZuTBAUW.js → eway-9ZTEmiod.js} +1 -1
- package/dist/chunks/{file-upload-vEUr_EuP.js → file-upload-Bhxg5QZe.js} +2 -0
- package/dist/chunks/{go-cardless-DWZeB0Bq.js → go-cardless-BN096eDZ.js} +1 -1
- package/dist/chunks/{mollie-8OMXIYa8.js → mollie-DCBzpCmt.js} +1 -1
- package/dist/chunks/{moneris-qYHJ9EFy.js → moneris-CeryRRRJ.js} +1 -1
- package/dist/chunks/{opayo-DlWPEnla.js → opayo-D5cbEqJy.js} +1 -1
- package/dist/chunks/{paddle-CArfWih0.js → paddle-CDiiBCJ8.js} +1 -1
- package/dist/chunks/{paypal-BcaMCMGY.js → paypal-CA-kRKlJ.js} +1 -1
- package/dist/chunks/{payway-vxC7_bfR.js → payway-K9eUUMvk.js} +1 -1
- package/dist/chunks/{square-Dyz0p_GU.js → square-Bn6y1M0R.js} +1 -1
- package/dist/chunks/{stripe-Bfd_jp_k.js → stripe-CmzSSdMg.js} +1 -1
- package/dist/chunks/{upload-manager-CkmsPJRl.js → upload-manager-cGKWwGhu.js} +196 -192
- package/dist/css/formie-base.css +26 -26
- package/dist/css/theme-base/_primitives.css +9 -8
- package/dist/index.js +430 -422
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-state.d.ts.map +1 -1
- package/dist/js/core/validation-focus.d.ts +1 -0
- package/dist/js/core/validation-focus.d.ts.map +1 -1
- package/dist/js/modules/fields/file-upload.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/package.json +4 -6
- package/src/css/formie-base.css +26 -26
- package/src/css/theme-base/_primitives.css +9 -8
- package/src/js/core/create-formie-client.ts +5 -0
- package/src/js/core/submit-result-state.ts +5 -0
- package/src/js/core/validation-focus.ts +40 -15
- package/src/js/modules/fields/file-upload.ts +7 -0
- package/src/js/modules/fields/upload-manager.ts +27 -12
|
@@ -156,11 +156,11 @@ function D(e) {
|
|
|
156
156
|
let t = "";
|
|
157
157
|
return e.replace(/[^A-Z0-9]/gi, (e) => (t += `-${E(e)}`, "/")) + t;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function ee(e, t) {
|
|
160
160
|
let n = t || "uppy";
|
|
161
161
|
return typeof e.name == "string" && (n += `-${D(e.name.toLowerCase())}`), e.type !== void 0 && (n += `-${e.type}`), e.meta && typeof e.meta.relativePath == "string" && (n += `-${D(e.meta.relativePath.toLowerCase())}`), e.data?.size !== void 0 && (n += `-${e.data.size}`), e.data.lastModified !== void 0 && (n += `-${e.data.lastModified}`), n;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function O(e) {
|
|
164
164
|
return !e.isRemote || !e.remote ? !1 : (/* @__PURE__ */ new Set([
|
|
165
165
|
"box",
|
|
166
166
|
"dropbox",
|
|
@@ -169,10 +169,10 @@ function k(e) {
|
|
|
169
169
|
"unsplash"
|
|
170
170
|
])).has(e.remote.provider);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
172
|
+
function k(e, t) {
|
|
173
|
+
if (O(e)) return e.id;
|
|
174
174
|
let n = T(e);
|
|
175
|
-
return
|
|
175
|
+
return ee({
|
|
176
176
|
...e,
|
|
177
177
|
type: n
|
|
178
178
|
}, t);
|
|
@@ -193,12 +193,12 @@ function M() {
|
|
|
193
193
|
}
|
|
194
194
|
//#endregion
|
|
195
195
|
//#region ../../node_modules/@uppy/utils/lib/isNetworkError.js
|
|
196
|
-
function
|
|
196
|
+
function te(e) {
|
|
197
197
|
return e ? e.readyState === 4 && e.status === 0 : !1;
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region ../../node_modules/@uppy/utils/lib/TaskQueue.js
|
|
201
|
-
var
|
|
201
|
+
var N = class {
|
|
202
202
|
#e = [];
|
|
203
203
|
#t = 0;
|
|
204
204
|
#n;
|
|
@@ -295,26 +295,26 @@ var te = class {
|
|
|
295
295
|
};
|
|
296
296
|
//#endregion
|
|
297
297
|
//#region ../../node_modules/@uppy/utils/lib/Translator.js
|
|
298
|
-
function
|
|
298
|
+
function P(e, t, n) {
|
|
299
299
|
let r = [];
|
|
300
300
|
return e.forEach((e) => typeof e == "string" ? t[Symbol.split](e).forEach((e, t, i) => {
|
|
301
301
|
e !== "" && r.push(e), t < i.length - 1 && r.push(n);
|
|
302
302
|
}) : r.push(e)), r;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function F(e, t) {
|
|
305
305
|
let n = /\$/g, r = [e];
|
|
306
306
|
if (t == null) return r;
|
|
307
307
|
for (let e of Object.keys(t)) if (e !== "_") {
|
|
308
308
|
let i = t[e];
|
|
309
|
-
typeof i == "string" && (i = n[Symbol.replace](i, "$$$$")), r =
|
|
309
|
+
typeof i == "string" && (i = n[Symbol.replace](i, "$$$$")), r = P(r, RegExp(`%\\{${e}\\}`, "g"), i);
|
|
310
310
|
}
|
|
311
311
|
return r;
|
|
312
312
|
}
|
|
313
|
-
var
|
|
313
|
+
var ne = (e) => {
|
|
314
314
|
throw Error(`missing string: ${e}`);
|
|
315
|
-
},
|
|
315
|
+
}, re = class {
|
|
316
316
|
locale;
|
|
317
|
-
constructor(e, { onMissingKey: t =
|
|
317
|
+
constructor(e, { onMissingKey: t = ne } = {}) {
|
|
318
318
|
this.locale = {
|
|
319
319
|
strings: {},
|
|
320
320
|
pluralize(e) {
|
|
@@ -342,14 +342,14 @@ var ie = (e) => {
|
|
|
342
342
|
if (n ??= (this.#e(e), e), typeof n == "object") {
|
|
343
343
|
if (t && t.smart_count !== void 0) {
|
|
344
344
|
let e = this.locale.pluralize(t.smart_count);
|
|
345
|
-
return
|
|
345
|
+
return F(n[e], t);
|
|
346
346
|
}
|
|
347
347
|
throw Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}");
|
|
348
348
|
}
|
|
349
349
|
if (typeof n != "string") throw Error("string was not a string");
|
|
350
|
-
return
|
|
350
|
+
return F(n, t);
|
|
351
351
|
}
|
|
352
|
-
},
|
|
352
|
+
}, ie = class {
|
|
353
353
|
uppy;
|
|
354
354
|
opts;
|
|
355
355
|
id;
|
|
@@ -382,7 +382,7 @@ var ie = (e) => {
|
|
|
382
382
|
}, this.setPluginState(void 0), this.i18nInit();
|
|
383
383
|
}
|
|
384
384
|
i18nInit() {
|
|
385
|
-
let e = new
|
|
385
|
+
let e = new re([
|
|
386
386
|
this.defaultLocale,
|
|
387
387
|
this.uppy.locale,
|
|
388
388
|
this.opts.locale
|
|
@@ -448,15 +448,15 @@ var ie = (e) => {
|
|
|
448
448
|
this.#e.getFile(e) && t();
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
|
-
},
|
|
451
|
+
}, L = {
|
|
452
452
|
debug: () => {},
|
|
453
453
|
warn: () => {},
|
|
454
454
|
error: (...e) => console.error(`[Uppy] [${M()}]`, ...e)
|
|
455
|
-
},
|
|
455
|
+
}, R = {
|
|
456
456
|
debug: (...e) => console.debug(`[Uppy] [${M()}]`, ...e),
|
|
457
457
|
warn: (...e) => console.warn(`[Uppy] [${M()}]`, ...e),
|
|
458
458
|
error: (...e) => console.error(`[Uppy] [${M()}]`, ...e)
|
|
459
|
-
},
|
|
459
|
+
}, ae = /* @__PURE__ */ t(((e, t) => {
|
|
460
460
|
t.exports = function(e) {
|
|
461
461
|
if (typeof e != "number" || Number.isNaN(e)) throw TypeError(`Expected a number, got ${typeof e}`);
|
|
462
462
|
let t = e < 0, n = Math.abs(e);
|
|
@@ -474,7 +474,7 @@ var ie = (e) => {
|
|
|
474
474
|
], i = Math.min(Math.floor(Math.log(n) / Math.log(1024)), r.length - 1), a = Number(n / 1024 ** i), o = r[i];
|
|
475
475
|
return `${a >= 10 || a % 1 == 0 ? Math.round(a) : a.toFixed(1)} ${o}`;
|
|
476
476
|
};
|
|
477
|
-
})),
|
|
477
|
+
})), oe = /* @__PURE__ */ t(((e, t) => {
|
|
478
478
|
function n(e, t) {
|
|
479
479
|
this.text = e ||= "", this.hasWild = ~e.indexOf("*"), this.separator = t, this.parts = e.split(t);
|
|
480
480
|
}
|
|
@@ -494,8 +494,8 @@ var ie = (e) => {
|
|
|
494
494
|
var i = new n(e, r || /[\/\.]/);
|
|
495
495
|
return t === void 0 ? i : i.match(t);
|
|
496
496
|
};
|
|
497
|
-
})),
|
|
498
|
-
var n =
|
|
497
|
+
})), se = /* @__PURE__ */ t(((e, t) => {
|
|
498
|
+
var n = oe(), r = /[\/\+\.]/;
|
|
499
499
|
t.exports = function(e, t) {
|
|
500
500
|
function i(t) {
|
|
501
501
|
var i = n(t, e, r);
|
|
@@ -503,7 +503,7 @@ var ie = (e) => {
|
|
|
503
503
|
}
|
|
504
504
|
return t ? i(t.split(";")[0]) : i;
|
|
505
505
|
};
|
|
506
|
-
})),
|
|
506
|
+
})), z = /* @__PURE__ */ e(ae(), 1), ce = /* @__PURE__ */ e(se(), 1), le = {
|
|
507
507
|
maxFileSize: null,
|
|
508
508
|
minFileSize: null,
|
|
509
509
|
maxTotalFileSize: null,
|
|
@@ -511,14 +511,14 @@ var ie = (e) => {
|
|
|
511
511
|
minNumberOfFiles: null,
|
|
512
512
|
allowedFileTypes: null,
|
|
513
513
|
requiredMetaFields: []
|
|
514
|
-
},
|
|
514
|
+
}, B = class extends Error {
|
|
515
515
|
isUserFacing;
|
|
516
516
|
file;
|
|
517
517
|
constructor(e, t) {
|
|
518
518
|
super(e), this.isUserFacing = t?.isUserFacing ?? !0, t?.file && (this.file = t.file);
|
|
519
519
|
}
|
|
520
520
|
isRestriction = !0;
|
|
521
|
-
},
|
|
521
|
+
}, ue = class {
|
|
522
522
|
getI18n;
|
|
523
523
|
getOpts;
|
|
524
524
|
constructor(e, t) {
|
|
@@ -530,26 +530,26 @@ var ie = (e) => {
|
|
|
530
530
|
}
|
|
531
531
|
validateAggregateRestrictions(e, t) {
|
|
532
532
|
let { maxTotalFileSize: n, maxNumberOfFiles: r } = this.getOpts().restrictions;
|
|
533
|
-
if (r && e.filter((e) => !e.isGhost).length + t.length > r) throw new
|
|
533
|
+
if (r && e.filter((e) => !e.isGhost).length + t.length > r) throw new B(`${this.getI18n()("youCanOnlyUploadX", { smart_count: r })}`);
|
|
534
534
|
if (n) {
|
|
535
535
|
let r = [...e, ...t].reduce((e, t) => e + (t.size ?? 0), 0);
|
|
536
|
-
if (r > n) throw new
|
|
537
|
-
sizeAllowed: (0,
|
|
538
|
-
size: (0,
|
|
536
|
+
if (r > n) throw new B(this.getI18n()("aggregateExceedsSize", {
|
|
537
|
+
sizeAllowed: (0, z.default)(n),
|
|
538
|
+
size: (0, z.default)(r)
|
|
539
539
|
}));
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
validateSingleFile(e) {
|
|
543
543
|
let { maxFileSize: t, minFileSize: n, allowedFileTypes: r } = this.getOpts().restrictions;
|
|
544
|
-
if (r && !r.some((t) => t.includes("/") ? e.type ? (0,
|
|
544
|
+
if (r && !r.some((t) => t.includes("/") ? e.type ? (0, ce.default)(e.type.replace(/;.*?$/, ""), t) : !1 : t[0] === "." && e.extension ? e.extension.toLowerCase() === t.slice(1).toLowerCase() : !1)) {
|
|
545
545
|
let t = r.join(", ");
|
|
546
|
-
throw new
|
|
546
|
+
throw new B(this.getI18n()("youCanOnlyUploadFileTypes", { types: t }), { file: e });
|
|
547
547
|
}
|
|
548
|
-
if (t && e.size != null && e.size > t) throw new
|
|
549
|
-
size: (0,
|
|
548
|
+
if (t && e.size != null && e.size > t) throw new B(this.getI18n()("exceedsSize", {
|
|
549
|
+
size: (0, z.default)(t),
|
|
550
550
|
file: e.name ?? this.getI18n()("unnamed")
|
|
551
551
|
}), { file: e });
|
|
552
|
-
if (n && e.size != null && e.size < n) throw new
|
|
552
|
+
if (n && e.size != null && e.size < n) throw new B(this.getI18n()("inferiorSize", { size: (0, z.default)(n) }), { file: e });
|
|
553
553
|
}
|
|
554
554
|
validate(e, t) {
|
|
555
555
|
t.forEach((e) => {
|
|
@@ -558,17 +558,17 @@ var ie = (e) => {
|
|
|
558
558
|
}
|
|
559
559
|
validateMinNumberOfFiles(e) {
|
|
560
560
|
let { minNumberOfFiles: t } = this.getOpts().restrictions;
|
|
561
|
-
if (t && Object.keys(e).length < t) throw new
|
|
561
|
+
if (t && Object.keys(e).length < t) throw new B(this.getI18n()("youHaveToAtLeastSelectX", { smart_count: t }));
|
|
562
562
|
}
|
|
563
563
|
getMissingRequiredMetaFields(e) {
|
|
564
|
-
let t = new
|
|
564
|
+
let t = new B(this.getI18n()("missingRequiredMetaFieldOnFile", { fileName: e.name ?? this.getI18n()("unnamed") })), { requiredMetaFields: n } = this.getOpts().restrictions, r = [];
|
|
565
565
|
for (let t of n) (!Object.hasOwn(e.meta, t) || e.meta[t] === "") && r.push(t);
|
|
566
566
|
return {
|
|
567
567
|
missingFields: r,
|
|
568
568
|
error: t
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
},
|
|
571
|
+
}, de = {
|
|
572
572
|
name: "@uppy/store-default",
|
|
573
573
|
description: "The default simple object-based store for Uppy.",
|
|
574
574
|
version: "5.0.0",
|
|
@@ -607,8 +607,8 @@ var ie = (e) => {
|
|
|
607
607
|
"dist",
|
|
608
608
|
"CHANGELOG.md"
|
|
609
609
|
]
|
|
610
|
-
},
|
|
611
|
-
static VERSION =
|
|
610
|
+
}, fe = class {
|
|
611
|
+
static VERSION = de.version;
|
|
612
612
|
state = {};
|
|
613
613
|
#e = /* @__PURE__ */ new Set();
|
|
614
614
|
getState() {
|
|
@@ -631,39 +631,39 @@ var ie = (e) => {
|
|
|
631
631
|
t(...e);
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
|
-
},
|
|
634
|
+
}, V = /* @__PURE__ */ t(((e, t) => {
|
|
635
635
|
function n(e) {
|
|
636
636
|
var t = typeof e;
|
|
637
637
|
return e != null && (t == "object" || t == "function");
|
|
638
638
|
}
|
|
639
639
|
t.exports = n;
|
|
640
|
-
})),
|
|
640
|
+
})), pe = /* @__PURE__ */ t(((e, t) => {
|
|
641
641
|
t.exports = typeof global == "object" && global && global.Object === Object && global;
|
|
642
|
-
})),
|
|
643
|
-
var n =
|
|
642
|
+
})), me = /* @__PURE__ */ t(((e, t) => {
|
|
643
|
+
var n = pe(), r = typeof self == "object" && self && self.Object === Object && self;
|
|
644
644
|
t.exports = n || r || Function("return this")();
|
|
645
|
-
})),
|
|
646
|
-
var n =
|
|
645
|
+
})), he = /* @__PURE__ */ t(((e, t) => {
|
|
646
|
+
var n = me();
|
|
647
647
|
t.exports = function() {
|
|
648
648
|
return n.Date.now();
|
|
649
649
|
};
|
|
650
|
-
})),
|
|
650
|
+
})), ge = /* @__PURE__ */ t(((e, t) => {
|
|
651
651
|
var n = /\s/;
|
|
652
652
|
function r(e) {
|
|
653
653
|
for (var t = e.length; t-- && n.test(e.charAt(t)););
|
|
654
654
|
return t;
|
|
655
655
|
}
|
|
656
656
|
t.exports = r;
|
|
657
|
-
})),
|
|
658
|
-
var n =
|
|
657
|
+
})), _e = /* @__PURE__ */ t(((e, t) => {
|
|
658
|
+
var n = ge(), r = /^\s+/;
|
|
659
659
|
function i(e) {
|
|
660
660
|
return e && e.slice(0, n(e) + 1).replace(r, "");
|
|
661
661
|
}
|
|
662
662
|
t.exports = i;
|
|
663
|
-
})),
|
|
664
|
-
t.exports =
|
|
665
|
-
})),
|
|
666
|
-
var n =
|
|
663
|
+
})), ve = /* @__PURE__ */ t(((e, t) => {
|
|
664
|
+
t.exports = me().Symbol;
|
|
665
|
+
})), ye = /* @__PURE__ */ t(((e, t) => {
|
|
666
|
+
var n = ve(), r = Object.prototype, i = r.hasOwnProperty, a = r.toString, o = n ? n.toStringTag : void 0;
|
|
667
667
|
function s(e) {
|
|
668
668
|
var t = i.call(e, o), n = e[o];
|
|
669
669
|
try {
|
|
@@ -674,31 +674,31 @@ var ie = (e) => {
|
|
|
674
674
|
return r && (t ? e[o] = n : delete e[o]), s;
|
|
675
675
|
}
|
|
676
676
|
t.exports = s;
|
|
677
|
-
})),
|
|
677
|
+
})), be = /* @__PURE__ */ t(((e, t) => {
|
|
678
678
|
var n = Object.prototype.toString;
|
|
679
679
|
function r(e) {
|
|
680
680
|
return n.call(e);
|
|
681
681
|
}
|
|
682
682
|
t.exports = r;
|
|
683
|
-
})),
|
|
684
|
-
var n =
|
|
683
|
+
})), xe = /* @__PURE__ */ t(((e, t) => {
|
|
684
|
+
var n = ve(), r = ye(), i = be(), a = "[object Null]", o = "[object Undefined]", s = n ? n.toStringTag : void 0;
|
|
685
685
|
function c(e) {
|
|
686
686
|
return e == null ? e === void 0 ? o : a : s && s in Object(e) ? r(e) : i(e);
|
|
687
687
|
}
|
|
688
688
|
t.exports = c;
|
|
689
|
-
})),
|
|
689
|
+
})), Se = /* @__PURE__ */ t(((e, t) => {
|
|
690
690
|
function n(e) {
|
|
691
691
|
return typeof e == "object" && !!e;
|
|
692
692
|
}
|
|
693
693
|
t.exports = n;
|
|
694
|
-
})),
|
|
695
|
-
var n =
|
|
694
|
+
})), Ce = /* @__PURE__ */ t(((e, t) => {
|
|
695
|
+
var n = xe(), r = Se(), i = "[object Symbol]";
|
|
696
696
|
function a(e) {
|
|
697
697
|
return typeof e == "symbol" || r(e) && n(e) == i;
|
|
698
698
|
}
|
|
699
699
|
t.exports = a;
|
|
700
|
-
})),
|
|
701
|
-
var n =
|
|
700
|
+
})), we = /* @__PURE__ */ t(((e, t) => {
|
|
701
|
+
var n = _e(), r = V(), i = Ce(), a = NaN, o = /^[-+]0x[0-9a-f]+$/i, s = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
|
|
702
702
|
function u(e) {
|
|
703
703
|
if (typeof e == "number") return e;
|
|
704
704
|
if (i(e)) return a;
|
|
@@ -712,8 +712,8 @@ var ie = (e) => {
|
|
|
712
712
|
return u || c.test(e) ? l(e.slice(2), u ? 2 : 8) : o.test(e) ? a : +e;
|
|
713
713
|
}
|
|
714
714
|
t.exports = u;
|
|
715
|
-
})),
|
|
716
|
-
var n =
|
|
715
|
+
})), Te = /* @__PURE__ */ t(((e, t) => {
|
|
716
|
+
var n = V(), r = he(), i = we(), a = "Expected a function", o = Math.max, s = Math.min;
|
|
717
717
|
function c(e, t, c) {
|
|
718
718
|
var l, u, d, f, p, m, h = 0, g = !1, _ = !1, v = !0;
|
|
719
719
|
if (typeof e != "function") throw TypeError(a);
|
|
@@ -758,8 +758,8 @@ var ie = (e) => {
|
|
|
758
758
|
return D.cancel = T, D.flush = E, D;
|
|
759
759
|
}
|
|
760
760
|
t.exports = c;
|
|
761
|
-
})),
|
|
762
|
-
var n =
|
|
761
|
+
})), Ee = /* @__PURE__ */ t(((e, t) => {
|
|
762
|
+
var n = Te(), r = V(), i = "Expected a function";
|
|
763
763
|
function a(e, t, a) {
|
|
764
764
|
var o = !0, s = !0;
|
|
765
765
|
if (typeof e != "function") throw TypeError(i);
|
|
@@ -770,7 +770,7 @@ var ie = (e) => {
|
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
772
|
t.exports = a;
|
|
773
|
-
})),
|
|
773
|
+
})), De = /* @__PURE__ */ t(((e, t) => {
|
|
774
774
|
t.exports = function() {
|
|
775
775
|
var e = {}, t = e._fns = {};
|
|
776
776
|
e.emit = function(e, t, i, a, o, s, c) {
|
|
@@ -810,11 +810,11 @@ var ie = (e) => {
|
|
|
810
810
|
}
|
|
811
811
|
return e;
|
|
812
812
|
};
|
|
813
|
-
})),
|
|
813
|
+
})), Oe = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", ke = (e = 21) => {
|
|
814
814
|
let t = "", n = e | 0;
|
|
815
|
-
for (; n-- > 0;) t +=
|
|
815
|
+
for (; n-- > 0;) t += Oe[Math.random() * 64 | 0];
|
|
816
816
|
return t;
|
|
817
|
-
},
|
|
817
|
+
}, Ae = {
|
|
818
818
|
name: "@uppy/core",
|
|
819
819
|
description: "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
|
|
820
820
|
version: "5.2.0",
|
|
@@ -876,12 +876,12 @@ var ie = (e) => {
|
|
|
876
876
|
};
|
|
877
877
|
//#endregion
|
|
878
878
|
//#region ../../node_modules/@uppy/core/lib/getFileName.js
|
|
879
|
-
function
|
|
879
|
+
function je(e, t) {
|
|
880
880
|
return t.name ? t.name : e.split("/")[0] === "image" ? `${e.split("/")[0]}.${e.split("/")[1]}` : "noname";
|
|
881
881
|
}
|
|
882
882
|
//#endregion
|
|
883
883
|
//#region ../../node_modules/@uppy/core/lib/locale.js
|
|
884
|
-
var
|
|
884
|
+
var Me = { strings: {
|
|
885
885
|
addBulkFilesFailed: {
|
|
886
886
|
0: "Failed to add %{smart_count} file due to an internal error",
|
|
887
887
|
1: "Failed to add %{smart_count} files due to internal errors"
|
|
@@ -945,7 +945,7 @@ var Pe = { strings: {
|
|
|
945
945
|
} };
|
|
946
946
|
//#endregion
|
|
947
947
|
//#region ../../node_modules/@uppy/core/lib/supportsUploadProgress.js
|
|
948
|
-
function
|
|
948
|
+
function Ne(e) {
|
|
949
949
|
if (e == null && typeof navigator < "u" && (e = navigator.userAgent), !e) return !0;
|
|
950
950
|
let t = /Edge\/(\d+\.\d+)/.exec(e);
|
|
951
951
|
if (!t) return !0;
|
|
@@ -954,17 +954,17 @@ function Fe(e) {
|
|
|
954
954
|
}
|
|
955
955
|
//#endregion
|
|
956
956
|
//#region ../../node_modules/@uppy/core/lib/Uppy.js
|
|
957
|
-
var
|
|
957
|
+
var Pe = /* @__PURE__ */ e(Ee(), 1), Fe = /* @__PURE__ */ e(De(), 1), H = {
|
|
958
958
|
totalProgress: 0,
|
|
959
959
|
allowNewUpload: !0,
|
|
960
960
|
error: null,
|
|
961
961
|
recoveredState: null
|
|
962
|
-
},
|
|
963
|
-
static VERSION =
|
|
962
|
+
}, Ie = class e {
|
|
963
|
+
static VERSION = Ae.version;
|
|
964
964
|
#e = Object.create(null);
|
|
965
965
|
#t;
|
|
966
966
|
#n;
|
|
967
|
-
#r = (0,
|
|
967
|
+
#r = (0, Fe.default)();
|
|
968
968
|
#i = /* @__PURE__ */ new Set();
|
|
969
969
|
#a = /* @__PURE__ */ new Set();
|
|
970
970
|
#o = /* @__PURE__ */ new Set();
|
|
@@ -977,18 +977,18 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
977
977
|
scheduledAutoProceed = null;
|
|
978
978
|
wasOffline = !1;
|
|
979
979
|
constructor(t) {
|
|
980
|
-
this.defaultLocale =
|
|
980
|
+
this.defaultLocale = Me;
|
|
981
981
|
let n = {
|
|
982
982
|
id: "uppy",
|
|
983
983
|
autoProceed: !1,
|
|
984
984
|
allowMultipleUploadBatches: !0,
|
|
985
985
|
debug: !1,
|
|
986
|
-
restrictions:
|
|
986
|
+
restrictions: le,
|
|
987
987
|
meta: {},
|
|
988
988
|
onBeforeFileAdded: (e, t) => !Object.hasOwn(t, e.id),
|
|
989
989
|
onBeforeUpload: (e) => e,
|
|
990
|
-
store: new
|
|
991
|
-
logger:
|
|
990
|
+
store: new fe(),
|
|
991
|
+
logger: L,
|
|
992
992
|
infoTimeout: 5e3
|
|
993
993
|
}, r = {
|
|
994
994
|
...n,
|
|
@@ -1000,19 +1000,19 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1000
1000
|
...n.restrictions,
|
|
1001
1001
|
...t?.restrictions
|
|
1002
1002
|
}
|
|
1003
|
-
}, t?.logger && t.debug ? this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.", "warning") : t?.debug && (this.opts.logger =
|
|
1004
|
-
...
|
|
1003
|
+
}, t?.logger && t.debug ? this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.", "warning") : t?.debug && (this.opts.logger = R), this.log(`Using Core v${e.VERSION}`), this.i18nInit(), this.store = this.opts.store, this.setState({
|
|
1004
|
+
...H,
|
|
1005
1005
|
plugins: {},
|
|
1006
1006
|
files: {},
|
|
1007
1007
|
currentUploads: {},
|
|
1008
1008
|
capabilities: {
|
|
1009
|
-
uploadProgress:
|
|
1009
|
+
uploadProgress: Ne(),
|
|
1010
1010
|
individualCancellation: !0,
|
|
1011
1011
|
resumableUploads: !1
|
|
1012
1012
|
},
|
|
1013
1013
|
meta: { ...this.opts.meta },
|
|
1014
1014
|
info: []
|
|
1015
|
-
}), this.#t = new
|
|
1015
|
+
}), this.#t = new ue(() => this.opts, () => this.i18n), this.#n = this.store.subscribe((e, t, n) => {
|
|
1016
1016
|
this.emit("state-update", e, t, n), this.updateAll(t);
|
|
1017
1017
|
}), this.opts.debug && typeof window < "u" && (window[this.opts.id] = this), this.#b();
|
|
1018
1018
|
}
|
|
@@ -1054,7 +1054,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1054
1054
|
this.patchFilesState({ [e]: t });
|
|
1055
1055
|
}
|
|
1056
1056
|
i18nInit() {
|
|
1057
|
-
let e = new
|
|
1057
|
+
let e = new re([this.defaultLocale, this.opts.locale], { onMissingKey: (e) => this.log(`Missing i18n string: ${e}`, "error") });
|
|
1058
1058
|
this.i18n = e.translate.bind(e), this.i18nArray = e.translateArray.bind(e), this.locale = e.locale;
|
|
1059
1059
|
}
|
|
1060
1060
|
setOptions(e) {
|
|
@@ -1088,14 +1088,14 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
}), this.setState({
|
|
1090
1090
|
files: n,
|
|
1091
|
-
...
|
|
1091
|
+
...H
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
clear() {
|
|
1095
1095
|
let { capabilities: e, currentUploads: t } = this.getState();
|
|
1096
1096
|
if (Object.keys(t).length > 0 && !e.individualCancellation) throw Error("The installed uploader plugin does not allow removing files during an upload.");
|
|
1097
1097
|
this.setState({
|
|
1098
|
-
...
|
|
1098
|
+
...H,
|
|
1099
1099
|
files: {}
|
|
1100
1100
|
});
|
|
1101
1101
|
}
|
|
@@ -1234,7 +1234,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1234
1234
|
#u(e) {
|
|
1235
1235
|
let { allowNewUpload: t } = this.getState();
|
|
1236
1236
|
if (t === !1) {
|
|
1237
|
-
let t = new
|
|
1237
|
+
let t = new B(this.i18n("noMoreFilesAllowed"), { file: e });
|
|
1238
1238
|
throw this.#s([t]), t;
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
@@ -1252,7 +1252,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1252
1252
|
isRemote: !1,
|
|
1253
1253
|
source: void 0,
|
|
1254
1254
|
preview: void 0
|
|
1255
|
-
} : e, n = T(t), r =
|
|
1255
|
+
} : e, n = T(t), r = je(n, t), i = C(r).extension, a = k(t, this.getID()), o = {
|
|
1256
1256
|
...t.meta,
|
|
1257
1257
|
name: r,
|
|
1258
1258
|
type: n
|
|
@@ -1312,8 +1312,8 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1312
1312
|
if (t = this.getState().files, n = {
|
|
1313
1313
|
...t,
|
|
1314
1314
|
...n
|
|
1315
|
-
}, !s && this.checkIfFileAlreadyExists(e.id)) throw new
|
|
1316
|
-
if (s === !1 && !o) throw new
|
|
1315
|
+
}, !s && this.checkIfFileAlreadyExists(e.id)) throw new B(this.i18n("noDuplicates", { fileName: e.name ?? this.i18n("unnamed") }), { file: e });
|
|
1316
|
+
if (s === !1 && !o) throw new B("Cannot add the file because onBeforeFileAdded returned false.", {
|
|
1317
1317
|
isUserFacing: !1,
|
|
1318
1318
|
file: e
|
|
1319
1319
|
});
|
|
@@ -1458,7 +1458,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1458
1458
|
cancelAll() {
|
|
1459
1459
|
this.emit("cancel-all");
|
|
1460
1460
|
let { files: e } = this.getState(), t = Object.keys(e);
|
|
1461
|
-
t.length && this.removeFiles(t), this.setState(
|
|
1461
|
+
t.length && this.removeFiles(t), this.setState(H);
|
|
1462
1462
|
}
|
|
1463
1463
|
retryUpload(e) {
|
|
1464
1464
|
this.setFileState(e, {
|
|
@@ -1500,7 +1500,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1500
1500
|
let e = this.#y(), t = null;
|
|
1501
1501
|
e != null && (t = Math.round(e * 100), t > 100 ? t = 100 : t < 0 && (t = 0)), this.emit("progress", t ?? 0), this.setState({ totalProgress: t ?? 0 });
|
|
1502
1502
|
}
|
|
1503
|
-
#v = (0,
|
|
1503
|
+
#v = (0, Pe.default)(() => this.#_(), 500, {
|
|
1504
1504
|
leading: !0,
|
|
1505
1505
|
trailing: !0
|
|
1506
1506
|
});
|
|
@@ -1697,7 +1697,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1697
1697
|
#C(e, t = {}) {
|
|
1698
1698
|
let { forceAllowNewUpload: n = !1 } = t, { allowNewUpload: r, currentUploads: i } = this.getState();
|
|
1699
1699
|
if (!r && !n) throw Error("Cannot create a new upload: already uploading.");
|
|
1700
|
-
let a =
|
|
1700
|
+
let a = ke();
|
|
1701
1701
|
return this.emit("upload", a, this.getFilesByIds(e)), this.setState({
|
|
1702
1702
|
allowNewUpload: this.opts.allowMultipleUploadBatches !== !1 && this.opts.allowMultipleUploads !== !1,
|
|
1703
1703
|
currentUploads: {
|
|
@@ -1796,7 +1796,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1796
1796
|
if (t === !1) throw Error("Not starting the upload because onBeforeUpload returned false");
|
|
1797
1797
|
t && typeof t == "object" && (e = t, this.setState({ files: e }));
|
|
1798
1798
|
try {
|
|
1799
|
-
if (this.#t.validateMinNumberOfFiles(e), !this.#l(e)) throw new
|
|
1799
|
+
if (this.#t.validateMinNumberOfFiles(e), !this.#l(e)) throw new B(this.i18n("missingRequiredMetaField"));
|
|
1800
1800
|
let { currentUploads: t } = this.getState(), n = Object.values(t).flatMap((e) => e.fileIDs), r = Object.keys(e).filter((e) => {
|
|
1801
1801
|
let t = this.getFile(e);
|
|
1802
1802
|
return t && !t.progress.uploadStarted && !n.includes(e);
|
|
@@ -1806,7 +1806,7 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1806
1806
|
throw this.#s([e]), e;
|
|
1807
1807
|
}
|
|
1808
1808
|
}
|
|
1809
|
-
},
|
|
1809
|
+
}, Le = {
|
|
1810
1810
|
name: "@uppy/xhr-upload",
|
|
1811
1811
|
description: "Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.",
|
|
1812
1812
|
version: "5.2.0",
|
|
@@ -1861,17 +1861,17 @@ var Ie = /* @__PURE__ */ e(Oe(), 1), Le = /* @__PURE__ */ e(ke(), 1), B = {
|
|
|
1861
1861
|
vitest: "^3.2.4"
|
|
1862
1862
|
},
|
|
1863
1863
|
peerDependencies: { "@uppy/core": "^5.2.0" }
|
|
1864
|
-
},
|
|
1864
|
+
}, Re = { strings: { uploadStalled: "Upload has not made any progress for %{seconds} seconds. You may want to retry it." } };
|
|
1865
1865
|
//#endregion
|
|
1866
1866
|
//#region ../../node_modules/@uppy/xhr-upload/lib/index.js
|
|
1867
|
-
function
|
|
1867
|
+
function ze(e, t) {
|
|
1868
1868
|
let n = t;
|
|
1869
|
-
return n ||= /* @__PURE__ */ Error("Upload error"), typeof n == "string" && (n = Error(n)), n instanceof Error || (n = Object.assign(/* @__PURE__ */ Error("Upload error"), { data: n })),
|
|
1869
|
+
return n ||= /* @__PURE__ */ Error("Upload error"), typeof n == "string" && (n = Error(n)), n instanceof Error || (n = Object.assign(/* @__PURE__ */ Error("Upload error"), { data: n })), te(e) ? (n = new h(n, e), n) : (n.request = e, n);
|
|
1870
1870
|
}
|
|
1871
|
-
function
|
|
1871
|
+
function Be(e) {
|
|
1872
1872
|
return e.data.slice(0, e.data.size, e.meta.type);
|
|
1873
1873
|
}
|
|
1874
|
-
var
|
|
1874
|
+
var Ve = {
|
|
1875
1875
|
formData: !0,
|
|
1876
1876
|
fieldName: "file",
|
|
1877
1877
|
method: "post",
|
|
@@ -1882,17 +1882,17 @@ var Ue = {
|
|
|
1882
1882
|
limit: 5,
|
|
1883
1883
|
withCredentials: !1,
|
|
1884
1884
|
responseType: ""
|
|
1885
|
-
},
|
|
1886
|
-
static VERSION =
|
|
1885
|
+
}, He = class extends ie {
|
|
1886
|
+
static VERSION = Le.version;
|
|
1887
1887
|
#e;
|
|
1888
1888
|
#t;
|
|
1889
1889
|
uploaderEvents;
|
|
1890
1890
|
constructor(e, t) {
|
|
1891
1891
|
if (super(e, {
|
|
1892
|
-
...
|
|
1892
|
+
...Ve,
|
|
1893
1893
|
fieldName: t.bundle ? "files[]" : "file",
|
|
1894
1894
|
...t
|
|
1895
|
-
}), this.type = "uploader", this.id = this.opts.id || "XHRUpload", this.defaultLocale =
|
|
1895
|
+
}), this.type = "uploader", this.id = this.opts.id || "XHRUpload", this.defaultLocale = Re, this.i18nInit(), this.#t = new N({ concurrency: this.opts.limit }), this.opts.bundle && !this.opts.formData) throw Error("`opts.formData` must be true when `opts.bundle` is enabled.");
|
|
1896
1896
|
if (this.opts.bundle && typeof this.opts.headers == "function") throw Error("`opts.headers` can not be a function when the `bundle: true` option is set.");
|
|
1897
1897
|
if (t?.allowedMetaFields === void 0 && "metaFields" in this.opts) throw Error("The `metaFields` option has been renamed to `allowedMetaFields`.");
|
|
1898
1898
|
this.uploaderEvents = Object.create(null), this.#e = (e) => async (t, n) => {
|
|
@@ -1933,7 +1933,7 @@ var Ue = {
|
|
|
1933
1933
|
} catch (t) {
|
|
1934
1934
|
if (t.name === "AbortError") return;
|
|
1935
1935
|
let n = t.request;
|
|
1936
|
-
for (let r of e) this.uppy.emit("upload-error", this.uppy.getFile(r.id),
|
|
1936
|
+
for (let r of e) this.uppy.emit("upload-error", this.uppy.getFile(r.id), ze(n, t), n);
|
|
1937
1937
|
throw t;
|
|
1938
1938
|
}
|
|
1939
1939
|
};
|
|
@@ -1956,13 +1956,13 @@ var Ue = {
|
|
|
1956
1956
|
createFormDataUpload(e, t) {
|
|
1957
1957
|
let n = new FormData();
|
|
1958
1958
|
this.addMetadata(n, e.meta, t);
|
|
1959
|
-
let r =
|
|
1959
|
+
let r = Be(e);
|
|
1960
1960
|
return e.name ? n.append(t.fieldName, r, e.meta.name) : n.append(t.fieldName, r), n;
|
|
1961
1961
|
}
|
|
1962
1962
|
createBundledUpload(e, t) {
|
|
1963
1963
|
let n = new FormData(), { meta: r } = this.uppy.getState();
|
|
1964
1964
|
return this.addMetadata(n, r, t), e.forEach((e) => {
|
|
1965
|
-
let t = this.getOptions(e), r =
|
|
1965
|
+
let t = this.getOptions(e), r = Be(e);
|
|
1966
1966
|
e.name ? n.append(t.fieldName, r, e.name) : n.append(t.fieldName, r);
|
|
1967
1967
|
}), n;
|
|
1968
1968
|
}
|
|
@@ -2073,8 +2073,8 @@ var Ue = {
|
|
|
2073
2073
|
}
|
|
2074
2074
|
this.uppy.removeUploader(this.#o);
|
|
2075
2075
|
}
|
|
2076
|
-
},
|
|
2077
|
-
d(tt, [
|
|
2076
|
+
}, Ue = "@layer formie-theme{.formie-upload-manager{gap:var(--formie-gap-field);flex-direction:column;display:flex}.formie-upload-manager-dropzone{justify-content:center;align-items:center;gap:var(--formie-space-2);padding:var(--formie-space-4);min-height:calc(var(--formie-control-height) * 3);border:var(--formie-border-width) dashed var(--formie-color-border-control);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface-subtle);color:var(--formie-color-text);text-align:center;cursor:pointer;flex-direction:column;transition:border-color .15s,background-color .15s,box-shadow .15s;display:flex}.formie-upload-manager-dropzone:hover,.formie-upload-manager-dropzone.formie-upload-manager-dropzone-active{border-color:var(--formie-color-focus-ring);background:var(--formie-color-surface-muted)}.formie-upload-manager-dropzone:focus{outline:0}.formie-upload-manager-dropzone:focus-visible{box-shadow:0 0 0 var(--formie-focus-ring-width) var(--formie-color-focus-ring)}.formie-field-has-error .formie-upload-manager-dropzone{border-color:var(--formie-color-danger)}.formie-upload-manager-prompt{font-size:var(--formie-font-size-sm);color:var(--formie-color-text-muted);margin:0}.formie-upload-manager-list{gap:var(--formie-space-2);flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.formie-upload-manager-item{align-items:center;gap:var(--formie-space-2);padding:var(--formie-space-2) var(--formie-space-3);border:var(--formie-border-width) solid var(--formie-color-border-control);border-radius:var(--formie-radius-sm);background:var(--formie-color-surface);grid-template-columns:minmax(0,1fr) minmax(6.5rem,8rem) auto;display:grid}.formie-upload-manager-item.is-error{border-color:var(--formie-color-danger)}.formie-upload-manager-item.is-complete .formie-upload-manager-progress{opacity:0;visibility:hidden;pointer-events:none}.formie-upload-manager-filename{text-overflow:ellipsis;white-space:nowrap;font-size:var(--formie-font-size-sm);overflow:hidden}.formie-upload-manager-progress{justify-content:center;gap:var(--formie-space-1);min-height:var(--formie-button-icon-button-size);opacity:1;visibility:visible;flex-direction:column;align-self:center;transition:opacity .2s,visibility .2s;display:flex}.formie-upload-manager-progress-track{border-radius:var(--formie-radius-full);background:var(--formie-color-surface-muted);height:.375rem;position:relative;overflow:hidden}.formie-upload-manager-progress-bar{border-radius:inherit;background:var(--formie-color-primary);width:0;height:100%;transition:width .18s ease-out,background-color .2s}.formie-upload-manager-item.is-upload-complete .formie-upload-manager-progress-bar{background:var(--formie-color-success,var(--formie-color-primary));width:100%!important}.formie-upload-manager-item.is-uploading:not(.is-upload-complete) .formie-upload-manager-progress-track[data-indeterminate=true] .formie-upload-manager-progress-bar,.formie-upload-manager-item.is-preparing .formie-upload-manager-progress-bar,.formie-upload-manager-item.is-processing .formie-upload-manager-progress-bar{width:35%;animation:1.1s ease-in-out infinite formie-upload-manager-progress-indeterminate}.formie-upload-manager-item.is-processing .formie-upload-manager-progress-bar{opacity:.85}.formie-upload-manager-item.is-processing .formie-upload-manager-progress-label{color:var(--formie-color-text)}@keyframes formie-upload-manager-progress-indeterminate{0%{transform:translate(-120%)}to{transform:translate(320%)}}.formie-upload-manager-progress-label{font-size:var(--formie-font-size-xs);color:var(--formie-color-text-muted);text-align:center;white-space:nowrap;line-height:1.2}.formie-upload-manager-item.is-upload-complete .formie-upload-manager-progress-label{color:var(--formie-color-success-dark,var(--formie-color-primary));font-weight:var(--formie-font-weight-medium)}.formie-upload-manager-error{font-size:var(--formie-font-size-xs);color:var(--formie-color-danger);grid-column:1/-1}.formie-upload-manager-browse-button{margin-top:var(--formie-space-1)}.formie-upload-manager-actions{align-items:center;gap:var(--formie-space-2);flex-shrink:0;align-self:center;display:flex}.formie-upload-manager-sort-controls{border-radius:var(--formie-radius-sm);background:0 0;flex-direction:row;align-items:center;gap:.0625rem;padding:0;display:inline-flex}.formie-upload-manager-sort-controls[hidden]{display:none}.formie-upload-manager-sort-button,.formie-upload-manager-action-button{border-radius:var(--formie-radius-sm);width:1.375rem;height:1.375rem;color:var(--formie-color-text-muted);cursor:pointer;text-indent:-9999px;white-space:nowrap;background:0 0;border:0;justify-content:center;align-items:center;padding:0;font-size:0;line-height:0;transition:background-color .15s,color .15s,opacity .15s;display:inline-flex;position:relative;overflow:hidden}.formie-upload-manager-sort-button{width:1.375rem;height:1.375rem}.formie-upload-manager-sort-button:hover:not(:disabled),.formie-upload-manager-action-button:hover{background:var(--formie-color-surface-muted);color:var(--formie-color-text)}.formie-upload-manager-sort-button:focus-visible,.formie-upload-manager-action-button:focus-visible{box-shadow:0 0 0 var(--formie-focus-ring-width) var(--formie-color-focus-ring);outline:0}.formie-upload-manager-sort-button:disabled{opacity:.28;cursor:not-allowed}.formie-upload-manager-sort-button:after,.formie-upload-manager-action-button:after{content:\"\";background-color:currentColor;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.formie-upload-manager-sort-button[data-formie-icon=arrow-up]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-arrow-up)}.formie-upload-manager-sort-button[data-formie-icon=arrow-down]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-arrow-down)}.formie-upload-manager-action-button[data-formie-icon=close]{--formie-upload-manager-icon-mask:var(--formie-icon-mask-close)}.formie-upload-manager-sort-button:after{width:.75rem;height:.75rem;-webkit-mask-image:var(--formie-upload-manager-icon-mask);-webkit-mask-image:var(--formie-upload-manager-icon-mask);mask-image:var(--formie-upload-manager-icon-mask)}.formie-upload-manager-action-button:after{width:.825rem;height:.825rem;-webkit-mask-image:var(--formie-upload-manager-icon-mask);-webkit-mask-image:var(--formie-upload-manager-icon-mask);mask-image:var(--formie-upload-manager-icon-mask)}.formie-upload-manager-remove-button{flex-shrink:0}}", U = "[data-formie-upload-manager-root]", W = "[data-formie-upload-manager]", We = "[data-formie-upload-manager-browse]", Ge = "[data-formie-upload-manager-input]", Ke = "[data-formie-upload-manager-status]", qe = "[data-formie-upload-manager-list]", Je = "[data-formie-upload-manager-sort-controls]", Ye = "[data-formie-upload-manager-sort=\"up\"]", Xe = "[data-formie-upload-manager-sort=\"down\"]", G = "data-formie-file-upload-anchor", K = "data-formie-file-upload-asset-id", Ze = "data-formie-file-upload-token", Qe = "data-formie-file-upload-entry", $e = r("reset"), et = i("repeater", "init-row"), tt = "upload-manager", nt = "upload-manager", rt = ["uploadManagerRequired", "uploadManagerFileLimit"], it = 900, at = 95, ot = 12e4, q = a("fields", "upload-manager");
|
|
2077
|
+
d(tt, [Ue]);
|
|
2078
2078
|
function st(e) {
|
|
2079
2079
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2080
2080
|
}
|
|
@@ -2097,33 +2097,33 @@ function X(e) {
|
|
|
2097
2097
|
return Array.from(e.querySelectorAll("input[type=\"hidden\"]")).filter((e) => e instanceof HTMLInputElement);
|
|
2098
2098
|
}
|
|
2099
2099
|
function ut(e, t) {
|
|
2100
|
-
let n = X(e).find((e) => e.hasAttribute(
|
|
2101
|
-
if (n) return n.setAttribute(
|
|
2100
|
+
let n = X(e).find((e) => e.hasAttribute(G) || e.name === t.replace("[]", "") && e.value === "");
|
|
2101
|
+
if (n) return n.setAttribute(G, "true"), n;
|
|
2102
2102
|
let r = document.createElement("input");
|
|
2103
|
-
return r.type = "hidden", r.name = t.replace("[]", ""), r.value = "", r.setAttribute(
|
|
2103
|
+
return r.type = "hidden", r.name = t.replace("[]", ""), r.value = "", r.setAttribute(G, "true"), e.prepend(r), r;
|
|
2104
2104
|
}
|
|
2105
2105
|
function dt(e, t) {
|
|
2106
|
-
return X(e).filter((e) => e.hasAttribute(
|
|
2106
|
+
return X(e).filter((e) => e.hasAttribute(K) || e.name === t && e.value.trim() !== "");
|
|
2107
2107
|
}
|
|
2108
2108
|
function ft(e, t) {
|
|
2109
|
-
return dt(e, t).map((e) => J(e.getAttribute(
|
|
2109
|
+
return dt(e, t).map((e) => J(e.getAttribute(K)) ?? J(e.value)).filter((e) => e !== null);
|
|
2110
2110
|
}
|
|
2111
2111
|
function pt(e, t) {
|
|
2112
2112
|
let n = {};
|
|
2113
2113
|
return dt(e, t).forEach((e) => {
|
|
2114
|
-
let t = J(e.getAttribute(
|
|
2114
|
+
let t = J(e.getAttribute(K)) ?? J(e.value), r = e.getAttribute(Ze)?.trim() || "";
|
|
2115
2115
|
t && r && (n[t] = r);
|
|
2116
2116
|
}), n;
|
|
2117
2117
|
}
|
|
2118
2118
|
function mt(e, t, n, r) {
|
|
2119
2119
|
let i = t, a = n.endsWith("[]") ? n.slice(0, -2) : n;
|
|
2120
|
-
X(e).filter((e) => e.hasAttribute(
|
|
2120
|
+
X(e).filter((e) => e.hasAttribute(Qe) || e.name === n && e.value.trim() !== "").forEach((e) => {
|
|
2121
2121
|
e.remove();
|
|
2122
2122
|
}), r.forEach(({ assetId: e, uploadToken: t, uploadUid: n, attachToken: r }, o) => {
|
|
2123
2123
|
let s = document.createElement("input");
|
|
2124
|
-
if (s.type = "hidden", s.setAttribute(
|
|
2124
|
+
if (s.type = "hidden", s.setAttribute(Qe, "true"), s.setAttribute(K, String(e)), n && r ? (s.name = `${a}[${o}][uploadUid]`, s.value = n) : (s.name = `${a}[${o}][assetId]`, s.value = String(e)), t && s.setAttribute(Ze, t), i.insertAdjacentElement("afterend", s), i = s, n && r) {
|
|
2125
2125
|
let e = document.createElement("input");
|
|
2126
|
-
e.type = "hidden", e.name = `${a}[${o}][attachToken]`, e.value = r, e.setAttribute(
|
|
2126
|
+
e.type = "hidden", e.name = `${a}[${o}][attachToken]`, e.value = r, e.setAttribute(Qe, "true"), i.insertAdjacentElement("afterend", e), i = e;
|
|
2127
2127
|
}
|
|
2128
2128
|
});
|
|
2129
2129
|
}
|
|
@@ -2270,7 +2270,7 @@ function Et(e, t) {
|
|
|
2270
2270
|
};
|
|
2271
2271
|
}
|
|
2272
2272
|
function Dt(e) {
|
|
2273
|
-
let t = X(e).find((e) => e.hasAttribute(
|
|
2273
|
+
let t = X(e).find((e) => e.hasAttribute(G));
|
|
2274
2274
|
if (t?.name) return t.name.endsWith("[]") ? t.name : `${t.name}[]`;
|
|
2275
2275
|
let n = ct(e), r = n ? u(n) : "";
|
|
2276
2276
|
return r ? `${r}[]` : "fields[fileUpload][]";
|
|
@@ -2294,19 +2294,19 @@ function $(e) {
|
|
|
2294
2294
|
function kt(e) {
|
|
2295
2295
|
m(e, nt, (e) => {
|
|
2296
2296
|
e.addValidator("uploadManagerRequired", ({ input: e }) => {
|
|
2297
|
-
if (!e.matches(
|
|
2297
|
+
if (!e.matches(Ke)) return !0;
|
|
2298
2298
|
let t = e.closest("[data-formie-field-handle]");
|
|
2299
2299
|
return !(t instanceof HTMLElement) || e.getAttribute("data-formie-validation-required") !== "true" || ft(t, Dt(t)).length > 0;
|
|
2300
2300
|
}, ({ input: e, label: t, t: n }) => e.getAttribute("data-formie-required-message") ?? n("{label} cannot be blank.", { label: t })), e.addValidator("uploadManagerFileLimit", ({ input: e }) => {
|
|
2301
|
-
if (!e.matches(
|
|
2301
|
+
if (!e.matches(Ke)) return !0;
|
|
2302
2302
|
let t = e.closest("[data-formie-field-handle]");
|
|
2303
2303
|
if (!(t instanceof HTMLElement)) return !0;
|
|
2304
|
-
let n = t.querySelector(
|
|
2304
|
+
let n = t.querySelector(W);
|
|
2305
2305
|
if (!(n instanceof HTMLElement)) return !0;
|
|
2306
2306
|
let r = parseInt(n.getAttribute("data-formie-file-limit") || "", 10);
|
|
2307
2307
|
return !r || ft(t, Dt(t)).length <= r;
|
|
2308
2308
|
}, ({ input: e, t }) => {
|
|
2309
|
-
let n = e.closest("[data-formie-field-handle]")?.querySelector(
|
|
2309
|
+
let n = e.closest("[data-formie-field-handle]")?.querySelector(W);
|
|
2310
2310
|
return n?.getAttribute("data-formie-validation-max-files-message") ?? t("Choose up to {files} files.", { files: n?.getAttribute("data-formie-file-limit") || "" });
|
|
2311
2311
|
});
|
|
2312
2312
|
});
|
|
@@ -2320,15 +2320,15 @@ function jt(e, t) {
|
|
|
2320
2320
|
return n instanceof HTMLFormElement ? n : null;
|
|
2321
2321
|
}
|
|
2322
2322
|
function Mt(e, t, r) {
|
|
2323
|
-
let i = e.querySelector(
|
|
2323
|
+
let i = e.querySelector(U);
|
|
2324
2324
|
if (!(i instanceof HTMLElement)) return () => {};
|
|
2325
|
-
let a = i.querySelector(
|
|
2325
|
+
let a = i.querySelector(W);
|
|
2326
2326
|
if (!(a instanceof HTMLElement)) return () => {};
|
|
2327
|
-
let o = i.querySelector(
|
|
2327
|
+
let o = i.querySelector(Ge), c = i.querySelector(We), u = i.querySelector(qe), d = i.querySelector(Ke);
|
|
2328
2328
|
if (!(o instanceof HTMLInputElement) || !(u instanceof HTMLElement)) return () => {};
|
|
2329
2329
|
let f = jt(t, e), m = d instanceof HTMLInputElement ? d : null, h = Dt(e), g = ut(e, h), _ = vt(a, r.uploadEndpoint, "data-formie-file-upload-upload-endpoint", "/actions/formie/file-upload/upload"), v = vt(a, r.deleteEndpoint, "data-formie-file-upload-delete-endpoint", "/actions/formie/file-upload/delete"), y = vt(a, r.hydrateEndpoint, "data-formie-file-upload-hydrate-endpoint", "/actions/formie/file-upload/hydrate"), b = r.maxFiles ?? J(a.getAttribute("data-formie-file-limit")), x = r.maxFileSize ?? parseFloat(a.getAttribute("data-formie-size-max-limit") || ""), S = r.minFileSize ?? parseFloat(a.getAttribute("data-formie-size-min-limit") || ""), C = _t(r.accept ?? a.getAttribute("accept") ?? o.accept), w = {};
|
|
2330
2330
|
b && (w.maxNumberOfFiles = b), x && (w.maxFileSize = x * 1e3 * 1e3), S && (w.minFileSize = S * 1e3 * 1e3), C && (w.allowedFileTypes = C);
|
|
2331
|
-
let T = new
|
|
2331
|
+
let T = new Ie({
|
|
2332
2332
|
autoProceed: !0,
|
|
2333
2333
|
restrictions: w
|
|
2334
2334
|
}), E = document.createElement("div");
|
|
@@ -2338,8 +2338,8 @@ function Mt(e, t, r) {
|
|
|
2338
2338
|
});
|
|
2339
2339
|
let D = () => {
|
|
2340
2340
|
E.textContent = "", E.hidden = !0;
|
|
2341
|
-
},
|
|
2342
|
-
T.use(
|
|
2341
|
+
}, ee = s(f);
|
|
2342
|
+
T.use(He, {
|
|
2343
2343
|
endpoint: _,
|
|
2344
2344
|
fieldName: "file",
|
|
2345
2345
|
formData: !0,
|
|
@@ -2359,7 +2359,7 @@ function Mt(e, t, r) {
|
|
|
2359
2359
|
"submissionEditToken",
|
|
2360
2360
|
"resumeToken",
|
|
2361
2361
|
"uploadCreateToken",
|
|
2362
|
-
...
|
|
2362
|
+
...ee ? [ee.name] : []
|
|
2363
2363
|
],
|
|
2364
2364
|
getResponseData(e) {
|
|
2365
2365
|
try {
|
|
@@ -2374,7 +2374,7 @@ function Mt(e, t, r) {
|
|
|
2374
2374
|
i && e.setRequestHeader("X-CSRF-Token", i.value);
|
|
2375
2375
|
let a = r[0];
|
|
2376
2376
|
a?.id && a.size && e.upload.addEventListener("progress", (e) => {
|
|
2377
|
-
let t =
|
|
2377
|
+
let t = I(a.id);
|
|
2378
2378
|
if (!t) return;
|
|
2379
2379
|
let n = 0;
|
|
2380
2380
|
e.lengthComputable && e.total > 0 ? n = Math.round(e.loaded / e.total * 100) : e.loaded > 0 && a.size && (n = Math.min(100, Math.round(e.loaded / a.size * 100))), bt(t.listItem, n, {
|
|
@@ -2384,7 +2384,7 @@ function Mt(e, t, r) {
|
|
|
2384
2384
|
});
|
|
2385
2385
|
}
|
|
2386
2386
|
});
|
|
2387
|
-
let
|
|
2387
|
+
let O = {
|
|
2388
2388
|
field: e,
|
|
2389
2389
|
dropzone: a,
|
|
2390
2390
|
browseInput: o,
|
|
@@ -2394,38 +2394,38 @@ function Mt(e, t, r) {
|
|
|
2394
2394
|
assetInputName: h,
|
|
2395
2395
|
uppy: T,
|
|
2396
2396
|
files: []
|
|
2397
|
-
},
|
|
2397
|
+
}, k = new AbortController(), A = 0, j = () => b ? Math.max(0, b - Ot(O)) : null, M = (e) => {
|
|
2398
2398
|
a.classList.toggle("formie-upload-manager-dropzone-active", e);
|
|
2399
|
-
},
|
|
2400
|
-
let e =
|
|
2401
|
-
|
|
2402
|
-
let r = t.listItem.querySelector(
|
|
2399
|
+
}, te = (e) => e.assetId !== null && !e.listItem.classList.contains("is-error"), N = () => {
|
|
2400
|
+
let e = O.files.length >= 2;
|
|
2401
|
+
O.files.forEach((t, n) => {
|
|
2402
|
+
let r = t.listItem.querySelector(Je), i = t.listItem.querySelector(Ye), a = t.listItem.querySelector(Xe);
|
|
2403
2403
|
if (!(r instanceof HTMLElement)) return;
|
|
2404
|
-
let o = e &&
|
|
2405
|
-
r.hidden = !o, i instanceof HTMLButtonElement && (i.disabled = !o || n === 0), a instanceof HTMLButtonElement && (a.disabled = !o || n >=
|
|
2404
|
+
let o = e && te(t);
|
|
2405
|
+
r.hidden = !o, i instanceof HTMLButtonElement && (i.disabled = !o || n === 0), a instanceof HTMLButtonElement && (a.disabled = !o || n >= O.files.length - 1);
|
|
2406
2406
|
});
|
|
2407
|
-
},
|
|
2408
|
-
let n =
|
|
2409
|
-
if (n < 0 || r < 0 || r >=
|
|
2410
|
-
let i =
|
|
2411
|
-
|
|
2407
|
+
}, P = (e, t) => {
|
|
2408
|
+
let n = O.files.indexOf(e), r = n + t;
|
|
2409
|
+
if (n < 0 || r < 0 || r >= O.files.length) return;
|
|
2410
|
+
let i = O.files[r];
|
|
2411
|
+
O.files[n] = i, O.files[r] = e, t === -1 ? i.listItem.before(e.listItem) : i.listItem.after(e.listItem), $(O), N(), p(O.field, "file-upload", "uploaded-assets-reordered", { assets: O.files.filter((e) => e.assetId !== null).map((e) => ({
|
|
2412
2412
|
assetId: e.assetId,
|
|
2413
2413
|
filename: e.filename
|
|
2414
2414
|
})) });
|
|
2415
|
-
},
|
|
2415
|
+
}, F = (e, t, n, r) => {
|
|
2416
2416
|
t.addEventListener("click", () => {
|
|
2417
2417
|
ne(e);
|
|
2418
2418
|
}), n.addEventListener("click", () => {
|
|
2419
|
-
|
|
2419
|
+
P(e, -1);
|
|
2420
2420
|
}), r.addEventListener("click", () => {
|
|
2421
|
-
|
|
2421
|
+
P(e, 1);
|
|
2422
2422
|
});
|
|
2423
2423
|
}, ne = async (t) => {
|
|
2424
|
-
if (t.uppyFileId && T.removeFile(t.uppyFileId), t.assetId) {
|
|
2424
|
+
if (t.uppyFileId && T.removeFile(t.uppyFileId), t.assetId && t.deleteToken) {
|
|
2425
2425
|
let n = new FormData(), r = ht(f, e, a);
|
|
2426
2426
|
Object.entries(r).forEach(([e, t]) => {
|
|
2427
2427
|
n.append(e, t);
|
|
2428
|
-
}), n.append("assetId", String(t.assetId)),
|
|
2428
|
+
}), n.append("assetId", String(t.assetId)), n.append("uploadToken", t.deleteToken);
|
|
2429
2429
|
try {
|
|
2430
2430
|
await l(v, {
|
|
2431
2431
|
profile: f?.dataset.formieRequestProfile,
|
|
@@ -2439,7 +2439,7 @@ function Mt(e, t, r) {
|
|
|
2439
2439
|
});
|
|
2440
2440
|
}
|
|
2441
2441
|
}
|
|
2442
|
-
t.listItem.remove(),
|
|
2442
|
+
t.listItem.remove(), O.files = O.files.filter((e) => e !== t), $(O), N();
|
|
2443
2443
|
}, re = (t, n, r = null, i = null, a = null, o = null) => {
|
|
2444
2444
|
let { listItem: s, removeButton: c, sortUpButton: l, sortDownButton: d } = Et(e, n);
|
|
2445
2445
|
s.classList.add("is-complete"), u.append(s);
|
|
@@ -2453,28 +2453,30 @@ function Mt(e, t, r) {
|
|
|
2453
2453
|
uppyFileId: null,
|
|
2454
2454
|
listItem: s
|
|
2455
2455
|
};
|
|
2456
|
-
|
|
2456
|
+
F(f, c, l, d), O.files.push(f), N();
|
|
2457
2457
|
}, ie = async () => {
|
|
2458
|
-
let t = ft(e, h);
|
|
2459
|
-
if (!
|
|
2460
|
-
let
|
|
2458
|
+
let t = ++A, n = ft(e, h);
|
|
2459
|
+
if (!n.length) return;
|
|
2460
|
+
let r = pt(e, h);
|
|
2461
2461
|
try {
|
|
2462
|
-
let
|
|
2462
|
+
let i = await l(y, {
|
|
2463
2463
|
profile: f?.dataset.formieRequestProfile,
|
|
2464
2464
|
method: "POST",
|
|
2465
|
-
body: gt(f, e,
|
|
2466
|
-
})
|
|
2467
|
-
t
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2465
|
+
body: gt(f, e, n, r)
|
|
2466
|
+
});
|
|
2467
|
+
if (t !== A) return;
|
|
2468
|
+
let a = i.assets || [], o = new Map(a.map((e) => [J(e.assetId), e]).filter(([e]) => e !== null));
|
|
2469
|
+
n.forEach((e) => {
|
|
2470
|
+
if (O.files.some((t) => t.assetId === e)) return;
|
|
2471
|
+
let t = o.get(e);
|
|
2472
|
+
t && re(e, t.filename || `Asset #${e}`, Y(t.uploadToken) || r[e] || null, Y(t.deleteToken) || null, Y(t.uploadUid) || null, Y(t.attachToken) || null);
|
|
2473
|
+
}), $(O), N();
|
|
2472
2474
|
} catch (e) {
|
|
2473
2475
|
q.warn("Failed to hydrate uploaded assets.", { error: e });
|
|
2474
2476
|
}
|
|
2475
|
-
},
|
|
2477
|
+
}, I = (e) => e && O.files.find((t) => t.uppyFileId === e) || null;
|
|
2476
2478
|
T.on("upload-progress", (e, t) => {
|
|
2477
|
-
let n =
|
|
2479
|
+
let n = I(e?.id);
|
|
2478
2480
|
if (!n) return;
|
|
2479
2481
|
let r = t.bytesTotal || 0, i = t.bytesUploaded || 0, a = r > 0 ? Math.round(i / r * 100) : 0;
|
|
2480
2482
|
bt(n.listItem, a, {
|
|
@@ -2482,10 +2484,10 @@ function Mt(e, t, r) {
|
|
|
2482
2484
|
total: r
|
|
2483
2485
|
});
|
|
2484
2486
|
}), T.on("upload-retry", (e) => {
|
|
2485
|
-
let t =
|
|
2487
|
+
let t = I(e?.id);
|
|
2486
2488
|
t && Q(t.listItem, "Retrying…", "retrying");
|
|
2487
2489
|
}), T.on("upload-success", (e, t) => {
|
|
2488
|
-
let n =
|
|
2490
|
+
let n = I(e?.id);
|
|
2489
2491
|
if (!n) return;
|
|
2490
2492
|
let r = n.listItem.querySelector("[data-formie-upload-manager-error]"), i = st(t?.body) ? t.body : {}, a = J(i.assetId);
|
|
2491
2493
|
if (!i.success || !a) {
|
|
@@ -2494,14 +2496,14 @@ function Mt(e, t, r) {
|
|
|
2494
2496
|
let e = i.errors ? Object.values(i.errors).flat().find(Boolean) : null;
|
|
2495
2497
|
e && (r.textContent = e);
|
|
2496
2498
|
}
|
|
2497
|
-
} else n.assetId = a, n.uploadToken = Y(i.uploadToken) || null, n.deleteToken = Y(i.deleteToken) || null, n.uploadUid = Y(i.uploadUid) || null, n.attachToken = Y(i.attachToken) || null, n.filename = i.filename || n.filename, Ct(n.listItem), $(
|
|
2499
|
+
} else n.assetId = a, n.uploadToken = Y(i.uploadToken) || null, n.deleteToken = Y(i.deleteToken) || null, n.uploadUid = Y(i.uploadUid) || null, n.attachToken = Y(i.attachToken) || null, n.filename = i.filename || n.filename, Ct(n.listItem), $(O), N();
|
|
2498
2500
|
}), T.on("upload-error", (e, t, n) => {
|
|
2499
|
-
let r =
|
|
2501
|
+
let r = I(e?.id);
|
|
2500
2502
|
if (!r) return;
|
|
2501
2503
|
let i = r.listItem.querySelector("[data-formie-upload-manager-error]");
|
|
2502
2504
|
wt(r.listItem), i instanceof HTMLElement && (i.hidden = !1, i.textContent = xt(n, t));
|
|
2503
2505
|
}), T.on("file-added", (t) => {
|
|
2504
|
-
let n =
|
|
2506
|
+
let n = j();
|
|
2505
2507
|
if (n !== null && n <= 0) {
|
|
2506
2508
|
T.removeFile(t.id), T.info("File limit reached.", "error", 3e3);
|
|
2507
2509
|
return;
|
|
@@ -2518,18 +2520,18 @@ function Mt(e, t, r) {
|
|
|
2518
2520
|
uppyFileId: t.id,
|
|
2519
2521
|
listItem: r
|
|
2520
2522
|
};
|
|
2521
|
-
|
|
2523
|
+
F(c, i, o, s), O.files.push(c), N();
|
|
2522
2524
|
});
|
|
2523
|
-
let
|
|
2525
|
+
let L = () => {
|
|
2524
2526
|
o.click();
|
|
2525
2527
|
};
|
|
2526
2528
|
c?.addEventListener("click", (e) => {
|
|
2527
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2528
|
-
}), a.addEventListener("click", (e) => {
|
|
2529
|
-
e.target instanceof Element && e.target.closest(
|
|
2530
|
-
}), a.addEventListener("keydown", (e) => {
|
|
2531
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
2532
|
-
}), o.addEventListener("change", () => {
|
|
2529
|
+
e.preventDefault(), e.stopPropagation(), L();
|
|
2530
|
+
}, { signal: k.signal }), a.addEventListener("click", (e) => {
|
|
2531
|
+
e.target instanceof Element && e.target.closest(We) || L();
|
|
2532
|
+
}, { signal: k.signal }), a.addEventListener("keydown", (e) => {
|
|
2533
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), L());
|
|
2534
|
+
}, { signal: k.signal }), o.addEventListener("change", () => {
|
|
2533
2535
|
if (!o.files?.length) return;
|
|
2534
2536
|
let e = Array.from(o.files);
|
|
2535
2537
|
o.value = "", D();
|
|
@@ -2542,14 +2544,14 @@ function Mt(e, t, r) {
|
|
|
2542
2544
|
} catch (e) {
|
|
2543
2545
|
e instanceof Error && T.info(e.message, "error", 3e3);
|
|
2544
2546
|
}
|
|
2545
|
-
}), ["dragenter", "dragover"].forEach((e) => {
|
|
2547
|
+
}, { signal: k.signal }), ["dragenter", "dragover"].forEach((e) => {
|
|
2546
2548
|
a.addEventListener(e, (e) => {
|
|
2547
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2548
|
-
});
|
|
2549
|
+
e.preventDefault(), e.stopPropagation(), M(!0);
|
|
2550
|
+
}, { signal: k.signal });
|
|
2549
2551
|
}), ["dragleave", "drop"].forEach((e) => {
|
|
2550
2552
|
a.addEventListener(e, (e) => {
|
|
2551
|
-
e.preventDefault(), e.stopPropagation(),
|
|
2552
|
-
});
|
|
2553
|
+
e.preventDefault(), e.stopPropagation(), M(!1);
|
|
2554
|
+
}, { signal: k.signal });
|
|
2553
2555
|
}), a.addEventListener("drop", (e) => {
|
|
2554
2556
|
let t = e.dataTransfer;
|
|
2555
2557
|
if (!t?.files?.length) return;
|
|
@@ -2564,14 +2566,16 @@ function Mt(e, t, r) {
|
|
|
2564
2566
|
} catch (e) {
|
|
2565
2567
|
e instanceof Error && T.info(e.message, "error", 3e3);
|
|
2566
2568
|
}
|
|
2567
|
-
});
|
|
2568
|
-
let
|
|
2569
|
-
D(),
|
|
2569
|
+
}, { signal: k.signal });
|
|
2570
|
+
let R = () => {
|
|
2571
|
+
A += 1, D(), O.files.forEach((e) => {
|
|
2570
2572
|
e.listItem.remove();
|
|
2571
|
-
}),
|
|
2573
|
+
}), O.files = [], T.cancelAll(), $(O);
|
|
2572
2574
|
};
|
|
2573
|
-
return f?.addEventListener($e,
|
|
2574
|
-
f?.removeEventListener($e,
|
|
2575
|
+
return f?.addEventListener($e, R), ie(), () => {
|
|
2576
|
+
A += 1, k.abort(), f?.removeEventListener($e, R), T.destroy(), E.remove(), O.files.forEach((e) => {
|
|
2577
|
+
e.listItem.remove();
|
|
2578
|
+
}), O.files = [];
|
|
2575
2579
|
};
|
|
2576
2580
|
}
|
|
2577
2581
|
var Nt = {
|
|
@@ -2583,7 +2587,7 @@ var Nt = {
|
|
|
2583
2587
|
"cp-edit"
|
|
2584
2588
|
],
|
|
2585
2589
|
kind: "field",
|
|
2586
|
-
match: (e) => !!e.target.querySelector(
|
|
2590
|
+
match: (e) => !!e.target.querySelector(U),
|
|
2587
2591
|
setup: async (e) => {
|
|
2588
2592
|
let t = e.options || {}, n = e.form, r = /* @__PURE__ */ new WeakSet(), i = [];
|
|
2589
2593
|
kt(n);
|
|
@@ -2591,11 +2595,11 @@ var Nt = {
|
|
|
2591
2595
|
let a = /* @__PURE__ */ new Set();
|
|
2592
2596
|
e instanceof HTMLElement && e.hasAttribute("data-formie-field-handle") && a.add(e), e instanceof Element && (e.querySelectorAll("[data-formie-field-handle]").forEach((e) => {
|
|
2593
2597
|
e instanceof HTMLElement && a.add(e);
|
|
2594
|
-
}), e.querySelectorAll(
|
|
2598
|
+
}), e.querySelectorAll(U).forEach((e) => {
|
|
2595
2599
|
let t = e.closest("[data-formie-field-handle]");
|
|
2596
2600
|
t instanceof HTMLElement && a.add(t);
|
|
2597
2601
|
})), a.forEach((e) => {
|
|
2598
|
-
!r.has(e) && e.querySelector(
|
|
2602
|
+
!r.has(e) && e.querySelector(U) && (r.add(e), i.push(Mt(e, n, t)));
|
|
2599
2603
|
});
|
|
2600
2604
|
};
|
|
2601
2605
|
a(e.target);
|