@oardi/ts-utils 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/array-extension.d.ts +13 -0
- package/extensions/array-extension.d.ts.map +1 -0
- package/extensions/date-extension.d.ts +18 -0
- package/extensions/date-extension.d.ts.map +1 -0
- package/extensions/{index.ts → index.d.ts} +1 -0
- package/extensions/index.d.ts.map +1 -0
- package/extensions/string-extensions.d.ts +9 -0
- package/extensions/string-extensions.d.ts.map +1 -0
- package/helpers/browser/browser-type.enum.d.ts +14 -0
- package/helpers/browser/browser-type.enum.d.ts.map +1 -0
- package/helpers/browser/browser.helper.d.ts +16 -0
- package/helpers/browser/browser.helper.d.ts.map +1 -0
- package/helpers/browser/{index.ts → index.d.ts} +1 -0
- package/helpers/browser/index.d.ts.map +1 -0
- package/helpers/clipboard.helper.d.ts +2 -0
- package/helpers/clipboard.helper.d.ts.map +1 -0
- package/helpers/csv.helper.d.ts +6 -0
- package/helpers/csv.helper.d.ts.map +1 -0
- package/helpers/download.helper.d.ts +14 -0
- package/helpers/download.helper.d.ts.map +1 -0
- package/helpers/enum.helper.d.ts +6 -0
- package/helpers/enum.helper.d.ts.map +1 -0
- package/helpers/file.helper.d.ts +16 -0
- package/helpers/file.helper.d.ts.map +1 -0
- package/helpers/{index.ts → index.d.ts} +1 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/local-storage.helper.d.ts +8 -0
- package/helpers/local-storage.helper.d.ts.map +1 -0
- package/helpers/logger/index.d.ts +4 -0
- package/helpers/logger/index.d.ts.map +1 -0
- package/helpers/logger/logger-type.enum.d.ts +8 -0
- package/helpers/logger/logger-type.enum.d.ts.map +1 -0
- package/helpers/logger/logger.helper.d.ts +15 -0
- package/helpers/logger/logger.helper.d.ts.map +1 -0
- package/helpers/logger/{logger.types.ts → logger.types.d.ts} +4 -5
- package/helpers/logger/logger.types.d.ts.map +1 -0
- package/helpers/sort.helper.d.ts +2 -0
- package/helpers/sort.helper.d.ts.map +1 -0
- package/helpers/token/{index.ts → index.d.ts} +1 -0
- package/helpers/token/index.d.ts.map +1 -0
- package/helpers/token/{token-type.enum.ts → token-type.enum.d.ts} +1 -0
- package/helpers/token/token-type.enum.d.ts.map +1 -0
- package/helpers/token/token.helper.d.ts +7 -0
- package/helpers/token/token.helper.d.ts.map +1 -0
- package/index.cjs.js +15 -0
- package/{index.ts → index.d.ts} +1 -0
- package/index.d.ts.map +1 -0
- package/index.es.js +1126 -0
- package/index.umd.js +15 -0
- package/interfaces/{index.ts → index.d.ts} +1 -0
- package/interfaces/index.d.ts.map +1 -0
- package/interfaces/keyvalue.interface.d.ts +5 -0
- package/interfaces/keyvalue.interface.d.ts.map +1 -0
- package/package.json +1 -1
- package/readme.md +15 -0
- package/services/browser/browser.consts.d.ts +3 -0
- package/services/browser/browser.consts.d.ts.map +1 -0
- package/services/browser/browser.interface.d.ts +6 -0
- package/services/browser/browser.interface.d.ts.map +1 -0
- package/services/browser/browser.service.d.ts +30 -0
- package/services/browser/browser.service.d.ts.map +1 -0
- package/services/browser/{browser.types.ts → browser.types.d.ts} +1 -1
- package/services/browser/browser.types.d.ts.map +1 -0
- package/services/browser/{index.ts → index.d.ts} +1 -0
- package/services/browser/index.d.ts.map +1 -0
- package/services/index.d.ts +2 -0
- package/services/index.d.ts.map +1 -0
- package/types/index.d.ts +9 -0
- package/types/index.d.ts.map +1 -0
- package/vite.config.d.ts +3 -0
- package/vite.config.d.ts.map +1 -0
- package/extensions/array-extension.ts +0 -54
- package/extensions/date-extension.ts +0 -69
- package/extensions/string-extensions.ts +0 -21
- package/helpers/browser/browser-type.enum.ts +0 -13
- package/helpers/browser/browser.helper.ts +0 -95
- package/helpers/clipboard.helper.ts +0 -3
- package/helpers/csv.helper.ts +0 -23
- package/helpers/download.helper.ts +0 -127
- package/helpers/enum.helper.ts +0 -20
- package/helpers/file.helper.ts +0 -105
- package/helpers/local-storage.helper.ts +0 -30
- package/helpers/logger/index.ts +0 -1
- package/helpers/logger/logger-type.enum.ts +0 -7
- package/helpers/logger/logger.helper.ts +0 -63
- package/helpers/sort.helper.ts +0 -33
- package/helpers/token/token.helper.ts +0 -16
- package/interfaces/keyvalue.interface.ts +0 -7
- package/services/browser/browser.consts.ts +0 -11
- package/services/browser/browser.interface.ts +0 -6
- package/services/browser/browser.service.ts +0 -119
- package/services/index.ts +0 -1
- package/tsconfig.json +0 -33
- package/types/index.ts +0 -11
- package/vite.config.ts +0 -21
package/index.es.js
ADDED
|
@@ -0,0 +1,1126 @@
|
|
|
1
|
+
function Xe(s) {
|
|
2
|
+
return navigator.clipboard.writeText(s);
|
|
3
|
+
}
|
|
4
|
+
function be(s) {
|
|
5
|
+
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
|
|
6
|
+
}
|
|
7
|
+
var _e = { exports: {} };
|
|
8
|
+
/* @license
|
|
9
|
+
Papa Parse
|
|
10
|
+
v5.5.3
|
|
11
|
+
https://github.com/mholt/PapaParse
|
|
12
|
+
License: MIT
|
|
13
|
+
*/
|
|
14
|
+
var $e = _e.exports, De;
|
|
15
|
+
function Ce() {
|
|
16
|
+
return De || (De = 1, (function(s, r) {
|
|
17
|
+
((i, l) => {
|
|
18
|
+
s.exports = l();
|
|
19
|
+
})($e, function i() {
|
|
20
|
+
var l = typeof self < "u" ? self : typeof window < "u" ? window : l !== void 0 ? l : {}, v, M = !l.document && !!l.postMessage, T = l.IS_PAPA_WORKER || !1, P = {}, Y = 0, w = {};
|
|
21
|
+
function N(e) {
|
|
22
|
+
this._handle = null, this._finished = !1, this._completed = !1, this._halted = !1, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = !0, this._completeResults = { data: [], errors: [], meta: {} }, (function(t) {
|
|
23
|
+
var n = se(t);
|
|
24
|
+
n.chunkSize = parseInt(n.chunkSize), t.step || t.chunk || (n.chunkSize = null), this._handle = new ee(n), (this._handle.streamer = this)._config = n;
|
|
25
|
+
}).call(this, e), this.parseChunk = function(t, n) {
|
|
26
|
+
var o = parseInt(this._config.skipFirstNLines) || 0;
|
|
27
|
+
if (this.isFirstChunk && 0 < o) {
|
|
28
|
+
let S = this._config.newline;
|
|
29
|
+
S || (g = this._config.quoteChar || '"', S = this._handle.guessLineEndings(t, g)), t = [...t.split(S).slice(o)].join(S);
|
|
30
|
+
}
|
|
31
|
+
this.isFirstChunk && R(this._config.beforeFirstChunk) && (g = this._config.beforeFirstChunk(t)) !== void 0 && (t = g), this.isFirstChunk = !1, this._halted = !1;
|
|
32
|
+
var o = this._partialLine + t, g = (this._partialLine = "", this._handle.parse(o, this._baseIndex, !this._finished));
|
|
33
|
+
if (!this._handle.paused() && !this._handle.aborted()) {
|
|
34
|
+
if (t = g.meta.cursor, o = (this._finished || (this._partialLine = o.substring(t - this._baseIndex), this._baseIndex = t), g && g.data && (this._rowCount += g.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview), T) l.postMessage({ results: g, workerId: w.WORKER_ID, finished: o });
|
|
35
|
+
else if (R(this._config.chunk) && !n) {
|
|
36
|
+
if (this._config.chunk(g, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = !0);
|
|
37
|
+
this._completeResults = g = void 0;
|
|
38
|
+
}
|
|
39
|
+
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(g.data), this._completeResults.errors = this._completeResults.errors.concat(g.errors), this._completeResults.meta = g.meta), this._completed || !o || !R(this._config.complete) || g && g.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = !0), o || g && g.meta.paused || this._nextChunk(), g;
|
|
40
|
+
}
|
|
41
|
+
this._halted = !0;
|
|
42
|
+
}, this._sendError = function(t) {
|
|
43
|
+
R(this._config.error) ? this._config.error(t) : T && this._config.error && l.postMessage({ workerId: w.WORKER_ID, error: t, finished: !1 });
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function W(e) {
|
|
47
|
+
var t;
|
|
48
|
+
(e = e || {}).chunkSize || (e.chunkSize = w.RemoteChunkSize), N.call(this, e), this._nextChunk = M ? function() {
|
|
49
|
+
this._readChunk(), this._chunkLoaded();
|
|
50
|
+
} : function() {
|
|
51
|
+
this._readChunk();
|
|
52
|
+
}, this.stream = function(n) {
|
|
53
|
+
this._input = n, this._nextChunk();
|
|
54
|
+
}, this._readChunk = function() {
|
|
55
|
+
if (this._finished) this._chunkLoaded();
|
|
56
|
+
else {
|
|
57
|
+
if (t = new XMLHttpRequest(), this._config.withCredentials && (t.withCredentials = this._config.withCredentials), M || (t.onload = q(this._chunkLoaded, this), t.onerror = q(this._chunkError, this)), t.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !M), this._config.downloadRequestHeaders) {
|
|
58
|
+
var n, o = this._config.downloadRequestHeaders;
|
|
59
|
+
for (n in o) t.setRequestHeader(n, o[n]);
|
|
60
|
+
}
|
|
61
|
+
var g;
|
|
62
|
+
this._config.chunkSize && (g = this._start + this._config.chunkSize - 1, t.setRequestHeader("Range", "bytes=" + this._start + "-" + g));
|
|
63
|
+
try {
|
|
64
|
+
t.send(this._config.downloadRequestBody);
|
|
65
|
+
} catch (S) {
|
|
66
|
+
this._chunkError(S.message);
|
|
67
|
+
}
|
|
68
|
+
M && t.status === 0 && this._chunkError();
|
|
69
|
+
}
|
|
70
|
+
}, this._chunkLoaded = function() {
|
|
71
|
+
t.readyState === 4 && (t.status < 200 || 400 <= t.status ? this._chunkError() : (this._start += this._config.chunkSize || t.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((n) => (n = n.getResponseHeader("Content-Range")) !== null ? parseInt(n.substring(n.lastIndexOf("/") + 1)) : -1)(t), this.parseChunk(t.responseText)));
|
|
72
|
+
}, this._chunkError = function(n) {
|
|
73
|
+
n = t.statusText || n, this._sendError(new Error(n));
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function X(e) {
|
|
77
|
+
(e = e || {}).chunkSize || (e.chunkSize = w.LocalChunkSize), N.call(this, e);
|
|
78
|
+
var t, n, o = typeof FileReader < "u";
|
|
79
|
+
this.stream = function(g) {
|
|
80
|
+
this._input = g, n = g.slice || g.webkitSlice || g.mozSlice, o ? ((t = new FileReader()).onload = q(this._chunkLoaded, this), t.onerror = q(this._chunkError, this)) : t = new FileReaderSync(), this._nextChunk();
|
|
81
|
+
}, this._nextChunk = function() {
|
|
82
|
+
this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
|
|
83
|
+
}, this._readChunk = function() {
|
|
84
|
+
var g = this._input, S = (this._config.chunkSize && (S = Math.min(this._start + this._config.chunkSize, this._input.size), g = n.call(g, this._start, S)), t.readAsText(g, this._config.encoding));
|
|
85
|
+
o || this._chunkLoaded({ target: { result: S } });
|
|
86
|
+
}, this._chunkLoaded = function(g) {
|
|
87
|
+
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(g.target.result);
|
|
88
|
+
}, this._chunkError = function() {
|
|
89
|
+
this._sendError(t.error);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function K(e) {
|
|
93
|
+
var t;
|
|
94
|
+
N.call(this, e = e || {}), this.stream = function(n) {
|
|
95
|
+
return t = n, this._nextChunk();
|
|
96
|
+
}, this._nextChunk = function() {
|
|
97
|
+
var n, o;
|
|
98
|
+
if (!this._finished) return n = this._config.chunkSize, t = n ? (o = t.substring(0, n), t.substring(n)) : (o = t, ""), this._finished = !t, this.parseChunk(o);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function V(e) {
|
|
102
|
+
N.call(this, e = e || {});
|
|
103
|
+
var t = [], n = !0, o = !1;
|
|
104
|
+
this.pause = function() {
|
|
105
|
+
N.prototype.pause.apply(this, arguments), this._input.pause();
|
|
106
|
+
}, this.resume = function() {
|
|
107
|
+
N.prototype.resume.apply(this, arguments), this._input.resume();
|
|
108
|
+
}, this.stream = function(g) {
|
|
109
|
+
this._input = g, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
|
|
110
|
+
}, this._checkIsFinished = function() {
|
|
111
|
+
o && t.length === 1 && (this._finished = !0);
|
|
112
|
+
}, this._nextChunk = function() {
|
|
113
|
+
this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : n = !0;
|
|
114
|
+
}, this._streamData = q(function(g) {
|
|
115
|
+
try {
|
|
116
|
+
t.push(typeof g == "string" ? g : g.toString(this._config.encoding)), n && (n = !1, this._checkIsFinished(), this.parseChunk(t.shift()));
|
|
117
|
+
} catch (S) {
|
|
118
|
+
this._streamError(S);
|
|
119
|
+
}
|
|
120
|
+
}, this), this._streamError = q(function(g) {
|
|
121
|
+
this._streamCleanUp(), this._sendError(g);
|
|
122
|
+
}, this), this._streamEnd = q(function() {
|
|
123
|
+
this._streamCleanUp(), o = !0, this._streamData("");
|
|
124
|
+
}, this), this._streamCleanUp = q(function() {
|
|
125
|
+
this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
|
|
126
|
+
}, this);
|
|
127
|
+
}
|
|
128
|
+
function ee(e) {
|
|
129
|
+
var t, n, o, g, S = Math.pow(2, 53), m = -S, f = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, h = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, a = this, u = 0, c = 0, y = !1, p = !1, _ = [], d = { data: [], errors: [], meta: {} };
|
|
130
|
+
function O(b) {
|
|
131
|
+
return e.skipEmptyLines === "greedy" ? b.join("").trim() === "" : b.length === 1 && b[0].length === 0;
|
|
132
|
+
}
|
|
133
|
+
function C() {
|
|
134
|
+
if (d && o && (j("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + w.DefaultDelimiter + "'"), o = !1), e.skipEmptyLines && (d.data = d.data.filter(function(k) {
|
|
135
|
+
return !O(k);
|
|
136
|
+
})), B()) {
|
|
137
|
+
let k = function(A, F) {
|
|
138
|
+
R(e.transformHeader) && (A = e.transformHeader(A, F)), _.push(A);
|
|
139
|
+
};
|
|
140
|
+
if (d) if (Array.isArray(d.data[0])) {
|
|
141
|
+
for (var b = 0; B() && b < d.data.length; b++) d.data[b].forEach(k);
|
|
142
|
+
d.data.splice(0, 1);
|
|
143
|
+
} else d.data.forEach(k);
|
|
144
|
+
}
|
|
145
|
+
function D(k, A) {
|
|
146
|
+
for (var F = e.header ? {} : [], I = 0; I < k.length; I++) {
|
|
147
|
+
var L = I, $ = k[I], $ = ((G, x) => ((z) => (e.dynamicTypingFunction && e.dynamicTyping[z] === void 0 && (e.dynamicTyping[z] = e.dynamicTypingFunction(z)), (e.dynamicTyping[z] || e.dynamicTyping) === !0))(G) ? x === "true" || x === "TRUE" || x !== "false" && x !== "FALSE" && (((z) => {
|
|
148
|
+
if (f.test(z) && (z = parseFloat(z), m < z && z < S))
|
|
149
|
+
return 1;
|
|
150
|
+
})(x) ? parseFloat(x) : h.test(x) ? new Date(x) : x === "" ? null : x) : x)(L = e.header ? I >= _.length ? "__parsed_extra" : _[I] : L, $ = e.transform ? e.transform($, L) : $);
|
|
151
|
+
L === "__parsed_extra" ? (F[L] = F[L] || [], F[L].push($)) : F[L] = $;
|
|
152
|
+
}
|
|
153
|
+
return e.header && (I > _.length ? j("FieldMismatch", "TooManyFields", "Too many fields: expected " + _.length + " fields but parsed " + I, c + A) : I < _.length && j("FieldMismatch", "TooFewFields", "Too few fields: expected " + _.length + " fields but parsed " + I, c + A)), F;
|
|
154
|
+
}
|
|
155
|
+
var E;
|
|
156
|
+
d && (e.header || e.dynamicTyping || e.transform) && (E = 1, !d.data.length || Array.isArray(d.data[0]) ? (d.data = d.data.map(D), E = d.data.length) : d.data = D(d.data, 0), e.header && d.meta && (d.meta.fields = _), c += E);
|
|
157
|
+
}
|
|
158
|
+
function B() {
|
|
159
|
+
return e.header && _.length === 0;
|
|
160
|
+
}
|
|
161
|
+
function j(b, D, E, k) {
|
|
162
|
+
b = { type: b, code: D, message: E }, k !== void 0 && (b.row = k), d.errors.push(b);
|
|
163
|
+
}
|
|
164
|
+
R(e.step) && (g = e.step, e.step = function(b) {
|
|
165
|
+
d = b, B() ? C() : (C(), d.data.length !== 0 && (u += b.data.length, e.preview && u > e.preview ? n.abort() : (d.data = d.data[0], g(d, a))));
|
|
166
|
+
}), this.parse = function(b, D, E) {
|
|
167
|
+
var k = e.quoteChar || '"', k = (e.newline || (e.newline = this.guessLineEndings(b, k)), o = !1, e.delimiter ? R(e.delimiter) && (e.delimiter = e.delimiter(b), d.meta.delimiter = e.delimiter) : ((k = ((A, F, I, L, $) => {
|
|
168
|
+
var G, x, z, ue;
|
|
169
|
+
$ = $ || [",", " ", "|", ";", w.RECORD_SEP, w.UNIT_SEP];
|
|
170
|
+
for (var he = 0; he < $.length; he++) {
|
|
171
|
+
for (var te, pe = $[he], H = 0, re = 0, U = 0, Q = (z = void 0, new ce({ comments: L, delimiter: pe, newline: F, preview: 10 }).parse(A)), ae = 0; ae < Q.data.length; ae++) I && O(Q.data[ae]) ? U++ : (te = Q.data[ae].length, re += te, z === void 0 ? z = te : 0 < te && (H += Math.abs(te - z), z = te));
|
|
172
|
+
0 < Q.data.length && (re /= Q.data.length - U), (x === void 0 || H <= x) && (ue === void 0 || ue < re) && 1.99 < re && (x = H, G = pe, ue = re);
|
|
173
|
+
}
|
|
174
|
+
return { successful: !!(e.delimiter = G), bestDelimiter: G };
|
|
175
|
+
})(b, e.newline, e.skipEmptyLines, e.comments, e.delimitersToGuess)).successful ? e.delimiter = k.bestDelimiter : (o = !0, e.delimiter = w.DefaultDelimiter), d.meta.delimiter = e.delimiter), se(e));
|
|
176
|
+
return e.preview && e.header && k.preview++, t = b, n = new ce(k), d = n.parse(t, D, E), C(), y ? { meta: { paused: !0 } } : d || { meta: { paused: !1 } };
|
|
177
|
+
}, this.paused = function() {
|
|
178
|
+
return y;
|
|
179
|
+
}, this.pause = function() {
|
|
180
|
+
y = !0, n.abort(), t = R(e.chunk) ? "" : t.substring(n.getCharIndex());
|
|
181
|
+
}, this.resume = function() {
|
|
182
|
+
a.streamer._halted ? (y = !1, a.streamer.parseChunk(t, !0)) : setTimeout(a.resume, 3);
|
|
183
|
+
}, this.aborted = function() {
|
|
184
|
+
return p;
|
|
185
|
+
}, this.abort = function() {
|
|
186
|
+
p = !0, n.abort(), d.meta.aborted = !0, R(e.complete) && e.complete(d), t = "";
|
|
187
|
+
}, this.guessLineEndings = function(A, k) {
|
|
188
|
+
A = A.substring(0, 1048576);
|
|
189
|
+
var k = new RegExp(ie(k) + "([^]*?)" + ie(k), "gm"), E = (A = A.replace(k, "")).split("\r"), k = A.split(`
|
|
190
|
+
`), A = 1 < k.length && k[0].length < E[0].length;
|
|
191
|
+
if (E.length === 1 || A) return `
|
|
192
|
+
`;
|
|
193
|
+
for (var F = 0, I = 0; I < E.length; I++) E[I][0] === `
|
|
194
|
+
` && F++;
|
|
195
|
+
return F >= E.length / 2 ? `\r
|
|
196
|
+
` : "\r";
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function ie(e) {
|
|
200
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
201
|
+
}
|
|
202
|
+
function ce(e) {
|
|
203
|
+
var t = (e = e || {}).delimiter, n = e.newline, o = e.comments, g = e.step, S = e.preview, m = e.fastMode, f = null, h = !1, a = e.quoteChar == null ? '"' : e.quoteChar, u = a;
|
|
204
|
+
if (e.escapeChar !== void 0 && (u = e.escapeChar), (typeof t != "string" || -1 < w.BAD_DELIMITERS.indexOf(t)) && (t = ","), o === t) throw new Error("Comment character same as delimiter");
|
|
205
|
+
o === !0 ? o = "#" : (typeof o != "string" || -1 < w.BAD_DELIMITERS.indexOf(o)) && (o = !1), n !== `
|
|
206
|
+
` && n !== "\r" && n !== `\r
|
|
207
|
+
` && (n = `
|
|
208
|
+
`);
|
|
209
|
+
var c = 0, y = !1;
|
|
210
|
+
this.parse = function(p, _, d) {
|
|
211
|
+
if (typeof p != "string") throw new Error("Input must be a string");
|
|
212
|
+
var O = p.length, C = t.length, B = n.length, j = o.length, b = R(g), D = [], E = [], k = [], A = c = 0;
|
|
213
|
+
if (!p) return H();
|
|
214
|
+
if (m || m !== !1 && p.indexOf(a) === -1) {
|
|
215
|
+
for (var F = p.split(n), I = 0; I < F.length; I++) {
|
|
216
|
+
if (k = F[I], c += k.length, I !== F.length - 1) c += n.length;
|
|
217
|
+
else if (d) return H();
|
|
218
|
+
if (!o || k.substring(0, j) !== o) {
|
|
219
|
+
if (b) {
|
|
220
|
+
if (D = [], ue(k.split(t)), re(), y) return H();
|
|
221
|
+
} else ue(k.split(t));
|
|
222
|
+
if (S && S <= I) return D = D.slice(0, S), H(!0);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return H();
|
|
226
|
+
}
|
|
227
|
+
for (var L = p.indexOf(t, c), $ = p.indexOf(n, c), G = new RegExp(ie(u) + ie(a), "g"), x = p.indexOf(a, c); ; ) if (p[c] === a) for (x = c, c++; ; ) {
|
|
228
|
+
if ((x = p.indexOf(a, x + 1)) === -1) return d || E.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: D.length, index: c }), te();
|
|
229
|
+
if (x === O - 1) return te(p.substring(c, x).replace(G, a));
|
|
230
|
+
if (a === u && p[x + 1] === u) x++;
|
|
231
|
+
else if (a === u || x === 0 || p[x - 1] !== u) {
|
|
232
|
+
L !== -1 && L < x + 1 && (L = p.indexOf(t, x + 1));
|
|
233
|
+
var z = he(($ = $ !== -1 && $ < x + 1 ? p.indexOf(n, x + 1) : $) === -1 ? L : Math.min(L, $));
|
|
234
|
+
if (p.substr(x + 1 + z, C) === t) {
|
|
235
|
+
k.push(p.substring(c, x).replace(G, a)), p[c = x + 1 + z + C] !== a && (x = p.indexOf(a, c)), L = p.indexOf(t, c), $ = p.indexOf(n, c);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
if (z = he($), p.substring(x + 1 + z, x + 1 + z + B) === n) {
|
|
239
|
+
if (k.push(p.substring(c, x).replace(G, a)), pe(x + 1 + z + B), L = p.indexOf(t, c), x = p.indexOf(a, c), b && (re(), y)) return H();
|
|
240
|
+
if (S && D.length >= S) return H(!0);
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
E.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: D.length, index: c }), x++;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (o && k.length === 0 && p.substring(c, c + j) === o) {
|
|
247
|
+
if ($ === -1) return H();
|
|
248
|
+
c = $ + B, $ = p.indexOf(n, c), L = p.indexOf(t, c);
|
|
249
|
+
} else if (L !== -1 && (L < $ || $ === -1)) k.push(p.substring(c, L)), c = L + C, L = p.indexOf(t, c);
|
|
250
|
+
else {
|
|
251
|
+
if ($ === -1) break;
|
|
252
|
+
if (k.push(p.substring(c, $)), pe($ + B), b && (re(), y)) return H();
|
|
253
|
+
if (S && D.length >= S) return H(!0);
|
|
254
|
+
}
|
|
255
|
+
return te();
|
|
256
|
+
function ue(U) {
|
|
257
|
+
D.push(U), A = c;
|
|
258
|
+
}
|
|
259
|
+
function he(U) {
|
|
260
|
+
var Q = 0;
|
|
261
|
+
return Q = U !== -1 && (U = p.substring(x + 1, U)) && U.trim() === "" ? U.length : Q;
|
|
262
|
+
}
|
|
263
|
+
function te(U) {
|
|
264
|
+
return d || (U === void 0 && (U = p.substring(c)), k.push(U), c = O, ue(k), b && re()), H();
|
|
265
|
+
}
|
|
266
|
+
function pe(U) {
|
|
267
|
+
c = U, ue(k), k = [], $ = p.indexOf(n, c);
|
|
268
|
+
}
|
|
269
|
+
function H(U) {
|
|
270
|
+
if (e.header && !_ && D.length && !h) {
|
|
271
|
+
var Q = D[0], ae = /* @__PURE__ */ Object.create(null), ve = new Set(Q);
|
|
272
|
+
let Se = !1;
|
|
273
|
+
for (let le = 0; le < Q.length; le++) {
|
|
274
|
+
let ne = Q[le];
|
|
275
|
+
if (ae[ne = R(e.transformHeader) ? e.transformHeader(ne, le) : ne]) {
|
|
276
|
+
let ge, xe = ae[ne];
|
|
277
|
+
for (; ge = ne + "_" + xe, xe++, ve.has(ge); ) ;
|
|
278
|
+
ve.add(ge), Q[le] = ge, ae[ne]++, Se = !0, (f = f === null ? {} : f)[ge] = ne;
|
|
279
|
+
} else ae[ne] = 1, Q[le] = ne;
|
|
280
|
+
ve.add(ne);
|
|
281
|
+
}
|
|
282
|
+
Se && console.warn("Duplicate headers found and renamed."), h = !0;
|
|
283
|
+
}
|
|
284
|
+
return { data: D, errors: E, meta: { delimiter: t, linebreak: n, aborted: y, truncated: !!U, cursor: A + (_ || 0), renamedHeaders: f } };
|
|
285
|
+
}
|
|
286
|
+
function re() {
|
|
287
|
+
g(H()), D = [], E = [];
|
|
288
|
+
}
|
|
289
|
+
}, this.abort = function() {
|
|
290
|
+
y = !0;
|
|
291
|
+
}, this.getCharIndex = function() {
|
|
292
|
+
return c;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function de(e) {
|
|
296
|
+
var t = e.data, n = P[t.workerId], o = !1;
|
|
297
|
+
if (t.error) n.userError(t.error, t.file);
|
|
298
|
+
else if (t.results && t.results.data) {
|
|
299
|
+
var g = { abort: function() {
|
|
300
|
+
o = !0, oe(t.workerId, { data: [], errors: [], meta: { aborted: !0 } });
|
|
301
|
+
}, pause: ye, resume: ye };
|
|
302
|
+
if (R(n.userStep)) {
|
|
303
|
+
for (var S = 0; S < t.results.data.length && (n.userStep({ data: t.results.data[S], errors: t.results.errors, meta: t.results.meta }, g), !o); S++) ;
|
|
304
|
+
delete t.results;
|
|
305
|
+
} else R(n.userChunk) && (n.userChunk(t.results, g, t.file), delete t.results);
|
|
306
|
+
}
|
|
307
|
+
t.finished && !o && oe(t.workerId, t.results);
|
|
308
|
+
}
|
|
309
|
+
function oe(e, t) {
|
|
310
|
+
var n = P[e];
|
|
311
|
+
R(n.userComplete) && n.userComplete(t), n.terminate(), delete P[e];
|
|
312
|
+
}
|
|
313
|
+
function ye() {
|
|
314
|
+
throw new Error("Not implemented.");
|
|
315
|
+
}
|
|
316
|
+
function se(e) {
|
|
317
|
+
if (typeof e != "object" || e === null) return e;
|
|
318
|
+
var t, n = Array.isArray(e) ? [] : {};
|
|
319
|
+
for (t in e) n[t] = se(e[t]);
|
|
320
|
+
return n;
|
|
321
|
+
}
|
|
322
|
+
function q(e, t) {
|
|
323
|
+
return function() {
|
|
324
|
+
e.apply(t, arguments);
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function R(e) {
|
|
328
|
+
return typeof e == "function";
|
|
329
|
+
}
|
|
330
|
+
return w.parse = function(e, t) {
|
|
331
|
+
var n = (t = t || {}).dynamicTyping || !1;
|
|
332
|
+
if (R(n) && (t.dynamicTypingFunction = n, n = {}), t.dynamicTyping = n, t.transform = !!R(t.transform) && t.transform, !t.worker || !w.WORKERS_SUPPORTED) return n = null, w.NODE_STREAM_INPUT, typeof e == "string" ? (e = ((o) => o.charCodeAt(0) !== 65279 ? o : o.slice(1))(e), n = new (t.download ? W : K)(t)) : e.readable === !0 && R(e.read) && R(e.on) ? n = new V(t) : (l.File && e instanceof File || e instanceof Object) && (n = new X(t)), n.stream(e);
|
|
333
|
+
(n = (() => {
|
|
334
|
+
var o;
|
|
335
|
+
return !!w.WORKERS_SUPPORTED && (o = (() => {
|
|
336
|
+
var g = l.URL || l.webkitURL || null, S = i.toString();
|
|
337
|
+
return w.BLOB_URL || (w.BLOB_URL = g.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", S, ")();"], { type: "text/javascript" })));
|
|
338
|
+
})(), (o = new l.Worker(o)).onmessage = de, o.id = Y++, P[o.id] = o);
|
|
339
|
+
})()).userStep = t.step, n.userChunk = t.chunk, n.userComplete = t.complete, n.userError = t.error, t.step = R(t.step), t.chunk = R(t.chunk), t.complete = R(t.complete), t.error = R(t.error), delete t.worker, n.postMessage({ input: e, config: t, workerId: n.id });
|
|
340
|
+
}, w.unparse = function(e, t) {
|
|
341
|
+
var n = !1, o = !0, g = ",", S = `\r
|
|
342
|
+
`, m = '"', f = m + m, h = !1, a = null, u = !1, c = ((() => {
|
|
343
|
+
if (typeof t == "object") {
|
|
344
|
+
if (typeof t.delimiter != "string" || w.BAD_DELIMITERS.filter(function(_) {
|
|
345
|
+
return t.delimiter.indexOf(_) !== -1;
|
|
346
|
+
}).length || (g = t.delimiter), typeof t.quotes != "boolean" && typeof t.quotes != "function" && !Array.isArray(t.quotes) || (n = t.quotes), typeof t.skipEmptyLines != "boolean" && typeof t.skipEmptyLines != "string" || (h = t.skipEmptyLines), typeof t.newline == "string" && (S = t.newline), typeof t.quoteChar == "string" && (m = t.quoteChar), typeof t.header == "boolean" && (o = t.header), Array.isArray(t.columns)) {
|
|
347
|
+
if (t.columns.length === 0) throw new Error("Option columns is empty");
|
|
348
|
+
a = t.columns;
|
|
349
|
+
}
|
|
350
|
+
t.escapeChar !== void 0 && (f = t.escapeChar + m), t.escapeFormulae instanceof RegExp ? u = t.escapeFormulae : typeof t.escapeFormulae == "boolean" && t.escapeFormulae && (u = /^[=+\-@\t\r].*$/);
|
|
351
|
+
}
|
|
352
|
+
})(), new RegExp(ie(m), "g"));
|
|
353
|
+
if (typeof e == "string" && (e = JSON.parse(e)), Array.isArray(e)) {
|
|
354
|
+
if (!e.length || Array.isArray(e[0])) return y(null, e, h);
|
|
355
|
+
if (typeof e[0] == "object") return y(a || Object.keys(e[0]), e, h);
|
|
356
|
+
} else if (typeof e == "object") return typeof e.data == "string" && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || a), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : typeof e.data[0] == "object" ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || typeof e.data[0] == "object" || (e.data = [e.data])), y(e.fields || [], e.data || [], h);
|
|
357
|
+
throw new Error("Unable to serialize unrecognized input");
|
|
358
|
+
function y(_, d, O) {
|
|
359
|
+
var C = "", B = (typeof _ == "string" && (_ = JSON.parse(_)), typeof d == "string" && (d = JSON.parse(d)), Array.isArray(_) && 0 < _.length), j = !Array.isArray(d[0]);
|
|
360
|
+
if (B && o) {
|
|
361
|
+
for (var b = 0; b < _.length; b++) 0 < b && (C += g), C += p(_[b], b);
|
|
362
|
+
0 < d.length && (C += S);
|
|
363
|
+
}
|
|
364
|
+
for (var D = 0; D < d.length; D++) {
|
|
365
|
+
var E = (B ? _ : d[D]).length, k = !1, A = B ? Object.keys(d[D]).length === 0 : d[D].length === 0;
|
|
366
|
+
if (O && !B && (k = O === "greedy" ? d[D].join("").trim() === "" : d[D].length === 1 && d[D][0].length === 0), O === "greedy" && B) {
|
|
367
|
+
for (var F = [], I = 0; I < E; I++) {
|
|
368
|
+
var L = j ? _[I] : I;
|
|
369
|
+
F.push(d[D][L]);
|
|
370
|
+
}
|
|
371
|
+
k = F.join("").trim() === "";
|
|
372
|
+
}
|
|
373
|
+
if (!k) {
|
|
374
|
+
for (var $ = 0; $ < E; $++) {
|
|
375
|
+
0 < $ && !A && (C += g);
|
|
376
|
+
var G = B && j ? _[$] : $;
|
|
377
|
+
C += p(d[D][G], $);
|
|
378
|
+
}
|
|
379
|
+
D < d.length - 1 && (!O || 0 < E && !A) && (C += S);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return C;
|
|
383
|
+
}
|
|
384
|
+
function p(_, d) {
|
|
385
|
+
var O, C;
|
|
386
|
+
return _ == null ? "" : _.constructor === Date ? JSON.stringify(_).slice(1, 25) : (C = !1, u && typeof _ == "string" && u.test(_) && (_ = "'" + _, C = !0), O = _.toString().replace(c, f), (C = C || n === !0 || typeof n == "function" && n(_, d) || Array.isArray(n) && n[d] || ((B, j) => {
|
|
387
|
+
for (var b = 0; b < j.length; b++) if (-1 < B.indexOf(j[b])) return !0;
|
|
388
|
+
return !1;
|
|
389
|
+
})(O, w.BAD_DELIMITERS) || -1 < O.indexOf(g) || O.charAt(0) === " " || O.charAt(O.length - 1) === " ") ? m + O + m : O);
|
|
390
|
+
}
|
|
391
|
+
}, w.RECORD_SEP = "", w.UNIT_SEP = "", w.BYTE_ORDER_MARK = "\uFEFF", w.BAD_DELIMITERS = ["\r", `
|
|
392
|
+
`, '"', w.BYTE_ORDER_MARK], w.WORKERS_SUPPORTED = !M && !!l.Worker, w.NODE_STREAM_INPUT = 1, w.LocalChunkSize = 10485760, w.RemoteChunkSize = 5242880, w.DefaultDelimiter = ",", w.Parser = ce, w.ParserHandle = ee, w.NetworkStreamer = W, w.FileStreamer = X, w.StringStreamer = K, w.ReadableStreamStreamer = V, l.jQuery && ((v = l.jQuery).fn.parse = function(e) {
|
|
393
|
+
var t = e.config || {}, n = [];
|
|
394
|
+
return this.each(function(S) {
|
|
395
|
+
if (!(v(this).prop("tagName").toUpperCase() === "INPUT" && v(this).attr("type").toLowerCase() === "file" && l.FileReader) || !this.files || this.files.length === 0) return !0;
|
|
396
|
+
for (var m = 0; m < this.files.length; m++) n.push({ file: this.files[m], inputElem: this, instanceConfig: v.extend({}, t) });
|
|
397
|
+
}), o(), this;
|
|
398
|
+
function o() {
|
|
399
|
+
if (n.length === 0) R(e.complete) && e.complete();
|
|
400
|
+
else {
|
|
401
|
+
var S, m, f, h, a = n[0];
|
|
402
|
+
if (R(e.before)) {
|
|
403
|
+
var u = e.before(a.file, a.inputElem);
|
|
404
|
+
if (typeof u == "object") {
|
|
405
|
+
if (u.action === "abort") return S = "AbortError", m = a.file, f = a.inputElem, h = u.reason, void (R(e.error) && e.error({ name: S }, m, f, h));
|
|
406
|
+
if (u.action === "skip") return void g();
|
|
407
|
+
typeof u.config == "object" && (a.instanceConfig = v.extend(a.instanceConfig, u.config));
|
|
408
|
+
} else if (u === "skip") return void g();
|
|
409
|
+
}
|
|
410
|
+
var c = a.instanceConfig.complete;
|
|
411
|
+
a.instanceConfig.complete = function(y) {
|
|
412
|
+
R(c) && c(y, a.file, a.inputElem), g();
|
|
413
|
+
}, w.parse(a.file, a.instanceConfig);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function g() {
|
|
417
|
+
n.splice(0, 1), o();
|
|
418
|
+
}
|
|
419
|
+
}), T && (l.onmessage = function(e) {
|
|
420
|
+
e = e.data, w.WORKER_ID === void 0 && e && (w.WORKER_ID = e.workerId), typeof e.input == "string" ? l.postMessage({ workerId: w.WORKER_ID, results: w.parse(e.input, e.config), finished: !0 }) : (l.File && e.input instanceof File || e.input instanceof Object) && (e = w.parse(e.input, e.config)) && l.postMessage({ workerId: w.WORKER_ID, results: e, finished: !0 });
|
|
421
|
+
}), (W.prototype = Object.create(N.prototype)).constructor = W, (X.prototype = Object.create(N.prototype)).constructor = X, (K.prototype = Object.create(K.prototype)).constructor = K, (V.prototype = Object.create(N.prototype)).constructor = V, w;
|
|
422
|
+
});
|
|
423
|
+
})(_e)), _e.exports;
|
|
424
|
+
}
|
|
425
|
+
var Re = Ce();
|
|
426
|
+
const Ae = /* @__PURE__ */ be(Re), { parse: Te, unparse: Ie } = Ae;
|
|
427
|
+
class et {
|
|
428
|
+
static unparse(r, i) {
|
|
429
|
+
return Ie(r, i);
|
|
430
|
+
}
|
|
431
|
+
static parse(r) {
|
|
432
|
+
return new Promise((i, l) => {
|
|
433
|
+
Te(r, {
|
|
434
|
+
header: !0,
|
|
435
|
+
complete: (v) => i(v),
|
|
436
|
+
error: (v) => l(v)
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
async function Le(s, r, i) {
|
|
442
|
+
const l = i?.mimeType ?? Fe(r), v = Be(s, l);
|
|
443
|
+
if ("showSaveFilePicker" in window && i?.showSaveFilePicker)
|
|
444
|
+
try {
|
|
445
|
+
const Y = await (await window.showSaveFilePicker({
|
|
446
|
+
suggestedName: r,
|
|
447
|
+
types: [{ description: "Datei", accept: { [l]: [`.${Me(r)}`] } }]
|
|
448
|
+
})).createWritable();
|
|
449
|
+
await Y.write(v), await Y.close();
|
|
450
|
+
return;
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
const M = URL.createObjectURL(v), T = document.createElement("a");
|
|
454
|
+
T.href = M, T.download = r, T.rel = "noopener", T.style.display = "none", document.body.appendChild(T), ze(T), window.setTimeout(() => {
|
|
455
|
+
document.body.removeChild(T), URL.revokeObjectURL(M);
|
|
456
|
+
}, 0), je() && window.open(M, "_blank", "noopener,noreferrer");
|
|
457
|
+
}
|
|
458
|
+
function Be(s, r) {
|
|
459
|
+
if (s instanceof Blob)
|
|
460
|
+
return s.type ? s : new Blob([s], { type: r });
|
|
461
|
+
if (s instanceof ArrayBuffer || s instanceof Uint8Array) {
|
|
462
|
+
const i = s instanceof Uint8Array ? s : new Uint8Array(s);
|
|
463
|
+
return new Blob([i], { type: r });
|
|
464
|
+
}
|
|
465
|
+
return new Blob([s], { type: r || "text/plain;charset=utf-8" });
|
|
466
|
+
}
|
|
467
|
+
function Fe(s) {
|
|
468
|
+
switch (Me(s).toLowerCase()) {
|
|
469
|
+
case "txt":
|
|
470
|
+
return "text/plain;charset=utf-8";
|
|
471
|
+
case "csv":
|
|
472
|
+
return "text/csv;charset=utf-8";
|
|
473
|
+
case "json":
|
|
474
|
+
return "application/json;charset=utf-8";
|
|
475
|
+
case "pdf":
|
|
476
|
+
return "application/pdf";
|
|
477
|
+
case "png":
|
|
478
|
+
return "image/png";
|
|
479
|
+
case "jpg":
|
|
480
|
+
case "jpeg":
|
|
481
|
+
return "image/jpeg";
|
|
482
|
+
case "svg":
|
|
483
|
+
return "image/svg+xml";
|
|
484
|
+
case "zip":
|
|
485
|
+
return "application/zip";
|
|
486
|
+
default:
|
|
487
|
+
return "application/octet-stream";
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function Me(s) {
|
|
491
|
+
const r = s.lastIndexOf(".");
|
|
492
|
+
return r >= 0 && r < s.length - 1 ? s.slice(r + 1) : "";
|
|
493
|
+
}
|
|
494
|
+
function ze(s) {
|
|
495
|
+
const r = document.createEvent("MouseEvents");
|
|
496
|
+
r.initMouseEvent("click", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), s.dispatchEvent(r);
|
|
497
|
+
}
|
|
498
|
+
function je() {
|
|
499
|
+
const s = navigator.userAgent, r = /iPad|iPhone|iPod/.test(s), i = /^((?!chrome|android).)*safari/i.test(s);
|
|
500
|
+
return r || i;
|
|
501
|
+
}
|
|
502
|
+
class tt {
|
|
503
|
+
static getEnumValue(r, i) {
|
|
504
|
+
if (i in r)
|
|
505
|
+
return r[i];
|
|
506
|
+
throw Error(`${i} not found in ${r}`);
|
|
507
|
+
}
|
|
508
|
+
static getKeyValues(r) {
|
|
509
|
+
return Object.keys(r).filter((i) => !isNaN(Number(i))).map((i) => ({
|
|
510
|
+
key: Number(i),
|
|
511
|
+
value: r[i]
|
|
512
|
+
}));
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
class rt {
|
|
516
|
+
static getFileExtension(r) {
|
|
517
|
+
let i = "";
|
|
518
|
+
const l = r.lastIndexOf(".");
|
|
519
|
+
return l > 0 && l < r.length - 1 && (i = `.${r.substring(l + 1).toLowerCase()}`), i;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* read content from a file or blob
|
|
523
|
+
*/
|
|
524
|
+
static readAsText(r) {
|
|
525
|
+
const i = new FileReader();
|
|
526
|
+
return new Promise((l, v) => {
|
|
527
|
+
i.onload = () => {
|
|
528
|
+
i.onload = null, i.onerror = null, typeof i.result == "string" ? l(i.result) : v(new Error("Unexpected result type"));
|
|
529
|
+
}, i.onerror = () => {
|
|
530
|
+
const M = i.error ?? new Error("FileReader error");
|
|
531
|
+
i.onload = null, i.onerror = null, v(M);
|
|
532
|
+
}, i.readAsText(r);
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
static readAsArrayBuffer(r) {
|
|
536
|
+
const i = new FileReader();
|
|
537
|
+
return new Promise((l, v) => {
|
|
538
|
+
i.onload = () => {
|
|
539
|
+
i.onload = null, i.onerror = null, i.result instanceof ArrayBuffer ? l(i.result) : v(new Error("Unexpected result type"));
|
|
540
|
+
}, i.onerror = () => {
|
|
541
|
+
const M = i.error ?? new Error("FileReader error");
|
|
542
|
+
i.onload = null, i.onerror = null, v(M);
|
|
543
|
+
}, i.readAsArrayBuffer(r);
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
static readAsDataUrl(r) {
|
|
547
|
+
const i = new FileReader();
|
|
548
|
+
return new Promise((l, v) => {
|
|
549
|
+
i.onload = (M) => {
|
|
550
|
+
l(M);
|
|
551
|
+
}, i.onerror = (M) => v(M), i.readAsDataURL(r);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/** usage:
|
|
555
|
+
* const file = new File(['Hello'], 'test.txt');
|
|
556
|
+
* FileHelper.formatFileSize(file.size);
|
|
557
|
+
* */
|
|
558
|
+
static formatFileSize(r, i = 2, l) {
|
|
559
|
+
if (r === 0)
|
|
560
|
+
return "0 Bytes";
|
|
561
|
+
const v = 1024, M = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
562
|
+
let T = Math.floor(Math.log(r) / Math.log(v));
|
|
563
|
+
l && M.includes(l) && (T = M.indexOf(l));
|
|
564
|
+
const P = r / Math.pow(v, T);
|
|
565
|
+
return `${parseFloat(P.toFixed(i))} ${M[T]}`;
|
|
566
|
+
}
|
|
567
|
+
static save(r, i, l) {
|
|
568
|
+
const v = new Blob([r], { type: l });
|
|
569
|
+
Le(v, i);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
class me {
|
|
573
|
+
static set(r, i) {
|
|
574
|
+
localStorage.setItem(r, JSON.stringify(i));
|
|
575
|
+
}
|
|
576
|
+
static get(r) {
|
|
577
|
+
let i = null;
|
|
578
|
+
const l = localStorage.getItem(r);
|
|
579
|
+
return l && (i = JSON.parse(l)), i;
|
|
580
|
+
}
|
|
581
|
+
static remove(r) {
|
|
582
|
+
let i = !!me.get(r);
|
|
583
|
+
return i && localStorage.removeItem(r), i;
|
|
584
|
+
}
|
|
585
|
+
static removeAll() {
|
|
586
|
+
localStorage.clear();
|
|
587
|
+
}
|
|
588
|
+
static getKeysBy(r) {
|
|
589
|
+
return Object.keys(localStorage).filter((i) => i.startsWith(r));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
var fe = /* @__PURE__ */ ((s) => (s.log = "log", s.info = "info", s.warn = "warn", s.debug = "debug", s.error = "error", s))(fe || {});
|
|
593
|
+
class J {
|
|
594
|
+
static listeners = /* @__PURE__ */ new Set();
|
|
595
|
+
static enabled = !0;
|
|
596
|
+
static log(...r) {
|
|
597
|
+
J.doLog(fe.log, r);
|
|
598
|
+
}
|
|
599
|
+
static info(...r) {
|
|
600
|
+
J.doLog(fe.info, r);
|
|
601
|
+
}
|
|
602
|
+
static warn(...r) {
|
|
603
|
+
J.doLog(fe.warn, r);
|
|
604
|
+
}
|
|
605
|
+
static debug(...r) {
|
|
606
|
+
J.doLog(fe.debug, r);
|
|
607
|
+
}
|
|
608
|
+
static error(...r) {
|
|
609
|
+
J.doLog(fe.error, r);
|
|
610
|
+
}
|
|
611
|
+
static clearListeners() {
|
|
612
|
+
J.listeners.clear();
|
|
613
|
+
}
|
|
614
|
+
static setEnabled(r) {
|
|
615
|
+
J.enabled = r;
|
|
616
|
+
}
|
|
617
|
+
static doLog(r, i) {
|
|
618
|
+
if (!J.enabled) return;
|
|
619
|
+
const l = {
|
|
620
|
+
type: r,
|
|
621
|
+
args: i,
|
|
622
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
623
|
+
};
|
|
624
|
+
for (const v of J.listeners)
|
|
625
|
+
try {
|
|
626
|
+
if (v(l) === !1)
|
|
627
|
+
return;
|
|
628
|
+
} catch {
|
|
629
|
+
}
|
|
630
|
+
console[r].apply(console, i);
|
|
631
|
+
}
|
|
632
|
+
static onLog(r, i = !1) {
|
|
633
|
+
if (i) {
|
|
634
|
+
const l = (v) => {
|
|
635
|
+
try {
|
|
636
|
+
return r(v);
|
|
637
|
+
} finally {
|
|
638
|
+
J.listeners.delete(l);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
return J.listeners.add(l), () => J.listeners.delete(l);
|
|
642
|
+
}
|
|
643
|
+
return J.listeners.add(r), () => J.listeners.delete(r);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
const We = (s, r, i) => s.localeCompare(r) * (i ? 1 : -1), Ue = (s, r) => s < r ? -1 : s === r ? 0 : 1, Pe = (s, r, i) => Ue(s, r) * (i ? 1 : -1), Ye = (s, r, i) => {
|
|
647
|
+
let l = 0;
|
|
648
|
+
return typeof s == "string" && typeof r == "string" ? l = We(s, r, i) : l = Pe(s, r, i), l;
|
|
649
|
+
}, Ne = (s, r, i, l) => {
|
|
650
|
+
const v = i(s), M = i(r);
|
|
651
|
+
return Ye(v, M, l);
|
|
652
|
+
};
|
|
653
|
+
class nt {
|
|
654
|
+
static get(r) {
|
|
655
|
+
return me.get(r);
|
|
656
|
+
}
|
|
657
|
+
static set(r, i) {
|
|
658
|
+
me.set(r, i);
|
|
659
|
+
}
|
|
660
|
+
static remove(r) {
|
|
661
|
+
me.remove(r);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
Array.prototype.distinct = function(s) {
|
|
665
|
+
const r = this;
|
|
666
|
+
return s ? r.filter((l, v, M) => M.findIndex((T) => s(T, l)) === v) : r.filter((l, v, M) => M.indexOf(l) === v);
|
|
667
|
+
};
|
|
668
|
+
Array.prototype.filterBy = function(s) {
|
|
669
|
+
return this.filter((r) => s(r));
|
|
670
|
+
};
|
|
671
|
+
Array.prototype.first = function() {
|
|
672
|
+
return this?.length > 0 ? this[0] : null;
|
|
673
|
+
};
|
|
674
|
+
Array.prototype.groupBy = function(s) {
|
|
675
|
+
return this.reduce((r, i) => {
|
|
676
|
+
const l = s(i);
|
|
677
|
+
return (r[l] = r[l] || []).push(i), r;
|
|
678
|
+
}, {});
|
|
679
|
+
};
|
|
680
|
+
Array.prototype.orderBy = function(s, r = !0) {
|
|
681
|
+
return this?.sort((i, l) => Ne(i, l, s, r)), this;
|
|
682
|
+
};
|
|
683
|
+
Array.prototype.removeBy = function(s, r) {
|
|
684
|
+
return this.filter((i) => s(i) !== r);
|
|
685
|
+
};
|
|
686
|
+
var we = { exports: {} }, qe = we.exports, Ee;
|
|
687
|
+
function He() {
|
|
688
|
+
return Ee || (Ee = 1, (function(s, r) {
|
|
689
|
+
(function(i, l) {
|
|
690
|
+
s.exports = l();
|
|
691
|
+
})(qe, (function() {
|
|
692
|
+
var i = 1e3, l = 6e4, v = 36e5, M = "millisecond", T = "second", P = "minute", Y = "hour", w = "day", N = "week", W = "month", X = "quarter", K = "year", V = "date", ee = "Invalid Date", ie = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, ce = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, de = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(m) {
|
|
693
|
+
var f = ["th", "st", "nd", "rd"], h = m % 100;
|
|
694
|
+
return "[" + m + (f[(h - 20) % 10] || f[h] || f[0]) + "]";
|
|
695
|
+
} }, oe = function(m, f, h) {
|
|
696
|
+
var a = String(m);
|
|
697
|
+
return !a || a.length >= f ? m : "" + Array(f + 1 - a.length).join(h) + m;
|
|
698
|
+
}, ye = { s: oe, z: function(m) {
|
|
699
|
+
var f = -m.utcOffset(), h = Math.abs(f), a = Math.floor(h / 60), u = h % 60;
|
|
700
|
+
return (f <= 0 ? "+" : "-") + oe(a, 2, "0") + ":" + oe(u, 2, "0");
|
|
701
|
+
}, m: function m(f, h) {
|
|
702
|
+
if (f.date() < h.date()) return -m(h, f);
|
|
703
|
+
var a = 12 * (h.year() - f.year()) + (h.month() - f.month()), u = f.clone().add(a, W), c = h - u < 0, y = f.clone().add(a + (c ? -1 : 1), W);
|
|
704
|
+
return +(-(a + (h - u) / (c ? u - y : y - u)) || 0);
|
|
705
|
+
}, a: function(m) {
|
|
706
|
+
return m < 0 ? Math.ceil(m) || 0 : Math.floor(m);
|
|
707
|
+
}, p: function(m) {
|
|
708
|
+
return { M: W, y: K, w: N, d: w, D: V, h: Y, m: P, s: T, ms: M, Q: X }[m] || String(m || "").toLowerCase().replace(/s$/, "");
|
|
709
|
+
}, u: function(m) {
|
|
710
|
+
return m === void 0;
|
|
711
|
+
} }, se = "en", q = {};
|
|
712
|
+
q[se] = de;
|
|
713
|
+
var R = "$isDayjsObject", e = function(m) {
|
|
714
|
+
return m instanceof g || !(!m || !m[R]);
|
|
715
|
+
}, t = function m(f, h, a) {
|
|
716
|
+
var u;
|
|
717
|
+
if (!f) return se;
|
|
718
|
+
if (typeof f == "string") {
|
|
719
|
+
var c = f.toLowerCase();
|
|
720
|
+
q[c] && (u = c), h && (q[c] = h, u = c);
|
|
721
|
+
var y = f.split("-");
|
|
722
|
+
if (!u && y.length > 1) return m(y[0]);
|
|
723
|
+
} else {
|
|
724
|
+
var p = f.name;
|
|
725
|
+
q[p] = f, u = p;
|
|
726
|
+
}
|
|
727
|
+
return !a && u && (se = u), u || !a && se;
|
|
728
|
+
}, n = function(m, f) {
|
|
729
|
+
if (e(m)) return m.clone();
|
|
730
|
+
var h = typeof f == "object" ? f : {};
|
|
731
|
+
return h.date = m, h.args = arguments, new g(h);
|
|
732
|
+
}, o = ye;
|
|
733
|
+
o.l = t, o.i = e, o.w = function(m, f) {
|
|
734
|
+
return n(m, { locale: f.$L, utc: f.$u, x: f.$x, $offset: f.$offset });
|
|
735
|
+
};
|
|
736
|
+
var g = (function() {
|
|
737
|
+
function m(h) {
|
|
738
|
+
this.$L = t(h.locale, null, !0), this.parse(h), this.$x = this.$x || h.x || {}, this[R] = !0;
|
|
739
|
+
}
|
|
740
|
+
var f = m.prototype;
|
|
741
|
+
return f.parse = function(h) {
|
|
742
|
+
this.$d = (function(a) {
|
|
743
|
+
var u = a.date, c = a.utc;
|
|
744
|
+
if (u === null) return /* @__PURE__ */ new Date(NaN);
|
|
745
|
+
if (o.u(u)) return /* @__PURE__ */ new Date();
|
|
746
|
+
if (u instanceof Date) return new Date(u);
|
|
747
|
+
if (typeof u == "string" && !/Z$/i.test(u)) {
|
|
748
|
+
var y = u.match(ie);
|
|
749
|
+
if (y) {
|
|
750
|
+
var p = y[2] - 1 || 0, _ = (y[7] || "0").substring(0, 3);
|
|
751
|
+
return c ? new Date(Date.UTC(y[1], p, y[3] || 1, y[4] || 0, y[5] || 0, y[6] || 0, _)) : new Date(y[1], p, y[3] || 1, y[4] || 0, y[5] || 0, y[6] || 0, _);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return new Date(u);
|
|
755
|
+
})(h), this.init();
|
|
756
|
+
}, f.init = function() {
|
|
757
|
+
var h = this.$d;
|
|
758
|
+
this.$y = h.getFullYear(), this.$M = h.getMonth(), this.$D = h.getDate(), this.$W = h.getDay(), this.$H = h.getHours(), this.$m = h.getMinutes(), this.$s = h.getSeconds(), this.$ms = h.getMilliseconds();
|
|
759
|
+
}, f.$utils = function() {
|
|
760
|
+
return o;
|
|
761
|
+
}, f.isValid = function() {
|
|
762
|
+
return this.$d.toString() !== ee;
|
|
763
|
+
}, f.isSame = function(h, a) {
|
|
764
|
+
var u = n(h);
|
|
765
|
+
return this.startOf(a) <= u && u <= this.endOf(a);
|
|
766
|
+
}, f.isAfter = function(h, a) {
|
|
767
|
+
return n(h) < this.startOf(a);
|
|
768
|
+
}, f.isBefore = function(h, a) {
|
|
769
|
+
return this.endOf(a) < n(h);
|
|
770
|
+
}, f.$g = function(h, a, u) {
|
|
771
|
+
return o.u(h) ? this[a] : this.set(u, h);
|
|
772
|
+
}, f.unix = function() {
|
|
773
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
774
|
+
}, f.valueOf = function() {
|
|
775
|
+
return this.$d.getTime();
|
|
776
|
+
}, f.startOf = function(h, a) {
|
|
777
|
+
var u = this, c = !!o.u(a) || a, y = o.p(h), p = function(D, E) {
|
|
778
|
+
var k = o.w(u.$u ? Date.UTC(u.$y, E, D) : new Date(u.$y, E, D), u);
|
|
779
|
+
return c ? k : k.endOf(w);
|
|
780
|
+
}, _ = function(D, E) {
|
|
781
|
+
return o.w(u.toDate()[D].apply(u.toDate("s"), (c ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(E)), u);
|
|
782
|
+
}, d = this.$W, O = this.$M, C = this.$D, B = "set" + (this.$u ? "UTC" : "");
|
|
783
|
+
switch (y) {
|
|
784
|
+
case K:
|
|
785
|
+
return c ? p(1, 0) : p(31, 11);
|
|
786
|
+
case W:
|
|
787
|
+
return c ? p(1, O) : p(0, O + 1);
|
|
788
|
+
case N:
|
|
789
|
+
var j = this.$locale().weekStart || 0, b = (d < j ? d + 7 : d) - j;
|
|
790
|
+
return p(c ? C - b : C + (6 - b), O);
|
|
791
|
+
case w:
|
|
792
|
+
case V:
|
|
793
|
+
return _(B + "Hours", 0);
|
|
794
|
+
case Y:
|
|
795
|
+
return _(B + "Minutes", 1);
|
|
796
|
+
case P:
|
|
797
|
+
return _(B + "Seconds", 2);
|
|
798
|
+
case T:
|
|
799
|
+
return _(B + "Milliseconds", 3);
|
|
800
|
+
default:
|
|
801
|
+
return this.clone();
|
|
802
|
+
}
|
|
803
|
+
}, f.endOf = function(h) {
|
|
804
|
+
return this.startOf(h, !1);
|
|
805
|
+
}, f.$set = function(h, a) {
|
|
806
|
+
var u, c = o.p(h), y = "set" + (this.$u ? "UTC" : ""), p = (u = {}, u[w] = y + "Date", u[V] = y + "Date", u[W] = y + "Month", u[K] = y + "FullYear", u[Y] = y + "Hours", u[P] = y + "Minutes", u[T] = y + "Seconds", u[M] = y + "Milliseconds", u)[c], _ = c === w ? this.$D + (a - this.$W) : a;
|
|
807
|
+
if (c === W || c === K) {
|
|
808
|
+
var d = this.clone().set(V, 1);
|
|
809
|
+
d.$d[p](_), d.init(), this.$d = d.set(V, Math.min(this.$D, d.daysInMonth())).$d;
|
|
810
|
+
} else p && this.$d[p](_);
|
|
811
|
+
return this.init(), this;
|
|
812
|
+
}, f.set = function(h, a) {
|
|
813
|
+
return this.clone().$set(h, a);
|
|
814
|
+
}, f.get = function(h) {
|
|
815
|
+
return this[o.p(h)]();
|
|
816
|
+
}, f.add = function(h, a) {
|
|
817
|
+
var u, c = this;
|
|
818
|
+
h = Number(h);
|
|
819
|
+
var y = o.p(a), p = function(O) {
|
|
820
|
+
var C = n(c);
|
|
821
|
+
return o.w(C.date(C.date() + Math.round(O * h)), c);
|
|
822
|
+
};
|
|
823
|
+
if (y === W) return this.set(W, this.$M + h);
|
|
824
|
+
if (y === K) return this.set(K, this.$y + h);
|
|
825
|
+
if (y === w) return p(1);
|
|
826
|
+
if (y === N) return p(7);
|
|
827
|
+
var _ = (u = {}, u[P] = l, u[Y] = v, u[T] = i, u)[y] || 1, d = this.$d.getTime() + h * _;
|
|
828
|
+
return o.w(d, this);
|
|
829
|
+
}, f.subtract = function(h, a) {
|
|
830
|
+
return this.add(-1 * h, a);
|
|
831
|
+
}, f.format = function(h) {
|
|
832
|
+
var a = this, u = this.$locale();
|
|
833
|
+
if (!this.isValid()) return u.invalidDate || ee;
|
|
834
|
+
var c = h || "YYYY-MM-DDTHH:mm:ssZ", y = o.z(this), p = this.$H, _ = this.$m, d = this.$M, O = u.weekdays, C = u.months, B = u.meridiem, j = function(E, k, A, F) {
|
|
835
|
+
return E && (E[k] || E(a, c)) || A[k].slice(0, F);
|
|
836
|
+
}, b = function(E) {
|
|
837
|
+
return o.s(p % 12 || 12, E, "0");
|
|
838
|
+
}, D = B || function(E, k, A) {
|
|
839
|
+
var F = E < 12 ? "AM" : "PM";
|
|
840
|
+
return A ? F.toLowerCase() : F;
|
|
841
|
+
};
|
|
842
|
+
return c.replace(ce, (function(E, k) {
|
|
843
|
+
return k || (function(A) {
|
|
844
|
+
switch (A) {
|
|
845
|
+
case "YY":
|
|
846
|
+
return String(a.$y).slice(-2);
|
|
847
|
+
case "YYYY":
|
|
848
|
+
return o.s(a.$y, 4, "0");
|
|
849
|
+
case "M":
|
|
850
|
+
return d + 1;
|
|
851
|
+
case "MM":
|
|
852
|
+
return o.s(d + 1, 2, "0");
|
|
853
|
+
case "MMM":
|
|
854
|
+
return j(u.monthsShort, d, C, 3);
|
|
855
|
+
case "MMMM":
|
|
856
|
+
return j(C, d);
|
|
857
|
+
case "D":
|
|
858
|
+
return a.$D;
|
|
859
|
+
case "DD":
|
|
860
|
+
return o.s(a.$D, 2, "0");
|
|
861
|
+
case "d":
|
|
862
|
+
return String(a.$W);
|
|
863
|
+
case "dd":
|
|
864
|
+
return j(u.weekdaysMin, a.$W, O, 2);
|
|
865
|
+
case "ddd":
|
|
866
|
+
return j(u.weekdaysShort, a.$W, O, 3);
|
|
867
|
+
case "dddd":
|
|
868
|
+
return O[a.$W];
|
|
869
|
+
case "H":
|
|
870
|
+
return String(p);
|
|
871
|
+
case "HH":
|
|
872
|
+
return o.s(p, 2, "0");
|
|
873
|
+
case "h":
|
|
874
|
+
return b(1);
|
|
875
|
+
case "hh":
|
|
876
|
+
return b(2);
|
|
877
|
+
case "a":
|
|
878
|
+
return D(p, _, !0);
|
|
879
|
+
case "A":
|
|
880
|
+
return D(p, _, !1);
|
|
881
|
+
case "m":
|
|
882
|
+
return String(_);
|
|
883
|
+
case "mm":
|
|
884
|
+
return o.s(_, 2, "0");
|
|
885
|
+
case "s":
|
|
886
|
+
return String(a.$s);
|
|
887
|
+
case "ss":
|
|
888
|
+
return o.s(a.$s, 2, "0");
|
|
889
|
+
case "SSS":
|
|
890
|
+
return o.s(a.$ms, 3, "0");
|
|
891
|
+
case "Z":
|
|
892
|
+
return y;
|
|
893
|
+
}
|
|
894
|
+
return null;
|
|
895
|
+
})(E) || y.replace(":", "");
|
|
896
|
+
}));
|
|
897
|
+
}, f.utcOffset = function() {
|
|
898
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
899
|
+
}, f.diff = function(h, a, u) {
|
|
900
|
+
var c, y = this, p = o.p(a), _ = n(h), d = (_.utcOffset() - this.utcOffset()) * l, O = this - _, C = function() {
|
|
901
|
+
return o.m(y, _);
|
|
902
|
+
};
|
|
903
|
+
switch (p) {
|
|
904
|
+
case K:
|
|
905
|
+
c = C() / 12;
|
|
906
|
+
break;
|
|
907
|
+
case W:
|
|
908
|
+
c = C();
|
|
909
|
+
break;
|
|
910
|
+
case X:
|
|
911
|
+
c = C() / 3;
|
|
912
|
+
break;
|
|
913
|
+
case N:
|
|
914
|
+
c = (O - d) / 6048e5;
|
|
915
|
+
break;
|
|
916
|
+
case w:
|
|
917
|
+
c = (O - d) / 864e5;
|
|
918
|
+
break;
|
|
919
|
+
case Y:
|
|
920
|
+
c = O / v;
|
|
921
|
+
break;
|
|
922
|
+
case P:
|
|
923
|
+
c = O / l;
|
|
924
|
+
break;
|
|
925
|
+
case T:
|
|
926
|
+
c = O / i;
|
|
927
|
+
break;
|
|
928
|
+
default:
|
|
929
|
+
c = O;
|
|
930
|
+
}
|
|
931
|
+
return u ? c : o.a(c);
|
|
932
|
+
}, f.daysInMonth = function() {
|
|
933
|
+
return this.endOf(W).$D;
|
|
934
|
+
}, f.$locale = function() {
|
|
935
|
+
return q[this.$L];
|
|
936
|
+
}, f.locale = function(h, a) {
|
|
937
|
+
if (!h) return this.$L;
|
|
938
|
+
var u = this.clone(), c = t(h, a, !0);
|
|
939
|
+
return c && (u.$L = c), u;
|
|
940
|
+
}, f.clone = function() {
|
|
941
|
+
return o.w(this.$d, this);
|
|
942
|
+
}, f.toDate = function() {
|
|
943
|
+
return new Date(this.valueOf());
|
|
944
|
+
}, f.toJSON = function() {
|
|
945
|
+
return this.isValid() ? this.toISOString() : null;
|
|
946
|
+
}, f.toISOString = function() {
|
|
947
|
+
return this.$d.toISOString();
|
|
948
|
+
}, f.toString = function() {
|
|
949
|
+
return this.$d.toUTCString();
|
|
950
|
+
}, m;
|
|
951
|
+
})(), S = g.prototype;
|
|
952
|
+
return n.prototype = S, [["$ms", M], ["$s", T], ["$m", P], ["$H", Y], ["$W", w], ["$M", W], ["$y", K], ["$D", V]].forEach((function(m) {
|
|
953
|
+
S[m[1]] = function(f) {
|
|
954
|
+
return this.$g(f, m[0], m[1]);
|
|
955
|
+
};
|
|
956
|
+
})), n.extend = function(m, f) {
|
|
957
|
+
return m.$i || (m(f, g, n), m.$i = !0), n;
|
|
958
|
+
}, n.locale = t, n.isDayjs = e, n.unix = function(m) {
|
|
959
|
+
return n(1e3 * m);
|
|
960
|
+
}, n.en = q[se], n.Ls = q, n.p = {}, n;
|
|
961
|
+
}));
|
|
962
|
+
})(we)), we.exports;
|
|
963
|
+
}
|
|
964
|
+
var Ke = He();
|
|
965
|
+
const Z = /* @__PURE__ */ be(Ke);
|
|
966
|
+
var ke = { exports: {} }, Je = ke.exports, Oe;
|
|
967
|
+
function Qe() {
|
|
968
|
+
return Oe || (Oe = 1, (function(s, r) {
|
|
969
|
+
(function(i, l) {
|
|
970
|
+
s.exports = l();
|
|
971
|
+
})(Je, (function() {
|
|
972
|
+
var i = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
|
|
973
|
+
return function(l, v, M) {
|
|
974
|
+
var T = v.prototype, P = T.format;
|
|
975
|
+
M.en.formats = i, T.format = function(Y) {
|
|
976
|
+
Y === void 0 && (Y = "YYYY-MM-DDTHH:mm:ssZ");
|
|
977
|
+
var w = this.$locale().formats, N = (function(W, X) {
|
|
978
|
+
return W.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(K, V, ee) {
|
|
979
|
+
var ie = ee && ee.toUpperCase();
|
|
980
|
+
return V || X[ee] || i[ee] || X[ie].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(ce, de, oe) {
|
|
981
|
+
return de || oe.slice(1);
|
|
982
|
+
}));
|
|
983
|
+
}));
|
|
984
|
+
})(Y, w === void 0 ? {} : w);
|
|
985
|
+
return P.call(this, N);
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
}));
|
|
989
|
+
})(ke)), ke.exports;
|
|
990
|
+
}
|
|
991
|
+
var Ve = Qe();
|
|
992
|
+
const Ze = /* @__PURE__ */ be(Ve);
|
|
993
|
+
Z.extend(Ze);
|
|
994
|
+
Date.prototype.isAfter = function(s, r) {
|
|
995
|
+
return Z(this).isAfter(s, r);
|
|
996
|
+
};
|
|
997
|
+
Date.prototype.isBefore = function(s, r) {
|
|
998
|
+
return Z(this).isBefore(s, r);
|
|
999
|
+
};
|
|
1000
|
+
Date.prototype.format = function(s) {
|
|
1001
|
+
return Z(this).format(s);
|
|
1002
|
+
};
|
|
1003
|
+
Date.prototype.isValid = function() {
|
|
1004
|
+
return Z(this).isValid();
|
|
1005
|
+
};
|
|
1006
|
+
Date.prototype.add = function(s, r) {
|
|
1007
|
+
return Z(this).add(s, r).toDate();
|
|
1008
|
+
};
|
|
1009
|
+
Date.prototype.subtract = function(s, r) {
|
|
1010
|
+
return Z(this).subtract(s, r).toDate();
|
|
1011
|
+
};
|
|
1012
|
+
Date.prototype.firstDayOfMonth = function() {
|
|
1013
|
+
return Z(this).startOf("month").toDate();
|
|
1014
|
+
};
|
|
1015
|
+
Date.prototype.lastDayOfMonth = function() {
|
|
1016
|
+
return Z(this).endOf("month").toDate();
|
|
1017
|
+
};
|
|
1018
|
+
Date.prototype.set = function(s, r) {
|
|
1019
|
+
return Z(this).set(s, r).toDate();
|
|
1020
|
+
};
|
|
1021
|
+
Date.prototype.diff = function(s, r) {
|
|
1022
|
+
return Z(this).diff(s, r);
|
|
1023
|
+
};
|
|
1024
|
+
Date.prototype.startOf = function(s) {
|
|
1025
|
+
return Z(this).startOf(s).toDate();
|
|
1026
|
+
};
|
|
1027
|
+
Date.prototype.endOf = function(s) {
|
|
1028
|
+
return Z(this).endOf(s).toDate();
|
|
1029
|
+
};
|
|
1030
|
+
String.prototype.capitalize = function() {
|
|
1031
|
+
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
1032
|
+
};
|
|
1033
|
+
String.prototype.isNumber = function() {
|
|
1034
|
+
return !isNaN(Number(this)) && this.trim() !== "";
|
|
1035
|
+
};
|
|
1036
|
+
String.prototype.isEmpty = function() {
|
|
1037
|
+
return this === void 0 || !this || this.length === 0;
|
|
1038
|
+
};
|
|
1039
|
+
const Ge = {
|
|
1040
|
+
xs: 0,
|
|
1041
|
+
sm: 576,
|
|
1042
|
+
md: 768,
|
|
1043
|
+
lg: 992,
|
|
1044
|
+
xl: 1200,
|
|
1045
|
+
xxl: 1400,
|
|
1046
|
+
xxxl: 1600
|
|
1047
|
+
};
|
|
1048
|
+
class it {
|
|
1049
|
+
screenBreakpoints;
|
|
1050
|
+
screenWidth = 0;
|
|
1051
|
+
lastBreakpoint;
|
|
1052
|
+
resizeListener;
|
|
1053
|
+
breakpointChangeCallbacks = /* @__PURE__ */ new Set();
|
|
1054
|
+
// feuert nur bei Breakpoint-Änderung
|
|
1055
|
+
onResizeCallbacks = /* @__PURE__ */ new Set();
|
|
1056
|
+
// feuert bei jedem throttled Resize
|
|
1057
|
+
rafId = null;
|
|
1058
|
+
emitTimeoutId = null;
|
|
1059
|
+
// für debounce der onResizeCallbacks
|
|
1060
|
+
pendingWidth;
|
|
1061
|
+
pendingBreakpoint;
|
|
1062
|
+
duplicateThresholdMs = 60;
|
|
1063
|
+
constructor(r) {
|
|
1064
|
+
typeof window < "u" && (this.screenBreakpoints = r || Ge, this.screenWidth = window.innerWidth, this.resizeListener = this.onResize.bind(this), window.addEventListener("resize", this.resizeListener, { passive: !0 }), this.lastBreakpoint = this.getBreakpointByScreenWidth(this.screenWidth));
|
|
1065
|
+
}
|
|
1066
|
+
destroy() {
|
|
1067
|
+
typeof window < "u" && window.removeEventListener("resize", this.resizeListener), this.breakpointChangeCallbacks.clear(), this.onResizeCallbacks.clear(), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
|
|
1068
|
+
}
|
|
1069
|
+
getCurrentScreenWidth() {
|
|
1070
|
+
return this.screenWidth;
|
|
1071
|
+
}
|
|
1072
|
+
getCurrentBreakpoint() {
|
|
1073
|
+
return this.lastBreakpoint;
|
|
1074
|
+
}
|
|
1075
|
+
onBreakpointChange(r) {
|
|
1076
|
+
this.breakpointChangeCallbacks.add(r);
|
|
1077
|
+
}
|
|
1078
|
+
offBreakpointChange(r) {
|
|
1079
|
+
this.breakpointChangeCallbacks.delete(r);
|
|
1080
|
+
}
|
|
1081
|
+
onResizeChange(r) {
|
|
1082
|
+
this.onResizeCallbacks.add(r);
|
|
1083
|
+
}
|
|
1084
|
+
offResizeChange(r) {
|
|
1085
|
+
this.onResizeCallbacks.delete(r);
|
|
1086
|
+
}
|
|
1087
|
+
getBreakpointByScreenWidth(r = this.screenWidth) {
|
|
1088
|
+
let i = "xs";
|
|
1089
|
+
for (const l of Object.keys(this.screenBreakpoints))
|
|
1090
|
+
this.screenBreakpoints[l] <= r && (i = l);
|
|
1091
|
+
return { breakpoint: i, screenWidth: this.screenBreakpoints[i] };
|
|
1092
|
+
}
|
|
1093
|
+
isScreenGreaterThan(r) {
|
|
1094
|
+
return this.screenWidth > this.screenBreakpoints[r];
|
|
1095
|
+
}
|
|
1096
|
+
isScreenSmallerThan(r) {
|
|
1097
|
+
return this.screenWidth < this.screenBreakpoints[r];
|
|
1098
|
+
}
|
|
1099
|
+
getBreakpoint(r) {
|
|
1100
|
+
return {
|
|
1101
|
+
breakpoint: r,
|
|
1102
|
+
screenWidth: this.screenBreakpoints[r]
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
onResize = () => {
|
|
1106
|
+
if (typeof window > "u") return;
|
|
1107
|
+
const r = window.innerWidth, i = this.getBreakpointByScreenWidth(r);
|
|
1108
|
+
this.lastBreakpoint?.breakpoint !== i?.breakpoint && (this.lastBreakpoint = i, i && this.breakpointChangeCallbacks.forEach((l) => l(i))), this.pendingWidth = r, this.pendingBreakpoint = i, this.emitTimeoutId && clearTimeout(this.emitTimeoutId), this.emitTimeoutId = window.setTimeout(() => {
|
|
1109
|
+
this.pendingBreakpoint && this.onResizeCallbacks.forEach((l) => l(this.pendingWidth, this.pendingBreakpoint)), this.pendingWidth = void 0, this.pendingBreakpoint = void 0, this.emitTimeoutId = null;
|
|
1110
|
+
}, this.duplicateThresholdMs);
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
export {
|
|
1114
|
+
it as BrowserService,
|
|
1115
|
+
et as CsvHelper,
|
|
1116
|
+
tt as EnumHelper,
|
|
1117
|
+
rt as FileHelper,
|
|
1118
|
+
me as LocalStorageHelper,
|
|
1119
|
+
J as LoggerHelper,
|
|
1120
|
+
fe as LoggerType,
|
|
1121
|
+
Ge as ScreenBreakpoints,
|
|
1122
|
+
nt as TokenHelper,
|
|
1123
|
+
Xe as copyToClipboard,
|
|
1124
|
+
Le as saveAs,
|
|
1125
|
+
Ne as sortHelper
|
|
1126
|
+
};
|