bard-attachment_field 0.5.7 → 0.5.8
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/app/assets/javascripts/input-attachment.js +389 -363
- data/input-attachment/bun.lockb +0 -0
- data/input-attachment/package.json +1 -1
- data/lib/bard/attachment_field/version.rb +1 -1
- metadata +1 -1
|
@@ -1935,9 +1935,9 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
|
1935
1935
|
if (p3.indexOf(_polyfillHostNoCombinator) > -1) {
|
|
1936
1936
|
scopedP = applySimpleSelectorScope(p3, scopeSelector2, hostSelector);
|
|
1937
1937
|
} else {
|
|
1938
|
-
const
|
|
1939
|
-
if (
|
|
1940
|
-
scopedP = injectScopingSelector(
|
|
1938
|
+
const t2 = p3.replace(_polyfillHostRe, "");
|
|
1939
|
+
if (t2.length > 0) {
|
|
1940
|
+
scopedP = injectScopingSelector(t2, className);
|
|
1941
1941
|
}
|
|
1942
1942
|
}
|
|
1943
1943
|
return scopedP;
|
|
@@ -4112,347 +4112,347 @@ var n = function() {
|
|
|
4112
4112
|
// dist/components/attachment-file2.js
|
|
4113
4113
|
var a2 = { exports: {} };
|
|
4114
4114
|
a2.exports = (function() {
|
|
4115
|
-
var
|
|
4116
|
-
function e3(
|
|
4117
|
-
var i3 =
|
|
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,
|
|
4115
|
+
var t2 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
4116
|
+
function e3(t3, e4) {
|
|
4117
|
+
var i3 = t3[0], s2 = t3[1], r5 = t3[2], n4 = t3[3];
|
|
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, t3[0] = i3 + t3[0] | 0, t3[1] = s2 + t3[1] | 0, t3[2] = r5 + t3[2] | 0, t3[3] = n4 + t3[3] | 0;
|
|
4119
4119
|
}
|
|
4120
|
-
function i2(
|
|
4120
|
+
function i2(t3) {
|
|
4121
4121
|
var e4, i3 = [];
|
|
4122
|
-
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] =
|
|
4122
|
+
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] = t3.charCodeAt(e4) + (t3.charCodeAt(e4 + 1) << 8) + (t3.charCodeAt(e4 + 2) << 16) + (t3.charCodeAt(e4 + 3) << 24);
|
|
4123
4123
|
return i3;
|
|
4124
4124
|
}
|
|
4125
|
-
function s(
|
|
4125
|
+
function s(t3) {
|
|
4126
4126
|
var e4, i3 = [];
|
|
4127
|
-
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] =
|
|
4127
|
+
for (e4 = 0; e4 < 64; e4 += 4) i3[e4 >> 2] = t3[e4] + (t3[e4 + 1] << 8) + (t3[e4 + 2] << 16) + (t3[e4 + 3] << 24);
|
|
4128
4128
|
return i3;
|
|
4129
4129
|
}
|
|
4130
|
-
function r4(
|
|
4131
|
-
var s2, r5, n4, o4, a4, h4, c6 =
|
|
4132
|
-
for (s2 = 64; s2 <= c6; s2 += 64) e3(l3, i2(
|
|
4133
|
-
for (r5 = (
|
|
4130
|
+
function r4(t3) {
|
|
4131
|
+
var s2, r5, n4, o4, a4, h4, c6 = t3.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
|
|
4132
|
+
for (s2 = 64; s2 <= c6; s2 += 64) e3(l3, i2(t3.substring(s2 - 64, s2)));
|
|
4133
|
+
for (r5 = (t3 = t3.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] |= t3.charCodeAt(s2) << (s2 % 4 << 3);
|
|
4134
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
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
4137
|
function n3(e4) {
|
|
4138
4138
|
var i3, s2 = "";
|
|
4139
|
-
for (i3 = 0; i3 < 4; i3 += 1) s2 +=
|
|
4139
|
+
for (i3 = 0; i3 < 4; i3 += 1) s2 += t2[e4 >> 8 * i3 + 4 & 15] + t2[e4 >> 8 * i3 & 15];
|
|
4140
4140
|
return s2;
|
|
4141
4141
|
}
|
|
4142
|
-
function o3(
|
|
4142
|
+
function o3(t3) {
|
|
4143
4143
|
var e4;
|
|
4144
|
-
for (e4 = 0; e4 <
|
|
4145
|
-
return
|
|
4144
|
+
for (e4 = 0; e4 < t3.length; e4 += 1) t3[e4] = n3(t3[e4]);
|
|
4145
|
+
return t3.join("");
|
|
4146
4146
|
}
|
|
4147
|
-
function a3(
|
|
4148
|
-
return /[\u0080-\uFFFF]/.test(
|
|
4147
|
+
function a3(t3) {
|
|
4148
|
+
return /[\u0080-\uFFFF]/.test(t3) && (t3 = unescape(encodeURIComponent(t3))), t3;
|
|
4149
4149
|
}
|
|
4150
|
-
function h3(
|
|
4151
|
-
var e4, i3 = [], s2 =
|
|
4152
|
-
for (e4 = 0; e4 < s2 - 1; e4 += 2) i3.push(parseInt(
|
|
4150
|
+
function h3(t3) {
|
|
4151
|
+
var e4, i3 = [], s2 = t3.length;
|
|
4152
|
+
for (e4 = 0; e4 < s2 - 1; e4 += 2) i3.push(parseInt(t3.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
|
|
4160
|
-
return (
|
|
4159
|
+
function t3(t4, e4) {
|
|
4160
|
+
return (t4 = 0 | t4 || 0) < 0 ? Math.max(t4 + e4, 0) : Math.min(t4, e4);
|
|
4161
4161
|
}
|
|
4162
4162
|
ArrayBuffer.prototype.slice = function(e4, i3) {
|
|
4163
|
-
var s2, r5, n4, o4, a4 = this.byteLength, h4 =
|
|
4164
|
-
return void 0 !== i3 && (c6 =
|
|
4163
|
+
var s2, r5, n4, o4, a4 = this.byteLength, h4 = t3(e4, a4), c6 = a4;
|
|
4164
|
+
return void 0 !== i3 && (c6 = t3(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
|
-
})(), c5.prototype.append = function(
|
|
4167
|
-
return this.appendBinary(a3(
|
|
4168
|
-
}, c5.prototype.appendBinary = function(
|
|
4169
|
-
this._buff +=
|
|
4166
|
+
})(), c5.prototype.append = function(t3) {
|
|
4167
|
+
return this.appendBinary(a3(t3)), this;
|
|
4168
|
+
}, c5.prototype.appendBinary = function(t3) {
|
|
4169
|
+
this._buff += t3, this._length += t3.length;
|
|
4170
4170
|
var s2, r5 = this._buff.length;
|
|
4171
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
|
-
}, c5.prototype.end = function(
|
|
4173
|
+
}, c5.prototype.end = function(t3) {
|
|
4174
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
4175
|
for (e4 = 0; e4 < r5; e4 += 1) n4[e4 >> 2] |= s2.charCodeAt(e4) << (e4 % 4 << 3);
|
|
4176
|
-
return this._finish(n4, r5), i3 = o3(this._hash),
|
|
4176
|
+
return this._finish(n4, r5), i3 = o3(this._hash), t3 && (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;
|
|
4179
4179
|
}, c5.prototype.getState = function() {
|
|
4180
4180
|
return { buff: this._buff, length: this._length, hash: this._hash.slice() };
|
|
4181
|
-
}, c5.prototype.setState = function(
|
|
4182
|
-
return this._buff =
|
|
4181
|
+
}, c5.prototype.setState = function(t3) {
|
|
4182
|
+
return this._buff = t3.buff, this._length = t3.length, this._hash = t3.hash, this;
|
|
4183
4183
|
}, c5.prototype.destroy = function() {
|
|
4184
4184
|
delete this._hash, delete this._buff, delete this._length;
|
|
4185
|
-
}, c5.prototype._finish = function(
|
|
4185
|
+
}, c5.prototype._finish = function(t3, i3) {
|
|
4186
4186
|
var s2, r5, n4, o4 = i3;
|
|
4187
|
-
if (
|
|
4188
|
-
s2 = (s2 = 8 * this._length).toString(16).match(/(.*?)(.{0,8})$/), r5 = parseInt(s2[2], 16), n4 = parseInt(s2[1], 16) || 0,
|
|
4189
|
-
}, c5.hash = function(
|
|
4190
|
-
return c5.hashBinary(a3(
|
|
4191
|
-
}, c5.hashBinary = function(
|
|
4192
|
-
var i3 = o3(r4(
|
|
4187
|
+
if (t3[o4 >> 2] |= 128 << (o4 % 4 << 3), o4 > 55) for (e3(this._hash, t3), o4 = 0; o4 < 16; o4 += 1) t3[o4] = 0;
|
|
4188
|
+
s2 = (s2 = 8 * this._length).toString(16).match(/(.*?)(.{0,8})$/), r5 = parseInt(s2[2], 16), n4 = parseInt(s2[1], 16) || 0, t3[14] = r5, t3[15] = n4, e3(this._hash, t3);
|
|
4189
|
+
}, c5.hash = function(t3, e4) {
|
|
4190
|
+
return c5.hashBinary(a3(t3), e4);
|
|
4191
|
+
}, c5.hashBinary = function(t3, e4) {
|
|
4192
|
+
var i3 = o3(r4(t3));
|
|
4193
4193
|
return e4 ? h3(i3) : i3;
|
|
4194
4194
|
}, (c5.ArrayBuffer = function() {
|
|
4195
4195
|
this.reset();
|
|
4196
|
-
}).prototype.append = function(
|
|
4197
|
-
var i3, r5, n4, o4, a4 = (r5 = this._buff.buffer, n4 =
|
|
4198
|
-
for (this._length +=
|
|
4196
|
+
}).prototype.append = function(t3) {
|
|
4197
|
+
var i3, r5, n4, o4, a4 = (r5 = this._buff.buffer, n4 = t3, (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 += t3.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
|
-
}, c5.ArrayBuffer.prototype.end = function(
|
|
4200
|
+
}, c5.ArrayBuffer.prototype.end = function(t3) {
|
|
4201
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
4202
|
for (e4 = 0; e4 < r5; e4 += 1) n4[e4 >> 2] |= s2[e4] << (e4 % 4 << 3);
|
|
4203
|
-
return this._finish(n4, r5), i3 = o3(this._hash),
|
|
4203
|
+
return this._finish(n4, r5), i3 = o3(this._hash), t3 && (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;
|
|
4206
4206
|
}, c5.ArrayBuffer.prototype.getState = function() {
|
|
4207
|
-
var
|
|
4208
|
-
return
|
|
4209
|
-
}, c5.ArrayBuffer.prototype.setState = function(
|
|
4210
|
-
return
|
|
4211
|
-
var i3, s2 =
|
|
4212
|
-
for (i3 = 0; i3 < s2; i3 += 1) n4[i3] =
|
|
4207
|
+
var t3 = c5.prototype.getState.call(this);
|
|
4208
|
+
return t3.buff = String.fromCharCode.apply(null, new Uint8Array(t3.buff)), t3;
|
|
4209
|
+
}, c5.ArrayBuffer.prototype.setState = function(t3) {
|
|
4210
|
+
return t3.buff = (function(t4, e4) {
|
|
4211
|
+
var i3, s2 = t4.length, r5 = new ArrayBuffer(s2), n4 = new Uint8Array(r5);
|
|
4212
|
+
for (i3 = 0; i3 < s2; i3 += 1) n4[i3] = t4.charCodeAt(i3);
|
|
4213
4213
|
return e4 ? n4 : r5;
|
|
4214
|
-
})(
|
|
4215
|
-
}, c5.ArrayBuffer.prototype.destroy = c5.prototype.destroy, c5.ArrayBuffer.prototype._finish = c5.prototype._finish, c5.ArrayBuffer.hash = function(
|
|
4216
|
-
var r5 = o3((function(
|
|
4217
|
-
var i4, r6, n4, o4, a4, h4, c6 =
|
|
4218
|
-
for (i4 = 64; i4 <= c6; i4 += 64) e3(l3, s(
|
|
4219
|
-
for (r6 = (
|
|
4214
|
+
})(t3.buff, true), c5.prototype.setState.call(this, t3);
|
|
4215
|
+
}, c5.ArrayBuffer.prototype.destroy = c5.prototype.destroy, c5.ArrayBuffer.prototype._finish = c5.prototype._finish, c5.ArrayBuffer.hash = function(t3, i3) {
|
|
4216
|
+
var r5 = o3((function(t4) {
|
|
4217
|
+
var i4, r6, n4, o4, a4, h4, c6 = t4.length, l3 = [1732584193, -271733879, -1732584194, 271733878];
|
|
4218
|
+
for (i4 = 64; i4 <= c6; i4 += 64) e3(l3, s(t4.subarray(i4 - 64, i4)));
|
|
4219
|
+
for (r6 = (t4 = i4 - 64 < c6 ? t4.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] |= t4[i4] << (i4 % 4 << 3);
|
|
4220
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
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
|
-
})(new Uint8Array(
|
|
4222
|
+
})(new Uint8Array(t3)));
|
|
4223
4223
|
return i3 ? h3(r5) : r5;
|
|
4224
4224
|
}, c5;
|
|
4225
4225
|
})();
|
|
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(
|
|
4230
|
-
new _l(
|
|
4229
|
+
static create(t2, e3) {
|
|
4230
|
+
new _l(t2).create(e3);
|
|
4231
4231
|
}
|
|
4232
|
-
constructor(
|
|
4233
|
-
this.file =
|
|
4232
|
+
constructor(t2) {
|
|
4233
|
+
this.file = t2, this.chunkSize = 2097152, this.chunkCount = Math.ceil(this.file.size / this.chunkSize), this.chunkIndex = 0;
|
|
4234
4234
|
}
|
|
4235
|
-
create(
|
|
4236
|
-
this.callback =
|
|
4235
|
+
create(t2) {
|
|
4236
|
+
this.callback = t2, this.md5Buffer = new h2.ArrayBuffer(), this.fileReader = new FileReader(), this.fileReader.addEventListener("load", ((t3) => this.fileReaderDidLoad(t3))), this.fileReader.addEventListener("error", ((t3) => this.fileReaderDidError(t3))), this.readNextChunk();
|
|
4237
4237
|
}
|
|
4238
|
-
fileReaderDidLoad(
|
|
4239
|
-
if (this.md5Buffer.append(
|
|
4240
|
-
const
|
|
4238
|
+
fileReaderDidLoad(t2) {
|
|
4239
|
+
if (this.md5Buffer.append(t2.target.result), !this.readNextChunk()) {
|
|
4240
|
+
const t3 = this.md5Buffer.end(true), e3 = btoa(t3);
|
|
4241
4241
|
this.callback(null, e3);
|
|
4242
4242
|
}
|
|
4243
4243
|
}
|
|
4244
|
-
fileReaderDidError(
|
|
4244
|
+
fileReaderDidError(t2) {
|
|
4245
4245
|
this.callback(`Error reading ${this.file.name}`);
|
|
4246
4246
|
}
|
|
4247
4247
|
readNextChunk() {
|
|
4248
4248
|
if (this.chunkIndex < this.chunkCount || 0 == this.chunkIndex && 0 == this.chunkCount) {
|
|
4249
|
-
const
|
|
4249
|
+
const t2 = this.chunkIndex * this.chunkSize, e3 = Math.min(t2 + this.chunkSize, this.file.size), i2 = c2.call(this.file, t2, e3);
|
|
4250
4250
|
return this.fileReader.readAsArrayBuffer(i2), this.chunkIndex++, true;
|
|
4251
4251
|
}
|
|
4252
4252
|
return false;
|
|
4253
4253
|
}
|
|
4254
4254
|
};
|
|
4255
|
-
function d(
|
|
4256
|
-
return "string" == typeof
|
|
4255
|
+
function d(t2, e3) {
|
|
4256
|
+
return "string" == typeof t2 && (e3 = t2, t2 = document), t2.querySelector(e3);
|
|
4257
4257
|
}
|
|
4258
|
-
function u(
|
|
4259
|
-
const { disabled: s } =
|
|
4258
|
+
function u(t2, e3, i2 = {}) {
|
|
4259
|
+
const { disabled: s } = t2, { bubbles: r4, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
|
|
4260
4260
|
a3.initEvent(e3, r4 || true, n3 || true), a3.detail = o3 || {};
|
|
4261
4261
|
try {
|
|
4262
|
-
|
|
4262
|
+
t2.disabled = false, t2.dispatchEvent(a3);
|
|
4263
4263
|
} finally {
|
|
4264
|
-
|
|
4264
|
+
t2.disabled = s;
|
|
4265
4265
|
}
|
|
4266
4266
|
return a3;
|
|
4267
4267
|
}
|
|
4268
|
-
function p(
|
|
4269
|
-
return Array.isArray(
|
|
4268
|
+
function p(t2) {
|
|
4269
|
+
return Array.isArray(t2) ? t2 : Array.from ? Array.from(t2) : [].slice.call(t2);
|
|
4270
4270
|
}
|
|
4271
4271
|
var f = class {
|
|
4272
|
-
constructor(
|
|
4273
|
-
this.file =
|
|
4274
|
-
this.xhr.setRequestHeader(
|
|
4272
|
+
constructor(t2, e3, i2, s = {}) {
|
|
4273
|
+
this.file = t2, this.attributes = { filename: t2.name, content_type: t2.type || "application/octet-stream", byte_size: t2.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(((t3) => {
|
|
4274
|
+
this.xhr.setRequestHeader(t3, s[t3]);
|
|
4275
4275
|
}));
|
|
4276
4276
|
const r4 = (function() {
|
|
4277
|
-
const
|
|
4278
|
-
if (
|
|
4277
|
+
const t3 = d(document.head, 'meta[name="csrf-token"]');
|
|
4278
|
+
if (t3) return t3.getAttribute("content");
|
|
4279
4279
|
})();
|
|
4280
|
-
null != r4 && this.xhr.setRequestHeader("X-CSRF-Token", r4), this.xhr.addEventListener("load", ((
|
|
4280
|
+
null != r4 && this.xhr.setRequestHeader("X-CSRF-Token", r4), this.xhr.addEventListener("load", ((t3) => this.requestDidLoad(t3))), this.xhr.addEventListener("error", ((t3) => this.requestDidError(t3)));
|
|
4281
4281
|
}
|
|
4282
4282
|
get status() {
|
|
4283
4283
|
return this.xhr.status;
|
|
4284
4284
|
}
|
|
4285
4285
|
get response() {
|
|
4286
|
-
const { responseType:
|
|
4287
|
-
return "json" ==
|
|
4286
|
+
const { responseType: t2, response: e3 } = this.xhr;
|
|
4287
|
+
return "json" == t2 ? e3 : JSON.parse(e3);
|
|
4288
4288
|
}
|
|
4289
|
-
create(
|
|
4290
|
-
this.callback =
|
|
4289
|
+
create(t2) {
|
|
4290
|
+
this.callback = t2, this.xhr.send(JSON.stringify({ blob: this.attributes }));
|
|
4291
4291
|
}
|
|
4292
|
-
requestDidLoad(
|
|
4292
|
+
requestDidLoad(t2) {
|
|
4293
4293
|
if (this.status >= 200 && this.status < 300) {
|
|
4294
|
-
const { response:
|
|
4295
|
-
delete
|
|
4296
|
-
} else this.requestDidError(
|
|
4294
|
+
const { response: t3 } = this, { direct_upload: e3 } = t3;
|
|
4295
|
+
delete t3.direct_upload, this.attributes = t3, this.directUploadData = e3, this.callback(null, this.toJSON());
|
|
4296
|
+
} else this.requestDidError(t2);
|
|
4297
4297
|
}
|
|
4298
|
-
requestDidError(
|
|
4298
|
+
requestDidError(t2) {
|
|
4299
4299
|
this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`);
|
|
4300
4300
|
}
|
|
4301
4301
|
toJSON() {
|
|
4302
|
-
const
|
|
4303
|
-
for (const e3 in this.attributes)
|
|
4304
|
-
return
|
|
4302
|
+
const t2 = {};
|
|
4303
|
+
for (const e3 in this.attributes) t2[e3] = this.attributes[e3];
|
|
4304
|
+
return t2;
|
|
4305
4305
|
}
|
|
4306
4306
|
};
|
|
4307
4307
|
var m = class {
|
|
4308
|
-
constructor(
|
|
4309
|
-
this.blob =
|
|
4310
|
-
const { url: e3, headers: i2 } =
|
|
4308
|
+
constructor(t2) {
|
|
4309
|
+
this.blob = t2, this.file = t2.file;
|
|
4310
|
+
const { url: e3, headers: i2 } = t2.directUploadData;
|
|
4311
4311
|
this.xhr = new XMLHttpRequest(), this.xhr.open("PUT", e3, true), this.xhr.responseType = "text";
|
|
4312
|
-
for (const
|
|
4313
|
-
this.xhr.addEventListener("load", ((
|
|
4312
|
+
for (const t3 in i2) this.xhr.setRequestHeader(t3, i2[t3]);
|
|
4313
|
+
this.xhr.addEventListener("load", ((t3) => this.requestDidLoad(t3))), this.xhr.addEventListener("error", ((t3) => this.requestDidError(t3)));
|
|
4314
4314
|
}
|
|
4315
|
-
create(
|
|
4316
|
-
this.callback =
|
|
4315
|
+
create(t2) {
|
|
4316
|
+
this.callback = t2, this.xhr.send(this.file.slice());
|
|
4317
4317
|
}
|
|
4318
|
-
requestDidLoad(
|
|
4318
|
+
requestDidLoad(t2) {
|
|
4319
4319
|
const { status: e3, response: i2 } = this.xhr;
|
|
4320
|
-
e3 >= 200 && e3 < 300 ? this.callback(null, i2) : this.requestDidError(
|
|
4320
|
+
e3 >= 200 && e3 < 300 ? this.callback(null, i2) : this.requestDidError(t2);
|
|
4321
4321
|
}
|
|
4322
|
-
requestDidError(
|
|
4322
|
+
requestDidError(t2) {
|
|
4323
4323
|
this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`);
|
|
4324
4324
|
}
|
|
4325
4325
|
};
|
|
4326
4326
|
var g = 0;
|
|
4327
4327
|
var b = class {
|
|
4328
|
-
constructor(
|
|
4329
|
-
this.id = ++g, this.file =
|
|
4328
|
+
constructor(t2, e3, i2, s = {}) {
|
|
4329
|
+
this.id = ++g, this.file = t2, this.url = e3, this.delegate = i2, this.customHeaders = s;
|
|
4330
4330
|
}
|
|
4331
|
-
create(
|
|
4331
|
+
create(t2) {
|
|
4332
4332
|
l.create(this.file, ((e3, i2) => {
|
|
4333
|
-
if (e3) return void
|
|
4333
|
+
if (e3) return void t2(e3);
|
|
4334
4334
|
const s = new f(this.file, i2, this.url, this.customHeaders);
|
|
4335
4335
|
v(this.delegate, "directUploadWillCreateBlobWithXHR", s.xhr), s.create(((e4) => {
|
|
4336
|
-
if (e4)
|
|
4336
|
+
if (e4) t2(e4);
|
|
4337
4337
|
else {
|
|
4338
4338
|
const e5 = new m(s);
|
|
4339
4339
|
v(this.delegate, "directUploadWillStoreFileWithXHR", e5.xhr), e5.create(((e6) => {
|
|
4340
|
-
e6 ?
|
|
4340
|
+
e6 ? t2(e6) : t2(null, s.toJSON());
|
|
4341
4341
|
}));
|
|
4342
4342
|
}
|
|
4343
4343
|
}));
|
|
4344
4344
|
}));
|
|
4345
4345
|
}
|
|
4346
4346
|
};
|
|
4347
|
-
function v(
|
|
4348
|
-
if (
|
|
4347
|
+
function v(t2, e3, ...i2) {
|
|
4348
|
+
if (t2 && "function" == typeof t2[e3]) return t2[e3](...i2);
|
|
4349
4349
|
}
|
|
4350
4350
|
var w = class {
|
|
4351
|
-
constructor(
|
|
4352
|
-
this.input =
|
|
4351
|
+
constructor(t2, e3) {
|
|
4352
|
+
this.input = t2, this.file = e3, this.directUpload = new b(this.file, this.url, this), this.dispatch("initialize");
|
|
4353
4353
|
}
|
|
4354
|
-
start(
|
|
4354
|
+
start(t2) {
|
|
4355
4355
|
const e3 = document.createElement("input");
|
|
4356
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"),
|
|
4357
|
+
i2 ? (e3.parentNode.removeChild(e3), this.dispatchError(i2)) : e3.value = s.signed_id, this.dispatch("end"), t2(i2);
|
|
4358
4358
|
}));
|
|
4359
4359
|
}
|
|
4360
|
-
uploadRequestDidProgress(
|
|
4361
|
-
const e3 =
|
|
4360
|
+
uploadRequestDidProgress(t2) {
|
|
4361
|
+
const e3 = t2.loaded / t2.total * 90;
|
|
4362
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(
|
|
4368
|
-
return e3.file = this.file, e3.id = this.directUpload.id, u(this.input, `direct-upload:${
|
|
4367
|
+
dispatch(t2, e3 = {}) {
|
|
4368
|
+
return e3.file = this.file, e3.id = this.directUpload.id, u(this.input, `direct-upload:${t2}`, { detail: e3 });
|
|
4369
4369
|
}
|
|
4370
|
-
dispatchError(
|
|
4371
|
-
this.dispatch("error", { error:
|
|
4370
|
+
dispatchError(t2) {
|
|
4371
|
+
this.dispatch("error", { error: t2 }).defaultPrevented || alert(t2);
|
|
4372
4372
|
}
|
|
4373
|
-
directUploadWillCreateBlobWithXHR(
|
|
4374
|
-
this.dispatch("before-blob-request", { xhr:
|
|
4373
|
+
directUploadWillCreateBlobWithXHR(t2) {
|
|
4374
|
+
this.dispatch("before-blob-request", { xhr: t2 });
|
|
4375
4375
|
}
|
|
4376
|
-
directUploadWillStoreFileWithXHR(
|
|
4377
|
-
this.dispatch("before-storage-request", { xhr:
|
|
4378
|
-
this.simulateResponseProgress(
|
|
4376
|
+
directUploadWillStoreFileWithXHR(t2) {
|
|
4377
|
+
this.dispatch("before-storage-request", { xhr: t2 }), t2.upload.addEventListener("progress", ((t3) => this.uploadRequestDidProgress(t3))), t2.upload.addEventListener("loadend", (() => {
|
|
4378
|
+
this.simulateResponseProgress(t2);
|
|
4379
4379
|
}));
|
|
4380
4380
|
}
|
|
4381
|
-
simulateResponseProgress(
|
|
4381
|
+
simulateResponseProgress(t2) {
|
|
4382
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
|
-
e3 = 90 + 9 * o3, this.dispatch("progress", { progress: e3 }),
|
|
4385
|
+
e3 = 90 + 9 * o3, this.dispatch("progress", { progress: e3 }), t2.readyState !== XMLHttpRequest.DONE && e3 < 99 && requestAnimationFrame(s);
|
|
4386
4386
|
};
|
|
4387
|
-
|
|
4387
|
+
t2.addEventListener("loadend", (() => {
|
|
4388
4388
|
this.dispatch("progress", { progress: 100 });
|
|
4389
4389
|
})), requestAnimationFrame(s);
|
|
4390
4390
|
}
|
|
4391
4391
|
estimateResponseTime() {
|
|
4392
|
-
const
|
|
4393
|
-
return
|
|
4392
|
+
const t2 = this.file.size, e3 = 1048576;
|
|
4393
|
+
return t2 < e3 ? 1e3 : t2 < 10 * e3 ? 2e3 : 3e3 + t2 / e3 * 50;
|
|
4394
4394
|
}
|
|
4395
4395
|
};
|
|
4396
4396
|
var y = class {
|
|
4397
|
-
constructor(
|
|
4397
|
+
constructor(t2) {
|
|
4398
4398
|
var e3, i2;
|
|
4399
|
-
this.form =
|
|
4399
|
+
this.form = t2, this.inputs = (e3 = t2, i2 = "input[type=file][data-direct-upload-url]:not([disabled])", "string" == typeof e3 && (i2 = e3, e3 = document), p(e3.querySelectorAll(i2))).filter(((t3) => t3.files.length));
|
|
4400
4400
|
}
|
|
4401
|
-
start(
|
|
4401
|
+
start(t2) {
|
|
4402
4402
|
const e3 = this.createDirectUploadControllers(), i2 = () => {
|
|
4403
4403
|
const s = e3.shift();
|
|
4404
4404
|
s ? s.start(((e4) => {
|
|
4405
|
-
e4 ? (
|
|
4406
|
-
})) : (
|
|
4405
|
+
e4 ? (t2(e4), this.dispatch("end")) : i2();
|
|
4406
|
+
})) : (t2(), this.dispatch("end"));
|
|
4407
4407
|
};
|
|
4408
4408
|
this.dispatch("start"), i2();
|
|
4409
4409
|
}
|
|
4410
4410
|
createDirectUploadControllers() {
|
|
4411
|
-
const
|
|
4411
|
+
const t2 = [];
|
|
4412
4412
|
return this.inputs.forEach(((e3) => {
|
|
4413
4413
|
p(e3.files).forEach(((i2) => {
|
|
4414
4414
|
const s = new w(e3, i2);
|
|
4415
|
-
|
|
4415
|
+
t2.push(s);
|
|
4416
4416
|
}));
|
|
4417
|
-
})),
|
|
4417
|
+
})), t2;
|
|
4418
4418
|
}
|
|
4419
|
-
dispatch(
|
|
4420
|
-
return u(this.form, `direct-uploads:${
|
|
4419
|
+
dispatch(t2, e3 = {}) {
|
|
4420
|
+
return u(this.form, `direct-uploads:${t2}`, { 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
|
-
function M(
|
|
4427
|
-
const e3 =
|
|
4426
|
+
function M(t2) {
|
|
4427
|
+
const e3 = t2.target.closest("button, input");
|
|
4428
4428
|
e3 && "submit" === e3.type && e3.form && k.set(e3.form, e3);
|
|
4429
4429
|
}
|
|
4430
|
-
function j(
|
|
4431
|
-
$(
|
|
4430
|
+
function j(t2) {
|
|
4431
|
+
$(t2);
|
|
4432
4432
|
}
|
|
4433
|
-
function A(
|
|
4434
|
-
"FORM" ==
|
|
4433
|
+
function A(t2) {
|
|
4434
|
+
"FORM" == t2.target.tagName && $(t2);
|
|
4435
4435
|
}
|
|
4436
|
-
function $(
|
|
4437
|
-
const e3 =
|
|
4438
|
-
if (e3.hasAttribute(x)) return void
|
|
4436
|
+
function $(t2) {
|
|
4437
|
+
const e3 = t2.target;
|
|
4438
|
+
if (e3.hasAttribute(x)) return void t2.preventDefault();
|
|
4439
4439
|
const i2 = new y(e3), { inputs: s } = i2;
|
|
4440
|
-
s.length && (
|
|
4441
|
-
e3.removeAttribute(x),
|
|
4442
|
-
let e4 = k.get(
|
|
4440
|
+
s.length && (t2.preventDefault(), e3.setAttribute(x, ""), s.forEach(E), i2.start(((t3) => {
|
|
4441
|
+
e3.removeAttribute(x), t3 ? s.forEach(U) : (function(t4) {
|
|
4442
|
+
let e4 = k.get(t4) || d(t4, "input[type=submit], button[type=submit]");
|
|
4443
4443
|
if (e4) {
|
|
4444
|
-
const { disabled:
|
|
4445
|
-
e4.disabled = false, e4.focus(), e4.click(), e4.disabled =
|
|
4446
|
-
} else e4 = document.createElement("input"), e4.type = "submit", e4.style.display = "none",
|
|
4447
|
-
k.delete(
|
|
4444
|
+
const { disabled: t5 } = e4;
|
|
4445
|
+
e4.disabled = false, e4.focus(), e4.click(), e4.disabled = t5;
|
|
4446
|
+
} else e4 = document.createElement("input"), e4.type = "submit", e4.style.display = "none", t4.appendChild(e4), e4.click(), t4.removeChild(e4);
|
|
4447
|
+
k.delete(t4);
|
|
4448
4448
|
})(e3);
|
|
4449
4449
|
})));
|
|
4450
4450
|
}
|
|
4451
|
-
function E(
|
|
4452
|
-
|
|
4451
|
+
function E(t2) {
|
|
4452
|
+
t2.disabled = true;
|
|
4453
4453
|
}
|
|
4454
|
-
function U(
|
|
4455
|
-
|
|
4454
|
+
function U(t2) {
|
|
4455
|
+
t2.disabled = false;
|
|
4456
4456
|
}
|
|
4457
4457
|
setTimeout((function() {
|
|
4458
4458
|
window.ActiveStorage && (R || (R = true, document.addEventListener("click", M, true), document.addEventListener("submit", j, true), document.addEventListener("ajax:before", A)));
|
|
@@ -4466,55 +4466,55 @@ var C = class {
|
|
|
4466
4466
|
callback = null;
|
|
4467
4467
|
cancelled = false;
|
|
4468
4468
|
completed = false;
|
|
4469
|
-
constructor(
|
|
4470
|
-
this.uploadedFile =
|
|
4469
|
+
constructor(t2, e3) {
|
|
4470
|
+
this.uploadedFile = t2, 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", {});
|
|
4474
4474
|
}
|
|
4475
|
-
abortXHR(
|
|
4476
|
-
|
|
4475
|
+
abortXHR(t2) {
|
|
4476
|
+
t2 && t2.abort();
|
|
4477
4477
|
}
|
|
4478
|
-
start(
|
|
4479
|
-
this.callback =
|
|
4480
|
-
this.complete(
|
|
4478
|
+
start(t2) {
|
|
4479
|
+
this.callback = t2, this.dispatch("start"), this.directUpload.create(((t3, e3) => {
|
|
4480
|
+
this.complete(t3, e3);
|
|
4481
4481
|
}));
|
|
4482
4482
|
}
|
|
4483
|
-
complete(
|
|
4484
|
-
this.completed || (this.completed = true,
|
|
4483
|
+
complete(t2, e3) {
|
|
4484
|
+
this.completed || (this.completed = true, t2 && this.dispatchError(t2), this.dispatch("end"), this.callback(t2));
|
|
4485
4485
|
}
|
|
4486
|
-
uploadRequestDidProgress(
|
|
4487
|
-
const e3 =
|
|
4486
|
+
uploadRequestDidProgress(t2) {
|
|
4487
|
+
const e3 = t2.loaded / t2.total * 100;
|
|
4488
4488
|
e3 && this.dispatch("progress", { progress: e3 });
|
|
4489
4489
|
}
|
|
4490
|
-
dispatch(
|
|
4491
|
-
return (function(
|
|
4492
|
-
const { disabled: s } =
|
|
4490
|
+
dispatch(t2, e3 = {}) {
|
|
4491
|
+
return (function(t3, e4, i2 = {}) {
|
|
4492
|
+
const { disabled: s } = t3, { bubbles: r4, cancelable: n3, detail: o3 } = i2, a3 = document.createEvent("Event");
|
|
4493
4493
|
a3.initEvent(e4, r4 || true, n3 || true), a3.detail = o3 || {};
|
|
4494
4494
|
try {
|
|
4495
|
-
|
|
4495
|
+
t3.disabled = false, t3.dispatchEvent(a3);
|
|
4496
4496
|
} finally {
|
|
4497
|
-
|
|
4497
|
+
t3.disabled = s;
|
|
4498
4498
|
}
|
|
4499
4499
|
return a3;
|
|
4500
|
-
})(this.uploadedFile, `direct-upload:${
|
|
4500
|
+
})(this.uploadedFile, `direct-upload:${t2}`, { detail: { ...e3, file: this.file, id: this.directUpload.id } });
|
|
4501
4501
|
}
|
|
4502
|
-
dispatchError(
|
|
4503
|
-
this.dispatch("error", { error:
|
|
4502
|
+
dispatchError(t2) {
|
|
4503
|
+
this.dispatch("error", { error: t2 });
|
|
4504
4504
|
}
|
|
4505
|
-
directUploadWillCreateBlobWithXHR(
|
|
4506
|
-
this.recordXHR =
|
|
4507
|
-
} : this.dispatch("before-blob-request", { xhr:
|
|
4505
|
+
directUploadWillCreateBlobWithXHR(t2) {
|
|
4506
|
+
this.recordXHR = t2, this.cancelled ? t2.send = () => {
|
|
4507
|
+
} : this.dispatch("before-blob-request", { xhr: t2 });
|
|
4508
4508
|
}
|
|
4509
|
-
directUploadWillStoreFileWithXHR(
|
|
4510
|
-
this.uploadXHR =
|
|
4511
|
-
} : (this.uploadedFile.value = this.recordXHR.response.signed_id, this.dispatch("before-storage-request", { xhr:
|
|
4509
|
+
directUploadWillStoreFileWithXHR(t2) {
|
|
4510
|
+
this.uploadXHR = t2, this.cancelled ? t2.send = () => {
|
|
4511
|
+
} : (this.uploadedFile.value = this.recordXHR.response.signed_id, this.dispatch("before-storage-request", { xhr: t2 }), t2.upload.addEventListener("progress", ((t3) => this.uploadRequestDidProgress(t3))));
|
|
4512
4512
|
}
|
|
4513
4513
|
};
|
|
4514
4514
|
var q = class {
|
|
4515
4515
|
uploadedFile;
|
|
4516
|
-
constructor(
|
|
4517
|
-
this.uploadedFile =
|
|
4516
|
+
constructor(t2) {
|
|
4517
|
+
this.uploadedFile = t2;
|
|
4518
4518
|
}
|
|
4519
4519
|
get errors() {
|
|
4520
4520
|
return this.#t || (this.#t = [], this.checkValidity() || this.#t.push(this.errorMessage)), this.#t;
|
|
@@ -4526,35 +4526,35 @@ 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(
|
|
4530
|
-
if (0 ===
|
|
4531
|
-
const i2 = e3 < 0 ? 0 : e3, s = Math.floor(Math.log(
|
|
4532
|
-
return parseFloat((
|
|
4529
|
+
formatBytes(t2, e3 = 2) {
|
|
4530
|
+
if (0 === t2) return "0 Bytes";
|
|
4531
|
+
const i2 = e3 < 0 ? 0 : e3, s = Math.floor(Math.log(t2) / Math.log(1024));
|
|
4532
|
+
return parseFloat((t2 / Math.pow(1024, s)).toFixed(i2)) + ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"][s];
|
|
4533
4533
|
}
|
|
4534
4534
|
};
|
|
4535
4535
|
var B = class {
|
|
4536
4536
|
uploadedFile;
|
|
4537
|
-
constructor(
|
|
4538
|
-
this.uploadedFile =
|
|
4537
|
+
constructor(t2) {
|
|
4538
|
+
this.uploadedFile = t2;
|
|
4539
4539
|
}
|
|
4540
4540
|
get errors() {
|
|
4541
4541
|
if (this.#t) return this.#t;
|
|
4542
4542
|
this.#t = [];
|
|
4543
|
-
const
|
|
4544
|
-
return
|
|
4543
|
+
const t2 = this.uploadedFile.accepts ? this.uploadedFile.accepts.split(/,\s*/) : [];
|
|
4544
|
+
return t2.length > 0 && !t2.includes(this.uploadedFile.filetype) && this.#t.push(`Must be a ${this.joinWords(t2)}.`), this.#t;
|
|
4545
4545
|
}
|
|
4546
4546
|
#t;
|
|
4547
|
-
joinWords(
|
|
4548
|
-
return
|
|
4547
|
+
joinWords(t2) {
|
|
4548
|
+
return t2.length >= 3 ? (t2.slice(0, -1) + [`or ${t2.at(-1)}`]).join(", ") : t2.join(" or ");
|
|
4549
4549
|
}
|
|
4550
4550
|
};
|
|
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(
|
|
4552
|
-
const e3 =
|
|
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(t2) {
|
|
4552
|
+
const e3 = t2.toString().split(".").at(-1).toLowerCase().trim();
|
|
4553
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
|
-
constructor(
|
|
4557
|
-
this.response =
|
|
4556
|
+
constructor(t2) {
|
|
4557
|
+
this.response = t2;
|
|
4558
4558
|
}
|
|
4559
4559
|
get statusCode() {
|
|
4560
4560
|
return this.response.status;
|
|
@@ -4598,8 +4598,8 @@ var S = class {
|
|
|
4598
4598
|
}
|
|
4599
4599
|
};
|
|
4600
4600
|
var T = class {
|
|
4601
|
-
static register(
|
|
4602
|
-
this.interceptor =
|
|
4601
|
+
static register(t2) {
|
|
4602
|
+
this.interceptor = t2;
|
|
4603
4603
|
}
|
|
4604
4604
|
static get() {
|
|
4605
4605
|
return this.interceptor;
|
|
@@ -4608,47 +4608,47 @@ var T = class {
|
|
|
4608
4608
|
this.interceptor = void 0;
|
|
4609
4609
|
}
|
|
4610
4610
|
};
|
|
4611
|
-
function W(
|
|
4612
|
-
const e3 = document.head.querySelector(`meta[name="${
|
|
4611
|
+
function W(t2) {
|
|
4612
|
+
const e3 = document.head.querySelector(`meta[name="${t2}"]`);
|
|
4613
4613
|
return e3 && e3.content;
|
|
4614
4614
|
}
|
|
4615
4615
|
var X = class {
|
|
4616
|
-
constructor(
|
|
4617
|
-
this.method =
|
|
4616
|
+
constructor(t2, e3, i2 = {}) {
|
|
4617
|
+
this.method = t2, this.options = i2, this.originalUrl = e3.toString();
|
|
4618
4618
|
}
|
|
4619
4619
|
async perform() {
|
|
4620
4620
|
try {
|
|
4621
|
-
const
|
|
4622
|
-
|
|
4623
|
-
} catch (
|
|
4624
|
-
console.error(
|
|
4621
|
+
const t3 = T.get();
|
|
4622
|
+
t3 && await t3(this);
|
|
4623
|
+
} catch (t3) {
|
|
4624
|
+
console.error(t3);
|
|
4625
4625
|
}
|
|
4626
|
-
const
|
|
4627
|
-
return
|
|
4626
|
+
const t2 = new S(await window.fetch(this.url, this.fetchOptions));
|
|
4627
|
+
return t2.unauthenticated && t2.authenticationURL ? Promise.reject(window.location.href = t2.authenticationURL) : (t2.ok && t2.isTurboStream && await t2.renderTurboStream(), t2);
|
|
4628
4628
|
}
|
|
4629
|
-
addHeader(
|
|
4629
|
+
addHeader(t2, e3) {
|
|
4630
4630
|
const i2 = this.additionalHeaders;
|
|
4631
|
-
i2[
|
|
4631
|
+
i2[t2] = 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
|
-
return (function(
|
|
4637
|
+
return (function(t2) {
|
|
4638
4638
|
const e3 = {};
|
|
4639
|
-
for (const i2 in
|
|
4640
|
-
const s =
|
|
4639
|
+
for (const i2 in t2) {
|
|
4640
|
+
const s = t2[i2];
|
|
4641
4641
|
void 0 !== s && (e3[i2] = s);
|
|
4642
4642
|
}
|
|
4643
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
|
-
return (function(
|
|
4648
|
-
const e3 = document.cookie ? document.cookie.split("; ") : [], i2 = `${encodeURIComponent(
|
|
4647
|
+
return (function(t2) {
|
|
4648
|
+
const e3 = document.cookie ? document.cookie.split("; ") : [], i2 = `${encodeURIComponent(t2)}=`, s = e3.find(((t3) => t3.startsWith(i2)));
|
|
4649
4649
|
if (s) {
|
|
4650
|
-
const
|
|
4651
|
-
if (
|
|
4650
|
+
const t3 = s.split("=").slice(1).join("=");
|
|
4651
|
+
if (t3) return decodeURIComponent(t3);
|
|
4652
4652
|
}
|
|
4653
4653
|
})(W("csrf-param")) || W("csrf-token");
|
|
4654
4654
|
}
|
|
@@ -4671,11 +4671,11 @@ var X = class {
|
|
|
4671
4671
|
return this.options.body;
|
|
4672
4672
|
}
|
|
4673
4673
|
get query() {
|
|
4674
|
-
const
|
|
4674
|
+
const t2 = (this.originalUrl.split("?")[1] || "").split("#")[0], e3 = new URLSearchParams(t2);
|
|
4675
4675
|
let i2 = this.options.query;
|
|
4676
4676
|
var s;
|
|
4677
|
-
i2 instanceof window.FormData ? (s = i2, i2 = [...s].reduce(((
|
|
4678
|
-
for (const [i3, s2] of e4) s2 instanceof window.File || (
|
|
4677
|
+
i2 instanceof window.FormData ? (s = i2, i2 = [...s].reduce(((t3, [e4, i3]) => t3.concat("string" == typeof i3 ? [[e4, i3]] : [])), [])) : i2 = i2 instanceof window.URLSearchParams ? i2.entries() : Object.entries(i2 || {}), (function(t3, e4) {
|
|
4678
|
+
for (const [i3, s2] of e4) s2 instanceof window.File || (t3.has(i3) ? (t3.delete(i3), t3.set(i3, s2)) : t3.append(i3, s2));
|
|
4679
4679
|
})(e3, i2);
|
|
4680
4680
|
const r4 = e3.toString();
|
|
4681
4681
|
return r4.length > 0 ? `?${r4}` : "";
|
|
@@ -4696,13 +4696,13 @@ var X = class {
|
|
|
4696
4696
|
return this.options.headers || {};
|
|
4697
4697
|
}
|
|
4698
4698
|
get formattedBody() {
|
|
4699
|
-
const
|
|
4700
|
-
return "application/json" !== this.headers["Content-Type"] ||
|
|
4699
|
+
const t2 = "[object String]" === Object.prototype.toString.call(this.body);
|
|
4700
|
+
return "application/json" !== this.headers["Content-Type"] || t2 ? this.body : JSON.stringify(this.body);
|
|
4701
4701
|
}
|
|
4702
4702
|
};
|
|
4703
4703
|
var H2 = proxyCustomElement(class extends H {
|
|
4704
|
-
constructor(
|
|
4705
|
-
super(), false !==
|
|
4704
|
+
constructor(t2) {
|
|
4705
|
+
super(), false !== t2 && this.__registerHost(), this.__attachShadow(), this.removeEvent = createEvent(this, "attachment-file:remove", 7), this.validationEvent = createEvent(this, "attachment-file:validation", 7), this.readyEvent = createEvent(this, "attachment-file:ready", 7);
|
|
4706
4706
|
}
|
|
4707
4707
|
get el() {
|
|
4708
4708
|
return this;
|
|
@@ -4723,11 +4723,11 @@ var H2 = proxyCustomElement(class extends H {
|
|
|
4723
4723
|
removeEvent;
|
|
4724
4724
|
validationEvent;
|
|
4725
4725
|
readyEvent;
|
|
4726
|
-
removeClicked = (
|
|
4727
|
-
|
|
4726
|
+
removeClicked = (t2) => {
|
|
4727
|
+
t2.stopPropagation(), t2.preventDefault(), this.controller?.cancel(), this.removeEvent.emit(this);
|
|
4728
4728
|
};
|
|
4729
|
-
retryClicked = (
|
|
4730
|
-
|
|
4729
|
+
retryClicked = (t2) => {
|
|
4730
|
+
t2.stopPropagation(), t2.preventDefault(), this.state = "pending", this.percent = 0, this.validationError = "", this.uploadError = "", this.controller = new C(this.el, this._file), this.controller.dispatch("initialize", { controller: this.controller });
|
|
4731
4731
|
};
|
|
4732
4732
|
controller;
|
|
4733
4733
|
_file;
|
|
@@ -4739,41 +4739,41 @@ var H2 = proxyCustomElement(class extends H {
|
|
|
4739
4739
|
get file() {
|
|
4740
4740
|
return this._file;
|
|
4741
4741
|
}
|
|
4742
|
-
set file(
|
|
4743
|
-
this.src = URL.createObjectURL(
|
|
4742
|
+
set file(t2) {
|
|
4743
|
+
this.src = URL.createObjectURL(t2), this.filename = t2.name, this.size = t2.size, this.state = "pending", this.percent = 0, this._file = t2;
|
|
4744
4744
|
}
|
|
4745
|
-
set signedId(
|
|
4746
|
-
this.value !==
|
|
4747
|
-
this.src = `/rails/active_storage/blobs/redirect/${
|
|
4745
|
+
set signedId(t2) {
|
|
4746
|
+
this.value !== t2 && ((t3, e3 = {}, i2 = {}) => ((t4, e4, i3, s) => new X("get", e4, { headers: { Accept: "application/json", ...s }, query: i3 }).perform().then(((t5) => t5.response.ok ? t5.json : t5)))(0, t3, e3, i2))(`/rails/active_storage/blobs/info/${t2}`).then(((e3) => {
|
|
4747
|
+
this.src = `/rails/active_storage/blobs/redirect/${t2}/${e3.filename}`, this.filename = e3.filename, this.size = e3.byte_size, this.state = "complete", this.percent = 100, this.value = t2, this.readyEvent.emit(this);
|
|
4748
4748
|
}));
|
|
4749
4749
|
}
|
|
4750
|
-
setMissingFiletype(
|
|
4750
|
+
setMissingFiletype(t2, e3) {
|
|
4751
4751
|
!this.filetype && this.filename && (this.filetype = F.getFileType(this.filename));
|
|
4752
4752
|
}
|
|
4753
|
-
start(
|
|
4753
|
+
start(t2) {
|
|
4754
4754
|
this.state = "pending", this.percent = 0;
|
|
4755
4755
|
}
|
|
4756
|
-
progress(
|
|
4757
|
-
const { progress: e3 } =
|
|
4756
|
+
progress(t2) {
|
|
4757
|
+
const { progress: e3 } = t2.detail;
|
|
4758
4758
|
this.percent = e3;
|
|
4759
4759
|
}
|
|
4760
|
-
error(
|
|
4761
|
-
|
|
4762
|
-
const { error: e3 } =
|
|
4760
|
+
error(t2) {
|
|
4761
|
+
t2.preventDefault();
|
|
4762
|
+
const { error: e3 } = t2.detail;
|
|
4763
4763
|
this.state = "error", this.uploadError = e3;
|
|
4764
4764
|
}
|
|
4765
|
-
end(
|
|
4765
|
+
end(t2) {
|
|
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: "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: (
|
|
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: (t2) => t2.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");
|
|
4773
4773
|
}
|
|
4774
4774
|
checkValidity() {
|
|
4775
|
-
let
|
|
4776
|
-
return
|
|
4775
|
+
let t2 = [];
|
|
4776
|
+
return t2.push(...new B(this).errors), t2.push(...new q(this).errors), this.validationError = t2.join(" "), this.validationEvent.emit({ valid: 0 === t2.length, error: this.validationError }), 0 === t2.length;
|
|
4777
4777
|
}
|
|
4778
4778
|
static get watchers() {
|
|
4779
4779
|
return { filename: [{ setMissingFiletype: 0 }] };
|
|
@@ -4790,30 +4790,45 @@ var o = H2;
|
|
|
4790
4790
|
var e = a;
|
|
4791
4791
|
|
|
4792
4792
|
// dist/components/index2.js
|
|
4793
|
-
var
|
|
4794
|
-
function
|
|
4795
|
-
const
|
|
4796
|
-
if (Number.isNaN(
|
|
4797
|
-
return Math.min(100, Math.max(0,
|
|
4793
|
+
var r = null;
|
|
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
4798
|
}
|
|
4799
|
-
|
|
4799
|
+
function e2(r4) {
|
|
4800
|
+
const n3 = Number(r4);
|
|
4801
|
+
if (Number.isNaN(n3)) throw new TypeError(`progress-bar: rate must be numeric, got ${JSON.stringify(r4)}`);
|
|
4802
|
+
return n3;
|
|
4803
|
+
}
|
|
4804
|
+
var t = class extends HTMLElement {
|
|
4800
4805
|
constructor() {
|
|
4801
|
-
super(), this.attachShadow({ mode: "open" }), this._percent = null, this._renderedMode = null;
|
|
4806
|
+
super(), this.attachShadow({ mode: "open" }), this._percent = null, this._renderedMode = null, this._rateTimer = null;
|
|
4802
4807
|
}
|
|
4803
4808
|
connectedCallback() {
|
|
4804
|
-
this.render(), this.setAttribute("role", "progressbar"), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuemax", "100"), this.updateBar();
|
|
4809
|
+
this.render(), this.setAttribute("role", "progressbar"), this.setAttribute("aria-valuemin", "0"), this.setAttribute("aria-valuemax", "100"), this.updateBar(), this._syncTicker();
|
|
4810
|
+
}
|
|
4811
|
+
disconnectedCallback() {
|
|
4812
|
+
this._stopTicker();
|
|
4805
4813
|
}
|
|
4806
4814
|
get percent() {
|
|
4807
4815
|
return this._percent;
|
|
4808
4816
|
}
|
|
4809
|
-
set percent(
|
|
4810
|
-
null ==
|
|
4817
|
+
set percent(r4) {
|
|
4818
|
+
null == r4 ? this.removeAttribute("percent") : this.setAttribute("percent", n2(r4));
|
|
4811
4819
|
}
|
|
4812
4820
|
get error() {
|
|
4813
4821
|
return this.hasAttribute("error");
|
|
4814
4822
|
}
|
|
4815
|
-
set error(
|
|
4816
|
-
this.toggleAttribute("error", Boolean(
|
|
4823
|
+
set error(r4) {
|
|
4824
|
+
this.toggleAttribute("error", Boolean(r4));
|
|
4825
|
+
}
|
|
4826
|
+
get rate() {
|
|
4827
|
+
const r4 = this.getAttribute("rate");
|
|
4828
|
+
return null === r4 ? null : Number(r4);
|
|
4829
|
+
}
|
|
4830
|
+
set rate(r4) {
|
|
4831
|
+
null == r4 ? this.removeAttribute("rate") : this.setAttribute("rate", e2(r4));
|
|
4817
4832
|
}
|
|
4818
4833
|
get indeterminate() {
|
|
4819
4834
|
return !this.hasAttribute("percent");
|
|
@@ -4821,28 +4836,39 @@ var e2 = class extends HTMLElement {
|
|
|
4821
4836
|
get mode() {
|
|
4822
4837
|
return "circular" === this.getAttribute("mode") ? "circular" : "linear";
|
|
4823
4838
|
}
|
|
4824
|
-
set mode(
|
|
4825
|
-
this.setAttribute("mode",
|
|
4839
|
+
set mode(r4) {
|
|
4840
|
+
this.setAttribute("mode", r4);
|
|
4826
4841
|
}
|
|
4827
4842
|
static get observedAttributes() {
|
|
4828
|
-
return ["percent", "mode"];
|
|
4843
|
+
return ["percent", "mode", "rate"];
|
|
4829
4844
|
}
|
|
4830
|
-
attributeChangedCallback(
|
|
4831
|
-
"percent" ===
|
|
4845
|
+
attributeChangedCallback(r4, t2, i2) {
|
|
4846
|
+
"percent" === r4 && (this._percent = null === i2 ? null : n2(i2)), "rate" === r4 && null !== i2 && e2(i2), "mode" === r4 && this.render(), "percent" !== r4 && "rate" !== r4 || this._syncTicker(), this.updateBar();
|
|
4832
4847
|
}
|
|
4833
4848
|
updateBar() {
|
|
4834
4849
|
if ("circular" === this.mode) {
|
|
4835
|
-
const
|
|
4836
|
-
|
|
4850
|
+
const r4 = this.shadowRoot?.querySelector(".progress-ring");
|
|
4851
|
+
r4 && (r4.style.strokeDashoffset = this.indeterminate ? "" : String(100 * (1 - this._percent / 100)));
|
|
4837
4852
|
} else {
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4853
|
+
const r4 = this.shadowRoot?.querySelector(".bar");
|
|
4854
|
+
r4 && (r4.style.width = this.indeterminate ? "" : `${this._percent}%`);
|
|
4840
4855
|
}
|
|
4841
4856
|
this.indeterminate ? this.removeAttribute("aria-valuenow") : this.setAttribute("aria-valuenow", String(this._percent));
|
|
4842
4857
|
}
|
|
4858
|
+
_syncTicker() {
|
|
4859
|
+
const r4 = Number(this.getAttribute("rate")), n3 = this.isConnected && !this.indeterminate && Number.isFinite(r4) && 0 !== r4;
|
|
4860
|
+
n3 && null === this._rateTimer ? this._rateTimer = setInterval((() => this._tick()), 1e3 / 30) : n3 || this._stopTicker();
|
|
4861
|
+
}
|
|
4862
|
+
_stopTicker() {
|
|
4863
|
+
null !== this._rateTimer && (clearInterval(this._rateTimer), this._rateTimer = null);
|
|
4864
|
+
}
|
|
4865
|
+
_tick() {
|
|
4866
|
+
const r4 = Number(this.getAttribute("rate")), e3 = n2(this._percent + r4 / 30);
|
|
4867
|
+
e3 !== this._percent && (this.percent = e3), 0 !== e3 && 100 !== e3 || this.removeAttribute("rate");
|
|
4868
|
+
}
|
|
4843
4869
|
render() {
|
|
4844
|
-
const
|
|
4845
|
-
this._renderedMode !==
|
|
4870
|
+
const n3 = this.mode;
|
|
4871
|
+
this._renderedMode !== n3 && (this._renderedMode = n3, this.shadowRoot.adoptedStyleSheets = [(r || (r = new CSSStyleSheet(), r.replaceSync(`
|
|
4846
4872
|
:host {
|
|
4847
4873
|
--progress-color: #2E7D32;
|
|
4848
4874
|
--error-color: #7a242f;
|
|
@@ -4984,39 +5010,39 @@ var e2 = class extends HTMLElement {
|
|
|
4984
5010
|
:host([error]) .progress-ring { display: none; }
|
|
4985
5011
|
:host([error]) .ring { animation: none; }
|
|
4986
5012
|
:host([error]) .error-mark { display: block; }
|
|
4987
|
-
`)),
|
|
5013
|
+
`)), r)], this.shadowRoot.innerHTML = "circular" === n3 ? '\n <div class="circular">\n <svg class="ring" viewBox="0 0 100 100">\n <circle class="track" cx="50" cy="50" r="40"></circle>\n <circle class="progress-ring" cx="50" cy="50" r="40" pathLength="100"></circle>\n <path class="error-mark" d="M37 37 L63 63 M63 37 L37 63"></path>\n </svg>\n <span class="label"><slot></slot></span>\n </div>\n' : '\n <div class="bar"></div>\n <div class="text"><slot></slot></div>\n');
|
|
4988
5014
|
}
|
|
4989
5015
|
};
|
|
4990
|
-
customElements.get("progress-bar") || customElements.define("progress-bar",
|
|
5016
|
+
customElements.get("progress-bar") || customElements.define("progress-bar", t);
|
|
4991
5017
|
|
|
4992
5018
|
// dist/components/input-attachment.js
|
|
4993
5019
|
var o2 = class _o {
|
|
4994
|
-
static instance(
|
|
4995
|
-
return
|
|
5020
|
+
static instance(t2, e3 = {}) {
|
|
5021
|
+
return t2.inputAttachmentFormController ||= new _o(t2, e3);
|
|
4996
5022
|
}
|
|
4997
5023
|
dialog;
|
|
4998
5024
|
element;
|
|
4999
5025
|
controllers;
|
|
5000
5026
|
submitted;
|
|
5001
5027
|
processing;
|
|
5002
|
-
constructor(
|
|
5003
|
-
this.element =
|
|
5028
|
+
constructor(t2, { uploadDialog: e3 = true } = {}) {
|
|
5029
|
+
this.element = t2, 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", ((t3) => this.submit(t3))), window.addEventListener("beforeunload", ((t3) => this.beforeUnload(t3))), this.element.addEventListener("direct-upload:initialize", ((t3) => this.init(t3))), this.element.addEventListener("direct-upload:start", ((t3) => this.start(t3))), this.element.addEventListener("direct-upload:progress", ((t3) => this.progress(t3))), this.element.addEventListener("direct-upload:error", ((t3) => this.error(t3))), this.element.addEventListener("direct-upload:end", ((t3) => this.end(t3))), this.element.addEventListener("attachment-file:remove", ((t3) => this.removeUploadedFile(t3)));
|
|
5004
5030
|
}
|
|
5005
|
-
beforeUnload(
|
|
5006
|
-
if (this.processing) return
|
|
5031
|
+
beforeUnload(t2) {
|
|
5032
|
+
if (this.processing) return t2.preventDefault(), t2.returnValue = "";
|
|
5007
5033
|
}
|
|
5008
|
-
submit(
|
|
5009
|
-
(0 !== this.controllers.length || this.hasUploadErrors() || this.processing) && (
|
|
5034
|
+
submit(t2) {
|
|
5035
|
+
(0 !== this.controllers.length || this.hasUploadErrors() || this.processing) && (t2.preventDefault(), this.submitted = true, this.setInputAttachmentsDisabled(true), this.startNextController(), this.processing && this.dialog?.open());
|
|
5010
5036
|
}
|
|
5011
5037
|
startNextController() {
|
|
5012
5038
|
if (this.processing) return;
|
|
5013
|
-
const
|
|
5014
|
-
|
|
5015
|
-
this.submitted ? e3 && this.setInputAttachmentsDisabled(false) : this.setControllerInputDisabled(
|
|
5039
|
+
const t2 = this.controllers.shift();
|
|
5040
|
+
t2 ? (this.processing = true, this.submitted ? this.setInputAttachmentsDisabled(true) : this.setControllerInputDisabled(t2, true), t2.start(((e3) => {
|
|
5041
|
+
this.submitted ? e3 && this.setInputAttachmentsDisabled(false) : this.setControllerInputDisabled(t2, false), this.processing = false, this.startNextController();
|
|
5016
5042
|
}))) : this.submitForm();
|
|
5017
5043
|
}
|
|
5018
5044
|
hasUploadErrors() {
|
|
5019
|
-
return Array.from(this.element.querySelectorAll("attachment-file")).some(((
|
|
5045
|
+
return Array.from(this.element.querySelectorAll("attachment-file")).some(((t2) => "error" === t2.state));
|
|
5020
5046
|
}
|
|
5021
5047
|
submitForm() {
|
|
5022
5048
|
if (this.submitted) {
|
|
@@ -5026,36 +5052,36 @@ var o2 = class _o {
|
|
|
5026
5052
|
}));
|
|
5027
5053
|
}
|
|
5028
5054
|
}
|
|
5029
|
-
setControllerInputDisabled(
|
|
5030
|
-
const i2 =
|
|
5055
|
+
setControllerInputDisabled(t2, e3) {
|
|
5056
|
+
const i2 = t2.uploadedFile.closest("input-attachment");
|
|
5031
5057
|
i2 && (i2.disabled = e3);
|
|
5032
5058
|
}
|
|
5033
|
-
setInputAttachmentsDisabled(
|
|
5059
|
+
setInputAttachmentsDisabled(t2) {
|
|
5034
5060
|
Array.from(this.element.querySelectorAll("input-attachment")).forEach(((e3) => {
|
|
5035
|
-
e3.disabled =
|
|
5061
|
+
e3.disabled = t2;
|
|
5036
5062
|
}));
|
|
5037
5063
|
}
|
|
5038
|
-
init(
|
|
5039
|
-
const { id: e3, file: i2, controller: s } =
|
|
5064
|
+
init(t2) {
|
|
5065
|
+
const { id: e3, file: i2, controller: s } = t2.detail;
|
|
5040
5066
|
this.dialog?.addUpload("direct-upload-" + e3, i2?.name || "Uploading..."), this.controllers.push(s), this.startNextController();
|
|
5041
5067
|
}
|
|
5042
|
-
start(
|
|
5043
|
-
this.dialog?.startUpload("direct-upload-" +
|
|
5068
|
+
start(t2) {
|
|
5069
|
+
this.dialog?.startUpload("direct-upload-" + t2.detail.id);
|
|
5044
5070
|
}
|
|
5045
|
-
progress(
|
|
5046
|
-
const { id: e3, progress: i2 } =
|
|
5071
|
+
progress(t2) {
|
|
5072
|
+
const { id: e3, progress: i2 } = t2.detail;
|
|
5047
5073
|
this.dialog?.updateProgress("direct-upload-" + e3, i2);
|
|
5048
5074
|
}
|
|
5049
|
-
error(
|
|
5050
|
-
|
|
5051
|
-
const { id: e3, error: i2 } =
|
|
5075
|
+
error(t2) {
|
|
5076
|
+
t2.preventDefault();
|
|
5077
|
+
const { id: e3, error: i2 } = t2.detail;
|
|
5052
5078
|
this.dialog?.setError("direct-upload-" + e3, i2);
|
|
5053
5079
|
}
|
|
5054
|
-
end(
|
|
5055
|
-
this.dialog?.completeUpload("direct-upload-" +
|
|
5080
|
+
end(t2) {
|
|
5081
|
+
this.dialog?.completeUpload("direct-upload-" + t2.detail.id);
|
|
5056
5082
|
}
|
|
5057
|
-
removeUploadedFile(
|
|
5058
|
-
const e3 =
|
|
5083
|
+
removeUploadedFile(t2) {
|
|
5084
|
+
const e3 = t2.detail, i2 = e3.controller?.directUpload?.id;
|
|
5059
5085
|
i2 && this.dialog?.removeUpload("direct-upload-" + i2), this.setInputAttachmentsDisabled(false), requestAnimationFrame((() => this.submitForm()));
|
|
5060
5086
|
}
|
|
5061
5087
|
};
|
|
@@ -5074,20 +5100,20 @@ var d2 = class extends HTMLElement {
|
|
|
5074
5100
|
this.removeEventListener("dragover", this.handleDragOver), this.removeEventListener("dragleave", this.handleDragLeave), this.removeEventListener("drop", this.handleDrop);
|
|
5075
5101
|
}
|
|
5076
5102
|
get fileTarget() {
|
|
5077
|
-
const
|
|
5078
|
-
return
|
|
5103
|
+
const t2 = this.getAttribute("for");
|
|
5104
|
+
return t2 ? document.querySelector("#" + t2) : null;
|
|
5079
5105
|
}
|
|
5080
|
-
handleDragOver(
|
|
5081
|
-
|
|
5106
|
+
handleDragOver(t2) {
|
|
5107
|
+
t2.preventDefault(), this.classList.add("-dragover");
|
|
5082
5108
|
}
|
|
5083
5109
|
handleDragLeave() {
|
|
5084
5110
|
this.classList.remove("-dragover");
|
|
5085
5111
|
}
|
|
5086
|
-
handleDrop(
|
|
5087
|
-
|
|
5112
|
+
handleDrop(t2) {
|
|
5113
|
+
t2.preventDefault(), this.classList.remove("-dragover");
|
|
5088
5114
|
const e3 = this.fileTarget;
|
|
5089
|
-
if (e3 &&
|
|
5090
|
-
e3.files =
|
|
5115
|
+
if (e3 && t2.dataTransfer.files.length > 0) {
|
|
5116
|
+
e3.files = t2.dataTransfer.files;
|
|
5091
5117
|
const i2 = new Event("change", { bubbles: true });
|
|
5092
5118
|
e3.dispatchEvent(i2);
|
|
5093
5119
|
}
|
|
@@ -5114,13 +5140,13 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5114
5140
|
internals;
|
|
5115
5141
|
fileInput;
|
|
5116
5142
|
_files = [];
|
|
5117
|
-
constructor(
|
|
5118
|
-
super(), false !==
|
|
5143
|
+
constructor(t2) {
|
|
5144
|
+
super(), false !== t2 && this.__registerHost(), this.__attachShadow(), this.internals = this.el.attachInternals();
|
|
5119
5145
|
}
|
|
5120
5146
|
componentWillLoad() {
|
|
5121
5147
|
this.form = this.internals.form, this.form && (this.form.addEventListener("reset", (() => this.reset())), o2.instance(this.form, { uploadDialog: this.uploadDialog }));
|
|
5122
|
-
const
|
|
5123
|
-
|
|
5148
|
+
const t2 = Array.from(this.el.children).filter(((t3) => "ATTACHMENT-FILE" == t3.tagName));
|
|
5149
|
+
t2.length > 0 && (this.files = t2), this.files.length > 0 && this.updateFormValue();
|
|
5124
5150
|
}
|
|
5125
5151
|
componentDidLoad() {
|
|
5126
5152
|
this.fileInput?.addEventListener("change", this.handleFileInputChange);
|
|
@@ -5128,26 +5154,26 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5128
5154
|
get files() {
|
|
5129
5155
|
return this._files;
|
|
5130
5156
|
}
|
|
5131
|
-
set files(
|
|
5132
|
-
this._files =
|
|
5157
|
+
set files(t2) {
|
|
5158
|
+
this._files = t2, this.multiple || (this._files = this._files.slice(-1)), forceUpdate(this.el), this.fireChangeEvent();
|
|
5133
5159
|
}
|
|
5134
5160
|
get value() {
|
|
5135
|
-
return JSON.stringify(this.files.map(((
|
|
5161
|
+
return JSON.stringify(this.files.map(((t2) => ({ value: t2.value, filename: t2.filename, src: t2.src, state: t2.state, percent: t2.percent, size: t2.size, filetype: t2.filetype }))));
|
|
5136
5162
|
}
|
|
5137
|
-
set value(
|
|
5138
|
-
const e3 = JSON.parse(
|
|
5139
|
-
0 !== e3.length ? (this.files = e3.map(((
|
|
5163
|
+
set value(t2) {
|
|
5164
|
+
const e3 = JSON.parse(t2 || "[]");
|
|
5165
|
+
0 !== e3.length ? (this.files = e3.map(((t3) => {
|
|
5140
5166
|
const e4 = document.createElement("attachment-file");
|
|
5141
|
-
return e4.name = this.name, e4.preview = this.preview, e4.value =
|
|
5167
|
+
return e4.name = this.name, e4.preview = this.preview, e4.value = t3.value, e4.filename = t3.filename, e4.src = t3.src, e4.state = t3.state || "complete", e4.percent = t3.percent || 100, e4.size = t3.size, e4.filetype = t3.filetype, e4;
|
|
5142
5168
|
})), requestAnimationFrame((() => this.componentDidRender()))) : this.files = [];
|
|
5143
5169
|
}
|
|
5144
5170
|
updateFormValue() {
|
|
5145
5171
|
if (!this.name || !this.internals?.setFormValue) return;
|
|
5146
|
-
const
|
|
5147
|
-
if (this.multiple ? (e3.forEach(((e4) =>
|
|
5172
|
+
const t2 = new FormData(), e3 = this.files.map(((t3) => t3.value)).filter(((t3) => t3 && "string" != typeof t3 ? (console.error("[input-attachment] Non-string value detected on attachment-file:", typeof t3, t3, Error().stack), false) : "string" == typeof t3 && t3.length > 0));
|
|
5173
|
+
if (this.multiple ? (e3.forEach(((e4) => t2.append(this.name, e4))), 0 === e3.length && t2.append(this.name, "")) : t2.set(this.name, e3[0] || ""), this.internals.setFormValue(t2), this.required && 0 === this.files.length) this.internals.setValidity({ valueMissing: true }, "Please select a file.", this.fileInput);
|
|
5148
5174
|
else {
|
|
5149
|
-
const
|
|
5150
|
-
|
|
5175
|
+
const t3 = this.files.map(((t4) => t4.validationError)).filter(((t4) => t4 && t4.length > 0));
|
|
5176
|
+
t3.length > 0 ? this.internals.setValidity({ customError: true }, t3[0], this.fileInput) : this.internals.setValidity({});
|
|
5151
5177
|
}
|
|
5152
5178
|
}
|
|
5153
5179
|
reset() {
|
|
@@ -5156,19 +5182,19 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5156
5182
|
handleFileInputChange = () => {
|
|
5157
5183
|
this.fileInput?.files?.length && (this.addFiles(this.fileInput.files), this.fileInput.value = null);
|
|
5158
5184
|
};
|
|
5159
|
-
handleDrop = (
|
|
5160
|
-
|
|
5185
|
+
handleDrop = (t2) => {
|
|
5186
|
+
t2.preventDefault(), this.isDisabled || t2.dataTransfer?.files?.length && this.addFiles(t2.dataTransfer.files);
|
|
5161
5187
|
};
|
|
5162
|
-
removeUploadedFile(
|
|
5163
|
-
!(function(
|
|
5164
|
-
const i2 =
|
|
5165
|
-
-1 !== i2 &&
|
|
5166
|
-
})(this.files,
|
|
5188
|
+
removeUploadedFile(t2) {
|
|
5189
|
+
!(function(t3, e3) {
|
|
5190
|
+
const i2 = t3.findIndex(((t4) => t4 === e3));
|
|
5191
|
+
-1 !== i2 && t3.splice(i2, 1);
|
|
5192
|
+
})(this.files, t2.detail), this.files = this.files;
|
|
5167
5193
|
}
|
|
5168
|
-
handleChildValidation(
|
|
5194
|
+
handleChildValidation(t2) {
|
|
5169
5195
|
this.updateFormValue();
|
|
5170
5196
|
}
|
|
5171
|
-
handleChildReady(
|
|
5197
|
+
handleChildReady(t2) {
|
|
5172
5198
|
this.updateFormValue();
|
|
5173
5199
|
}
|
|
5174
5200
|
fireChangeEvent() {
|
|
@@ -5180,38 +5206,38 @@ var c3 = proxyCustomElement(class extends H {
|
|
|
5180
5206
|
return this.disabled || !!this.el.closest("fieldset[disabled]");
|
|
5181
5207
|
}
|
|
5182
5208
|
render() {
|
|
5183
|
-
return h(Host, { key: "59748e20522a9e4ab161e9810b42bd19e9f53680" }, h("input", { key: "36d0bbf56a1eab608ae86f39641fbf44eeb999d8", ref: (
|
|
5209
|
+
return h(Host, { key: "59748e20522a9e4ab161e9810b42bd19e9f53680" }, h("input", { key: "36d0bbf56a1eab608ae86f39641fbf44eeb999d8", ref: (t2) => this.fileInput = t2, type: "file", "aria-label": "Choose " + (this.multiple ? "files" : "file"), multiple: this.multiple, accept: this.accepts, required: this.required && 0 === this.files.length, disabled: this.isDisabled, onChange: () => this.handleFileInputChange() }), h("file-drop", { key: "00348d5fa7495a5f0a9d4868b99ac3f9708fb874", onClick: () => this.fileInput?.click(), onDrop: this.handleDrop }, h("p", { key: "aa0ee6f54ffb4d23c84376af60040c6df103e84f", part: "title" }, h("strong", { key: "708c2c367984ed4439c6666fba613b7b8bab06a4" }, "Choose ", this.multiple ? "files" : "file", " "), h("span", { key: "b82c6eab958d846af3ce11fca9cfaab9c6311074" }, "or drag ", this.multiple ? "them" : "it", " here.")), h("div", { key: "8e5e5c7b319c4fe88266f9e7a1aab5dbb7352c3b", class: "media-preview " + (this.multiple ? "-stacked" : "") }, h("slot", { key: "f0354fcd6c301e98a91422e2e65f0aff3e78ffde" }))));
|
|
5184
5210
|
}
|
|
5185
5211
|
componentDidRender() {
|
|
5186
5212
|
if (0 === this.files.length) {
|
|
5187
|
-
const
|
|
5188
|
-
|
|
5213
|
+
const t3 = Array.from(this.el.children).filter(((t4) => "ATTACHMENT-FILE" == t4.tagName));
|
|
5214
|
+
t3.length > 0 && (this._files = t3);
|
|
5189
5215
|
}
|
|
5190
|
-
const
|
|
5191
|
-
this.files.forEach(((e4) =>
|
|
5216
|
+
const t2 = document.createElement("div");
|
|
5217
|
+
this.files.forEach(((e4) => t2.appendChild(e4)));
|
|
5192
5218
|
let e3 = false;
|
|
5193
|
-
if (
|
|
5194
|
-
else for (let i2 = 0; i2 <
|
|
5219
|
+
if (t2.children.length !== this.el.children.length) e3 = true;
|
|
5220
|
+
else for (let i2 = 0; i2 < t2.children.length; i2++) if (t2.children[i2] !== this.el.children[i2]) {
|
|
5195
5221
|
e3 = true;
|
|
5196
5222
|
break;
|
|
5197
5223
|
}
|
|
5198
5224
|
if (e3) {
|
|
5199
5225
|
for (; this.el.firstChild; ) this.el.removeChild(this.el.firstChild);
|
|
5200
|
-
this.el.appendChild(
|
|
5226
|
+
this.el.appendChild(t2);
|
|
5201
5227
|
}
|
|
5202
5228
|
this.updateFormValue();
|
|
5203
5229
|
}
|
|
5204
|
-
addFiles(
|
|
5205
|
-
Array.from(
|
|
5230
|
+
addFiles(t2) {
|
|
5231
|
+
Array.from(t2).forEach(((t3) => {
|
|
5206
5232
|
const e3 = document.createElement("attachment-file");
|
|
5207
|
-
e3.name = this.name, e3.preview = this.preview, e3.setAttribute("url", this.directupload), e3.accepts = this.accepts, e3.max = this.max, e3.file =
|
|
5233
|
+
e3.name = this.name, e3.preview = this.preview, e3.setAttribute("url", this.directupload), e3.accepts = this.accepts, e3.max = this.max, e3.file = t3, this._files.push(e3);
|
|
5208
5234
|
})), this.files = this._files, requestAnimationFrame((() => this.componentDidRender()));
|
|
5209
5235
|
}
|
|
5210
5236
|
checkValidity() {
|
|
5211
5237
|
return !this.required || 0 !== this.files.length;
|
|
5212
5238
|
}
|
|
5213
|
-
setCustomValidity(
|
|
5214
|
-
this.internals.setValidity(
|
|
5239
|
+
setCustomValidity(t2) {
|
|
5240
|
+
this.internals.setValidity(t2 ? { customError: true } : {}, t2, this.fileInput);
|
|
5215
5241
|
}
|
|
5216
5242
|
reportValidity() {
|
|
5217
5243
|
return this.internals.reportValidity();
|
|
@@ -5241,23 +5267,23 @@ var r2 = proxyCustomElement(class extends H {
|
|
|
5241
5267
|
async close() {
|
|
5242
5268
|
this.dialog.close();
|
|
5243
5269
|
}
|
|
5244
|
-
async addUpload(e3,
|
|
5245
|
-
this.uploads = [...this.uploads, { id: e3, filename:
|
|
5270
|
+
async addUpload(e3, t2) {
|
|
5271
|
+
this.uploads = [...this.uploads, { id: e3, filename: t2, pending: true, percent: 0, complete: false, error: null }];
|
|
5246
5272
|
}
|
|
5247
5273
|
async startUpload(e3) {
|
|
5248
|
-
this.uploads = this.uploads.map(((
|
|
5274
|
+
this.uploads = this.uploads.map(((t2) => t2.id === e3 ? { ...t2, pending: false } : t2));
|
|
5249
5275
|
}
|
|
5250
|
-
async updateProgress(e3,
|
|
5251
|
-
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, percent:
|
|
5276
|
+
async updateProgress(e3, t2) {
|
|
5277
|
+
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, percent: t2 } : a3));
|
|
5252
5278
|
}
|
|
5253
|
-
async setError(e3,
|
|
5254
|
-
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, error:
|
|
5279
|
+
async setError(e3, t2) {
|
|
5280
|
+
this.uploads = this.uploads.map(((a3) => a3.id === e3 ? { ...a3, error: t2 } : a3));
|
|
5255
5281
|
}
|
|
5256
5282
|
async completeUpload(e3) {
|
|
5257
|
-
this.uploads = this.uploads.map(((
|
|
5283
|
+
this.uploads = this.uploads.map(((t2) => t2.id === e3 ? { ...t2, complete: true } : t2));
|
|
5258
5284
|
}
|
|
5259
5285
|
async removeUpload(e3) {
|
|
5260
|
-
this.uploads = this.uploads.filter(((
|
|
5286
|
+
this.uploads = this.uploads.filter(((t2) => t2.id !== e3));
|
|
5261
5287
|
}
|
|
5262
5288
|
render() {
|
|
5263
5289
|
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)))))));
|