bard-attachment_field 0.5.3 → 0.5.4
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.
- checksums.yaml +4 -4
- data/README.md +72 -12
- data/Rakefile +4 -0
- data/app/assets/javascripts/input-attachment.js +245 -234
- data/bard-attachment_field.gemspec +1 -1
- data/input-attachment/bun.lockb +0 -0
- data/input-attachment/package.json +3 -1
- data/input-attachment/src/components/attachment-file/attachment-file.css +0 -1
- data/input-attachment/src/components/attachment-file/attachment-file.tsx +1 -1
- data/lib/bard/attachment_field/version.rb +1 -1
- metadata +2 -2
|
@@ -207,7 +207,7 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
207
207
|
};
|
|
208
208
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
209
209
|
var customError;
|
|
210
|
-
var consoleError = (
|
|
210
|
+
var consoleError = (e3, el) => (customError || console.error)(e3, el);
|
|
211
211
|
var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
|
|
212
212
|
"%cstencil",
|
|
213
213
|
"color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
|
|
@@ -237,8 +237,8 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
237
237
|
}
|
|
238
238
|
return importedModule[exportName];
|
|
239
239
|
},
|
|
240
|
-
(
|
|
241
|
-
consoleError(
|
|
240
|
+
(e3) => {
|
|
241
|
+
consoleError(e3, hostRef.$hostElement$);
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
244
|
};
|
|
@@ -287,7 +287,7 @@ var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
|
287
287
|
}
|
|
288
288
|
})
|
|
289
289
|
);
|
|
290
|
-
} catch (
|
|
290
|
+
} catch (e3) {
|
|
291
291
|
}
|
|
292
292
|
return supportsListenerOptions2;
|
|
293
293
|
})();
|
|
@@ -299,7 +299,7 @@ var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */
|
|
|
299
299
|
}
|
|
300
300
|
new CSSStyleSheet();
|
|
301
301
|
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
302
|
-
} catch (
|
|
302
|
+
} catch (e3) {
|
|
303
303
|
}
|
|
304
304
|
return false;
|
|
305
305
|
})() : false;
|
|
@@ -324,8 +324,8 @@ var consume = (queue) => {
|
|
|
324
324
|
for (let i2 = 0; i2 < queue.length; i2++) {
|
|
325
325
|
try {
|
|
326
326
|
queue[i2](performance.now());
|
|
327
|
-
} catch (
|
|
328
|
-
consoleError(
|
|
327
|
+
} catch (e3) {
|
|
328
|
+
consoleError(e3);
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
queue.length = 0;
|
|
@@ -336,8 +336,8 @@ var consumeTimeout = (queue, timeout) => {
|
|
|
336
336
|
while (i2 < queue.length && (ts = performance.now()) < timeout) {
|
|
337
337
|
try {
|
|
338
338
|
queue[i2++](ts);
|
|
339
|
-
} catch (
|
|
340
|
-
consoleError(
|
|
339
|
+
} catch (e3) {
|
|
340
|
+
consoleError(e3);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
if (i2 === queue.length) {
|
|
@@ -2325,7 +2325,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2325
2325
|
const propName = memberName.slice(5);
|
|
2326
2326
|
try {
|
|
2327
2327
|
elm[propName] = newValue;
|
|
2328
|
-
} catch (
|
|
2328
|
+
} catch (e3) {
|
|
2329
2329
|
}
|
|
2330
2330
|
return;
|
|
2331
2331
|
} else if (BUILD.vdomPropOrAttr) {
|
|
@@ -2346,7 +2346,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2346
2346
|
} else if (elm[memberName] !== newValue) {
|
|
2347
2347
|
elm[memberName] = newValue;
|
|
2348
2348
|
}
|
|
2349
|
-
} catch (
|
|
2349
|
+
} catch (e3) {
|
|
2350
2350
|
}
|
|
2351
2351
|
}
|
|
2352
2352
|
let xlink = false;
|
|
@@ -3146,8 +3146,8 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
3146
3146
|
elm["s-en"] = "c";
|
|
3147
3147
|
}
|
|
3148
3148
|
}
|
|
3149
|
-
} catch (
|
|
3150
|
-
consoleError(
|
|
3149
|
+
} catch (e3) {
|
|
3150
|
+
consoleError(e3, elm);
|
|
3151
3151
|
}
|
|
3152
3152
|
}
|
|
3153
3153
|
if (BUILD.asyncLoading && rc) {
|
|
@@ -3201,8 +3201,8 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
3201
3201
|
}
|
|
3202
3202
|
}
|
|
3203
3203
|
}
|
|
3204
|
-
} catch (
|
|
3205
|
-
consoleError(
|
|
3204
|
+
} catch (e3) {
|
|
3205
|
+
consoleError(e3, hostRef.$hostElement$);
|
|
3206
3206
|
}
|
|
3207
3207
|
renderingRef = null;
|
|
3208
3208
|
return null;
|
|
@@ -3297,8 +3297,8 @@ var safeCall = (instance, method, arg, elm) => {
|
|
|
3297
3297
|
if (instance && instance[method]) {
|
|
3298
3298
|
try {
|
|
3299
3299
|
return instance[method](arg);
|
|
3300
|
-
} catch (
|
|
3301
|
-
consoleError(
|
|
3300
|
+
} catch (e3) {
|
|
3301
|
+
consoleError(e3, elm);
|
|
3302
3302
|
}
|
|
3303
3303
|
}
|
|
3304
3304
|
return void 0;
|
|
@@ -3414,8 +3414,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3414
3414
|
instance[watchMethodName](newVal, oldVal, propName);
|
|
3415
3415
|
}
|
|
3416
3416
|
}
|
|
3417
|
-
} catch (
|
|
3418
|
-
consoleError(
|
|
3417
|
+
} catch (e3) {
|
|
3418
|
+
consoleError(e3, elm);
|
|
3419
3419
|
}
|
|
3420
3420
|
});
|
|
3421
3421
|
}
|
|
@@ -3715,8 +3715,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3715
3715
|
}
|
|
3716
3716
|
try {
|
|
3717
3717
|
new Cstr(hostRef);
|
|
3718
|
-
} catch (
|
|
3719
|
-
consoleError(
|
|
3718
|
+
} catch (e3) {
|
|
3719
|
+
consoleError(e3, elm);
|
|
3720
3720
|
}
|
|
3721
3721
|
if (BUILD.member) {
|
|
3722
3722
|
hostRef.$flags$ &= ~8;
|
|
@@ -3774,8 +3774,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3774
3774
|
} else {
|
|
3775
3775
|
schedule();
|
|
3776
3776
|
}
|
|
3777
|
-
} catch (
|
|
3778
|
-
consoleError(
|
|
3777
|
+
} catch (e3) {
|
|
3778
|
+
consoleError(e3, elm);
|
|
3779
3779
|
if (BUILD.asyncLoading && hostRef.$onRenderResolve$) {
|
|
3780
3780
|
hostRef.$onRenderResolve$();
|
|
3781
3781
|
hostRef.$onRenderResolve$ = void 0;
|
|
@@ -3995,8 +3995,8 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3995
3995
|
1 | 2
|
|
3996
3996
|
/* proxyState */
|
|
3997
3997
|
);
|
|
3998
|
-
} catch (
|
|
3999
|
-
consoleError(
|
|
3998
|
+
} catch (e3) {
|
|
3999
|
+
consoleError(e3);
|
|
4000
4000
|
return Cstr;
|
|
4001
4001
|
}
|
|
4002
4002
|
};
|
|
@@ -4033,8 +4033,8 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
4033
4033
|
} else {
|
|
4034
4034
|
hostRef.$hostElement$[methodName](ev);
|
|
4035
4035
|
}
|
|
4036
|
-
} catch (
|
|
4037
|
-
consoleError(
|
|
4036
|
+
} catch (e3) {
|
|
4037
|
+
consoleError(e3, hostRef.$hostElement$);
|
|
4038
4038
|
}
|
|
4039
4039
|
};
|
|
4040
4040
|
var getHostListenerTarget = (doc, elm, flags) => {
|
|
@@ -4081,8 +4081,8 @@ function transformTag(tag) {
|
|
|
4081
4081
|
|
|
4082
4082
|
// dist/components/attachment-preview2.js
|
|
4083
4083
|
var a = proxyCustomElement(class extends H {
|
|
4084
|
-
constructor(
|
|
4085
|
-
super(), false !==
|
|
4084
|
+
constructor(e3) {
|
|
4085
|
+
super(), false !== e3 && this.__registerHost(), this.__attachShadow();
|
|
4086
4086
|
}
|
|
4087
4087
|
src;
|
|
4088
4088
|
filetype;
|
|
@@ -4113,54 +4113,54 @@ var n = function() {
|
|
|
4113
4113
|
var a2 = { exports: {} };
|
|
4114
4114
|
a2.exports = (function() {
|
|
4115
4115
|
var t = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
4116
|
-
function
|
|
4116
|
+
function e3(t2, e4) {
|
|
4117
4117
|
var i3 = t2[0], s2 = t2[1], r5 = t2[2], n4 = t2[3];
|
|
4118
|
-
s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r5 | ~s2 & n4) +
|
|
4118
|
+
s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r5 | ~s2 & n4) + e4[0] - 680876936 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r5) + e4[1] - 389564586 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e4[2] + 606105819 | 0) << 17 | r5 >>> 15) + n4 | 0) & n4 | ~r5 & i3) + e4[3] - 1044525330 | 0) << 22 | s2 >>> 10) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r5 | ~s2 & n4) + e4[4] - 176418897 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r5) + e4[5] + 1200080426 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e4[6] - 1473231341 | 0) << 17 | r5 >>> 15) + n4 | 0) & n4 | ~r5 & i3) + e4[7] - 45705983 | 0) << 22 | s2 >>> 10) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r5 | ~s2 & n4) + e4[8] + 1770035416 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r5) + e4[9] - 1958414417 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e4[10] - 42063 | 0) << 17 | r5 >>> 15) + n4 | 0) & n4 | ~r5 & i3) + e4[11] - 1990404162 | 0) << 22 | s2 >>> 10) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & r5 | ~s2 & n4) + e4[12] + 1804603682 | 0) << 7 | i3 >>> 25) + s2 | 0) & s2 | ~i3 & r5) + e4[13] - 40341101 | 0) << 12 | n4 >>> 20) + i3 | 0) & i3 | ~n4 & s2) + e4[14] - 1502002290 | 0) << 17 | r5 >>> 15) + n4 | 0) & n4 | ~r5 & i3) + e4[15] + 1236535329 | 0) << 22 | s2 >>> 10) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r5 & ~n4) + e4[1] - 165796510 | 0) << 5 | i3 >>> 27) + s2 | 0) & r5 | s2 & ~r5) + e4[6] - 1069501632 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e4[11] + 643717713 | 0) << 14 | r5 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e4[0] - 373897302 | 0) << 20 | s2 >>> 12) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r5 & ~n4) + e4[5] - 701558691 | 0) << 5 | i3 >>> 27) + s2 | 0) & r5 | s2 & ~r5) + e4[10] + 38016083 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e4[15] - 660478335 | 0) << 14 | r5 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e4[4] - 405537848 | 0) << 20 | s2 >>> 12) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r5 & ~n4) + e4[9] + 568446438 | 0) << 5 | i3 >>> 27) + s2 | 0) & r5 | s2 & ~r5) + e4[14] - 1019803690 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e4[3] - 187363961 | 0) << 14 | r5 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e4[8] + 1163531501 | 0) << 20 | s2 >>> 12) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 & n4 | r5 & ~n4) + e4[13] - 1444681467 | 0) << 5 | i3 >>> 27) + s2 | 0) & r5 | s2 & ~r5) + e4[2] - 51403784 | 0) << 9 | n4 >>> 23) + i3 | 0) & s2 | i3 & ~s2) + e4[7] + 1735328473 | 0) << 14 | r5 >>> 18) + n4 | 0) & i3 | n4 & ~i3) + e4[12] - 1926607734 | 0) << 20 | s2 >>> 12) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r5 ^ n4) + e4[5] - 378558 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r5) + e4[8] - 2022574463 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e4[11] + 1839030562 | 0) << 16 | r5 >>> 16) + n4 | 0) ^ n4 ^ i3) + e4[14] - 35309556 | 0) << 23 | s2 >>> 9) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r5 ^ n4) + e4[1] - 1530992060 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r5) + e4[4] + 1272893353 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e4[7] - 155497632 | 0) << 16 | r5 >>> 16) + n4 | 0) ^ n4 ^ i3) + e4[10] - 1094730640 | 0) << 23 | s2 >>> 9) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r5 ^ n4) + e4[13] + 681279174 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r5) + e4[0] - 358537222 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e4[3] - 722521979 | 0) << 16 | r5 >>> 16) + n4 | 0) ^ n4 ^ i3) + e4[6] + 76029189 | 0) << 23 | s2 >>> 9) + r5 | 0, s2 = ((s2 += ((r5 = ((r5 += ((n4 = ((n4 += ((i3 = ((i3 += (s2 ^ r5 ^ n4) + e4[9] - 640364487 | 0) << 4 | i3 >>> 28) + s2 | 0) ^ s2 ^ r5) + e4[12] - 421815835 | 0) << 11 | n4 >>> 21) + i3 | 0) ^ i3 ^ s2) + e4[15] + 530742520 | 0) << 16 | r5 >>> 16) + n4 | 0) ^ n4 ^ i3) + e4[2] - 995338651 | 0) << 23 | s2 >>> 9) + r5 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r5 ^ (s2 | ~n4)) + e4[0] - 198630844 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r5)) + e4[7] + 1126891415 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r5 = ((r5 += (i3 ^ (n4 | ~s2)) + e4[14] - 1416354905 | 0) << 15 | r5 >>> 17) + n4 | 0) | ~i3)) + e4[5] - 57434055 | 0) << 21 | s2 >>> 11) + r5 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r5 ^ (s2 | ~n4)) + e4[12] + 1700485571 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r5)) + e4[3] - 1894986606 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r5 = ((r5 += (i3 ^ (n4 | ~s2)) + e4[10] - 1051523 | 0) << 15 | r5 >>> 17) + n4 | 0) | ~i3)) + e4[1] - 2054922799 | 0) << 21 | s2 >>> 11) + r5 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r5 ^ (s2 | ~n4)) + e4[8] + 1873313359 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r5)) + e4[15] - 30611744 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r5 = ((r5 += (i3 ^ (n4 | ~s2)) + e4[6] - 1560198380 | 0) << 15 | r5 >>> 17) + n4 | 0) | ~i3)) + e4[13] + 1309151649 | 0) << 21 | s2 >>> 11) + r5 | 0, s2 = ((s2 += ((n4 = ((n4 += (s2 ^ ((i3 = ((i3 += (r5 ^ (s2 | ~n4)) + e4[4] - 145523070 | 0) << 6 | i3 >>> 26) + s2 | 0) | ~r5)) + e4[11] - 1120210379 | 0) << 10 | n4 >>> 22) + i3 | 0) ^ ((r5 = ((r5 += (i3 ^ (n4 | ~s2)) + e4[2] + 718787259 | 0) << 15 | r5 >>> 17) + n4 | 0) | ~i3)) + e4[9] - 343485551 | 0) << 21 | s2 >>> 11) + r5 | 0, t2[0] = i3 + t2[0] | 0, t2[1] = s2 + t2[1] | 0, t2[2] = r5 + t2[2] | 0, t2[3] = n4 + t2[3] | 0;
|
|
4119
4119
|
}
|
|
4120
4120
|
function i2(t2) {
|
|
4121
|
-
var
|
|
4122
|
-
for (
|
|
4121
|
+
var e4, i3 = [];
|
|
4122
|
+
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] = t2.charCodeAt(e4) + (t2.charCodeAt(e4 + 1) << 8) + (t2.charCodeAt(e4 + 2) << 16) + (t2.charCodeAt(e4 + 3) << 24);
|
|
4123
4123
|
return i3;
|
|
4124
4124
|
}
|
|
4125
4125
|
function s(t2) {
|
|
4126
|
-
var
|
|
4127
|
-
for (
|
|
4126
|
+
var e4, i3 = [];
|
|
4127
|
+
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] = t2[e4] + (t2[e4 + 1] << 8) + (t2[e4 + 2] << 16) + (t2[e4 + 3] << 24);
|
|
4128
4128
|
return i3;
|
|
4129
4129
|
}
|
|
4130
4130
|
function r4(t2) {
|
|
4131
4131
|
var s2, r5, n4, o4, a4, h4, c6 = t2.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
|
|
4132
|
-
for (s2 = 64; s2 <= c6; s2 += 64)
|
|
4132
|
+
for (s2 = 64; s2 <= c6; s2 += 64) e3(l3, i2(t2.substring(s2 - 64, s2)));
|
|
4133
4133
|
for (r5 = (t2 = t2.substring(s2 - 64)).length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], s2 = 0; s2 < r5; s2 += 1) n4[s2 >> 2] |= t2.charCodeAt(s2) << (s2 % 4 << 3);
|
|
4134
|
-
if (n4[s2 >> 2] |= 128 << (s2 % 4 << 3), s2 > 55) for (
|
|
4135
|
-
return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4,
|
|
4134
|
+
if (n4[s2 >> 2] |= 128 << (s2 % 4 << 3), s2 > 55) for (e3(l3, n4), s2 = 0; s2 < 16; s2 += 1) n4[s2] = 0;
|
|
4135
|
+
return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4, e3(l3, n4), l3;
|
|
4136
4136
|
}
|
|
4137
|
-
function n3(
|
|
4137
|
+
function n3(e4) {
|
|
4138
4138
|
var i3, s2 = "";
|
|
4139
|
-
for (i3 = 0; i3 < 4; i3 += 1) s2 += t[
|
|
4139
|
+
for (i3 = 0; i3 < 4; i3 += 1) s2 += t[e4 >> 8 * i3 + 4 & 15] + t[e4 >> 8 * i3 & 15];
|
|
4140
4140
|
return s2;
|
|
4141
4141
|
}
|
|
4142
4142
|
function o3(t2) {
|
|
4143
|
-
var
|
|
4144
|
-
for (
|
|
4143
|
+
var e4;
|
|
4144
|
+
for (e4 = 0; e4 < t2.length; e4 += 1) t2[e4] = n3(t2[e4]);
|
|
4145
4145
|
return t2.join("");
|
|
4146
4146
|
}
|
|
4147
4147
|
function a3(t2) {
|
|
4148
4148
|
return /[\u0080-\uFFFF]/.test(t2) && (t2 = unescape(encodeURIComponent(t2))), t2;
|
|
4149
4149
|
}
|
|
4150
4150
|
function h3(t2) {
|
|
4151
|
-
var
|
|
4152
|
-
for (
|
|
4151
|
+
var e4, i3 = [], s2 = t2.length;
|
|
4152
|
+
for (e4 = 0; e4 < s2 - 1; e4 += 2) i3.push(parseInt(t2.substr(e4, 2), 16));
|
|
4153
4153
|
return String.fromCharCode.apply(String, i3);
|
|
4154
4154
|
}
|
|
4155
4155
|
function c5() {
|
|
4156
4156
|
this.reset();
|
|
4157
4157
|
}
|
|
4158
4158
|
return o3(r4("hello")), "undefined" == typeof ArrayBuffer || ArrayBuffer.prototype.slice || (function() {
|
|
4159
|
-
function t2(t3,
|
|
4160
|
-
return (t3 = 0 | t3 || 0) < 0 ? Math.max(t3 +
|
|
4159
|
+
function t2(t3, e4) {
|
|
4160
|
+
return (t3 = 0 | t3 || 0) < 0 ? Math.max(t3 + e4, 0) : Math.min(t3, e4);
|
|
4161
4161
|
}
|
|
4162
|
-
ArrayBuffer.prototype.slice = function(
|
|
4163
|
-
var s2, r5, n4, o4, a4 = this.byteLength, h4 = t2(
|
|
4162
|
+
ArrayBuffer.prototype.slice = function(e4, i3) {
|
|
4163
|
+
var s2, r5, n4, o4, a4 = this.byteLength, h4 = t2(e4, a4), c6 = a4;
|
|
4164
4164
|
return void 0 !== i3 && (c6 = t2(i3, a4)), h4 > c6 ? new ArrayBuffer(0) : (s2 = c6 - h4, r5 = new ArrayBuffer(s2), n4 = new Uint8Array(r5), o4 = new Uint8Array(this, h4, s2), n4.set(o4), r5);
|
|
4165
4165
|
};
|
|
4166
4166
|
})(), c5.prototype.append = function(t2) {
|
|
@@ -4168,11 +4168,11 @@ a2.exports = (function() {
|
|
|
4168
4168
|
}, c5.prototype.appendBinary = function(t2) {
|
|
4169
4169
|
this._buff += t2, this._length += t2.length;
|
|
4170
4170
|
var s2, r5 = this._buff.length;
|
|
4171
|
-
for (s2 = 64; s2 <= r5; s2 += 64)
|
|
4171
|
+
for (s2 = 64; s2 <= r5; s2 += 64) e3(this._hash, i2(this._buff.substring(s2 - 64, s2)));
|
|
4172
4172
|
return this._buff = this._buff.substring(s2 - 64), this;
|
|
4173
4173
|
}, c5.prototype.end = function(t2) {
|
|
4174
|
-
var
|
|
4175
|
-
for (
|
|
4174
|
+
var e4, i3, s2 = this._buff, r5 = s2.length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
4175
|
+
for (e4 = 0; e4 < r5; e4 += 1) n4[e4 >> 2] |= s2.charCodeAt(e4) << (e4 % 4 << 3);
|
|
4176
4176
|
return this._finish(n4, r5), i3 = o3(this._hash), t2 && (i3 = h3(i3)), this.reset(), i3;
|
|
4177
4177
|
}, c5.prototype.reset = function() {
|
|
4178
4178
|
return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
|
|
@@ -4184,22 +4184,22 @@ a2.exports = (function() {
|
|
|
4184
4184
|
delete this._hash, delete this._buff, delete this._length;
|
|
4185
4185
|
}, c5.prototype._finish = function(t2, i3) {
|
|
4186
4186
|
var s2, r5, n4, o4 = i3;
|
|
4187
|
-
if (t2[o4 >> 2] |= 128 << (o4 % 4 << 3), o4 > 55) for (
|
|
4188
|
-
s2 = (s2 = 8 * this._length).toString(16).match(/(.*?)(.{0,8})$/), r5 = parseInt(s2[2], 16), n4 = parseInt(s2[1], 16) || 0, t2[14] = r5, t2[15] = n4,
|
|
4189
|
-
}, c5.hash = function(t2,
|
|
4190
|
-
return c5.hashBinary(a3(t2),
|
|
4191
|
-
}, c5.hashBinary = function(t2,
|
|
4187
|
+
if (t2[o4 >> 2] |= 128 << (o4 % 4 << 3), o4 > 55) for (e3(this._hash, t2), o4 = 0; o4 < 16; o4 += 1) t2[o4] = 0;
|
|
4188
|
+
s2 = (s2 = 8 * this._length).toString(16).match(/(.*?)(.{0,8})$/), r5 = parseInt(s2[2], 16), n4 = parseInt(s2[1], 16) || 0, t2[14] = r5, t2[15] = n4, e3(this._hash, t2);
|
|
4189
|
+
}, c5.hash = function(t2, e4) {
|
|
4190
|
+
return c5.hashBinary(a3(t2), e4);
|
|
4191
|
+
}, c5.hashBinary = function(t2, e4) {
|
|
4192
4192
|
var i3 = o3(r4(t2));
|
|
4193
|
-
return
|
|
4193
|
+
return e4 ? h3(i3) : i3;
|
|
4194
4194
|
}, (c5.ArrayBuffer = function() {
|
|
4195
4195
|
this.reset();
|
|
4196
4196
|
}).prototype.append = function(t2) {
|
|
4197
4197
|
var i3, r5, n4, o4, a4 = (r5 = this._buff.buffer, n4 = t2, (o4 = new Uint8Array(r5.byteLength + n4.byteLength)).set(new Uint8Array(r5)), o4.set(new Uint8Array(n4), r5.byteLength), o4), h4 = a4.length;
|
|
4198
|
-
for (this._length += t2.byteLength, i3 = 64; i3 <= h4; i3 += 64)
|
|
4198
|
+
for (this._length += t2.byteLength, i3 = 64; i3 <= h4; i3 += 64) e3(this._hash, s(a4.subarray(i3 - 64, i3)));
|
|
4199
4199
|
return this._buff = i3 - 64 < h4 ? new Uint8Array(a4.buffer.slice(i3 - 64)) : new Uint8Array(0), this;
|
|
4200
4200
|
}, c5.ArrayBuffer.prototype.end = function(t2) {
|
|
4201
|
-
var
|
|
4202
|
-
for (
|
|
4201
|
+
var e4, i3, s2 = this._buff, r5 = s2.length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
4202
|
+
for (e4 = 0; e4 < r5; e4 += 1) n4[e4 >> 2] |= s2[e4] << (e4 % 4 << 3);
|
|
4203
4203
|
return this._finish(n4, r5), i3 = o3(this._hash), t2 && (i3 = h3(i3)), this.reset(), i3;
|
|
4204
4204
|
}, c5.ArrayBuffer.prototype.reset = function() {
|
|
4205
4205
|
return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
|
|
@@ -4207,18 +4207,18 @@ a2.exports = (function() {
|
|
|
4207
4207
|
var t2 = c5.prototype.getState.call(this);
|
|
4208
4208
|
return t2.buff = String.fromCharCode.apply(null, new Uint8Array(t2.buff)), t2;
|
|
4209
4209
|
}, c5.ArrayBuffer.prototype.setState = function(t2) {
|
|
4210
|
-
return t2.buff = (function(t3,
|
|
4210
|
+
return t2.buff = (function(t3, e4) {
|
|
4211
4211
|
var i3, s2 = t3.length, r5 = new ArrayBuffer(s2), n4 = new Uint8Array(r5);
|
|
4212
4212
|
for (i3 = 0; i3 < s2; i3 += 1) n4[i3] = t3.charCodeAt(i3);
|
|
4213
|
-
return
|
|
4213
|
+
return e4 ? n4 : r5;
|
|
4214
4214
|
})(t2.buff, true), c5.prototype.setState.call(this, t2);
|
|
4215
4215
|
}, c5.ArrayBuffer.prototype.destroy = c5.prototype.destroy, c5.ArrayBuffer.prototype._finish = c5.prototype._finish, c5.ArrayBuffer.hash = function(t2, i3) {
|
|
4216
4216
|
var r5 = o3((function(t3) {
|
|
4217
4217
|
var i4, r6, n4, o4, a4, h4, c6 = t3.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
|
|
4218
|
-
for (i4 = 64; i4 <= c6; i4 += 64)
|
|
4218
|
+
for (i4 = 64; i4 <= c6; i4 += 64) e3(l3, s(t3.subarray(i4 - 64, i4)));
|
|
4219
4219
|
for (r6 = (t3 = i4 - 64 < c6 ? t3.subarray(i4 - 64) : new Uint8Array(0)).length, n4 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i4 = 0; i4 < r6; i4 += 1) n4[i4 >> 2] |= t3[i4] << (i4 % 4 << 3);
|
|
4220
|
-
if (n4[i4 >> 2] |= 128 << (i4 % 4 << 3), i4 > 55) for (
|
|
4221
|
-
return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4,
|
|
4220
|
+
if (n4[i4 >> 2] |= 128 << (i4 % 4 << 3), i4 > 55) for (e3(l3, n4), i4 = 0; i4 < 16; i4 += 1) n4[i4] = 0;
|
|
4221
|
+
return o4 = (o4 = 8 * c6).toString(16).match(/(.*?)(.{0,8})$/), a4 = parseInt(o4[2], 16), h4 = parseInt(o4[1], 16) || 0, n4[14] = a4, n4[15] = h4, e3(l3, n4), l3;
|
|
4222
4222
|
})(new Uint8Array(t2)));
|
|
4223
4223
|
return i3 ? h3(r5) : r5;
|
|
4224
4224
|
}, c5;
|
|
@@ -4226,8 +4226,8 @@ a2.exports = (function() {
|
|
|
4226
4226
|
var h2 = a2.exports;
|
|
4227
4227
|
var c2 = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
|
|
4228
4228
|
var l = class _l {
|
|
4229
|
-
static create(t,
|
|
4230
|
-
new _l(t).create(
|
|
4229
|
+
static create(t, e3) {
|
|
4230
|
+
new _l(t).create(e3);
|
|
4231
4231
|
}
|
|
4232
4232
|
constructor(t) {
|
|
4233
4233
|
this.file = t, this.chunkSize = 2097152, this.chunkCount = Math.ceil(this.file.size / this.chunkSize), this.chunkIndex = 0;
|
|
@@ -4237,8 +4237,8 @@ var l = class _l {
|
|
|
4237
4237
|
}
|
|
4238
4238
|
fileReaderDidLoad(t) {
|
|
4239
4239
|
if (this.md5Buffer.append(t.target.result), !this.readNextChunk()) {
|
|
4240
|
-
const t2 = this.md5Buffer.end(true),
|
|
4241
|
-
this.callback(null,
|
|
4240
|
+
const t2 = this.md5Buffer.end(true), e3 = btoa(t2);
|
|
4241
|
+
this.callback(null, e3);
|
|
4242
4242
|
}
|
|
4243
4243
|
}
|
|
4244
4244
|
fileReaderDidError(t) {
|
|
@@ -4246,18 +4246,18 @@ var l = class _l {
|
|
|
4246
4246
|
}
|
|
4247
4247
|
readNextChunk() {
|
|
4248
4248
|
if (this.chunkIndex < this.chunkCount || 0 == this.chunkIndex && 0 == this.chunkCount) {
|
|
4249
|
-
const t = this.chunkIndex * this.chunkSize,
|
|
4249
|
+
const t = this.chunkIndex * this.chunkSize, e3 = Math.min(t + this.chunkSize, this.file.size), i2 = c2.call(this.file, t, e3);
|
|
4250
4250
|
return this.fileReader.readAsArrayBuffer(i2), this.chunkIndex++, true;
|
|
4251
4251
|
}
|
|
4252
4252
|
return false;
|
|
4253
4253
|
}
|
|
4254
4254
|
};
|
|
4255
|
-
function d(t,
|
|
4256
|
-
return "string" == typeof t && (
|
|
4255
|
+
function d(t, e3) {
|
|
4256
|
+
return "string" == typeof t && (e3 = t, t = document), t.querySelector(e3);
|
|
4257
4257
|
}
|
|
4258
|
-
function u(t,
|
|
4258
|
+
function u(t, e3, i2 = {}) {
|
|
4259
4259
|
const { disabled: s } = t, { bubbles: r4, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
|
|
4260
|
-
a3.initEvent(
|
|
4260
|
+
a3.initEvent(e3, r4 || true, n3 || true), a3.detail = o3 || {};
|
|
4261
4261
|
try {
|
|
4262
4262
|
t.disabled = false, t.dispatchEvent(a3);
|
|
4263
4263
|
} finally {
|
|
@@ -4269,8 +4269,8 @@ function p(t) {
|
|
|
4269
4269
|
return Array.isArray(t) ? t : Array.from ? Array.from(t) : [].slice.call(t);
|
|
4270
4270
|
}
|
|
4271
4271
|
var f = class {
|
|
4272
|
-
constructor(t,
|
|
4273
|
-
this.file = t, this.attributes = { filename: t.name, content_type: t.type || "application/octet-stream", byte_size: t.size, checksum:
|
|
4272
|
+
constructor(t, e3, i2, s = {}) {
|
|
4273
|
+
this.file = t, this.attributes = { filename: t.name, content_type: t.type || "application/octet-stream", byte_size: t.size, checksum: e3 }, this.xhr = new XMLHttpRequest(), this.xhr.open("POST", i2, true), this.xhr.responseType = "json", this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.setRequestHeader("Accept", "application/json"), this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(s).forEach(((t2) => {
|
|
4274
4274
|
this.xhr.setRequestHeader(t2, s[t2]);
|
|
4275
4275
|
}));
|
|
4276
4276
|
const r4 = (function() {
|
|
@@ -4283,16 +4283,16 @@ var f = class {
|
|
|
4283
4283
|
return this.xhr.status;
|
|
4284
4284
|
}
|
|
4285
4285
|
get response() {
|
|
4286
|
-
const { responseType: t, response:
|
|
4287
|
-
return "json" == t ?
|
|
4286
|
+
const { responseType: t, response: e3 } = this.xhr;
|
|
4287
|
+
return "json" == t ? e3 : JSON.parse(e3);
|
|
4288
4288
|
}
|
|
4289
4289
|
create(t) {
|
|
4290
4290
|
this.callback = t, this.xhr.send(JSON.stringify({ blob: this.attributes }));
|
|
4291
4291
|
}
|
|
4292
4292
|
requestDidLoad(t) {
|
|
4293
4293
|
if (this.status >= 200 && this.status < 300) {
|
|
4294
|
-
const { response: t2 } = this, { direct_upload:
|
|
4295
|
-
delete t2.direct_upload, this.attributes = t2, this.directUploadData =
|
|
4294
|
+
const { response: t2 } = this, { direct_upload: e3 } = t2;
|
|
4295
|
+
delete t2.direct_upload, this.attributes = t2, this.directUploadData = e3, this.callback(null, this.toJSON());
|
|
4296
4296
|
} else this.requestDidError(t);
|
|
4297
4297
|
}
|
|
4298
4298
|
requestDidError(t) {
|
|
@@ -4300,15 +4300,15 @@ var f = class {
|
|
|
4300
4300
|
}
|
|
4301
4301
|
toJSON() {
|
|
4302
4302
|
const t = {};
|
|
4303
|
-
for (const
|
|
4303
|
+
for (const e3 in this.attributes) t[e3] = this.attributes[e3];
|
|
4304
4304
|
return t;
|
|
4305
4305
|
}
|
|
4306
4306
|
};
|
|
4307
4307
|
var m = class {
|
|
4308
4308
|
constructor(t) {
|
|
4309
4309
|
this.blob = t, this.file = t.file;
|
|
4310
|
-
const { url:
|
|
4311
|
-
this.xhr = new XMLHttpRequest(), this.xhr.open("PUT",
|
|
4310
|
+
const { url: e3, headers: i2 } = t.directUploadData;
|
|
4311
|
+
this.xhr = new XMLHttpRequest(), this.xhr.open("PUT", e3, true), this.xhr.responseType = "text";
|
|
4312
4312
|
for (const t2 in i2) this.xhr.setRequestHeader(t2, i2[t2]);
|
|
4313
4313
|
this.xhr.addEventListener("load", ((t2) => this.requestDidLoad(t2))), this.xhr.addEventListener("error", ((t2) => this.requestDidError(t2)));
|
|
4314
4314
|
}
|
|
@@ -4316,8 +4316,8 @@ var m = class {
|
|
|
4316
4316
|
this.callback = t, this.xhr.send(this.file.slice());
|
|
4317
4317
|
}
|
|
4318
4318
|
requestDidLoad(t) {
|
|
4319
|
-
const { status:
|
|
4320
|
-
|
|
4319
|
+
const { status: e3, response: i2 } = this.xhr;
|
|
4320
|
+
e3 >= 200 && e3 < 300 ? this.callback(null, i2) : this.requestDidError(t);
|
|
4321
4321
|
}
|
|
4322
4322
|
requestDidError(t) {
|
|
4323
4323
|
this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`);
|
|
@@ -4325,47 +4325,47 @@ var m = class {
|
|
|
4325
4325
|
};
|
|
4326
4326
|
var g = 0;
|
|
4327
4327
|
var b = class {
|
|
4328
|
-
constructor(t,
|
|
4329
|
-
this.id = ++g, this.file = t, this.url =
|
|
4328
|
+
constructor(t, e3, i2, s = {}) {
|
|
4329
|
+
this.id = ++g, this.file = t, this.url = e3, this.delegate = i2, this.customHeaders = s;
|
|
4330
4330
|
}
|
|
4331
4331
|
create(t) {
|
|
4332
|
-
l.create(this.file, ((
|
|
4333
|
-
if (
|
|
4332
|
+
l.create(this.file, ((e3, i2) => {
|
|
4333
|
+
if (e3) return void t(e3);
|
|
4334
4334
|
const s = new f(this.file, i2, this.url, this.customHeaders);
|
|
4335
|
-
v(this.delegate, "directUploadWillCreateBlobWithXHR", s.xhr), s.create(((
|
|
4336
|
-
if (
|
|
4335
|
+
v(this.delegate, "directUploadWillCreateBlobWithXHR", s.xhr), s.create(((e4) => {
|
|
4336
|
+
if (e4) t(e4);
|
|
4337
4337
|
else {
|
|
4338
|
-
const
|
|
4339
|
-
v(this.delegate, "directUploadWillStoreFileWithXHR",
|
|
4340
|
-
|
|
4338
|
+
const e5 = new m(s);
|
|
4339
|
+
v(this.delegate, "directUploadWillStoreFileWithXHR", e5.xhr), e5.create(((e6) => {
|
|
4340
|
+
e6 ? t(e6) : t(null, s.toJSON());
|
|
4341
4341
|
}));
|
|
4342
4342
|
}
|
|
4343
4343
|
}));
|
|
4344
4344
|
}));
|
|
4345
4345
|
}
|
|
4346
4346
|
};
|
|
4347
|
-
function v(t,
|
|
4348
|
-
if (t && "function" == typeof t[
|
|
4347
|
+
function v(t, e3, ...i2) {
|
|
4348
|
+
if (t && "function" == typeof t[e3]) return t[e3](...i2);
|
|
4349
4349
|
}
|
|
4350
4350
|
var w = class {
|
|
4351
|
-
constructor(t,
|
|
4352
|
-
this.input = t, this.file =
|
|
4351
|
+
constructor(t, e3) {
|
|
4352
|
+
this.input = t, this.file = e3, this.directUpload = new b(this.file, this.url, this), this.dispatch("initialize");
|
|
4353
4353
|
}
|
|
4354
4354
|
start(t) {
|
|
4355
|
-
const
|
|
4356
|
-
|
|
4357
|
-
i2 ? (
|
|
4355
|
+
const e3 = document.createElement("input");
|
|
4356
|
+
e3.type = "hidden", e3.name = this.input.name, this.input.insertAdjacentElement("beforebegin", e3), this.dispatch("start"), this.directUpload.create(((i2, s) => {
|
|
4357
|
+
i2 ? (e3.parentNode.removeChild(e3), this.dispatchError(i2)) : e3.value = s.signed_id, this.dispatch("end"), t(i2);
|
|
4358
4358
|
}));
|
|
4359
4359
|
}
|
|
4360
4360
|
uploadRequestDidProgress(t) {
|
|
4361
|
-
const
|
|
4362
|
-
|
|
4361
|
+
const e3 = t.loaded / t.total * 90;
|
|
4362
|
+
e3 && this.dispatch("progress", { progress: e3 });
|
|
4363
4363
|
}
|
|
4364
4364
|
get url() {
|
|
4365
4365
|
return this.input.getAttribute("data-direct-upload-url");
|
|
4366
4366
|
}
|
|
4367
|
-
dispatch(t,
|
|
4368
|
-
return
|
|
4367
|
+
dispatch(t, e3 = {}) {
|
|
4368
|
+
return e3.file = this.file, e3.id = this.directUpload.id, u(this.input, `direct-upload:${t}`, { detail: e3 });
|
|
4369
4369
|
}
|
|
4370
4370
|
dispatchError(t) {
|
|
4371
4371
|
this.dispatch("error", { error: t }).defaultPrevented || alert(t);
|
|
@@ -4379,53 +4379,53 @@ var w = class {
|
|
|
4379
4379
|
}));
|
|
4380
4380
|
}
|
|
4381
4381
|
simulateResponseProgress(t) {
|
|
4382
|
-
let
|
|
4382
|
+
let e3 = 90;
|
|
4383
4383
|
const i2 = Date.now(), s = () => {
|
|
4384
4384
|
const r4 = Date.now() - i2, n3 = this.estimateResponseTime(), o3 = Math.min(r4 / n3, 1);
|
|
4385
|
-
|
|
4385
|
+
e3 = 90 + 9 * o3, this.dispatch("progress", { progress: e3 }), t.readyState !== XMLHttpRequest.DONE && e3 < 99 && requestAnimationFrame(s);
|
|
4386
4386
|
};
|
|
4387
4387
|
t.addEventListener("loadend", (() => {
|
|
4388
4388
|
this.dispatch("progress", { progress: 100 });
|
|
4389
4389
|
})), requestAnimationFrame(s);
|
|
4390
4390
|
}
|
|
4391
4391
|
estimateResponseTime() {
|
|
4392
|
-
const t = this.file.size,
|
|
4393
|
-
return t <
|
|
4392
|
+
const t = this.file.size, e3 = 1048576;
|
|
4393
|
+
return t < e3 ? 1e3 : t < 10 * e3 ? 2e3 : 3e3 + t / e3 * 50;
|
|
4394
4394
|
}
|
|
4395
4395
|
};
|
|
4396
4396
|
var y = class {
|
|
4397
4397
|
constructor(t) {
|
|
4398
|
-
var
|
|
4399
|
-
this.form = t, this.inputs = (
|
|
4398
|
+
var e3, i2;
|
|
4399
|
+
this.form = t, this.inputs = (e3 = t, i2 = "input[type=file][data-direct-upload-url]:not([disabled])", "string" == typeof e3 && (i2 = e3, e3 = document), p(e3.querySelectorAll(i2))).filter(((t2) => t2.files.length));
|
|
4400
4400
|
}
|
|
4401
4401
|
start(t) {
|
|
4402
|
-
const
|
|
4403
|
-
const s =
|
|
4404
|
-
s ? s.start(((
|
|
4405
|
-
|
|
4402
|
+
const e3 = this.createDirectUploadControllers(), i2 = () => {
|
|
4403
|
+
const s = e3.shift();
|
|
4404
|
+
s ? s.start(((e4) => {
|
|
4405
|
+
e4 ? (t(e4), this.dispatch("end")) : i2();
|
|
4406
4406
|
})) : (t(), this.dispatch("end"));
|
|
4407
4407
|
};
|
|
4408
4408
|
this.dispatch("start"), i2();
|
|
4409
4409
|
}
|
|
4410
4410
|
createDirectUploadControllers() {
|
|
4411
4411
|
const t = [];
|
|
4412
|
-
return this.inputs.forEach(((
|
|
4413
|
-
p(
|
|
4414
|
-
const s = new w(
|
|
4412
|
+
return this.inputs.forEach(((e3) => {
|
|
4413
|
+
p(e3.files).forEach(((i2) => {
|
|
4414
|
+
const s = new w(e3, i2);
|
|
4415
4415
|
t.push(s);
|
|
4416
4416
|
}));
|
|
4417
4417
|
})), t;
|
|
4418
4418
|
}
|
|
4419
|
-
dispatch(t,
|
|
4420
|
-
return u(this.form, `direct-uploads:${t}`, { detail:
|
|
4419
|
+
dispatch(t, e3 = {}) {
|
|
4420
|
+
return u(this.form, `direct-uploads:${t}`, { detail: e3 });
|
|
4421
4421
|
}
|
|
4422
4422
|
};
|
|
4423
4423
|
var x = "data-direct-uploads-processing";
|
|
4424
4424
|
var k = /* @__PURE__ */ new WeakMap();
|
|
4425
4425
|
var R = false;
|
|
4426
4426
|
function M(t) {
|
|
4427
|
-
const
|
|
4428
|
-
|
|
4427
|
+
const e3 = t.target.closest("button, input");
|
|
4428
|
+
e3 && "submit" === e3.type && e3.form && k.set(e3.form, e3);
|
|
4429
4429
|
}
|
|
4430
4430
|
function j(t) {
|
|
4431
4431
|
$(t);
|
|
@@ -4434,18 +4434,18 @@ function A(t) {
|
|
|
4434
4434
|
"FORM" == t.target.tagName && $(t);
|
|
4435
4435
|
}
|
|
4436
4436
|
function $(t) {
|
|
4437
|
-
const
|
|
4438
|
-
if (
|
|
4439
|
-
const i2 = new y(
|
|
4440
|
-
s.length && (t.preventDefault(),
|
|
4441
|
-
|
|
4442
|
-
let
|
|
4443
|
-
if (
|
|
4444
|
-
const { disabled: t4 } =
|
|
4445
|
-
|
|
4446
|
-
} else
|
|
4437
|
+
const e3 = t.target;
|
|
4438
|
+
if (e3.hasAttribute(x)) return void t.preventDefault();
|
|
4439
|
+
const i2 = new y(e3), { inputs: s } = i2;
|
|
4440
|
+
s.length && (t.preventDefault(), e3.setAttribute(x, ""), s.forEach(E), i2.start(((t2) => {
|
|
4441
|
+
e3.removeAttribute(x), t2 ? s.forEach(U) : (function(t3) {
|
|
4442
|
+
let e4 = k.get(t3) || d(t3, "input[type=submit], button[type=submit]");
|
|
4443
|
+
if (e4) {
|
|
4444
|
+
const { disabled: t4 } = e4;
|
|
4445
|
+
e4.disabled = false, e4.focus(), e4.click(), e4.disabled = t4;
|
|
4446
|
+
} else e4 = document.createElement("input"), e4.type = "submit", e4.style.display = "none", t3.appendChild(e4), e4.click(), t3.removeChild(e4);
|
|
4447
4447
|
k.delete(t3);
|
|
4448
|
-
})(
|
|
4448
|
+
})(e3);
|
|
4449
4449
|
})));
|
|
4450
4450
|
}
|
|
4451
4451
|
function E(t) {
|
|
@@ -4466,8 +4466,8 @@ var C = class {
|
|
|
4466
4466
|
callback = null;
|
|
4467
4467
|
cancelled = false;
|
|
4468
4468
|
completed = false;
|
|
4469
|
-
constructor(t,
|
|
4470
|
-
this.uploadedFile = t, this.file =
|
|
4469
|
+
constructor(t, e3) {
|
|
4470
|
+
this.uploadedFile = t, this.file = e3, this.directUpload = new b(this.file, this.uploadedFile.url, this);
|
|
4471
4471
|
}
|
|
4472
4472
|
cancel() {
|
|
4473
4473
|
this.cancelled = true, this.abortXHR(this.recordXHR), this.abortXHR(this.uploadXHR), this.complete("aborted", {});
|
|
@@ -4476,28 +4476,28 @@ var C = class {
|
|
|
4476
4476
|
t && t.abort();
|
|
4477
4477
|
}
|
|
4478
4478
|
start(t) {
|
|
4479
|
-
this.callback = t, this.dispatch("start"), this.directUpload.create(((t2,
|
|
4480
|
-
this.complete(t2,
|
|
4479
|
+
this.callback = t, this.dispatch("start"), this.directUpload.create(((t2, e3) => {
|
|
4480
|
+
this.complete(t2, e3);
|
|
4481
4481
|
}));
|
|
4482
4482
|
}
|
|
4483
|
-
complete(t,
|
|
4483
|
+
complete(t, e3) {
|
|
4484
4484
|
this.completed || (this.completed = true, t && this.dispatchError(t), this.dispatch("end"), this.callback(t));
|
|
4485
4485
|
}
|
|
4486
4486
|
uploadRequestDidProgress(t) {
|
|
4487
|
-
const
|
|
4488
|
-
|
|
4487
|
+
const e3 = t.loaded / t.total * 100;
|
|
4488
|
+
e3 && this.dispatch("progress", { progress: e3 });
|
|
4489
4489
|
}
|
|
4490
|
-
dispatch(t,
|
|
4491
|
-
return (function(t2,
|
|
4490
|
+
dispatch(t, e3 = {}) {
|
|
4491
|
+
return (function(t2, e4, i2 = {}) {
|
|
4492
4492
|
const { disabled: s } = t2, { bubbles: r4, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
|
|
4493
|
-
a3.initEvent(
|
|
4493
|
+
a3.initEvent(e4, r4 || true, n3 || true), a3.detail = o3 || {};
|
|
4494
4494
|
try {
|
|
4495
4495
|
t2.disabled = false, t2.dispatchEvent(a3);
|
|
4496
4496
|
} finally {
|
|
4497
4497
|
t2.disabled = s;
|
|
4498
4498
|
}
|
|
4499
4499
|
return a3;
|
|
4500
|
-
})(this.uploadedFile, `direct-upload:${t}`, { detail: { ...
|
|
4500
|
+
})(this.uploadedFile, `direct-upload:${t}`, { detail: { ...e3, file: this.file, id: this.directUpload.id } });
|
|
4501
4501
|
}
|
|
4502
4502
|
dispatchError(t) {
|
|
4503
4503
|
this.dispatch("error", { error: t });
|
|
@@ -4526,9 +4526,9 @@ var q = class {
|
|
|
4526
4526
|
get errorMessage() {
|
|
4527
4527
|
return [`Must be smaller than ${this.formatBytes(this.uploadedFile.max)},`, `and "${this.uploadedFile.filename}" is ${this.formatBytes(this.uploadedFile.size)}.`, "Please attach a smaller file."].join(" ");
|
|
4528
4528
|
}
|
|
4529
|
-
formatBytes(t,
|
|
4529
|
+
formatBytes(t, e3 = 2) {
|
|
4530
4530
|
if (0 === t) return "0 Bytes";
|
|
4531
|
-
const i2 =
|
|
4531
|
+
const i2 = e3 < 0 ? 0 : e3, s = Math.floor(Math.log(t) / Math.log(1024));
|
|
4532
4532
|
return parseFloat((t / Math.pow(1024, s)).toFixed(i2)) + ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][s];
|
|
4533
4533
|
}
|
|
4534
4534
|
};
|
|
@@ -4549,8 +4549,8 @@ var B = class {
|
|
|
4549
4549
|
}
|
|
4550
4550
|
};
|
|
4551
4551
|
var F = { image: ["ase", "art", "bmp", "blp", "cd5", "cit", "cpt", "cr2", "cut", "dds", "dib", "djvu", "egt", "exif", "gif", "gpl", "grf", "icns", "ico", "iff", "jng", "jpeg", "jpg", "jfif", "jp2", "jps", "lbm", "max", "miff", "mng", "msp", "nef", "nitf", "ota", "pbm", "pc1", "pc2", "pc3", "pcf", "pcx", "pdn", "pgm", "PI1", "PI2", "PI3", "pict", "pct", "pnm", "pns", "ppm", "psb", "psd", "pdd", "psp", "px", "pxm", "pxr", "qfx", "raw", "rle", "sct", "sgi", "rgb", "int", "bw", "tga", "tiff", "tif", "vtf", "xbm", "xcf", "xpm", "3dv", "amf", "ai", "awg", "cgm", "cdr", "cmx", "dxf", "e2d", "egt", "eps", "fs", "gbr", "odg", "svg", "stl", "vrml", "x3d", "sxd", "v2d", "vnd", "wmf", "emf", "art", "xar", "png", "webp", "jxr", "hdp", "wdp", "cur", "ecw", "iff", "lbm", "liff", "nrrd", "pam", "pcx", "pgf", "sgi", "rgb", "rgba", "bw", "int", "inta", "sid", "ras", "sun", "tga", "heic", "heif"], video: ["3g2", "3gp", "3gpp", "aaf", "asf", "avchd", "avi", "drc", "flv", "m2v", "m3u8", "m4p", "m4v", "mkv", "mng", "mov", "mp2", "mp4", "mpe", "mpeg", "mpg", "mpv", "mxf", "nsv", "ogg", "ogv", "qt", "rm", "rmvb", "roq", "svi", "vob", "webm", "wmv", "yuv"], pdf: ["pdf"], getFileType: function(t) {
|
|
4552
|
-
const
|
|
4553
|
-
return this.video.includes(
|
|
4552
|
+
const e3 = t.toString().split(".").at(-1).toLowerCase().trim();
|
|
4553
|
+
return this.video.includes(e3) ? "video" : this.image.includes(e3) ? "image" : this.pdf.includes(e3) ? "pdf" : "unknown";
|
|
4554
4554
|
} };
|
|
4555
4555
|
var S = class {
|
|
4556
4556
|
constructor(t) {
|
|
@@ -4609,12 +4609,12 @@ var T = class {
|
|
|
4609
4609
|
}
|
|
4610
4610
|
};
|
|
4611
4611
|
function W(t) {
|
|
4612
|
-
const
|
|
4613
|
-
return
|
|
4612
|
+
const e3 = document.head.querySelector(`meta[name="${t}"]`);
|
|
4613
|
+
return e3 && e3.content;
|
|
4614
4614
|
}
|
|
4615
4615
|
var X = class {
|
|
4616
|
-
constructor(t,
|
|
4617
|
-
this.method = t, this.options = i2, this.originalUrl =
|
|
4616
|
+
constructor(t, e3, i2 = {}) {
|
|
4617
|
+
this.method = t, this.options = i2, this.originalUrl = e3.toString();
|
|
4618
4618
|
}
|
|
4619
4619
|
async perform() {
|
|
4620
4620
|
try {
|
|
@@ -4626,26 +4626,26 @@ var X = class {
|
|
|
4626
4626
|
const t = new S(await window.fetch(this.url, this.fetchOptions));
|
|
4627
4627
|
return t.unauthenticated && t.authenticationURL ? Promise.reject(window.location.href = t.authenticationURL) : (t.ok && t.isTurboStream && await t.renderTurboStream(), t);
|
|
4628
4628
|
}
|
|
4629
|
-
addHeader(t,
|
|
4629
|
+
addHeader(t, e3) {
|
|
4630
4630
|
const i2 = this.additionalHeaders;
|
|
4631
|
-
i2[t] =
|
|
4631
|
+
i2[t] = e3, this.options.headers = i2;
|
|
4632
4632
|
}
|
|
4633
4633
|
get fetchOptions() {
|
|
4634
4634
|
return { method: this.method.toUpperCase(), headers: this.headers, body: this.formattedBody, signal: this.signal, credentials: "same-origin", redirect: this.redirect };
|
|
4635
4635
|
}
|
|
4636
4636
|
get headers() {
|
|
4637
4637
|
return (function(t) {
|
|
4638
|
-
const
|
|
4638
|
+
const e3 = {};
|
|
4639
4639
|
for (const i2 in t) {
|
|
4640
4640
|
const s = t[i2];
|
|
4641
|
-
void 0 !== s && (
|
|
4641
|
+
void 0 !== s && (e3[i2] = s);
|
|
4642
4642
|
}
|
|
4643
|
-
return
|
|
4643
|
+
return e3;
|
|
4644
4644
|
})(Object.assign({ "X-Requested-With": "XMLHttpRequest", "X-CSRF-Token": this.csrfToken, "Content-Type": this.contentType, Accept: this.accept }, this.additionalHeaders));
|
|
4645
4645
|
}
|
|
4646
4646
|
get csrfToken() {
|
|
4647
4647
|
return (function(t) {
|
|
4648
|
-
const
|
|
4648
|
+
const e3 = document.cookie ? document.cookie.split("; ") : [], i2 = `${encodeURIComponent(t)}=`, s = e3.find(((t2) => t2.startsWith(i2)));
|
|
4649
4649
|
if (s) {
|
|
4650
4650
|
const t2 = s.split("=").slice(1).join("=");
|
|
4651
4651
|
if (t2) return decodeURIComponent(t2);
|
|
@@ -4671,13 +4671,13 @@ var X = class {
|
|
|
4671
4671
|
return this.options.body;
|
|
4672
4672
|
}
|
|
4673
4673
|
get query() {
|
|
4674
|
-
const t = (this.originalUrl.split("?")[1] || "").split("#")[0],
|
|
4674
|
+
const t = (this.originalUrl.split("?")[1] || "").split("#")[0], e3 = new URLSearchParams(t);
|
|
4675
4675
|
let i2 = this.options.query;
|
|
4676
4676
|
var s;
|
|
4677
|
-
i2 instanceof window.FormData ? (s = i2, i2 = [...s].reduce(((t2, [
|
|
4678
|
-
for (const [i3, s2] of
|
|
4679
|
-
})(
|
|
4680
|
-
const r4 =
|
|
4677
|
+
i2 instanceof window.FormData ? (s = i2, i2 = [...s].reduce(((t2, [e4, i3]) => t2.concat("string" == typeof i3 ? [[e4, i3]] : [])), [])) : i2 = i2 instanceof window.URLSearchParams ? i2.entries() : Object.entries(i2 || {}), (function(t2, e4) {
|
|
4678
|
+
for (const [i3, s2] of e4) s2 instanceof window.File || (t2.has(i3) ? (t2.delete(i3), t2.set(i3, s2)) : t2.append(i3, s2));
|
|
4679
|
+
})(e3, i2);
|
|
4680
|
+
const r4 = e3.toString();
|
|
4681
4681
|
return r4.length > 0 ? `?${r4}` : "";
|
|
4682
4682
|
}
|
|
4683
4683
|
get url() {
|
|
@@ -4743,30 +4743,30 @@ var H2 = proxyCustomElement(class extends H {
|
|
|
4743
4743
|
this.src = URL.createObjectURL(t), this.filename = t.name, this.size = t.size, this.state = "pending", this.percent = 0, this._file = t;
|
|
4744
4744
|
}
|
|
4745
4745
|
set signedId(t) {
|
|
4746
|
-
this.value !== t && ((t2,
|
|
4747
|
-
this.src = `/rails/active_storage/blobs/redirect/${t}/${
|
|
4746
|
+
this.value !== t && ((t2, e3 = {}, i2 = {}) => ((t3, e4, i3, s) => new X("get", e4, { headers: { Accept: "application/json", ...s }, query: i3 }).perform().then(((t4) => t4.response.ok ? t4.json : t4)))(0, t2, e3, i2))(`/rails/active_storage/blobs/info/${t}`).then(((e3) => {
|
|
4747
|
+
this.src = `/rails/active_storage/blobs/redirect/${t}/${e3.filename}`, this.filename = e3.filename, this.size = e3.byte_size, this.state = "complete", this.percent = 100, this.value = t, this.readyEvent.emit(this);
|
|
4748
4748
|
}));
|
|
4749
4749
|
}
|
|
4750
|
-
setMissingFiletype(t,
|
|
4750
|
+
setMissingFiletype(t, e3) {
|
|
4751
4751
|
!this.filetype && this.filename && (this.filetype = F.getFileType(this.filename));
|
|
4752
4752
|
}
|
|
4753
4753
|
start(t) {
|
|
4754
4754
|
this.state = "pending", this.percent = 0;
|
|
4755
4755
|
}
|
|
4756
4756
|
progress(t) {
|
|
4757
|
-
const { progress:
|
|
4758
|
-
this.percent =
|
|
4757
|
+
const { progress: e3 } = t.detail;
|
|
4758
|
+
this.percent = e3;
|
|
4759
4759
|
}
|
|
4760
4760
|
error(t) {
|
|
4761
4761
|
t.preventDefault();
|
|
4762
|
-
const { error:
|
|
4763
|
-
this.state = "error", this.uploadError =
|
|
4762
|
+
const { error: e3 } = t.detail;
|
|
4763
|
+
this.state = "error", this.uploadError = e3;
|
|
4764
4764
|
}
|
|
4765
4765
|
end(t) {
|
|
4766
4766
|
"error" !== this.state && (this.state = "complete", this.percent = 100);
|
|
4767
4767
|
}
|
|
4768
4768
|
render() {
|
|
4769
|
-
return h(Host, { key: "1af2d43e01a8714c658ea70a9ca68cce57bbda12" }, h("slot", { key: "deadfff4a159e17d52ed8f66d5d18aecc71fb44d" }), h("figure", { key: "7319a724f2d51c396734dacd7528b1864fb8e980" }, h("div", { key: "ce0794f4062073a8fc28e4f2398a91d711f00521", class: "progress-details" }, h("progress-bar", { key: "
|
|
4769
|
+
return h(Host, { key: "1af2d43e01a8714c658ea70a9ca68cce57bbda12" }, h("slot", { key: "deadfff4a159e17d52ed8f66d5d18aecc71fb44d" }), h("figure", { key: "7319a724f2d51c396734dacd7528b1864fb8e980" }, h("div", { key: "ce0794f4062073a8fc28e4f2398a91d711f00521", class: "progress-details" }, h("progress-bar", { key: "7317e5149cbc15dd1bff84b9c8ea92d55a29fe3f", percent: this.percent, class: this.state, error: "error" === this.state }, h("a", { key: "638de84fd46da31a7ad9b652f0dd1d71fdb87edb", class: "download-link", href: this.src, download: this.filename, onClick: (t) => t.stopPropagation() }, this.filename)), h("span", { key: "fe8b77d5cd5b9014caa92abe34c515a5b16dbe86", class: "progress-icon" }), h("a", { key: "b8b2fde12f9ecf1df5a044a812be4b43ee24502c", class: "remove-media", onClick: this.removeClicked, href: "#" }, h("span", { key: "7ce869972ee400de34bd3462f0656263f0ddc013" }, "Remove media")), this.uploadError && this._file ? h("a", { class: "retry-media", onClick: this.retryClicked, href: "#" }, h("span", null, "Retry upload")) : ""), this.validationError || this.uploadError ? h("p", { class: "validation-error" }, this.validationError || this.uploadError) : "", this.preview ? h("attachment-preview", { src: this.src, filetype: this.filetype }) : ""));
|
|
4770
4770
|
}
|
|
4771
4771
|
componentDidLoad() {
|
|
4772
4772
|
"pending" == this.state && this._file && (this.checkValidity() ? (this.controller = new C(this.el, this._file), this.controller.dispatch("initialize", { controller: this.controller })) : this.state = "error");
|
|
@@ -4779,7 +4779,7 @@ var H2 = proxyCustomElement(class extends H {
|
|
|
4779
4779
|
return { filename: [{ setMissingFiletype: 0 }] };
|
|
4780
4780
|
}
|
|
4781
4781
|
static get style() {
|
|
4782
|
-
return `:host{display:block;width:100%;max-width:100%;font-size:13px}figure{margin:0}.progress-details{position:relative;display:flex;align-items:center}progress-bar{flex:1 0
|
|
4782
|
+
return `:host{display:block;width:100%;max-width:100%;font-size:13px}figure{margin:0}.progress-details{position:relative;display:flex;align-items:center}progress-bar{flex:1 0}progress-bar.pending{opacity:0.5}progress-bar.complete{opacity:0.8}progress-bar:not(.complete)+.progress-icon{display:none}progress-bar.complete+.progress-icon{content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve"><g><path d="M6.3,9.1c0.2,0,0.5,0.1,0.7,0.4c0.5,0.5,1,1,1.4,1.4c0.3,0.3,0.3,0.3,0.6,0c1.4-1.3,2.7-2.6,4-3.9c0.3-0.3,0.6-0.4,1-0.4 c0.5,0.1,0.9,0.6,0.7,1.1c-0.1,0.2-0.2,0.4-0.3,0.6c-1.6,1.6-3.2,3.2-4.8,4.8c-0.5,0.5-1,0.5-1.6,0c-0.8-0.7-1.5-1.5-2.3-2.3 c-0.3-0.3-0.5-0.6-0.3-1.1C5.5,9.3,5.8,9.1,6.3,9.1z"/></g></svg>');filter:invert(100%)}.progress-icon{display:inline-block;flex:0 0 20px;width:28px;height:28px;background-size:contain;position:absolute;right:30px;z-index:1}progress-bar.error{background:var(--input-attachment-error-bg, rgba(74, 70, 70, 0.25));opacity:1}.progress-bar a{color:#fff}.download-link{padding-right:20px;color:#fff}.remove-media{display:inline-block;content:url('data:image/svg+xml;utf8,<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve"><g><path d="M0,19.9C0.2,8.5,9.2-0.1,20.1,0C31.8,0.1,40.2,9.5,40,20.4c-0.2,11-8.9,19.7-20.1,19.6C8,39.9,0,30.5,0,19.9z M20,3.7 c-9,0-16.3,7-16.3,16.2C3.7,29,10.9,36.3,20,36.3c9,0,16.3-7.1,16.4-16.3C36.3,11,29.2,3.8,20,3.7z"/><path d="M17.3,20c-0.2-0.2-0.3-0.4-0.5-0.6c-1-1-2-1.9-2.9-2.9c-0.5-0.5-0.8-1.1-0.7-1.9c0.1-0.7,0.5-1.2,1.2-1.4 c0.8-0.2,1.5,0,2.1,0.6c1,1,2,2,3,3.1c0.3,0.4,0.6,0.3,0.9,0c1-1,2-2,3-3c0.3-0.3,0.7-0.5,1.1-0.6c0.8-0.2,1.6,0.1,2,0.8 c0.4,0.8,0.3,1.7-0.4,2.4c-1,1-2,2-3,3c-0.2,0.2-0.3,0.4-0.5,0.6c1.2,1.2,2.3,2.3,3.4,3.4c0.6,0.6,0.9,1.3,0.6,2.2 c-0.4,1.1-1.7,1.6-2.6,1c-0.3-0.2-0.5-0.4-0.8-0.6c-1-1-1.9-1.9-2.9-2.9c-0.3-0.3-0.5-0.3-0.9,0c-1,1-2,2.1-3,3 c-0.4,0.4-1,0.6-1.5,0.8c-0.6,0.1-1.2-0.2-1.5-0.8c-0.4-0.6-0.5-1.3-0.1-1.9c0.2-0.3,0.4-0.5,0.6-0.7C15.1,22.3,16.2,21.2,17.3,20z "/></g></svg>');flex:0 0 25px;width:25px;height:20px;align-items:center;opacity:0.25}.remove-media:hover{opacity:1;filter:invert(50%)sepia(100%)saturate(10000%)}.remove-media span{display:inline-block;text-indent:-9999px;color:transparent}.retry-media{color:var(--input-attachment-error-color, #c00);font-size:12px;text-decoration:underline;cursor:pointer;padding-left:8px}.retry-media:hover{color:var(--input-attachment-error-color-hover, #900)}.validation-error{color:var(--input-attachment-error-color, #c00);font-size:12px;margin:4px 0 0 10px}`;
|
|
4783
4783
|
}
|
|
4784
4784
|
}, [769, "attachment-file", { name: [1537], accepts: [1537], max: [1538], url: [1537], value: [1537], filename: [1537], src: [1537], filetype: [1537], size: [1538], state: [1537], percent: [1538], preview: [1540], validationMessage: [1, "validation-message"] }, [[0, "direct-upload:initialize", "start"], [0, "direct-upload:start", "start"], [0, "direct-upload:progress", "progress"], [0, "direct-upload:error", "error"], [0, "direct-upload:end", "end"]], { filename: [{ setMissingFiletype: 0 }] }]);
|
|
4785
4785
|
|
|
@@ -4791,47 +4791,58 @@ var e = a;
|
|
|
4791
4791
|
|
|
4792
4792
|
// dist/components/index2.js
|
|
4793
4793
|
var r = null;
|
|
4794
|
-
|
|
4794
|
+
function n2(r4) {
|
|
4795
|
+
const n3 = Number(r4);
|
|
4796
|
+
if (Number.isNaN(n3)) throw new TypeError(`progress-bar: percent must be numeric, got ${JSON.stringify(r4)}`);
|
|
4797
|
+
return Math.min(100, Math.max(0, n3));
|
|
4798
|
+
}
|
|
4799
|
+
var e2 = class extends HTMLElement {
|
|
4795
4800
|
constructor() {
|
|
4796
|
-
super(), this.attachShadow({ mode: "open" }), this._percent = 0;
|
|
4801
|
+
super(), this.attachShadow({ mode: "open" }), this._percent = 0, this._rendered = false;
|
|
4797
4802
|
}
|
|
4798
4803
|
connectedCallback() {
|
|
4799
|
-
this.render(), this.updateBar();
|
|
4804
|
+
this._rendered || (this.render(), this._rendered = true), this.updateBar();
|
|
4800
4805
|
}
|
|
4801
4806
|
get percent() {
|
|
4802
4807
|
return this._percent;
|
|
4803
4808
|
}
|
|
4804
4809
|
set percent(r4) {
|
|
4805
|
-
this.
|
|
4810
|
+
this.setAttribute("percent", n2(r4));
|
|
4811
|
+
}
|
|
4812
|
+
get error() {
|
|
4813
|
+
return this.hasAttribute("error");
|
|
4814
|
+
}
|
|
4815
|
+
set error(r4) {
|
|
4816
|
+
this.toggleAttribute("error", Boolean(r4));
|
|
4806
4817
|
}
|
|
4807
4818
|
static get observedAttributes() {
|
|
4808
4819
|
return ["percent"];
|
|
4809
4820
|
}
|
|
4810
|
-
attributeChangedCallback(r4,
|
|
4811
|
-
"percent" === r4 && (this._percent =
|
|
4821
|
+
attributeChangedCallback(r4, e3, t) {
|
|
4822
|
+
"percent" === r4 && (this._percent = n2(t), this.updateBar());
|
|
4812
4823
|
}
|
|
4813
4824
|
updateBar() {
|
|
4814
4825
|
const r4 = this.shadowRoot?.querySelector(".bar");
|
|
4815
|
-
r4 && (r4.style.width = `${this._percent}%`);
|
|
4826
|
+
r4 && (r4.style.width = `${this._percent}%`), this.setAttribute("aria-valuenow", String(this._percent));
|
|
4816
4827
|
}
|
|
4817
4828
|
render() {
|
|
4818
|
-
this.shadowRoot.adoptedStyleSheets = [(r || (r = new CSSStyleSheet(), r.replaceSync("\n :host {\n --progress-color: #2E7D32;\n --
|
|
4829
|
+
this.shadowRoot.adoptedStyleSheets = [(r || (r = new CSSStyleSheet(), r.replaceSync("\n :host {\n --progress-color: #2E7D32;\n --error-color: #7a242f;\n --progress-duration: 120ms;\n --bar-height: 32px;\n --bar-padding: 8px;\n display: block;\n overflow: hidden;\n background: #333333;\n border: 1px solid #999;\n border-radius: 4px;\n }\n\n .content {\n position: relative;\n display: flex;\n align-items: center;\n min-height: var(--bar-height);\n box-sizing: border-box;\n padding: var(--bar-padding);\n color: white;\n font-size: 13px;\n z-index: 0;\n }\n\n .bar {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 0%;\n background: var(--progress-color);\n transition: width var(--progress-duration) ease;\n z-index: -1;\n }\n\n :host([error]) .bar {\n background: var(--error-color);\n }\n")), r)], this.shadowRoot.innerHTML = '\n <span class="content">\n <div class="bar"></div>\n <slot></slot>\n </span>\n ', this.setAttribute("role", "progressbar"), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuemax", "100");
|
|
4819
4830
|
}
|
|
4820
4831
|
};
|
|
4821
|
-
customElements.get("progress-bar") || customElements.define("progress-bar",
|
|
4832
|
+
customElements.get("progress-bar") || customElements.define("progress-bar", e2);
|
|
4822
4833
|
|
|
4823
4834
|
// dist/components/input-attachment.js
|
|
4824
4835
|
var o2 = class _o {
|
|
4825
|
-
static instance(t,
|
|
4826
|
-
return t.inputAttachmentFormController ||= new _o(t,
|
|
4836
|
+
static instance(t, e3 = {}) {
|
|
4837
|
+
return t.inputAttachmentFormController ||= new _o(t, e3);
|
|
4827
4838
|
}
|
|
4828
4839
|
dialog;
|
|
4829
4840
|
element;
|
|
4830
4841
|
controllers;
|
|
4831
4842
|
submitted;
|
|
4832
4843
|
processing;
|
|
4833
|
-
constructor(t, { uploadDialog:
|
|
4834
|
-
this.element = t, this.controllers = [], this.submitted = false, this.processing = false,
|
|
4844
|
+
constructor(t, { uploadDialog: e3 = true } = {}) {
|
|
4845
|
+
this.element = t, this.controllers = [], this.submitted = false, this.processing = false, e3 && (this.dialog = document.createElement("upload-dialog"), this.dialog.id = "form-controller-dialog", this.element.appendChild(this.dialog)), this.element.addEventListener("submit", ((t2) => this.submit(t2))), window.addEventListener("beforeunload", ((t2) => this.beforeUnload(t2))), this.element.addEventListener("direct-upload:initialize", ((t2) => this.init(t2))), this.element.addEventListener("direct-upload:start", ((t2) => this.start(t2))), this.element.addEventListener("direct-upload:progress", ((t2) => this.progress(t2))), this.element.addEventListener("direct-upload:error", ((t2) => this.error(t2))), this.element.addEventListener("direct-upload:end", ((t2) => this.end(t2))), this.element.addEventListener("attachment-file:remove", ((t2) => this.removeUploadedFile(t2)));
|
|
4835
4846
|
}
|
|
4836
4847
|
beforeUnload(t) {
|
|
4837
4848
|
if (this.processing) return t.preventDefault(), t.returnValue = "";
|
|
@@ -4842,8 +4853,8 @@ var o2 = class _o {
|
|
|
4842
4853
|
startNextController() {
|
|
4843
4854
|
if (this.processing) return;
|
|
4844
4855
|
const t = this.controllers.shift();
|
|
4845
|
-
t ? (this.processing = true, this.submitted ? this.setInputAttachmentsDisabled(true) : this.setControllerInputDisabled(t, true), t.start(((
|
|
4846
|
-
this.submitted ?
|
|
4856
|
+
t ? (this.processing = true, this.submitted ? this.setInputAttachmentsDisabled(true) : this.setControllerInputDisabled(t, true), t.start(((e3) => {
|
|
4857
|
+
this.submitted ? e3 && this.setInputAttachmentsDisabled(false) : this.setControllerInputDisabled(t, false), this.processing = false, this.startNextController();
|
|
4847
4858
|
}))) : this.submitForm();
|
|
4848
4859
|
}
|
|
4849
4860
|
hasUploadErrors() {
|
|
@@ -4857,36 +4868,36 @@ var o2 = class _o {
|
|
|
4857
4868
|
}));
|
|
4858
4869
|
}
|
|
4859
4870
|
}
|
|
4860
|
-
setControllerInputDisabled(t,
|
|
4871
|
+
setControllerInputDisabled(t, e3) {
|
|
4861
4872
|
const i2 = t.uploadedFile.closest("input-attachment");
|
|
4862
|
-
i2 && (i2.disabled =
|
|
4873
|
+
i2 && (i2.disabled = e3);
|
|
4863
4874
|
}
|
|
4864
4875
|
setInputAttachmentsDisabled(t) {
|
|
4865
|
-
Array.from(this.element.querySelectorAll("input-attachment")).forEach(((
|
|
4866
|
-
|
|
4876
|
+
Array.from(this.element.querySelectorAll("input-attachment")).forEach(((e3) => {
|
|
4877
|
+
e3.disabled = t;
|
|
4867
4878
|
}));
|
|
4868
4879
|
}
|
|
4869
4880
|
init(t) {
|
|
4870
|
-
const { id:
|
|
4871
|
-
this.dialog?.addUpload("direct-upload-" +
|
|
4881
|
+
const { id: e3, file: i2, controller: s } = t.detail;
|
|
4882
|
+
this.dialog?.addUpload("direct-upload-" + e3, i2?.name || "Uploading..."), this.controllers.push(s), this.startNextController();
|
|
4872
4883
|
}
|
|
4873
4884
|
start(t) {
|
|
4874
4885
|
this.dialog?.startUpload("direct-upload-" + t.detail.id);
|
|
4875
4886
|
}
|
|
4876
4887
|
progress(t) {
|
|
4877
|
-
const { id:
|
|
4878
|
-
this.dialog?.updateProgress("direct-upload-" +
|
|
4888
|
+
const { id: e3, progress: i2 } = t.detail;
|
|
4889
|
+
this.dialog?.updateProgress("direct-upload-" + e3, i2);
|
|
4879
4890
|
}
|
|
4880
4891
|
error(t) {
|
|
4881
4892
|
t.preventDefault();
|
|
4882
|
-
const { id:
|
|
4883
|
-
this.dialog?.setError("direct-upload-" +
|
|
4893
|
+
const { id: e3, error: i2 } = t.detail;
|
|
4894
|
+
this.dialog?.setError("direct-upload-" + e3, i2);
|
|
4884
4895
|
}
|
|
4885
4896
|
end(t) {
|
|
4886
4897
|
this.dialog?.completeUpload("direct-upload-" + t.detail.id);
|
|
4887
4898
|
}
|
|
4888
4899
|
removeUploadedFile(t) {
|
|
4889
|
-
const
|
|
4900
|
+
const e3 = t.detail, i2 = e3.controller?.directUpload?.id;
|
|
4890
4901
|
i2 && this.dialog?.removeUpload("direct-upload-" + i2), this.setInputAttachmentsDisabled(false), requestAnimationFrame((() => this.submitForm()));
|
|
4891
4902
|
}
|
|
4892
4903
|
};
|
|
@@ -4916,11 +4927,11 @@ var d2 = class extends HTMLElement {
|
|
|
4916
4927
|
}
|
|
4917
4928
|
handleDrop(t) {
|
|
4918
4929
|
t.preventDefault(), this.classList.remove("-dragover");
|
|
4919
|
-
const
|
|
4920
|
-
if (
|
|
4921
|
-
|
|
4930
|
+
const e3 = this.fileTarget;
|
|
4931
|
+
if (e3 && t.dataTransfer.files.length > 0) {
|
|
4932
|
+
e3.files = t.dataTransfer.files;
|
|
4922
4933
|
const i2 = new Event("change", { bubbles: true });
|
|
4923
|
-
|
|
4934
|
+
e3.dispatchEvent(i2);
|
|
4924
4935
|
}
|
|
4925
4936
|
}
|
|
4926
4937
|
applyDefaultStyles() {
|
|
@@ -4966,16 +4977,16 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
4966
4977
|
return JSON.stringify(this.files.map(((t) => ({ value: t.value, filename: t.filename, src: t.src, state: t.state, percent: t.percent, size: t.size, filetype: t.filetype }))));
|
|
4967
4978
|
}
|
|
4968
4979
|
set value(t) {
|
|
4969
|
-
const
|
|
4970
|
-
0 !==
|
|
4971
|
-
const
|
|
4972
|
-
return
|
|
4980
|
+
const e3 = JSON.parse(t || "[]");
|
|
4981
|
+
0 !== e3.length ? (this.files = e3.map(((t2) => {
|
|
4982
|
+
const e4 = document.createElement("attachment-file");
|
|
4983
|
+
return e4.name = this.name, e4.preview = this.preview, e4.value = t2.value, e4.filename = t2.filename, e4.src = t2.src, e4.state = t2.state || "complete", e4.percent = t2.percent || 100, e4.size = t2.size, e4.filetype = t2.filetype, e4;
|
|
4973
4984
|
})), requestAnimationFrame((() => this.componentDidRender()))) : this.files = [];
|
|
4974
4985
|
}
|
|
4975
4986
|
updateFormValue() {
|
|
4976
4987
|
if (!this.name || !this.internals?.setFormValue) return;
|
|
4977
|
-
const t = new FormData(),
|
|
4978
|
-
if (this.multiple ? (
|
|
4988
|
+
const t = new FormData(), e3 = this.files.map(((t2) => t2.value)).filter(((t2) => t2 && "string" != typeof t2 ? (console.error("[input-attachment] Non-string value detected on attachment-file:", typeof t2, t2, Error().stack), false) : "string" == typeof t2 && t2.length > 0));
|
|
4989
|
+
if (this.multiple ? (e3.forEach(((e4) => t.append(this.name, e4))), 0 === e3.length && t.append(this.name, "")) : t.set(this.name, e3[0] || ""), this.internals.setFormValue(t), this.required && 0 === this.files.length) this.internals.setValidity({ valueMissing: true }, "Please select a file.", this.fileInput);
|
|
4979
4990
|
else {
|
|
4980
4991
|
const t2 = this.files.map(((t3) => t3.validationError)).filter(((t3) => t3 && t3.length > 0));
|
|
4981
4992
|
t2.length > 0 ? this.internals.setValidity({ customError: true }, t2[0], this.fileInput) : this.internals.setValidity({});
|
|
@@ -4991,8 +5002,8 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
4991
5002
|
t.preventDefault(), this.isDisabled || t.dataTransfer?.files?.length && this.addFiles(t.dataTransfer.files);
|
|
4992
5003
|
};
|
|
4993
5004
|
removeUploadedFile(t) {
|
|
4994
|
-
!(function(t2,
|
|
4995
|
-
const i2 = t2.findIndex(((t3) => t3 ===
|
|
5005
|
+
!(function(t2, e3) {
|
|
5006
|
+
const i2 = t2.findIndex(((t3) => t3 === e3));
|
|
4996
5007
|
-1 !== i2 && t2.splice(i2, 1);
|
|
4997
5008
|
})(this.files, t.detail), this.files = this.files;
|
|
4998
5009
|
}
|
|
@@ -5019,14 +5030,14 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5019
5030
|
t2.length > 0 && (this._files = t2);
|
|
5020
5031
|
}
|
|
5021
5032
|
const t = document.createElement("div");
|
|
5022
|
-
this.files.forEach(((
|
|
5023
|
-
let
|
|
5024
|
-
if (t.children.length !== this.el.children.length)
|
|
5033
|
+
this.files.forEach(((e4) => t.appendChild(e4)));
|
|
5034
|
+
let e3 = false;
|
|
5035
|
+
if (t.children.length !== this.el.children.length) e3 = true;
|
|
5025
5036
|
else for (let i2 = 0; i2 < t.children.length; i2++) if (t.children[i2] !== this.el.children[i2]) {
|
|
5026
|
-
|
|
5037
|
+
e3 = true;
|
|
5027
5038
|
break;
|
|
5028
5039
|
}
|
|
5029
|
-
if (
|
|
5040
|
+
if (e3) {
|
|
5030
5041
|
for (; this.el.firstChild; ) this.el.removeChild(this.el.firstChild);
|
|
5031
5042
|
this.el.appendChild(t);
|
|
5032
5043
|
}
|
|
@@ -5034,8 +5045,8 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5034
5045
|
}
|
|
5035
5046
|
addFiles(t) {
|
|
5036
5047
|
Array.from(t).forEach(((t2) => {
|
|
5037
|
-
const
|
|
5038
|
-
|
|
5048
|
+
const e3 = document.createElement("attachment-file");
|
|
5049
|
+
e3.name = this.name, e3.preview = this.preview, e3.setAttribute("url", this.directupload), e3.accepts = this.accepts, e3.max = this.max, e3.file = t2, this._files.push(e3);
|
|
5039
5050
|
})), this.files = this._files, requestAnimationFrame((() => this.componentDidRender()));
|
|
5040
5051
|
}
|
|
5041
5052
|
checkValidity() {
|
|
@@ -5061,8 +5072,8 @@ var p2 = c3;
|
|
|
5061
5072
|
|
|
5062
5073
|
// dist/components/upload-dialog.js
|
|
5063
5074
|
var r2 = proxyCustomElement(class extends H {
|
|
5064
|
-
constructor(
|
|
5065
|
-
super(), false !==
|
|
5075
|
+
constructor(e3) {
|
|
5076
|
+
super(), false !== e3 && this.__registerHost(), this.__attachShadow();
|
|
5066
5077
|
}
|
|
5067
5078
|
dialog;
|
|
5068
5079
|
uploads = [];
|
|
@@ -5072,26 +5083,26 @@ var r2 = proxyCustomElement(class extends H {
|
|
|
5072
5083
|
async close() {
|
|
5073
5084
|
this.dialog.close();
|
|
5074
5085
|
}
|
|
5075
|
-
async addUpload(
|
|
5076
|
-
this.uploads = [...this.uploads, { id:
|
|
5086
|
+
async addUpload(e3, t) {
|
|
5087
|
+
this.uploads = [...this.uploads, { id: e3, filename: t, pending: true, percent: 0, complete: false, error: null }];
|
|
5077
5088
|
}
|
|
5078
|
-
async startUpload(
|
|
5079
|
-
this.uploads = this.uploads.map(((t) => t.id ===
|
|
5089
|
+
async startUpload(e3) {
|
|
5090
|
+
this.uploads = this.uploads.map(((t) => t.id === e3 ? { ...t, pending: false } : t));
|
|
5080
5091
|
}
|
|
5081
|
-
async updateProgress(
|
|
5082
|
-
this.uploads = this.uploads.map(((a3) => a3.id ===
|
|
5092
|
+
async updateProgress(e3, t) {
|
|
5093
|
+
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, percent: t } : a3));
|
|
5083
5094
|
}
|
|
5084
|
-
async setError(
|
|
5085
|
-
this.uploads = this.uploads.map(((a3) => a3.id ===
|
|
5095
|
+
async setError(e3, t) {
|
|
5096
|
+
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, error: t } : a3));
|
|
5086
5097
|
}
|
|
5087
|
-
async completeUpload(
|
|
5088
|
-
this.uploads = this.uploads.map(((t) => t.id ===
|
|
5098
|
+
async completeUpload(e3) {
|
|
5099
|
+
this.uploads = this.uploads.map(((t) => t.id === e3 ? { ...t, complete: true } : t));
|
|
5089
5100
|
}
|
|
5090
|
-
async removeUpload(
|
|
5091
|
-
this.uploads = this.uploads.filter(((t) => t.id !==
|
|
5101
|
+
async removeUpload(e3) {
|
|
5102
|
+
this.uploads = this.uploads.filter(((t) => t.id !== e3));
|
|
5092
5103
|
}
|
|
5093
5104
|
render() {
|
|
5094
|
-
return h(Host, { key: "76874b06863ae2cab526de1f0e491bb04300c6fc" }, h("dialog", { key: "55b715d6d5fc6ee0c6a16df16c6374ca6e285aee", ref: (
|
|
5105
|
+
return h(Host, { key: "76874b06863ae2cab526de1f0e491bb04300c6fc" }, h("dialog", { key: "55b715d6d5fc6ee0c6a16df16c6374ca6e285aee", ref: (e3) => this.dialog = e3 }, h("div", { key: "bab0ae4ed41bb5a909351866d92f0da330858691", class: "direct-upload-wrapper" }, h("div", { key: "23fe0a67bd942f5f4a53df1bd61bec8863104b2c", class: "direct-upload-content" }, h("h3", { key: "d2e349d855c046a541c9dc3ac837873bcd75da22" }, "Uploading your media"), this.uploads.map(((e3) => h("progress-bar", { key: e3.id, class: { "direct-upload--pending": e3.pending, "direct-upload--complete": e3.complete, "direct-upload--error": !!e3.error }, percent: e3.percent, title: e3.error || void 0 }, e3.filename)))))));
|
|
5095
5106
|
}
|
|
5096
5107
|
static get style() {
|
|
5097
5108
|
return "dialog{border:none;padding:0;background:transparent;max-width:100vw;max-height:100vh}dialog::backdrop{background:transparent}.direct-upload-wrapper{position:fixed;z-index:9999;top:0;left:0;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;background:var(--input-attachment-overlay-bg, rgba(51, 51, 51, 0.9))}.direct-upload-content{display:block;background:var(--input-attachment-dialog-bg, #fcfcfc);color:var(--input-attachment-text-color, #000);padding:40px 60px 60px;border-radius:3px;width:60vw}.direct-upload-content h3{border-bottom:2px solid var(--input-attachment-dialog-border, #1f1f1f);margin-bottom:20px}.direct-upload--pending{opacity:0.6}.direct-upload--complete{opacity:0.4}.direct-upload--error{border-color:var(--input-attachment-error-color, red)}";
|
|
@@ -5101,8 +5112,8 @@ var c4 = r2;
|
|
|
5101
5112
|
|
|
5102
5113
|
// dist/components/index.js
|
|
5103
5114
|
var r3 = (r4) => {
|
|
5104
|
-
"undefined" != typeof customElements && [o, e, p2, c4].forEach(((
|
|
5105
|
-
customElements.get(transformTag(
|
|
5115
|
+
"undefined" != typeof customElements && [o, e, p2, c4].forEach(((e3) => {
|
|
5116
|
+
customElements.get(transformTag(e3.is)) || customElements.define(transformTag(e3.is), e3, r4);
|
|
5106
5117
|
}));
|
|
5107
5118
|
};
|
|
5108
5119
|
|