@opencloud-eu/web-client 5.0.0 → 5.1.0

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.
@@ -1,4648 +0,0 @@
1
- import { a as Nr } from "./index-DD48hLOx.js";
2
- import { D as st, I as he, J as me, t as xr, l as ue, p as Kt, m as Pr, K as se } from "./functions-fAVnHNMc.js";
3
- import { u as M } from "./toString-BMC5nz5v.js";
4
- import { ocs as Er } from "./web-client/ocs.js";
5
- import { p as oe, g as ve } from "./index-8RyXehLU.js";
6
- const we = (r) => encodeURIComponent(r).split("%2F").join("/");
7
- class Qt extends Error {
8
- response;
9
- statusCode;
10
- constructor(e, t, n = null) {
11
- super(e), this.response = t, this.statusCode = n;
12
- }
13
- }
14
- class Ar extends Qt {
15
- errorCode;
16
- constructor(e, t, n, a = null) {
17
- super(e, n, a), this.errorCode = t;
18
- }
19
- }
20
- const re = (r, { fileId: e, path: t, name: n }) => {
21
- if (t !== void 0)
22
- return M(r.webDavPath, t);
23
- if (e !== void 0) {
24
- if (st(r))
25
- throw new Error("public spaces need a path provided");
26
- return M("spaces", e, n || "");
27
- }
28
- return r.webDavPath;
29
- }, Tr = (r, e) => ({
30
- copyFiles(t, { path: n, fileId: a }, u, {
31
- path: c,
32
- parentFolderId: i,
33
- name: h
34
- }, { overwrite: o, ...s } = {}) {
35
- const f = re(t, {
36
- fileId: a,
37
- path: n
38
- }), l = re(u, {
39
- fileId: i,
40
- path: c,
41
- name: h
42
- });
43
- return r.copy(f, l, {
44
- overwrite: o || !1,
45
- ...s
46
- });
47
- }
48
- }), Or = (r, e, t) => ({
49
- async createFolder(n, { path: a, parentFolderId: u, folderName: c, fetchFolder: i = !0, ...h }) {
50
- const o = re(n, { fileId: u, path: a, name: c });
51
- if (await r.mkcol(o), i)
52
- return e.getFileInfo(n, { path: a }, h);
53
- }
54
- }), Cr = (r, { axiosClient: e }) => ({
55
- async getFileContents(t, { fileId: n, path: a }, {
56
- responseType: u = "text",
57
- noCache: c = !0,
58
- headers: i,
59
- ...h
60
- } = {}) {
61
- try {
62
- const o = re(t, { fileId: n, path: a }), s = await e.get(r.getFileUrl(o), {
63
- responseType: u,
64
- headers: {
65
- ...c && { "Cache-Control": "no-cache" },
66
- ...i || {}
67
- },
68
- ...h
69
- });
70
- return {
71
- response: s,
72
- body: s.data,
73
- headers: {
74
- ETag: s.headers.etag,
75
- "OC-ETag": s.headers["oc-etag"],
76
- "OC-FileId": s.headers["oc-fileid"]
77
- }
78
- };
79
- } catch (o) {
80
- const { message: s, response: f } = o;
81
- throw new Qt(s, f, f.status);
82
- }
83
- }
84
- }), Ir = (r, e) => ({
85
- async getFileInfo(t, n, a) {
86
- return (await r.listFiles(t, n, {
87
- depth: 0,
88
- ...a
89
- })).resource;
90
- }
91
- }), Sr = (r, e, t, { axiosClient: n, baseUrl: a }) => ({
92
- async getFileUrl(u, c, {
93
- disposition: i = "attachment",
94
- version: h = null,
95
- username: o = "",
96
- ...s
97
- }) {
98
- if (i === "inline") {
99
- const l = await e.getFileContents(u, c, {
100
- responseType: "blob",
101
- ...s
102
- });
103
- return URL.createObjectURL(l.body);
104
- }
105
- if (h) {
106
- if (!o)
107
- throw new Error("username is required for URL signing");
108
- const l = r.getFileUrl(M("meta", c.fileId, "v", h));
109
- return await Er(a, n).signUrl(l, o);
110
- }
111
- if (c.downloadURL)
112
- return c.downloadURL;
113
- const { downloadURL: f } = await t.getFileInfo(u, c, {
114
- davProperties: [he.DownloadURL]
115
- });
116
- return f;
117
- },
118
- revokeUrl: (u) => {
119
- u && u.startsWith("blob:") && URL.revokeObjectURL(u);
120
- }
121
- }), Fr = (r, e) => ({
122
- getPublicFileUrl(t, n) {
123
- return r.getFileUrl(M("public-files", n));
124
- }
125
- }), jr = (r, e, t) => ({
126
- async listFiles(n, { path: a, fileId: u } = {}, { depth: c = 1, davProperties: i, isTrash: h = !1, ...o } = {}) {
127
- let s;
128
- if (st(n)) {
129
- s = await r.propfind(M(n.webDavPath, a), {
130
- depth: c,
131
- properties: i || me.PublicLink,
132
- ...o
133
- }), s.forEach((d) => {
134
- d.filename = d.filename.split("/").slice(1).join("/");
135
- }), s.length === 1 && (s[0].filename = M(n.id, a, {
136
- leadingSlash: !0
137
- })), s.forEach((d) => {
138
- d.filename = d.filename.split("/").slice(2).join("/");
139
- });
140
- const l = n.driveAlias.startsWith("ocm/") ? "ocm" : "public-link";
141
- if ((!a || a === "/") && c > 0 && l === "ocm" && s[0].props[he.PublicLinkItemType] === "file" && (s = [
142
- {
143
- basename: n.fileId,
144
- type: "directory",
145
- filename: "",
146
- props: {}
147
- },
148
- ...s
149
- ]), !a) {
150
- const [d, ...m] = s;
151
- return {
152
- resource: xr({
153
- ...d,
154
- id: n.id,
155
- driveAlias: n.driveAlias,
156
- webDavPath: n.webDavPath,
157
- publicLinkType: l
158
- }),
159
- children: m.map((w) => ue(w, r.extraProps))
160
- };
161
- }
162
- const g = s.map((d) => ue(d, r.extraProps));
163
- return { resource: g[0], children: g.slice(1) };
164
- }
165
- const f = async () => {
166
- const l = await e.getPathForFileId(u);
167
- return this.listFiles(n, { path: l }, { depth: c, davProperties: i });
168
- };
169
- try {
170
- let l = "";
171
- if (h ? l = Kt(n.id) : l = re(n, { fileId: u, path: a }), s = await r.propfind(l, {
172
- depth: c,
173
- properties: i || me.Default,
174
- ...o
175
- }), h)
176
- return {
177
- resource: ue(s[0], r.extraProps),
178
- children: s.slice(1).map(Pr)
179
- };
180
- const g = s.map((m) => ue(m, r.extraProps)), d = u === n.id;
181
- return u && !d && g[0].fileId && u !== g[0].fileId ? f() : { resource: g[0], children: g.slice(1) };
182
- } catch (l) {
183
- if (l.statusCode === 404 && u)
184
- return f();
185
- throw l;
186
- }
187
- }
188
- }), $r = (r, e) => ({
189
- moveFiles(t, { path: n, fileId: a }, u, {
190
- path: c,
191
- parentFolderId: i,
192
- name: h
193
- }, { overwrite: o, ...s } = {}) {
194
- const f = re(t, {
195
- fileId: a,
196
- path: n
197
- }), l = re(u, {
198
- fileId: i,
199
- path: c,
200
- name: h
201
- });
202
- return r.move(f, l, {
203
- overwrite: o || !1,
204
- ...s
205
- });
206
- }
207
- }), Rr = (r, e, t) => ({
208
- async putFileContents(n, {
209
- fileName: a,
210
- path: u,
211
- parentFolderId: c,
212
- content: i = "",
213
- previousEntityTag: h = "",
214
- overwrite: o,
215
- onUploadProgress: s = null,
216
- ...f
217
- }) {
218
- const l = re(n, { fileId: c, name: a, path: u }), { result: g } = await r.put(l, i, {
219
- previousEntityTag: h,
220
- overwrite: o,
221
- onUploadProgress: s,
222
- ...f
223
- });
224
- return e.getFileInfo(n, {
225
- fileId: g.headers.get("Oc-Fileid"),
226
- path: u
227
- });
228
- }
229
- }), Lr = (r, e) => ({
230
- deleteFile(t, { path: n, ...a }) {
231
- return r.delete(M(t.webDavPath, n), a);
232
- }
233
- }), kr = (r, e) => ({
234
- restoreFile(t, { id: n }, { path: a }, { overwrite: u, ...c } = {}) {
235
- if (st(t))
236
- return;
237
- const i = M(t.webDavPath, a);
238
- return r.move(M(t.webDavTrashPath, n), i, {
239
- overwrite: u,
240
- ...c
241
- });
242
- }
243
- }), Ur = (r, e) => ({
244
- restoreFileVersion(t, { parentFolderId: n, name: a, path: u }, c, i = {}) {
245
- const h = re(t, { path: u, fileId: n, name: a }), o = M("meta", n, "v", c, { leadingSlash: !0 }), s = M("files", h, { leadingSlash: !0 });
246
- return r.copy(o, s, i);
247
- }
248
- }), _r = (r, e) => ({
249
- clearTrashBin(t, { id: n, ...a } = {}) {
250
- let u = Kt(t.id);
251
- return n && (u = M(u, n)), r.delete(u, a);
252
- }
253
- }), Mr = (r, e) => ({
254
- async search(t, { davProperties: n = me.Default, searchLimit: a, ...u }) {
255
- const c = "/spaces/", { range: i, results: h } = await r.report(c, {
256
- pattern: t,
257
- limit: a,
258
- properties: n,
259
- ...u
260
- });
261
- return {
262
- resources: h.map((o) => ({
263
- ...ue(o, r.extraProps),
264
- highlights: o.props[he.Highlights] || ""
265
- })),
266
- totalResults: i ? parseInt(i?.split("/")[1]) : null
267
- };
268
- }
269
- }), Vr = (r, e) => ({
270
- async getPathForFileId(t, n = {}) {
271
- return (await r.propfind(M("meta", t, { leadingSlash: !0 }), {
272
- properties: [he.MetaPathForUser],
273
- ...n
274
- }))[0].props[he.MetaPathForUser];
275
- }
276
- });
277
- var Br = { 2: (r) => {
278
- function e(a, u, c) {
279
- a instanceof RegExp && (a = t(a, c)), u instanceof RegExp && (u = t(u, c));
280
- var i = n(a, u, c);
281
- return i && { start: i[0], end: i[1], pre: c.slice(0, i[0]), body: c.slice(i[0] + a.length, i[1]), post: c.slice(i[1] + u.length) };
282
- }
283
- function t(a, u) {
284
- var c = u.match(a);
285
- return c ? c[0] : null;
286
- }
287
- function n(a, u, c) {
288
- var i, h, o, s, f, l = c.indexOf(a), g = c.indexOf(u, l + 1), d = l;
289
- if (l >= 0 && g > 0) {
290
- for (i = [], o = c.length; d >= 0 && !f; ) d == l ? (i.push(d), l = c.indexOf(a, d + 1)) : i.length == 1 ? f = [i.pop(), g] : ((h = i.pop()) < o && (o = h, s = g), g = c.indexOf(u, d + 1)), d = l < g && l >= 0 ? l : g;
291
- i.length && (f = [o, s]);
292
- }
293
- return f;
294
- }
295
- r.exports = e, e.range = n;
296
- }, 101: function(r, e, t) {
297
- var n;
298
- r = t.nmd(r), (function(a) {
299
- var u = (r && r.exports, typeof ve == "object" && ve);
300
- u.global !== u && u.window;
301
- var c = function(f) {
302
- this.message = f;
303
- };
304
- (c.prototype = new Error()).name = "InvalidCharacterError";
305
- var i = function(f) {
306
- throw new c(f);
307
- }, h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = /[\t\n\f\r ]/g, s = { encode: function(f) {
308
- f = String(f), /[^\0-\xFF]/.test(f) && i("The string to be encoded contains characters outside of the Latin1 range.");
309
- for (var l, g, d, m, w = f.length % 3, v = "", p = -1, y = f.length - w; ++p < y; ) l = f.charCodeAt(p) << 16, g = f.charCodeAt(++p) << 8, d = f.charCodeAt(++p), v += h.charAt((m = l + g + d) >> 18 & 63) + h.charAt(m >> 12 & 63) + h.charAt(m >> 6 & 63) + h.charAt(63 & m);
310
- return w == 2 ? (l = f.charCodeAt(p) << 8, g = f.charCodeAt(++p), v += h.charAt((m = l + g) >> 10) + h.charAt(m >> 4 & 63) + h.charAt(m << 2 & 63) + "=") : w == 1 && (m = f.charCodeAt(p), v += h.charAt(m >> 2) + h.charAt(m << 4 & 63) + "=="), v;
311
- }, decode: function(f) {
312
- var l = (f = String(f).replace(o, "")).length;
313
- l % 4 == 0 && (l = (f = f.replace(/==?$/, "")).length), (l % 4 == 1 || /[^+a-zA-Z0-9/]/.test(f)) && i("Invalid character: the string to be decoded is not correctly encoded.");
314
- for (var g, d, m = 0, w = "", v = -1; ++v < l; ) d = h.indexOf(f.charAt(v)), g = m % 4 ? 64 * g + d : d, m++ % 4 && (w += String.fromCharCode(255 & g >> (-2 * m & 6)));
315
- return w;
316
- }, version: "1.0.0" };
317
- (n = (function() {
318
- return s;
319
- }).call(e, t, e, r)) === void 0 || (r.exports = n);
320
- })();
321
- }, 172: (r, e) => {
322
- e.d = function(t) {
323
- if (!t) return 0;
324
- for (var n = (t = t.toString()).length, a = t.length; a--; ) {
325
- var u = t.charCodeAt(a);
326
- 56320 <= u && u <= 57343 && a--, 127 < u && u <= 2047 ? n++ : 2047 < u && u <= 65535 && (n += 2);
327
- }
328
- return n;
329
- };
330
- }, 526: (r) => {
331
- var e = { utf8: { stringToBytes: function(t) {
332
- return e.bin.stringToBytes(unescape(encodeURIComponent(t)));
333
- }, bytesToString: function(t) {
334
- return decodeURIComponent(escape(e.bin.bytesToString(t)));
335
- } }, bin: { stringToBytes: function(t) {
336
- for (var n = [], a = 0; a < t.length; a++) n.push(255 & t.charCodeAt(a));
337
- return n;
338
- }, bytesToString: function(t) {
339
- for (var n = [], a = 0; a < t.length; a++) n.push(String.fromCharCode(t[a]));
340
- return n.join("");
341
- } } };
342
- r.exports = e;
343
- }, 298: (r) => {
344
- var e, t;
345
- e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = { rotl: function(n, a) {
346
- return n << a | n >>> 32 - a;
347
- }, rotr: function(n, a) {
348
- return n << 32 - a | n >>> a;
349
- }, endian: function(n) {
350
- if (n.constructor == Number) return 16711935 & t.rotl(n, 8) | 4278255360 & t.rotl(n, 24);
351
- for (var a = 0; a < n.length; a++) n[a] = t.endian(n[a]);
352
- return n;
353
- }, randomBytes: function(n) {
354
- for (var a = []; n > 0; n--) a.push(Math.floor(256 * Math.random()));
355
- return a;
356
- }, bytesToWords: function(n) {
357
- for (var a = [], u = 0, c = 0; u < n.length; u++, c += 8) a[c >>> 5] |= n[u] << 24 - c % 32;
358
- return a;
359
- }, wordsToBytes: function(n) {
360
- for (var a = [], u = 0; u < 32 * n.length; u += 8) a.push(n[u >>> 5] >>> 24 - u % 32 & 255);
361
- return a;
362
- }, bytesToHex: function(n) {
363
- for (var a = [], u = 0; u < n.length; u++) a.push((n[u] >>> 4).toString(16)), a.push((15 & n[u]).toString(16));
364
- return a.join("");
365
- }, hexToBytes: function(n) {
366
- for (var a = [], u = 0; u < n.length; u += 2) a.push(parseInt(n.substr(u, 2), 16));
367
- return a;
368
- }, bytesToBase64: function(n) {
369
- for (var a = [], u = 0; u < n.length; u += 3) for (var c = n[u] << 16 | n[u + 1] << 8 | n[u + 2], i = 0; i < 4; i++) 8 * u + 6 * i <= 8 * n.length ? a.push(e.charAt(c >>> 6 * (3 - i) & 63)) : a.push("=");
370
- return a.join("");
371
- }, base64ToBytes: function(n) {
372
- n = n.replace(/[^A-Z0-9+\/]/gi, "");
373
- for (var a = [], u = 0, c = 0; u < n.length; c = ++u % 4) c != 0 && a.push((e.indexOf(n.charAt(u - 1)) & Math.pow(2, -2 * c + 8) - 1) << 2 * c | e.indexOf(n.charAt(u)) >>> 6 - 2 * c);
374
- return a;
375
- } }, r.exports = t;
376
- }, 635: (r, e, t) => {
377
- const n = t(31), a = t(338), u = t(221);
378
- r.exports = { XMLParser: a, XMLValidator: n, XMLBuilder: u };
379
- }, 118: (r) => {
380
- r.exports = function(e) {
381
- return typeof e == "function" ? e : Array.isArray(e) ? (t) => {
382
- for (const n of e)
383
- if (typeof n == "string" && t === n || n instanceof RegExp && n.test(t)) return !0;
384
- } : () => !1;
385
- };
386
- }, 705: (r, e) => {
387
- const t = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", n = "[" + t + "][" + t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*", a = new RegExp("^" + n + "$");
388
- e.isExist = function(u) {
389
- return u !== void 0;
390
- }, e.isEmptyObject = function(u) {
391
- return Object.keys(u).length === 0;
392
- }, e.merge = function(u, c, i) {
393
- if (c) {
394
- const h = Object.keys(c), o = h.length;
395
- for (let s = 0; s < o; s++) u[h[s]] = i === "strict" ? [c[h[s]]] : c[h[s]];
396
- }
397
- }, e.getValue = function(u) {
398
- return e.isExist(u) ? u : "";
399
- }, e.isName = function(u) {
400
- return a.exec(u) != null;
401
- }, e.getAllMatches = function(u, c) {
402
- const i = [];
403
- let h = c.exec(u);
404
- for (; h; ) {
405
- const o = [];
406
- o.startIndex = c.lastIndex - h[0].length;
407
- const s = h.length;
408
- for (let f = 0; f < s; f++) o.push(h[f]);
409
- i.push(o), h = c.exec(u);
410
- }
411
- return i;
412
- }, e.nameRegexp = n;
413
- }, 31: (r, e, t) => {
414
- const n = t(705), a = { allowBooleanAttributes: !1, unpairedTags: [] };
415
- function u(p) {
416
- return p === " " || p === " " || p === `
417
- ` || p === "\r";
418
- }
419
- function c(p, y) {
420
- const A = y;
421
- for (; y < p.length; y++) if (!(p[y] != "?" && p[y] != " ")) {
422
- const N = p.substr(A, y - A);
423
- if (y > 5 && N === "xml") return d("InvalidXml", "XML declaration allowed only at the start of the document.", w(p, y));
424
- if (p[y] == "?" && p[y + 1] == ">") {
425
- y++;
426
- break;
427
- }
428
- }
429
- return y;
430
- }
431
- function i(p, y) {
432
- if (p.length > y + 5 && p[y + 1] === "-" && p[y + 2] === "-") {
433
- for (y += 3; y < p.length; y++) if (p[y] === "-" && p[y + 1] === "-" && p[y + 2] === ">") {
434
- y += 2;
435
- break;
436
- }
437
- } else if (p.length > y + 8 && p[y + 1] === "D" && p[y + 2] === "O" && p[y + 3] === "C" && p[y + 4] === "T" && p[y + 5] === "Y" && p[y + 6] === "P" && p[y + 7] === "E") {
438
- let A = 1;
439
- for (y += 8; y < p.length; y++) if (p[y] === "<") A++;
440
- else if (p[y] === ">" && (A--, A === 0)) break;
441
- } else if (p.length > y + 9 && p[y + 1] === "[" && p[y + 2] === "C" && p[y + 3] === "D" && p[y + 4] === "A" && p[y + 5] === "T" && p[y + 6] === "A" && p[y + 7] === "[") {
442
- for (y += 8; y < p.length; y++) if (p[y] === "]" && p[y + 1] === "]" && p[y + 2] === ">") {
443
- y += 2;
444
- break;
445
- }
446
- }
447
- return y;
448
- }
449
- e.validate = function(p, y) {
450
- y = Object.assign({}, a, y);
451
- const A = [];
452
- let N = !1, b = !1;
453
- p[0] === "\uFEFF" && (p = p.substr(1));
454
- for (let x = 0; x < p.length; x++) if (p[x] === "<" && p[x + 1] === "?") {
455
- if (x += 2, x = c(p, x), x.err) return x;
456
- } else {
457
- if (p[x] !== "<") {
458
- if (u(p[x])) continue;
459
- return d("InvalidChar", "char '" + p[x] + "' is not expected.", w(p, x));
460
- }
461
- {
462
- let T = x;
463
- if (x++, p[x] === "!") {
464
- x = i(p, x);
465
- continue;
466
- }
467
- {
468
- let O = !1;
469
- p[x] === "/" && (O = !0, x++);
470
- let I = "";
471
- for (; x < p.length && p[x] !== ">" && p[x] !== " " && p[x] !== " " && p[x] !== `
472
- ` && p[x] !== "\r"; x++) I += p[x];
473
- if (I = I.trim(), I[I.length - 1] === "/" && (I = I.substring(0, I.length - 1), x--), E = I, !n.isName(E)) {
474
- let F;
475
- return F = I.trim().length === 0 ? "Invalid space after '<'." : "Tag '" + I + "' is an invalid name.", d("InvalidTag", F, w(p, x));
476
- }
477
- const C = s(p, x);
478
- if (C === !1) return d("InvalidAttr", "Attributes for '" + I + "' have open quote.", w(p, x));
479
- let P = C.value;
480
- if (x = C.index, P[P.length - 1] === "/") {
481
- const F = x - P.length;
482
- P = P.substring(0, P.length - 1);
483
- const S = l(P, y);
484
- if (S !== !0) return d(S.err.code, S.err.msg, w(p, F + S.err.line));
485
- N = !0;
486
- } else if (O) {
487
- if (!C.tagClosed) return d("InvalidTag", "Closing tag '" + I + "' doesn't have proper closing.", w(p, x));
488
- if (P.trim().length > 0) return d("InvalidTag", "Closing tag '" + I + "' can't have attributes or invalid starting.", w(p, T));
489
- if (A.length === 0) return d("InvalidTag", "Closing tag '" + I + "' has not been opened.", w(p, T));
490
- {
491
- const F = A.pop();
492
- if (I !== F.tagName) {
493
- let S = w(p, F.tagStartPos);
494
- return d("InvalidTag", "Expected closing tag '" + F.tagName + "' (opened in line " + S.line + ", col " + S.col + ") instead of closing tag '" + I + "'.", w(p, T));
495
- }
496
- A.length == 0 && (b = !0);
497
- }
498
- } else {
499
- const F = l(P, y);
500
- if (F !== !0) return d(F.err.code, F.err.msg, w(p, x - P.length + F.err.line));
501
- if (b === !0) return d("InvalidXml", "Multiple possible root nodes found.", w(p, x));
502
- y.unpairedTags.indexOf(I) !== -1 || A.push({ tagName: I, tagStartPos: T }), N = !0;
503
- }
504
- for (x++; x < p.length; x++) if (p[x] === "<") {
505
- if (p[x + 1] === "!") {
506
- x++, x = i(p, x);
507
- continue;
508
- }
509
- if (p[x + 1] !== "?") break;
510
- if (x = c(p, ++x), x.err) return x;
511
- } else if (p[x] === "&") {
512
- const F = g(p, x);
513
- if (F == -1) return d("InvalidChar", "char '&' is not expected.", w(p, x));
514
- x = F;
515
- } else if (b === !0 && !u(p[x])) return d("InvalidXml", "Extra text at the end", w(p, x));
516
- p[x] === "<" && x--;
517
- }
518
- }
519
- }
520
- var E;
521
- return N ? A.length == 1 ? d("InvalidTag", "Unclosed tag '" + A[0].tagName + "'.", w(p, A[0].tagStartPos)) : !(A.length > 0) || d("InvalidXml", "Invalid '" + JSON.stringify(A.map(((x) => x.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : d("InvalidXml", "Start tag expected.", 1);
522
- };
523
- const h = '"', o = "'";
524
- function s(p, y) {
525
- let A = "", N = "", b = !1;
526
- for (; y < p.length; y++) {
527
- if (p[y] === h || p[y] === o) N === "" ? N = p[y] : N !== p[y] || (N = "");
528
- else if (p[y] === ">" && N === "") {
529
- b = !0;
530
- break;
531
- }
532
- A += p[y];
533
- }
534
- return N === "" && { value: A, index: y, tagClosed: b };
535
- }
536
- const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
537
- function l(p, y) {
538
- const A = n.getAllMatches(p, f), N = {};
539
- for (let b = 0; b < A.length; b++) {
540
- if (A[b][1].length === 0) return d("InvalidAttr", "Attribute '" + A[b][2] + "' has no space in starting.", v(A[b]));
541
- if (A[b][3] !== void 0 && A[b][4] === void 0) return d("InvalidAttr", "Attribute '" + A[b][2] + "' is without value.", v(A[b]));
542
- if (A[b][3] === void 0 && !y.allowBooleanAttributes) return d("InvalidAttr", "boolean attribute '" + A[b][2] + "' is not allowed.", v(A[b]));
543
- const E = A[b][2];
544
- if (!m(E)) return d("InvalidAttr", "Attribute '" + E + "' is an invalid name.", v(A[b]));
545
- if (N.hasOwnProperty(E)) return d("InvalidAttr", "Attribute '" + E + "' is repeated.", v(A[b]));
546
- N[E] = 1;
547
- }
548
- return !0;
549
- }
550
- function g(p, y) {
551
- if (p[++y] === ";") return -1;
552
- if (p[y] === "#") return (function(N, b) {
553
- let E = /\d/;
554
- for (N[b] === "x" && (b++, E = /[\da-fA-F]/); b < N.length; b++) {
555
- if (N[b] === ";") return b;
556
- if (!N[b].match(E)) break;
557
- }
558
- return -1;
559
- })(p, ++y);
560
- let A = 0;
561
- for (; y < p.length; y++, A++) if (!(p[y].match(/\w/) && A < 20)) {
562
- if (p[y] === ";") break;
563
- return -1;
564
- }
565
- return y;
566
- }
567
- function d(p, y, A) {
568
- return { err: { code: p, msg: y, line: A.line || A, col: A.col } };
569
- }
570
- function m(p) {
571
- return n.isName(p);
572
- }
573
- function w(p, y) {
574
- const A = p.substring(0, y).split(/\r?\n/);
575
- return { line: A.length, col: A[A.length - 1].length + 1 };
576
- }
577
- function v(p) {
578
- return p.startIndex + p[1].length;
579
- }
580
- }, 221: (r, e, t) => {
581
- const n = t(87), a = t(118), u = { attributeNamePrefix: "@_", attributesGroupName: !1, textNodeName: "#text", ignoreAttributes: !0, cdataPropName: !1, format: !1, indentBy: " ", suppressEmptyNode: !1, suppressUnpairedNode: !0, suppressBooleanAttributes: !0, tagValueProcessor: function(s, f) {
582
- return f;
583
- }, attributeValueProcessor: function(s, f) {
584
- return f;
585
- }, preserveOrder: !1, commentPropName: !1, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&amp;" }, { regex: new RegExp(">", "g"), val: "&gt;" }, { regex: new RegExp("<", "g"), val: "&lt;" }, { regex: new RegExp("'", "g"), val: "&apos;" }, { regex: new RegExp('"', "g"), val: "&quot;" }], processEntities: !0, stopNodes: [], oneListGroup: !1 };
586
- function c(s) {
587
- this.options = Object.assign({}, u, s), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
588
- return !1;
589
- } : (this.ignoreAttributesFn = a(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = o), this.processTextOrObjNode = i, this.options.format ? (this.indentate = h, this.tagEndChar = `>
590
- `, this.newLine = `
591
- `) : (this.indentate = function() {
592
- return "";
593
- }, this.tagEndChar = ">", this.newLine = "");
594
- }
595
- function i(s, f, l, g) {
596
- const d = this.j2x(s, l + 1, g.concat(f));
597
- return s[this.options.textNodeName] !== void 0 && Object.keys(s).length === 1 ? this.buildTextValNode(s[this.options.textNodeName], f, d.attrStr, l) : this.buildObjectNode(d.val, f, d.attrStr, l);
598
- }
599
- function h(s) {
600
- return this.options.indentBy.repeat(s);
601
- }
602
- function o(s) {
603
- return !(!s.startsWith(this.options.attributeNamePrefix) || s === this.options.textNodeName) && s.substr(this.attrPrefixLen);
604
- }
605
- c.prototype.build = function(s) {
606
- return this.options.preserveOrder ? n(s, this.options) : (Array.isArray(s) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (s = { [this.options.arrayNodeName]: s }), this.j2x(s, 0, []).val);
607
- }, c.prototype.j2x = function(s, f, l) {
608
- let g = "", d = "";
609
- const m = l.join(".");
610
- for (let w in s) if (Object.prototype.hasOwnProperty.call(s, w)) if (s[w] === void 0) this.isAttribute(w) && (d += "");
611
- else if (s[w] === null) this.isAttribute(w) ? d += "" : w[0] === "?" ? d += this.indentate(f) + "<" + w + "?" + this.tagEndChar : d += this.indentate(f) + "<" + w + "/" + this.tagEndChar;
612
- else if (s[w] instanceof Date) d += this.buildTextValNode(s[w], w, "", f);
613
- else if (typeof s[w] != "object") {
614
- const v = this.isAttribute(w);
615
- if (v && !this.ignoreAttributesFn(v, m)) g += this.buildAttrPairStr(v, "" + s[w]);
616
- else if (!v) if (w === this.options.textNodeName) {
617
- let p = this.options.tagValueProcessor(w, "" + s[w]);
618
- d += this.replaceEntitiesValue(p);
619
- } else d += this.buildTextValNode(s[w], w, "", f);
620
- } else if (Array.isArray(s[w])) {
621
- const v = s[w].length;
622
- let p = "", y = "";
623
- for (let A = 0; A < v; A++) {
624
- const N = s[w][A];
625
- if (N !== void 0) if (N === null) w[0] === "?" ? d += this.indentate(f) + "<" + w + "?" + this.tagEndChar : d += this.indentate(f) + "<" + w + "/" + this.tagEndChar;
626
- else if (typeof N == "object") if (this.options.oneListGroup) {
627
- const b = this.j2x(N, f + 1, l.concat(w));
628
- p += b.val, this.options.attributesGroupName && N.hasOwnProperty(this.options.attributesGroupName) && (y += b.attrStr);
629
- } else p += this.processTextOrObjNode(N, w, f, l);
630
- else if (this.options.oneListGroup) {
631
- let b = this.options.tagValueProcessor(w, N);
632
- b = this.replaceEntitiesValue(b), p += b;
633
- } else p += this.buildTextValNode(N, w, "", f);
634
- }
635
- this.options.oneListGroup && (p = this.buildObjectNode(p, w, y, f)), d += p;
636
- } else if (this.options.attributesGroupName && w === this.options.attributesGroupName) {
637
- const v = Object.keys(s[w]), p = v.length;
638
- for (let y = 0; y < p; y++) g += this.buildAttrPairStr(v[y], "" + s[w][v[y]]);
639
- } else d += this.processTextOrObjNode(s[w], w, f, l);
640
- return { attrStr: g, val: d };
641
- }, c.prototype.buildAttrPairStr = function(s, f) {
642
- return f = this.options.attributeValueProcessor(s, "" + f), f = this.replaceEntitiesValue(f), this.options.suppressBooleanAttributes && f === "true" ? " " + s : " " + s + '="' + f + '"';
643
- }, c.prototype.buildObjectNode = function(s, f, l, g) {
644
- if (s === "") return f[0] === "?" ? this.indentate(g) + "<" + f + l + "?" + this.tagEndChar : this.indentate(g) + "<" + f + l + this.closeTag(f) + this.tagEndChar;
645
- {
646
- let d = "</" + f + this.tagEndChar, m = "";
647
- return f[0] === "?" && (m = "?", d = ""), !l && l !== "" || s.indexOf("<") !== -1 ? this.options.commentPropName !== !1 && f === this.options.commentPropName && m.length === 0 ? this.indentate(g) + `<!--${s}-->` + this.newLine : this.indentate(g) + "<" + f + l + m + this.tagEndChar + s + this.indentate(g) + d : this.indentate(g) + "<" + f + l + m + ">" + s + d;
648
- }
649
- }, c.prototype.closeTag = function(s) {
650
- let f = "";
651
- return this.options.unpairedTags.indexOf(s) !== -1 ? this.options.suppressUnpairedNode || (f = "/") : f = this.options.suppressEmptyNode ? "/" : `></${s}`, f;
652
- }, c.prototype.buildTextValNode = function(s, f, l, g) {
653
- if (this.options.cdataPropName !== !1 && f === this.options.cdataPropName) return this.indentate(g) + `<![CDATA[${s}]]>` + this.newLine;
654
- if (this.options.commentPropName !== !1 && f === this.options.commentPropName) return this.indentate(g) + `<!--${s}-->` + this.newLine;
655
- if (f[0] === "?") return this.indentate(g) + "<" + f + l + "?" + this.tagEndChar;
656
- {
657
- let d = this.options.tagValueProcessor(f, s);
658
- return d = this.replaceEntitiesValue(d), d === "" ? this.indentate(g) + "<" + f + l + this.closeTag(f) + this.tagEndChar : this.indentate(g) + "<" + f + l + ">" + d + "</" + f + this.tagEndChar;
659
- }
660
- }, c.prototype.replaceEntitiesValue = function(s) {
661
- if (s && s.length > 0 && this.options.processEntities) for (let f = 0; f < this.options.entities.length; f++) {
662
- const l = this.options.entities[f];
663
- s = s.replace(l.regex, l.val);
664
- }
665
- return s;
666
- }, r.exports = c;
667
- }, 87: (r) => {
668
- function e(c, i, h, o) {
669
- let s = "", f = !1;
670
- for (let l = 0; l < c.length; l++) {
671
- const g = c[l], d = t(g);
672
- if (d === void 0) continue;
673
- let m = "";
674
- if (m = h.length === 0 ? d : `${h}.${d}`, d === i.textNodeName) {
675
- let y = g[d];
676
- a(m, i) || (y = i.tagValueProcessor(d, y), y = u(y, i)), f && (s += o), s += y, f = !1;
677
- continue;
678
- }
679
- if (d === i.cdataPropName) {
680
- f && (s += o), s += `<![CDATA[${g[d][0][i.textNodeName]}]]>`, f = !1;
681
- continue;
682
- }
683
- if (d === i.commentPropName) {
684
- s += o + `<!--${g[d][0][i.textNodeName]}-->`, f = !0;
685
- continue;
686
- }
687
- if (d[0] === "?") {
688
- const y = n(g[":@"], i), A = d === "?xml" ? "" : o;
689
- let N = g[d][0][i.textNodeName];
690
- N = N.length !== 0 ? " " + N : "", s += A + `<${d}${N}${y}?>`, f = !0;
691
- continue;
692
- }
693
- let w = o;
694
- w !== "" && (w += i.indentBy);
695
- const v = o + `<${d}${n(g[":@"], i)}`, p = e(g[d], i, m, w);
696
- i.unpairedTags.indexOf(d) !== -1 ? i.suppressUnpairedNode ? s += v + ">" : s += v + "/>" : p && p.length !== 0 || !i.suppressEmptyNode ? p && p.endsWith(">") ? s += v + `>${p}${o}</${d}>` : (s += v + ">", p && o !== "" && (p.includes("/>") || p.includes("</")) ? s += o + i.indentBy + p + o : s += p, s += `</${d}>`) : s += v + "/>", f = !0;
697
- }
698
- return s;
699
- }
700
- function t(c) {
701
- const i = Object.keys(c);
702
- for (let h = 0; h < i.length; h++) {
703
- const o = i[h];
704
- if (c.hasOwnProperty(o) && o !== ":@") return o;
705
- }
706
- }
707
- function n(c, i) {
708
- let h = "";
709
- if (c && !i.ignoreAttributes) for (let o in c) {
710
- if (!c.hasOwnProperty(o)) continue;
711
- let s = i.attributeValueProcessor(o, c[o]);
712
- s = u(s, i), s === !0 && i.suppressBooleanAttributes ? h += ` ${o.substr(i.attributeNamePrefix.length)}` : h += ` ${o.substr(i.attributeNamePrefix.length)}="${s}"`;
713
- }
714
- return h;
715
- }
716
- function a(c, i) {
717
- let h = (c = c.substr(0, c.length - i.textNodeName.length - 1)).substr(c.lastIndexOf(".") + 1);
718
- for (let o in i.stopNodes) if (i.stopNodes[o] === c || i.stopNodes[o] === "*." + h) return !0;
719
- return !1;
720
- }
721
- function u(c, i) {
722
- if (c && c.length > 0 && i.processEntities) for (let h = 0; h < i.entities.length; h++) {
723
- const o = i.entities[h];
724
- c = c.replace(o.regex, o.val);
725
- }
726
- return c;
727
- }
728
- r.exports = function(c, i) {
729
- let h = "";
730
- return i.format && i.indentBy.length > 0 && (h = `
731
- `), e(c, i, "", h);
732
- };
733
- }, 193: (r, e, t) => {
734
- const n = t(705);
735
- function a(f, l) {
736
- let g = "";
737
- for (; l < f.length && f[l] !== "'" && f[l] !== '"'; l++) g += f[l];
738
- if (g = g.trim(), g.indexOf(" ") !== -1) throw new Error("External entites are not supported");
739
- const d = f[l++];
740
- let m = "";
741
- for (; l < f.length && f[l] !== d; l++) m += f[l];
742
- return [g, m, l];
743
- }
744
- function u(f, l) {
745
- return f[l + 1] === "!" && f[l + 2] === "-" && f[l + 3] === "-";
746
- }
747
- function c(f, l) {
748
- return f[l + 1] === "!" && f[l + 2] === "E" && f[l + 3] === "N" && f[l + 4] === "T" && f[l + 5] === "I" && f[l + 6] === "T" && f[l + 7] === "Y";
749
- }
750
- function i(f, l) {
751
- return f[l + 1] === "!" && f[l + 2] === "E" && f[l + 3] === "L" && f[l + 4] === "E" && f[l + 5] === "M" && f[l + 6] === "E" && f[l + 7] === "N" && f[l + 8] === "T";
752
- }
753
- function h(f, l) {
754
- return f[l + 1] === "!" && f[l + 2] === "A" && f[l + 3] === "T" && f[l + 4] === "T" && f[l + 5] === "L" && f[l + 6] === "I" && f[l + 7] === "S" && f[l + 8] === "T";
755
- }
756
- function o(f, l) {
757
- return f[l + 1] === "!" && f[l + 2] === "N" && f[l + 3] === "O" && f[l + 4] === "T" && f[l + 5] === "A" && f[l + 6] === "T" && f[l + 7] === "I" && f[l + 8] === "O" && f[l + 9] === "N";
758
- }
759
- function s(f) {
760
- if (n.isName(f)) return f;
761
- throw new Error(`Invalid entity name ${f}`);
762
- }
763
- r.exports = function(f, l) {
764
- const g = {};
765
- if (f[l + 3] !== "O" || f[l + 4] !== "C" || f[l + 5] !== "T" || f[l + 6] !== "Y" || f[l + 7] !== "P" || f[l + 8] !== "E") throw new Error("Invalid Tag instead of DOCTYPE");
766
- {
767
- l += 9;
768
- let d = 1, m = !1, w = !1, v = "";
769
- for (; l < f.length; l++) if (f[l] !== "<" || w) if (f[l] === ">") {
770
- if (w ? f[l - 1] === "-" && f[l - 2] === "-" && (w = !1, d--) : d--, d === 0) break;
771
- } else f[l] === "[" ? m = !0 : v += f[l];
772
- else {
773
- if (m && c(f, l)) {
774
- let p, y;
775
- l += 7, [p, y, l] = a(f, l + 1), y.indexOf("&") === -1 && (g[s(p)] = { regx: RegExp(`&${p};`, "g"), val: y });
776
- } else if (m && i(f, l)) l += 8;
777
- else if (m && h(f, l)) l += 8;
778
- else if (m && o(f, l)) l += 9;
779
- else {
780
- if (!u) throw new Error("Invalid DOCTYPE");
781
- w = !0;
782
- }
783
- d++, v = "";
784
- }
785
- if (d !== 0) throw new Error("Unclosed DOCTYPE");
786
- }
787
- return { entities: g, i: l };
788
- };
789
- }, 63: (r, e) => {
790
- const t = { preserveOrder: !1, attributeNamePrefix: "@_", attributesGroupName: !1, textNodeName: "#text", ignoreAttributes: !0, removeNSPrefix: !1, allowBooleanAttributes: !1, parseTagValue: !0, parseAttributeValue: !1, trimValues: !0, cdataPropName: !1, numberParseOptions: { hex: !0, leadingZeros: !0, eNotation: !0 }, tagValueProcessor: function(n, a) {
791
- return a;
792
- }, attributeValueProcessor: function(n, a) {
793
- return a;
794
- }, stopNodes: [], alwaysCreateTextNode: !1, isArray: () => !1, commentPropName: !1, unpairedTags: [], processEntities: !0, htmlEntities: !1, ignoreDeclaration: !1, ignorePiTags: !1, transformTagName: !1, transformAttributeName: !1, updateTag: function(n, a, u) {
795
- return n;
796
- } };
797
- e.buildOptions = function(n) {
798
- return Object.assign({}, t, n);
799
- }, e.defaultOptions = t;
800
- }, 299: (r, e, t) => {
801
- const n = t(705), a = t(365), u = t(193), c = t(494), i = t(118);
802
- function h(b) {
803
- const E = Object.keys(b);
804
- for (let x = 0; x < E.length; x++) {
805
- const T = E[x];
806
- this.lastEntities[T] = { regex: new RegExp("&" + T + ";", "g"), val: b[T] };
807
- }
808
- }
809
- function o(b, E, x, T, O, I, C) {
810
- if (b !== void 0 && (this.options.trimValues && !T && (b = b.trim()), b.length > 0)) {
811
- C || (b = this.replaceEntitiesValue(b));
812
- const P = this.options.tagValueProcessor(E, b, x, O, I);
813
- return P == null ? b : typeof P != typeof b || P !== b ? P : this.options.trimValues || b.trim() === b ? N(b, this.options.parseTagValue, this.options.numberParseOptions) : b;
814
- }
815
- }
816
- function s(b) {
817
- if (this.options.removeNSPrefix) {
818
- const E = b.split(":"), x = b.charAt(0) === "/" ? "/" : "";
819
- if (E[0] === "xmlns") return "";
820
- E.length === 2 && (b = x + E[1]);
821
- }
822
- return b;
823
- }
824
- const f = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
825
- function l(b, E, x) {
826
- if (this.options.ignoreAttributes !== !0 && typeof b == "string") {
827
- const T = n.getAllMatches(b, f), O = T.length, I = {};
828
- for (let C = 0; C < O; C++) {
829
- const P = this.resolveNameSpace(T[C][1]);
830
- if (this.ignoreAttributesFn(P, E)) continue;
831
- let F = T[C][4], S = this.options.attributeNamePrefix + P;
832
- if (P.length) if (this.options.transformAttributeName && (S = this.options.transformAttributeName(S)), S === "__proto__" && (S = "#__proto__"), F !== void 0) {
833
- this.options.trimValues && (F = F.trim()), F = this.replaceEntitiesValue(F);
834
- const j = this.options.attributeValueProcessor(P, F, E);
835
- I[S] = j == null ? F : typeof j != typeof F || j !== F ? j : N(F, this.options.parseAttributeValue, this.options.numberParseOptions);
836
- } else this.options.allowBooleanAttributes && (I[S] = !0);
837
- }
838
- if (!Object.keys(I).length) return;
839
- if (this.options.attributesGroupName) {
840
- const C = {};
841
- return C[this.options.attributesGroupName] = I, C;
842
- }
843
- return I;
844
- }
845
- }
846
- const g = function(b) {
847
- b = b.replace(/\r\n?/g, `
848
- `);
849
- const E = new a("!xml");
850
- let x = E, T = "", O = "";
851
- for (let I = 0; I < b.length; I++) if (b[I] === "<") if (b[I + 1] === "/") {
852
- const C = p(b, ">", I, "Closing Tag is not closed.");
853
- let P = b.substring(I + 2, C).trim();
854
- if (this.options.removeNSPrefix) {
855
- const j = P.indexOf(":");
856
- j !== -1 && (P = P.substr(j + 1));
857
- }
858
- this.options.transformTagName && (P = this.options.transformTagName(P)), x && (T = this.saveTextToParentTag(T, x, O));
859
- const F = O.substring(O.lastIndexOf(".") + 1);
860
- if (P && this.options.unpairedTags.indexOf(P) !== -1) throw new Error(`Unpaired tag can not be used as closing tag: </${P}>`);
861
- let S = 0;
862
- F && this.options.unpairedTags.indexOf(F) !== -1 ? (S = O.lastIndexOf(".", O.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : S = O.lastIndexOf("."), O = O.substring(0, S), x = this.tagsNodeStack.pop(), T = "", I = C;
863
- } else if (b[I + 1] === "?") {
864
- let C = y(b, I, !1, "?>");
865
- if (!C) throw new Error("Pi Tag is not closed.");
866
- if (T = this.saveTextToParentTag(T, x, O), !(this.options.ignoreDeclaration && C.tagName === "?xml" || this.options.ignorePiTags)) {
867
- const P = new a(C.tagName);
868
- P.add(this.options.textNodeName, ""), C.tagName !== C.tagExp && C.attrExpPresent && (P[":@"] = this.buildAttributesMap(C.tagExp, O, C.tagName)), this.addChild(x, P, O);
869
- }
870
- I = C.closeIndex + 1;
871
- } else if (b.substr(I + 1, 3) === "!--") {
872
- const C = p(b, "-->", I + 4, "Comment is not closed.");
873
- if (this.options.commentPropName) {
874
- const P = b.substring(I + 4, C - 2);
875
- T = this.saveTextToParentTag(T, x, O), x.add(this.options.commentPropName, [{ [this.options.textNodeName]: P }]);
876
- }
877
- I = C;
878
- } else if (b.substr(I + 1, 2) === "!D") {
879
- const C = u(b, I);
880
- this.docTypeEntities = C.entities, I = C.i;
881
- } else if (b.substr(I + 1, 2) === "![") {
882
- const C = p(b, "]]>", I, "CDATA is not closed.") - 2, P = b.substring(I + 9, C);
883
- T = this.saveTextToParentTag(T, x, O);
884
- let F = this.parseTextData(P, x.tagname, O, !0, !1, !0, !0);
885
- F == null && (F = ""), this.options.cdataPropName ? x.add(this.options.cdataPropName, [{ [this.options.textNodeName]: P }]) : x.add(this.options.textNodeName, F), I = C + 2;
886
- } else {
887
- let C = y(b, I, this.options.removeNSPrefix), P = C.tagName;
888
- const F = C.rawTagName;
889
- let S = C.tagExp, j = C.attrExpPresent, V = C.closeIndex;
890
- this.options.transformTagName && (P = this.options.transformTagName(P)), x && T && x.tagname !== "!xml" && (T = this.saveTextToParentTag(T, x, O, !1));
891
- const _ = x;
892
- if (_ && this.options.unpairedTags.indexOf(_.tagname) !== -1 && (x = this.tagsNodeStack.pop(), O = O.substring(0, O.lastIndexOf("."))), P !== E.tagname && (O += O ? "." + P : P), this.isItStopNode(this.options.stopNodes, O, P)) {
893
- let $ = "";
894
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), O = O.substr(0, O.length - 1), S = P) : S = S.substr(0, S.length - 1), I = C.closeIndex;
895
- else if (this.options.unpairedTags.indexOf(P) !== -1) I = C.closeIndex;
896
- else {
897
- const L = this.readStopNodeData(b, F, V + 1);
898
- if (!L) throw new Error(`Unexpected end of ${F}`);
899
- I = L.i, $ = L.tagContent;
900
- }
901
- const z = new a(P);
902
- P !== S && j && (z[":@"] = this.buildAttributesMap(S, O, P)), $ && ($ = this.parseTextData($, P, O, !0, j, !0, !0)), O = O.substr(0, O.lastIndexOf(".")), z.add(this.options.textNodeName, $), this.addChild(x, z, O);
903
- } else {
904
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) {
905
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), O = O.substr(0, O.length - 1), S = P) : S = S.substr(0, S.length - 1), this.options.transformTagName && (P = this.options.transformTagName(P));
906
- const $ = new a(P);
907
- P !== S && j && ($[":@"] = this.buildAttributesMap(S, O, P)), this.addChild(x, $, O), O = O.substr(0, O.lastIndexOf("."));
908
- } else {
909
- const $ = new a(P);
910
- this.tagsNodeStack.push(x), P !== S && j && ($[":@"] = this.buildAttributesMap(S, O, P)), this.addChild(x, $, O), x = $;
911
- }
912
- T = "", I = V;
913
- }
914
- }
915
- else T += b[I];
916
- return E.child;
917
- };
918
- function d(b, E, x) {
919
- const T = this.options.updateTag(E.tagname, x, E[":@"]);
920
- T === !1 || (typeof T == "string" && (E.tagname = T), b.addChild(E));
921
- }
922
- const m = function(b) {
923
- if (this.options.processEntities) {
924
- for (let E in this.docTypeEntities) {
925
- const x = this.docTypeEntities[E];
926
- b = b.replace(x.regx, x.val);
927
- }
928
- for (let E in this.lastEntities) {
929
- const x = this.lastEntities[E];
930
- b = b.replace(x.regex, x.val);
931
- }
932
- if (this.options.htmlEntities) for (let E in this.htmlEntities) {
933
- const x = this.htmlEntities[E];
934
- b = b.replace(x.regex, x.val);
935
- }
936
- b = b.replace(this.ampEntity.regex, this.ampEntity.val);
937
- }
938
- return b;
939
- };
940
- function w(b, E, x, T) {
941
- return b && (T === void 0 && (T = Object.keys(E.child).length === 0), (b = this.parseTextData(b, E.tagname, x, !1, !!E[":@"] && Object.keys(E[":@"]).length !== 0, T)) !== void 0 && b !== "" && E.add(this.options.textNodeName, b), b = ""), b;
942
- }
943
- function v(b, E, x) {
944
- const T = "*." + x;
945
- for (const O in b) {
946
- const I = b[O];
947
- if (T === I || E === I) return !0;
948
- }
949
- return !1;
950
- }
951
- function p(b, E, x, T) {
952
- const O = b.indexOf(E, x);
953
- if (O === -1) throw new Error(T);
954
- return O + E.length - 1;
955
- }
956
- function y(b, E, x) {
957
- const T = (function(j, V) {
958
- let _, $ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ">", z = "";
959
- for (let L = V; L < j.length; L++) {
960
- let X = j[L];
961
- if (_) X === _ && (_ = "");
962
- else if (X === '"' || X === "'") _ = X;
963
- else if (X === $[0]) {
964
- if (!$[1]) return { data: z, index: L };
965
- if (j[L + 1] === $[1]) return { data: z, index: L };
966
- } else X === " " && (X = " ");
967
- z += X;
968
- }
969
- })(b, E + 1, arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ">");
970
- if (!T) return;
971
- let O = T.data;
972
- const I = T.index, C = O.search(/\s/);
973
- let P = O, F = !0;
974
- C !== -1 && (P = O.substring(0, C), O = O.substring(C + 1).trimStart());
975
- const S = P;
976
- if (x) {
977
- const j = P.indexOf(":");
978
- j !== -1 && (P = P.substr(j + 1), F = P !== T.data.substr(j + 1));
979
- }
980
- return { tagName: P, tagExp: O, closeIndex: I, attrExpPresent: F, rawTagName: S };
981
- }
982
- function A(b, E, x) {
983
- const T = x;
984
- let O = 1;
985
- for (; x < b.length; x++) if (b[x] === "<") if (b[x + 1] === "/") {
986
- const I = p(b, ">", x, `${E} is not closed`);
987
- if (b.substring(x + 2, I).trim() === E && (O--, O === 0)) return { tagContent: b.substring(T, x), i: I };
988
- x = I;
989
- } else if (b[x + 1] === "?") x = p(b, "?>", x + 1, "StopNode is not closed.");
990
- else if (b.substr(x + 1, 3) === "!--") x = p(b, "-->", x + 3, "StopNode is not closed.");
991
- else if (b.substr(x + 1, 2) === "![") x = p(b, "]]>", x, "StopNode is not closed.") - 2;
992
- else {
993
- const I = y(b, x, ">");
994
- I && ((I && I.tagName) === E && I.tagExp[I.tagExp.length - 1] !== "/" && O++, x = I.closeIndex);
995
- }
996
- }
997
- function N(b, E, x) {
998
- if (E && typeof b == "string") {
999
- const T = b.trim();
1000
- return T === "true" || T !== "false" && c(b, x);
1001
- }
1002
- return n.isExist(b) ? b : "";
1003
- }
1004
- r.exports = class {
1005
- constructor(b) {
1006
- this.options = b, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "¢" }, pound: { regex: /&(pound|#163);/g, val: "£" }, yen: { regex: /&(yen|#165);/g, val: "¥" }, euro: { regex: /&(euro|#8364);/g, val: "€" }, copyright: { regex: /&(copy|#169);/g, val: "©" }, reg: { regex: /&(reg|#174);/g, val: "®" }, inr: { regex: /&(inr|#8377);/g, val: "₹" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 10)) }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 16)) } }, this.addExternalEntities = h, this.parseXml = g, this.parseTextData = o, this.resolveNameSpace = s, this.buildAttributesMap = l, this.isItStopNode = v, this.replaceEntitiesValue = m, this.readStopNodeData = A, this.saveTextToParentTag = w, this.addChild = d, this.ignoreAttributesFn = i(this.options.ignoreAttributes);
1007
- }
1008
- };
1009
- }, 338: (r, e, t) => {
1010
- const { buildOptions: n } = t(63), a = t(299), { prettify: u } = t(728), c = t(31);
1011
- r.exports = class {
1012
- constructor(i) {
1013
- this.externalEntities = {}, this.options = n(i);
1014
- }
1015
- parse(i, h) {
1016
- if (typeof i != "string") {
1017
- if (!i.toString) throw new Error("XML data is accepted in String or Bytes[] form.");
1018
- i = i.toString();
1019
- }
1020
- if (h) {
1021
- h === !0 && (h = {});
1022
- const f = c.validate(i, h);
1023
- if (f !== !0) throw Error(`${f.err.msg}:${f.err.line}:${f.err.col}`);
1024
- }
1025
- const o = new a(this.options);
1026
- o.addExternalEntities(this.externalEntities);
1027
- const s = o.parseXml(i);
1028
- return this.options.preserveOrder || s === void 0 ? s : u(s, this.options);
1029
- }
1030
- addEntity(i, h) {
1031
- if (h.indexOf("&") !== -1) throw new Error("Entity value can't have '&'");
1032
- if (i.indexOf("&") !== -1 || i.indexOf(";") !== -1) throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1033
- if (h === "&") throw new Error("An entity with value '&' is not permitted");
1034
- this.externalEntities[i] = h;
1035
- }
1036
- };
1037
- }, 728: (r, e) => {
1038
- function t(c, i, h) {
1039
- let o;
1040
- const s = {};
1041
- for (let f = 0; f < c.length; f++) {
1042
- const l = c[f], g = n(l);
1043
- let d = "";
1044
- if (d = h === void 0 ? g : h + "." + g, g === i.textNodeName) o === void 0 ? o = l[g] : o += "" + l[g];
1045
- else {
1046
- if (g === void 0) continue;
1047
- if (l[g]) {
1048
- let m = t(l[g], i, d);
1049
- const w = u(m, i);
1050
- l[":@"] ? a(m, l[":@"], d, i) : Object.keys(m).length !== 1 || m[i.textNodeName] === void 0 || i.alwaysCreateTextNode ? Object.keys(m).length === 0 && (i.alwaysCreateTextNode ? m[i.textNodeName] = "" : m = "") : m = m[i.textNodeName], s[g] !== void 0 && s.hasOwnProperty(g) ? (Array.isArray(s[g]) || (s[g] = [s[g]]), s[g].push(m)) : i.isArray(g, d, w) ? s[g] = [m] : s[g] = m;
1051
- }
1052
- }
1053
- }
1054
- return typeof o == "string" ? o.length > 0 && (s[i.textNodeName] = o) : o !== void 0 && (s[i.textNodeName] = o), s;
1055
- }
1056
- function n(c) {
1057
- const i = Object.keys(c);
1058
- for (let h = 0; h < i.length; h++) {
1059
- const o = i[h];
1060
- if (o !== ":@") return o;
1061
- }
1062
- }
1063
- function a(c, i, h, o) {
1064
- if (i) {
1065
- const s = Object.keys(i), f = s.length;
1066
- for (let l = 0; l < f; l++) {
1067
- const g = s[l];
1068
- o.isArray(g, h + "." + g, !0, !0) ? c[g] = [i[g]] : c[g] = i[g];
1069
- }
1070
- }
1071
- }
1072
- function u(c, i) {
1073
- const { textNodeName: h } = i, o = Object.keys(c).length;
1074
- return o === 0 || !(o !== 1 || !c[h] && typeof c[h] != "boolean" && c[h] !== 0);
1075
- }
1076
- e.prettify = function(c, i) {
1077
- return t(c, i);
1078
- };
1079
- }, 365: (r) => {
1080
- r.exports = class {
1081
- constructor(e) {
1082
- this.tagname = e, this.child = [], this[":@"] = {};
1083
- }
1084
- add(e, t) {
1085
- e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: t });
1086
- }
1087
- addChild(e) {
1088
- e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child });
1089
- }
1090
- };
1091
- }, 135: (r) => {
1092
- function e(t) {
1093
- return !!t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
1094
- }
1095
- r.exports = function(t) {
1096
- return t != null && (e(t) || (function(n) {
1097
- return typeof n.readFloatLE == "function" && typeof n.slice == "function" && e(n.slice(0, 0));
1098
- })(t) || !!t._isBuffer);
1099
- };
1100
- }, 542: (r, e, t) => {
1101
- (function() {
1102
- var n = t(298), a = t(526).utf8, u = t(135), c = t(526).bin, i = function(h, o) {
1103
- h.constructor == String ? h = o && o.encoding === "binary" ? c.stringToBytes(h) : a.stringToBytes(h) : u(h) ? h = Array.prototype.slice.call(h, 0) : Array.isArray(h) || h.constructor === Uint8Array || (h = h.toString());
1104
- for (var s = n.bytesToWords(h), f = 8 * h.length, l = 1732584193, g = -271733879, d = -1732584194, m = 271733878, w = 0; w < s.length; w++) s[w] = 16711935 & (s[w] << 8 | s[w] >>> 24) | 4278255360 & (s[w] << 24 | s[w] >>> 8);
1105
- s[f >>> 5] |= 128 << f % 32, s[14 + (f + 64 >>> 9 << 4)] = f;
1106
- var v = i._ff, p = i._gg, y = i._hh, A = i._ii;
1107
- for (w = 0; w < s.length; w += 16) {
1108
- var N = l, b = g, E = d, x = m;
1109
- l = v(l, g, d, m, s[w + 0], 7, -680876936), m = v(m, l, g, d, s[w + 1], 12, -389564586), d = v(d, m, l, g, s[w + 2], 17, 606105819), g = v(g, d, m, l, s[w + 3], 22, -1044525330), l = v(l, g, d, m, s[w + 4], 7, -176418897), m = v(m, l, g, d, s[w + 5], 12, 1200080426), d = v(d, m, l, g, s[w + 6], 17, -1473231341), g = v(g, d, m, l, s[w + 7], 22, -45705983), l = v(l, g, d, m, s[w + 8], 7, 1770035416), m = v(m, l, g, d, s[w + 9], 12, -1958414417), d = v(d, m, l, g, s[w + 10], 17, -42063), g = v(g, d, m, l, s[w + 11], 22, -1990404162), l = v(l, g, d, m, s[w + 12], 7, 1804603682), m = v(m, l, g, d, s[w + 13], 12, -40341101), d = v(d, m, l, g, s[w + 14], 17, -1502002290), l = p(l, g = v(g, d, m, l, s[w + 15], 22, 1236535329), d, m, s[w + 1], 5, -165796510), m = p(m, l, g, d, s[w + 6], 9, -1069501632), d = p(d, m, l, g, s[w + 11], 14, 643717713), g = p(g, d, m, l, s[w + 0], 20, -373897302), l = p(l, g, d, m, s[w + 5], 5, -701558691), m = p(m, l, g, d, s[w + 10], 9, 38016083), d = p(d, m, l, g, s[w + 15], 14, -660478335), g = p(g, d, m, l, s[w + 4], 20, -405537848), l = p(l, g, d, m, s[w + 9], 5, 568446438), m = p(m, l, g, d, s[w + 14], 9, -1019803690), d = p(d, m, l, g, s[w + 3], 14, -187363961), g = p(g, d, m, l, s[w + 8], 20, 1163531501), l = p(l, g, d, m, s[w + 13], 5, -1444681467), m = p(m, l, g, d, s[w + 2], 9, -51403784), d = p(d, m, l, g, s[w + 7], 14, 1735328473), l = y(l, g = p(g, d, m, l, s[w + 12], 20, -1926607734), d, m, s[w + 5], 4, -378558), m = y(m, l, g, d, s[w + 8], 11, -2022574463), d = y(d, m, l, g, s[w + 11], 16, 1839030562), g = y(g, d, m, l, s[w + 14], 23, -35309556), l = y(l, g, d, m, s[w + 1], 4, -1530992060), m = y(m, l, g, d, s[w + 4], 11, 1272893353), d = y(d, m, l, g, s[w + 7], 16, -155497632), g = y(g, d, m, l, s[w + 10], 23, -1094730640), l = y(l, g, d, m, s[w + 13], 4, 681279174), m = y(m, l, g, d, s[w + 0], 11, -358537222), d = y(d, m, l, g, s[w + 3], 16, -722521979), g = y(g, d, m, l, s[w + 6], 23, 76029189), l = y(l, g, d, m, s[w + 9], 4, -640364487), m = y(m, l, g, d, s[w + 12], 11, -421815835), d = y(d, m, l, g, s[w + 15], 16, 530742520), l = A(l, g = y(g, d, m, l, s[w + 2], 23, -995338651), d, m, s[w + 0], 6, -198630844), m = A(m, l, g, d, s[w + 7], 10, 1126891415), d = A(d, m, l, g, s[w + 14], 15, -1416354905), g = A(g, d, m, l, s[w + 5], 21, -57434055), l = A(l, g, d, m, s[w + 12], 6, 1700485571), m = A(m, l, g, d, s[w + 3], 10, -1894986606), d = A(d, m, l, g, s[w + 10], 15, -1051523), g = A(g, d, m, l, s[w + 1], 21, -2054922799), l = A(l, g, d, m, s[w + 8], 6, 1873313359), m = A(m, l, g, d, s[w + 15], 10, -30611744), d = A(d, m, l, g, s[w + 6], 15, -1560198380), g = A(g, d, m, l, s[w + 13], 21, 1309151649), l = A(l, g, d, m, s[w + 4], 6, -145523070), m = A(m, l, g, d, s[w + 11], 10, -1120210379), d = A(d, m, l, g, s[w + 2], 15, 718787259), g = A(g, d, m, l, s[w + 9], 21, -343485551), l = l + N >>> 0, g = g + b >>> 0, d = d + E >>> 0, m = m + x >>> 0;
1110
- }
1111
- return n.endian([l, g, d, m]);
1112
- };
1113
- i._ff = function(h, o, s, f, l, g, d) {
1114
- var m = h + (o & s | ~o & f) + (l >>> 0) + d;
1115
- return (m << g | m >>> 32 - g) + o;
1116
- }, i._gg = function(h, o, s, f, l, g, d) {
1117
- var m = h + (o & f | s & ~f) + (l >>> 0) + d;
1118
- return (m << g | m >>> 32 - g) + o;
1119
- }, i._hh = function(h, o, s, f, l, g, d) {
1120
- var m = h + (o ^ s ^ f) + (l >>> 0) + d;
1121
- return (m << g | m >>> 32 - g) + o;
1122
- }, i._ii = function(h, o, s, f, l, g, d) {
1123
- var m = h + (s ^ (o | ~f)) + (l >>> 0) + d;
1124
- return (m << g | m >>> 32 - g) + o;
1125
- }, i._blocksize = 16, i._digestsize = 16, r.exports = function(h, o) {
1126
- if (h == null) throw new Error("Illegal argument " + h);
1127
- var s = n.wordsToBytes(i(h, o));
1128
- return o && o.asBytes ? s : o && o.asString ? c.bytesToString(s) : n.bytesToHex(s);
1129
- };
1130
- })();
1131
- }, 285: (r, e, t) => {
1132
- var n = t(2);
1133
- r.exports = function(v) {
1134
- return v ? (v.substr(0, 2) === "{}" && (v = "\\{\\}" + v.substr(2)), w((function(p) {
1135
- return p.split("\\\\").join(a).split("\\{").join(u).split("\\}").join(c).split("\\,").join(i).split("\\.").join(h);
1136
- })(v), !0).map(s)) : [];
1137
- };
1138
- var a = "\0SLASH" + Math.random() + "\0", u = "\0OPEN" + Math.random() + "\0", c = "\0CLOSE" + Math.random() + "\0", i = "\0COMMA" + Math.random() + "\0", h = "\0PERIOD" + Math.random() + "\0";
1139
- function o(v) {
1140
- return parseInt(v, 10) == v ? parseInt(v, 10) : v.charCodeAt(0);
1141
- }
1142
- function s(v) {
1143
- return v.split(a).join("\\").split(u).join("{").split(c).join("}").split(i).join(",").split(h).join(".");
1144
- }
1145
- function f(v) {
1146
- if (!v) return [""];
1147
- var p = [], y = n("{", "}", v);
1148
- if (!y) return v.split(",");
1149
- var A = y.pre, N = y.body, b = y.post, E = A.split(",");
1150
- E[E.length - 1] += "{" + N + "}";
1151
- var x = f(b);
1152
- return b.length && (E[E.length - 1] += x.shift(), E.push.apply(E, x)), p.push.apply(p, E), p;
1153
- }
1154
- function l(v) {
1155
- return "{" + v + "}";
1156
- }
1157
- function g(v) {
1158
- return /^-?0\d/.test(v);
1159
- }
1160
- function d(v, p) {
1161
- return v <= p;
1162
- }
1163
- function m(v, p) {
1164
- return v >= p;
1165
- }
1166
- function w(v, p) {
1167
- var y = [], A = n("{", "}", v);
1168
- if (!A) return [v];
1169
- var N = A.pre, b = A.post.length ? w(A.post, !1) : [""];
1170
- if (/\$$/.test(A.pre)) for (var E = 0; E < b.length; E++) {
1171
- var x = N + "{" + A.body + "}" + b[E];
1172
- y.push(x);
1173
- }
1174
- else {
1175
- var T, O, I = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(A.body), C = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(A.body), P = I || C, F = A.body.indexOf(",") >= 0;
1176
- if (!P && !F) return A.post.match(/,.*\}/) ? w(v = A.pre + "{" + A.body + c + A.post) : [v];
1177
- if (P) T = A.body.split(/\.\./);
1178
- else if ((T = f(A.body)).length === 1 && (T = w(T[0], !1).map(l)).length === 1) return b.map((function(wr) {
1179
- return A.pre + T[0] + wr;
1180
- }));
1181
- if (P) {
1182
- var S = o(T[0]), j = o(T[1]), V = Math.max(T[0].length, T[1].length), _ = T.length == 3 ? Math.abs(o(T[2])) : 1, $ = d;
1183
- j < S && (_ *= -1, $ = m);
1184
- var z = T.some(g);
1185
- O = [];
1186
- for (var L = S; $(L, j); L += _) {
1187
- var X;
1188
- if (C) (X = String.fromCharCode(L)) === "\\" && (X = "");
1189
- else if (X = String(L), z) {
1190
- var gt = V - X.length;
1191
- if (gt > 0) {
1192
- var dt = new Array(gt + 1).join("0");
1193
- X = L < 0 ? "-" + dt + X.slice(1) : dt + X;
1194
- }
1195
- }
1196
- O.push(X);
1197
- }
1198
- } else {
1199
- O = [];
1200
- for (var ie = 0; ie < T.length; ie++) O.push.apply(O, w(T[ie], !1));
1201
- }
1202
- for (ie = 0; ie < O.length; ie++) for (E = 0; E < b.length; E++) x = N + O[ie] + b[E], (!p || P || x) && y.push(x);
1203
- }
1204
- return y;
1205
- }
1206
- }, 829: (r) => {
1207
- function e(o) {
1208
- return e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
1209
- return typeof s;
1210
- } : function(s) {
1211
- return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
1212
- }, e(o);
1213
- }
1214
- function t(o) {
1215
- var s = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
1216
- return t = function(f) {
1217
- if (f === null || (l = f, Function.toString.call(l).indexOf("[native code]") === -1)) return f;
1218
- var l;
1219
- if (typeof f != "function") throw new TypeError("Super expression must either be null or a function");
1220
- if (s !== void 0) {
1221
- if (s.has(f)) return s.get(f);
1222
- s.set(f, g);
1223
- }
1224
- function g() {
1225
- return n(f, arguments, u(this).constructor);
1226
- }
1227
- return g.prototype = Object.create(f.prototype, { constructor: { value: g, enumerable: !1, writable: !0, configurable: !0 } }), a(g, f);
1228
- }, t(o);
1229
- }
1230
- function n(o, s, f) {
1231
- return n = (function() {
1232
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
1233
- if (typeof Proxy == "function") return !0;
1234
- try {
1235
- return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {
1236
- }))), !0;
1237
- } catch {
1238
- return !1;
1239
- }
1240
- })() ? Reflect.construct : function(l, g, d) {
1241
- var m = [null];
1242
- m.push.apply(m, g);
1243
- var w = new (Function.bind.apply(l, m))();
1244
- return d && a(w, d.prototype), w;
1245
- }, n.apply(null, arguments);
1246
- }
1247
- function a(o, s) {
1248
- return a = Object.setPrototypeOf || function(f, l) {
1249
- return f.__proto__ = l, f;
1250
- }, a(o, s);
1251
- }
1252
- function u(o) {
1253
- return u = Object.setPrototypeOf ? Object.getPrototypeOf : function(s) {
1254
- return s.__proto__ || Object.getPrototypeOf(s);
1255
- }, u(o);
1256
- }
1257
- var c = (function(o) {
1258
- function s(f) {
1259
- var l;
1260
- return (function(g, d) {
1261
- if (!(g instanceof d)) throw new TypeError("Cannot call a class as a function");
1262
- })(this, s), (l = (function(g, d) {
1263
- return !d || e(d) !== "object" && typeof d != "function" ? (function(m) {
1264
- if (m === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1265
- return m;
1266
- })(g) : d;
1267
- })(this, u(s).call(this, f))).name = "ObjectPrototypeMutationError", l;
1268
- }
1269
- return (function(f, l) {
1270
- if (typeof l != "function" && l !== null) throw new TypeError("Super expression must either be null or a function");
1271
- f.prototype = Object.create(l && l.prototype, { constructor: { value: f, writable: !0, configurable: !0 } }), l && a(f, l);
1272
- })(s, o), s;
1273
- })(t(Error));
1274
- function i(o, s) {
1275
- for (var f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
1276
- }, l = s.split("."), g = l.length, d = function(v) {
1277
- var p = l[v];
1278
- if (!o) return { v: void 0 };
1279
- if (p === "+") {
1280
- if (Array.isArray(o)) return { v: o.map((function(A, N) {
1281
- var b = l.slice(v + 1);
1282
- return b.length > 0 ? i(A, b.join("."), f) : f(o, N, l, v);
1283
- })) };
1284
- var y = l.slice(0, v).join(".");
1285
- throw new Error("Object at wildcard (".concat(y, ") is not an array"));
1286
- }
1287
- o = f(o, p, l, v);
1288
- }, m = 0; m < g; m++) {
1289
- var w = d(m);
1290
- if (e(w) === "object") return w.v;
1291
- }
1292
- return o;
1293
- }
1294
- function h(o, s) {
1295
- return o.length === s + 1;
1296
- }
1297
- r.exports = { set: function(o, s, f) {
1298
- if (e(o) != "object" || o === null || s === void 0) return o;
1299
- if (typeof s == "number") return o[s] = f, o[s];
1300
- try {
1301
- return i(o, s, (function(l, g, d, m) {
1302
- if (l === Reflect.getPrototypeOf({})) throw new c("Attempting to mutate Object.prototype");
1303
- if (!l[g]) {
1304
- var w = Number.isInteger(Number(d[m + 1])), v = d[m + 1] === "+";
1305
- l[g] = w || v ? [] : {};
1306
- }
1307
- return h(d, m) && (l[g] = f), l[g];
1308
- }));
1309
- } catch (l) {
1310
- if (l instanceof c) throw l;
1311
- return o;
1312
- }
1313
- }, get: function(o, s) {
1314
- if (e(o) != "object" || o === null || s === void 0) return o;
1315
- if (typeof s == "number") return o[s];
1316
- try {
1317
- return i(o, s, (function(f, l) {
1318
- return f[l];
1319
- }));
1320
- } catch {
1321
- return o;
1322
- }
1323
- }, has: function(o, s) {
1324
- var f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1325
- if (e(o) != "object" || o === null || s === void 0) return !1;
1326
- if (typeof s == "number") return s in o;
1327
- try {
1328
- var l = !1;
1329
- return i(o, s, (function(g, d, m, w) {
1330
- if (!h(m, w)) return g && g[d];
1331
- l = f.own ? g.hasOwnProperty(d) : d in g;
1332
- })), l;
1333
- } catch {
1334
- return !1;
1335
- }
1336
- }, hasOwn: function(o, s, f) {
1337
- return this.has(o, s, f || { own: !0 });
1338
- }, isIn: function(o, s, f) {
1339
- var l = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1340
- if (e(o) != "object" || o === null || s === void 0) return !1;
1341
- try {
1342
- var g = !1, d = !1;
1343
- return i(o, s, (function(m, w, v, p) {
1344
- return g = g || m === f || !!m && m[w] === f, d = h(v, p) && e(m) === "object" && w in m, m && m[w];
1345
- })), l.validPath ? g && d : g;
1346
- } catch {
1347
- return !1;
1348
- }
1349
- }, ObjectPrototypeMutationError: c };
1350
- }, 47: (r, e, t) => {
1351
- var n = t(410), a = function(o) {
1352
- return typeof o == "string";
1353
- };
1354
- function u(o, s) {
1355
- for (var f = [], l = 0; l < o.length; l++) {
1356
- var g = o[l];
1357
- g && g !== "." && (g === ".." ? f.length && f[f.length - 1] !== ".." ? f.pop() : s && f.push("..") : f.push(g));
1358
- }
1359
- return f;
1360
- }
1361
- var c = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/, i = {};
1362
- function h(o) {
1363
- return c.exec(o).slice(1);
1364
- }
1365
- i.resolve = function() {
1366
- for (var o = "", s = !1, f = arguments.length - 1; f >= -1 && !s; f--) {
1367
- var l = f >= 0 ? arguments[f] : oe.cwd();
1368
- if (!a(l)) throw new TypeError("Arguments to path.resolve must be strings");
1369
- l && (o = l + "/" + o, s = l.charAt(0) === "/");
1370
- }
1371
- return (s ? "/" : "") + (o = u(o.split("/"), !s).join("/")) || ".";
1372
- }, i.normalize = function(o) {
1373
- var s = i.isAbsolute(o), f = o.substr(-1) === "/";
1374
- return (o = u(o.split("/"), !s).join("/")) || s || (o = "."), o && f && (o += "/"), (s ? "/" : "") + o;
1375
- }, i.isAbsolute = function(o) {
1376
- return o.charAt(0) === "/";
1377
- }, i.join = function() {
1378
- for (var o = "", s = 0; s < arguments.length; s++) {
1379
- var f = arguments[s];
1380
- if (!a(f)) throw new TypeError("Arguments to path.join must be strings");
1381
- f && (o += o ? "/" + f : f);
1382
- }
1383
- return i.normalize(o);
1384
- }, i.relative = function(o, s) {
1385
- function f(p) {
1386
- for (var y = 0; y < p.length && p[y] === ""; y++) ;
1387
- for (var A = p.length - 1; A >= 0 && p[A] === ""; A--) ;
1388
- return y > A ? [] : p.slice(y, A + 1);
1389
- }
1390
- o = i.resolve(o).substr(1), s = i.resolve(s).substr(1);
1391
- for (var l = f(o.split("/")), g = f(s.split("/")), d = Math.min(l.length, g.length), m = d, w = 0; w < d; w++) if (l[w] !== g[w]) {
1392
- m = w;
1393
- break;
1394
- }
1395
- var v = [];
1396
- for (w = m; w < l.length; w++) v.push("..");
1397
- return (v = v.concat(g.slice(m))).join("/");
1398
- }, i._makeLong = function(o) {
1399
- return o;
1400
- }, i.dirname = function(o) {
1401
- var s = h(o), f = s[0], l = s[1];
1402
- return f || l ? (l && (l = l.substr(0, l.length - 1)), f + l) : ".";
1403
- }, i.basename = function(o, s) {
1404
- var f = h(o)[2];
1405
- return s && f.substr(-1 * s.length) === s && (f = f.substr(0, f.length - s.length)), f;
1406
- }, i.extname = function(o) {
1407
- return h(o)[3];
1408
- }, i.format = function(o) {
1409
- if (!n.isObject(o)) throw new TypeError("Parameter 'pathObject' must be an object, not " + typeof o);
1410
- var s = o.root || "";
1411
- if (!a(s)) throw new TypeError("'pathObject.root' must be a string or undefined, not " + typeof o.root);
1412
- return (o.dir ? o.dir + i.sep : "") + (o.base || "");
1413
- }, i.parse = function(o) {
1414
- if (!a(o)) throw new TypeError("Parameter 'pathString' must be a string, not " + typeof o);
1415
- var s = h(o);
1416
- if (!s || s.length !== 4) throw new TypeError("Invalid path '" + o + "'");
1417
- return s[1] = s[1] || "", s[2] = s[2] || "", s[3] = s[3] || "", { root: s[0], dir: s[0] + s[1].slice(0, s[1].length - 1), base: s[2], ext: s[3], name: s[2].slice(0, s[2].length - s[3].length) };
1418
- }, i.sep = "/", i.delimiter = ":", r.exports = i;
1419
- }, 647: (r, e) => {
1420
- var t = Object.prototype.hasOwnProperty;
1421
- function n(u) {
1422
- try {
1423
- return decodeURIComponent(u.replace(/\+/g, " "));
1424
- } catch {
1425
- return null;
1426
- }
1427
- }
1428
- function a(u) {
1429
- try {
1430
- return encodeURIComponent(u);
1431
- } catch {
1432
- return null;
1433
- }
1434
- }
1435
- e.stringify = function(u, c) {
1436
- c = c || "";
1437
- var i, h, o = [];
1438
- for (h in typeof c != "string" && (c = "?"), u) if (t.call(u, h)) {
1439
- if ((i = u[h]) || i != null && !isNaN(i) || (i = ""), h = a(h), i = a(i), h === null || i === null) continue;
1440
- o.push(h + "=" + i);
1441
- }
1442
- return o.length ? c + o.join("&") : "";
1443
- }, e.parse = function(u) {
1444
- for (var c, i = /([^=?#&]+)=?([^&]*)/g, h = {}; c = i.exec(u); ) {
1445
- var o = n(c[1]), s = n(c[2]);
1446
- o === null || s === null || o in h || (h[o] = s);
1447
- }
1448
- return h;
1449
- };
1450
- }, 670: (r) => {
1451
- r.exports = function(e, t) {
1452
- if (t = t.split(":")[0], !(e = +e)) return !1;
1453
- switch (t) {
1454
- case "http":
1455
- case "ws":
1456
- return e !== 80;
1457
- case "https":
1458
- case "wss":
1459
- return e !== 443;
1460
- case "ftp":
1461
- return e !== 21;
1462
- case "gopher":
1463
- return e !== 70;
1464
- case "file":
1465
- return !1;
1466
- }
1467
- return e !== 0;
1468
- };
1469
- }, 494: (r) => {
1470
- const e = /^[-+]?0x[a-fA-F0-9]+$/, t = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
1471
- !Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt), !Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
1472
- const n = { hex: !0, leadingZeros: !0, decimalPoint: ".", eNotation: !0 };
1473
- r.exports = function(a) {
1474
- let u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1475
- if (u = Object.assign({}, n, u), !a || typeof a != "string") return a;
1476
- let c = a.trim();
1477
- if (u.skipLike !== void 0 && u.skipLike.test(c)) return a;
1478
- if (u.hex && e.test(c)) return Number.parseInt(c, 16);
1479
- {
1480
- const h = t.exec(c);
1481
- if (h) {
1482
- const o = h[1], s = h[2];
1483
- let f = ((i = h[3]) && i.indexOf(".") !== -1 && ((i = i.replace(/0+$/, "")) === "." ? i = "0" : i[0] === "." ? i = "0" + i : i[i.length - 1] === "." && (i = i.substr(0, i.length - 1))), i);
1484
- const l = h[4] || h[6];
1485
- if (!u.leadingZeros && s.length > 0 && o && c[2] !== "." || !u.leadingZeros && s.length > 0 && !o && c[1] !== ".") return a;
1486
- {
1487
- const g = Number(c), d = "" + g;
1488
- return d.search(/[eE]/) !== -1 || l ? u.eNotation ? g : a : c.indexOf(".") !== -1 ? d === "0" && f === "" || d === f || o && d === "-" + f ? g : a : s ? f === d || o + f === d ? g : a : c === d || c === o + d ? g : a;
1489
- }
1490
- }
1491
- return a;
1492
- }
1493
- var i;
1494
- };
1495
- }, 737: (r, e, t) => {
1496
- var n = t(670), a = t(647), u = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, c = /[\n\r\t]/g, i = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, h = /:\d+$/, o = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, s = /^[a-zA-Z]:/;
1497
- function f(p) {
1498
- return (p || "").toString().replace(u, "");
1499
- }
1500
- var l = [["#", "hash"], ["?", "query"], function(p, y) {
1501
- return m(y.protocol) ? p.replace(/\\/g, "/") : p;
1502
- }, ["/", "pathname"], ["@", "auth", 1], [NaN, "host", void 0, 1, 1], [/:(\d*)$/, "port", void 0, 1], [NaN, "hostname", void 0, 1, 1]], g = { hash: 1, query: 1 };
1503
- function d(p) {
1504
- var y, A = (typeof window < "u" ? window : typeof ve < "u" ? ve : typeof self < "u" ? self : {}).location || {}, N = {}, b = typeof (p = p || A);
1505
- if (p.protocol === "blob:") N = new v(unescape(p.pathname), {});
1506
- else if (b === "string") for (y in N = new v(p, {}), g) delete N[y];
1507
- else if (b === "object") {
1508
- for (y in p) y in g || (N[y] = p[y]);
1509
- N.slashes === void 0 && (N.slashes = i.test(p.href));
1510
- }
1511
- return N;
1512
- }
1513
- function m(p) {
1514
- return p === "file:" || p === "ftp:" || p === "http:" || p === "https:" || p === "ws:" || p === "wss:";
1515
- }
1516
- function w(p, y) {
1517
- p = (p = f(p)).replace(c, ""), y = y || {};
1518
- var A, N = o.exec(p), b = N[1] ? N[1].toLowerCase() : "", E = !!N[2], x = !!N[3], T = 0;
1519
- return E ? x ? (A = N[2] + N[3] + N[4], T = N[2].length + N[3].length) : (A = N[2] + N[4], T = N[2].length) : x ? (A = N[3] + N[4], T = N[3].length) : A = N[4], b === "file:" ? T >= 2 && (A = A.slice(2)) : m(b) ? A = N[4] : b ? E && (A = A.slice(2)) : T >= 2 && m(y.protocol) && (A = N[4]), { protocol: b, slashes: E || m(b), slashesCount: T, rest: A };
1520
- }
1521
- function v(p, y, A) {
1522
- if (p = (p = f(p)).replace(c, ""), !(this instanceof v)) return new v(p, y, A);
1523
- var N, b, E, x, T, O, I = l.slice(), C = typeof y, P = this, F = 0;
1524
- for (C !== "object" && C !== "string" && (A = y, y = null), A && typeof A != "function" && (A = a.parse), N = !(b = w(p || "", y = d(y))).protocol && !b.slashes, P.slashes = b.slashes || N && y.slashes, P.protocol = b.protocol || y.protocol || "", p = b.rest, (b.protocol === "file:" && (b.slashesCount !== 2 || s.test(p)) || !b.slashes && (b.protocol || b.slashesCount < 2 || !m(P.protocol))) && (I[3] = [/(.*)/, "pathname"]); F < I.length; F++) typeof (x = I[F]) != "function" ? (E = x[0], O = x[1], E != E ? P[O] = p : typeof E == "string" ? ~(T = E === "@" ? p.lastIndexOf(E) : p.indexOf(E)) && (typeof x[2] == "number" ? (P[O] = p.slice(0, T), p = p.slice(T + x[2])) : (P[O] = p.slice(T), p = p.slice(0, T))) : (T = E.exec(p)) && (P[O] = T[1], p = p.slice(0, T.index)), P[O] = P[O] || N && x[3] && y[O] || "", x[4] && (P[O] = P[O].toLowerCase())) : p = x(p, P);
1525
- A && (P.query = A(P.query)), N && y.slashes && P.pathname.charAt(0) !== "/" && (P.pathname !== "" || y.pathname !== "") && (P.pathname = (function(S, j) {
1526
- if (S === "") return j;
1527
- for (var V = (j || "/").split("/").slice(0, -1).concat(S.split("/")), _ = V.length, $ = V[_ - 1], z = !1, L = 0; _--; ) V[_] === "." ? V.splice(_, 1) : V[_] === ".." ? (V.splice(_, 1), L++) : L && (_ === 0 && (z = !0), V.splice(_, 1), L--);
1528
- return z && V.unshift(""), $ !== "." && $ !== ".." || V.push(""), V.join("/");
1529
- })(P.pathname, y.pathname)), P.pathname.charAt(0) !== "/" && m(P.protocol) && (P.pathname = "/" + P.pathname), n(P.port, P.protocol) || (P.host = P.hostname, P.port = ""), P.username = P.password = "", P.auth && (~(T = P.auth.indexOf(":")) ? (P.username = P.auth.slice(0, T), P.username = encodeURIComponent(decodeURIComponent(P.username)), P.password = P.auth.slice(T + 1), P.password = encodeURIComponent(decodeURIComponent(P.password))) : P.username = encodeURIComponent(decodeURIComponent(P.auth)), P.auth = P.password ? P.username + ":" + P.password : P.username), P.origin = P.protocol !== "file:" && m(P.protocol) && P.host ? P.protocol + "//" + P.host : "null", P.href = P.toString();
1530
- }
1531
- v.prototype = { set: function(p, y, A) {
1532
- var N = this;
1533
- switch (p) {
1534
- case "query":
1535
- typeof y == "string" && y.length && (y = (A || a.parse)(y)), N[p] = y;
1536
- break;
1537
- case "port":
1538
- N[p] = y, n(y, N.protocol) ? y && (N.host = N.hostname + ":" + y) : (N.host = N.hostname, N[p] = "");
1539
- break;
1540
- case "hostname":
1541
- N[p] = y, N.port && (y += ":" + N.port), N.host = y;
1542
- break;
1543
- case "host":
1544
- N[p] = y, h.test(y) ? (y = y.split(":"), N.port = y.pop(), N.hostname = y.join(":")) : (N.hostname = y, N.port = "");
1545
- break;
1546
- case "protocol":
1547
- N.protocol = y.toLowerCase(), N.slashes = !A;
1548
- break;
1549
- case "pathname":
1550
- case "hash":
1551
- if (y) {
1552
- var b = p === "pathname" ? "/" : "#";
1553
- N[p] = y.charAt(0) !== b ? b + y : y;
1554
- } else N[p] = y;
1555
- break;
1556
- case "username":
1557
- case "password":
1558
- N[p] = encodeURIComponent(y);
1559
- break;
1560
- case "auth":
1561
- var E = y.indexOf(":");
1562
- ~E ? (N.username = y.slice(0, E), N.username = encodeURIComponent(decodeURIComponent(N.username)), N.password = y.slice(E + 1), N.password = encodeURIComponent(decodeURIComponent(N.password))) : N.username = encodeURIComponent(decodeURIComponent(y));
1563
- }
1564
- for (var x = 0; x < l.length; x++) {
1565
- var T = l[x];
1566
- T[4] && (N[T[1]] = N[T[1]].toLowerCase());
1567
- }
1568
- return N.auth = N.password ? N.username + ":" + N.password : N.username, N.origin = N.protocol !== "file:" && m(N.protocol) && N.host ? N.protocol + "//" + N.host : "null", N.href = N.toString(), N;
1569
- }, toString: function(p) {
1570
- p && typeof p == "function" || (p = a.stringify);
1571
- var y, A = this, N = A.host, b = A.protocol;
1572
- b && b.charAt(b.length - 1) !== ":" && (b += ":");
1573
- var E = b + (A.protocol && A.slashes || m(A.protocol) ? "//" : "");
1574
- return A.username ? (E += A.username, A.password && (E += ":" + A.password), E += "@") : A.password ? (E += ":" + A.password, E += "@") : A.protocol !== "file:" && m(A.protocol) && !N && A.pathname !== "/" && (E += "@"), (N[N.length - 1] === ":" || h.test(A.hostname) && !A.port) && (N += ":"), E += N + A.pathname, (y = typeof A.query == "object" ? p(A.query) : A.query) && (E += y.charAt(0) !== "?" ? "?" + y : y), A.hash && (E += A.hash), E;
1575
- } }, v.extractProtocol = w, v.location = d, v.trimLeft = f, v.qs = a, r.exports = v;
1576
- }, 410: () => {
1577
- }, 388: () => {
1578
- }, 805: () => {
1579
- }, 345: () => {
1580
- }, 800: () => {
1581
- } }, mt = {};
1582
- function R(r) {
1583
- var e = mt[r];
1584
- if (e !== void 0) return e.exports;
1585
- var t = mt[r] = { id: r, loaded: !1, exports: {} };
1586
- return Br[r].call(t.exports, t, t.exports, R), t.loaded = !0, t.exports;
1587
- }
1588
- R.n = (r) => {
1589
- var e = r && r.__esModule ? () => r.default : () => r;
1590
- return R.d(e, { a: e }), e;
1591
- }, R.d = (r, e) => {
1592
- for (var t in e) R.o(e, t) && !R.o(r, t) && Object.defineProperty(r, t, { enumerable: !0, get: e[t] });
1593
- }, R.o = (r, e) => Object.prototype.hasOwnProperty.call(r, e), R.nmd = (r) => (r.paths = [], r.children || (r.children = []), r);
1594
- var ee = {};
1595
- R.d(ee, { hT: () => J, O4: () => ne, Kd: () => Yr, YK: () => Kr, UU: () => ss, Gu: () => rr, ky: () => hr, h4: () => ye, ch: () => Se, hq: () => ae, i5: () => fr });
1596
- var qr = R(737), Wr = R.n(qr);
1597
- function Fe(r) {
1598
- if (!Qe(r)) throw new Error("Parameter was not an error");
1599
- }
1600
- function Qe(r) {
1601
- return !!r && typeof r == "object" && (e = r, Object.prototype.toString.call(e) === "[object Error]") || r instanceof Error;
1602
- var e;
1603
- }
1604
- class K extends Error {
1605
- constructor(e, t) {
1606
- const n = [...arguments], { options: a, shortMessage: u } = (function(i) {
1607
- let h, o = "";
1608
- if (i.length === 0) h = {};
1609
- else if (Qe(i[0])) h = { cause: i[0] }, o = i.slice(1).join(" ") || "";
1610
- else if (i[0] && typeof i[0] == "object") h = Object.assign({}, i[0]), o = i.slice(1).join(" ") || "";
1611
- else {
1612
- if (typeof i[0] != "string") throw new Error("Invalid arguments passed to Layerr");
1613
- h = {}, o = o = i.join(" ") || "";
1614
- }
1615
- return { options: h, shortMessage: o };
1616
- })(n);
1617
- let c = u;
1618
- if (a.cause && (c = `${c}: ${a.cause.message}`), super(c), this.message = c, a.name && typeof a.name == "string" ? this.name = a.name : this.name = "Layerr", a.cause && Object.defineProperty(this, "_cause", { value: a.cause }), Object.defineProperty(this, "_info", { value: {} }), a.info && typeof a.info == "object" && Object.assign(this._info, a.info), Error.captureStackTrace) {
1619
- const i = a.constructorOpt || this.constructor;
1620
- Error.captureStackTrace(this, i);
1621
- }
1622
- }
1623
- static cause(e) {
1624
- return Fe(e), e._cause && Qe(e._cause) ? e._cause : null;
1625
- }
1626
- static fullStack(e) {
1627
- Fe(e);
1628
- const t = K.cause(e);
1629
- return t ? `${e.stack}
1630
- caused by: ${K.fullStack(t)}` : e.stack ?? "";
1631
- }
1632
- static info(e) {
1633
- Fe(e);
1634
- const t = {}, n = K.cause(e);
1635
- return n && Object.assign(t, K.info(n)), e._info && Object.assign(t, e._info), t;
1636
- }
1637
- toString() {
1638
- let e = this.name || this.constructor.name || this.constructor.prototype.name;
1639
- return this.message && (e = `${e}: ${this.message}`), e;
1640
- }
1641
- }
1642
- var Xr = R(47), Pe = R.n(Xr);
1643
- const bt = "__PATH_SEPARATOR_POSIX__", yt = "__PATH_SEPARATOR_WINDOWS__";
1644
- function k(r) {
1645
- try {
1646
- const e = r.replace(/\//g, bt).replace(/\\\\/g, yt);
1647
- return encodeURIComponent(e).split(yt).join("\\\\").split(bt).join("/");
1648
- } catch (e) {
1649
- throw new K(e, "Failed encoding path");
1650
- }
1651
- }
1652
- function vt(r) {
1653
- return r.startsWith("/") ? r : "/" + r;
1654
- }
1655
- function be(r) {
1656
- let e = r;
1657
- return e[0] !== "/" && (e = "/" + e), /^.+\/$/.test(e) && (e = e.substr(0, e.length - 1)), e;
1658
- }
1659
- function Gr(r) {
1660
- let e = new (Wr())(r).pathname;
1661
- return e.length <= 0 && (e = "/"), be(e);
1662
- }
1663
- function U() {
1664
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1665
- return (function() {
1666
- return (function(n) {
1667
- var a = [];
1668
- if (n.length === 0) return "";
1669
- if (typeof n[0] != "string") throw new TypeError("Url must be a string. Received " + n[0]);
1670
- if (n[0].match(/^[^/:]+:\/*$/) && n.length > 1) {
1671
- var u = n.shift();
1672
- n[0] = u + n[0];
1673
- }
1674
- n[0].match(/^file:\/\/\//) ? n[0] = n[0].replace(/^([^/:]+):\/*/, "$1:///") : n[0] = n[0].replace(/^([^/:]+):\/*/, "$1://");
1675
- for (var c = 0; c < n.length; c++) {
1676
- var i = n[c];
1677
- if (typeof i != "string") throw new TypeError("Url must be a string. Received " + i);
1678
- i !== "" && (c > 0 && (i = i.replace(/^[\/]+/, "")), i = c < n.length - 1 ? i.replace(/[\/]+$/, "") : i.replace(/[\/]+$/, "/"), a.push(i));
1679
- }
1680
- var h = a.join("/"), o = (h = h.replace(/\/(\?|&|#[^!])/g, "$1")).split("?");
1681
- return o.shift() + (o.length > 0 ? "?" : "") + o.join("&");
1682
- })(typeof arguments[0] == "object" ? arguments[0] : [].slice.call(arguments));
1683
- })(e.reduce(((n, a, u) => ((u === 0 || a !== "/" || a === "/" && n[n.length - 1] !== "/") && n.push(a), n)), []));
1684
- }
1685
- var zr = R(542), fe = R.n(zr);
1686
- const Hr = "abcdef0123456789";
1687
- function wt(r, e) {
1688
- const t = r.url.replace("//", ""), n = t.indexOf("/") == -1 ? "/" : t.slice(t.indexOf("/")), a = r.method ? r.method.toUpperCase() : "GET", u = !!/(^|,)\s*auth\s*($|,)/.test(e.qop) && "auth", c = `00000000${e.nc}`.slice(-8), i = (function(l, g, d, m, w, v, p) {
1689
- const y = p || fe()(`${g}:${d}:${m}`);
1690
- return l && l.toLowerCase() === "md5-sess" ? fe()(`${y}:${w}:${v}`) : y;
1691
- })(e.algorithm, e.username, e.realm, e.password, e.nonce, e.cnonce, e.ha1), h = fe()(`${a}:${n}`), o = u ? fe()(`${i}:${e.nonce}:${c}:${e.cnonce}:${u}:${h}`) : fe()(`${i}:${e.nonce}:${h}`), s = { username: e.username, realm: e.realm, nonce: e.nonce, uri: n, qop: u, response: o, nc: c, cnonce: e.cnonce, algorithm: e.algorithm, opaque: e.opaque }, f = [];
1692
- for (const l in s) s[l] && (l === "qop" || l === "nc" || l === "algorithm" ? f.push(`${l}=${s[l]}`) : f.push(`${l}="${s[l]}"`));
1693
- return `Digest ${f.join(", ")}`;
1694
- }
1695
- function Dt(r) {
1696
- return (r.headers && r.headers.get("www-authenticate") || "").split(/\s/)[0].toLowerCase() === "digest";
1697
- }
1698
- var Zr = R(101), er = R.n(Zr);
1699
- function Nt(r) {
1700
- return er().decode(r);
1701
- }
1702
- function xt(r, e) {
1703
- var t;
1704
- return `Basic ${t = `${r}:${e}`, er().encode(t)}`;
1705
- }
1706
- const Ee = typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : typeof window < "u" ? window : globalThis, Jr = Ee.fetch.bind(Ee), Yr = Ee.Request, Kr = Ee.Response;
1707
- let J = (function(r) {
1708
- return r.Auto = "auto", r.Digest = "digest", r.None = "none", r.Password = "password", r.Token = "token", r;
1709
- })({}), ne = (function(r) {
1710
- return r.DataTypeNoLength = "data-type-no-length", r.InvalidAuthType = "invalid-auth-type", r.InvalidOutputFormat = "invalid-output-format", r.LinkUnsupportedAuthType = "link-unsupported-auth", r.InvalidUpdateRange = "invalid-update-range", r.NotSupported = "not-supported", r;
1711
- })({});
1712
- function tr(r, e, t, n, a) {
1713
- switch (r.authType) {
1714
- case J.Auto:
1715
- e && t && (r.headers.Authorization = xt(e, t));
1716
- break;
1717
- case J.Digest:
1718
- r.digest = /* @__PURE__ */ (function(c, i, h) {
1719
- return { username: c, password: i, ha1: h, nc: 0, algorithm: "md5", hasDigestAuth: !1 };
1720
- })(e, t, a);
1721
- break;
1722
- case J.None:
1723
- break;
1724
- case J.Password:
1725
- r.headers.Authorization = xt(e, t);
1726
- break;
1727
- case J.Token:
1728
- r.headers.Authorization = `${(u = n).token_type} ${u.access_token}`;
1729
- break;
1730
- default:
1731
- throw new K({ info: { code: ne.InvalidAuthType } }, `Invalid auth type: ${r.authType}`);
1732
- }
1733
- var u;
1734
- }
1735
- R(345), R(800);
1736
- const Pt = "@@HOTPATCHER", Qr = () => {
1737
- };
1738
- function je(r) {
1739
- return { original: r, methods: [r], final: !1 };
1740
- }
1741
- class Dr {
1742
- constructor() {
1743
- this._configuration = { registry: {}, getEmptyAction: "null" }, this.__type__ = Pt;
1744
- }
1745
- get configuration() {
1746
- return this._configuration;
1747
- }
1748
- get getEmptyAction() {
1749
- return this.configuration.getEmptyAction;
1750
- }
1751
- set getEmptyAction(e) {
1752
- this.configuration.getEmptyAction = e;
1753
- }
1754
- control(e) {
1755
- let t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
1756
- if (!e || e.__type__ !== Pt) throw new Error("Failed taking control of target HotPatcher instance: Invalid type or object");
1757
- return Object.keys(e.configuration.registry).forEach(((n) => {
1758
- this.configuration.registry.hasOwnProperty(n) ? t && (this.configuration.registry[n] = Object.assign({}, e.configuration.registry[n])) : this.configuration.registry[n] = Object.assign({}, e.configuration.registry[n]);
1759
- })), e._configuration = this.configuration, this;
1760
- }
1761
- execute(e) {
1762
- const t = this.get(e) || Qr;
1763
- for (var n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), u = 1; u < n; u++) a[u - 1] = arguments[u];
1764
- return t(...a);
1765
- }
1766
- get(e) {
1767
- const t = this.configuration.registry[e];
1768
- if (!t) switch (this.getEmptyAction) {
1769
- case "null":
1770
- return null;
1771
- case "throw":
1772
- throw new Error(`Failed handling method request: No method provided for override: ${e}`);
1773
- default:
1774
- throw new Error(`Failed handling request which resulted in an empty method: Invalid empty-action specified: ${this.getEmptyAction}`);
1775
- }
1776
- return (function() {
1777
- for (var n = arguments.length, a = new Array(n), u = 0; u < n; u++) a[u] = arguments[u];
1778
- if (a.length === 0) throw new Error("Failed creating sequence: No functions provided");
1779
- return function() {
1780
- for (var c = arguments.length, i = new Array(c), h = 0; h < c; h++) i[h] = arguments[h];
1781
- let o = i;
1782
- const s = this;
1783
- for (; a.length > 0; ) o = [a.shift().apply(s, o)];
1784
- return o[0];
1785
- };
1786
- })(...t.methods);
1787
- }
1788
- isPatched(e) {
1789
- return !!this.configuration.registry[e];
1790
- }
1791
- patch(e, t) {
1792
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1793
- const { chain: a = !1 } = n;
1794
- if (this.configuration.registry[e] && this.configuration.registry[e].final) throw new Error(`Failed patching '${e}': Method marked as being final`);
1795
- if (typeof t != "function") throw new Error(`Failed patching '${e}': Provided method is not a function`);
1796
- if (a) this.configuration.registry[e] ? this.configuration.registry[e].methods.push(t) : this.configuration.registry[e] = je(t);
1797
- else if (this.isPatched(e)) {
1798
- const { original: u } = this.configuration.registry[e];
1799
- this.configuration.registry[e] = Object.assign(je(t), { original: u });
1800
- } else this.configuration.registry[e] = je(t);
1801
- return this;
1802
- }
1803
- patchInline(e, t) {
1804
- this.isPatched(e) || this.patch(e, t);
1805
- for (var n = arguments.length, a = new Array(n > 2 ? n - 2 : 0), u = 2; u < n; u++) a[u - 2] = arguments[u];
1806
- return this.execute(e, ...a);
1807
- }
1808
- plugin(e) {
1809
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++) n[a - 1] = arguments[a];
1810
- return n.forEach(((u) => {
1811
- this.patch(e, u, { chain: !0 });
1812
- })), this;
1813
- }
1814
- restore(e) {
1815
- if (!this.isPatched(e)) throw new Error(`Failed restoring method: No method present for key: ${e}`);
1816
- if (typeof this.configuration.registry[e].original != "function") throw new Error(`Failed restoring method: Original method not found or of invalid type for key: ${e}`);
1817
- return this.configuration.registry[e].methods = [this.configuration.registry[e].original], this;
1818
- }
1819
- setFinal(e) {
1820
- if (!this.configuration.registry.hasOwnProperty(e)) throw new Error(`Failed marking '${e}' as final: No method found for key`);
1821
- return this.configuration.registry[e].final = !0, this;
1822
- }
1823
- }
1824
- let $e = null;
1825
- function rr() {
1826
- return $e || ($e = new Dr()), $e;
1827
- }
1828
- function Ae(r) {
1829
- return (function(e) {
1830
- if (typeof e != "object" || e === null || Object.prototype.toString.call(e) != "[object Object]") return !1;
1831
- if (Object.getPrototypeOf(e) === null) return !0;
1832
- let t = e;
1833
- for (; Object.getPrototypeOf(t) !== null; ) t = Object.getPrototypeOf(t);
1834
- return Object.getPrototypeOf(e) === t;
1835
- })(r) ? Object.assign({}, r) : Object.setPrototypeOf(Object.assign({}, r), Object.getPrototypeOf(r));
1836
- }
1837
- function Et() {
1838
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1839
- let n = null, a = [...e];
1840
- for (; a.length > 0; ) {
1841
- const u = a.shift();
1842
- n = n ? nr(n, u) : Ae(u);
1843
- }
1844
- return n;
1845
- }
1846
- function nr(r, e) {
1847
- const t = Ae(r);
1848
- return Object.keys(e).forEach(((n) => {
1849
- t.hasOwnProperty(n) ? Array.isArray(e[n]) ? t[n] = Array.isArray(t[n]) ? [...t[n], ...e[n]] : [...e[n]] : typeof e[n] == "object" && e[n] ? t[n] = typeof t[n] == "object" && t[n] ? nr(t[n], e[n]) : Ae(e[n]) : t[n] = e[n] : t[n] = e[n];
1850
- })), t;
1851
- }
1852
- function en(r) {
1853
- const e = {};
1854
- for (const t of r.keys()) e[t] = r.get(t);
1855
- return e;
1856
- }
1857
- function De() {
1858
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1859
- if (e.length === 0) return {};
1860
- const n = {};
1861
- return e.reduce(((a, u) => (Object.keys(u).forEach(((c) => {
1862
- const i = c.toLowerCase();
1863
- n.hasOwnProperty(i) ? a[n[i]] = u[c] : (n[i] = c, a[c] = u[c]);
1864
- })), a)), {});
1865
- }
1866
- R(805);
1867
- const tn = typeof ArrayBuffer == "function", { toString: rn } = Object.prototype;
1868
- function sr(r) {
1869
- return tn && (r instanceof ArrayBuffer || rn.call(r) === "[object ArrayBuffer]");
1870
- }
1871
- function ir(r) {
1872
- return r != null && r.constructor != null && typeof r.constructor.isBuffer == "function" && r.constructor.isBuffer(r);
1873
- }
1874
- function it(r) {
1875
- return function() {
1876
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
1877
- try {
1878
- return Promise.resolve(r.apply(this, e));
1879
- } catch (n) {
1880
- return Promise.reject(n);
1881
- }
1882
- };
1883
- }
1884
- function et(r, e, t) {
1885
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
1886
- }
1887
- const or = it((function(r) {
1888
- const e = r._digest;
1889
- return delete r._digest, e.hasDigestAuth && (r = Et(r, { headers: { Authorization: wt(r, e) } })), et(Te(r), (function(t) {
1890
- let n = !1;
1891
- return a = function(c) {
1892
- return n ? c : t;
1893
- }, (u = (function() {
1894
- if (t.status == 401) return e.hasDigestAuth = (function(c, i) {
1895
- if (!Dt(c)) return !1;
1896
- const h = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;
1897
- for (; ; ) {
1898
- const o = c.headers && c.headers.get("www-authenticate") || "", s = h.exec(o);
1899
- if (!s) break;
1900
- i[s[1]] = s[2] || s[3];
1901
- }
1902
- return i.nc += 1, i.cnonce = (function() {
1903
- let o = "";
1904
- for (let s = 0; s < 32; ++s) o = `${o}${Hr[Math.floor(16 * Math.random())]}`;
1905
- return o;
1906
- })(), !0;
1907
- })(t, e), (function() {
1908
- if (e.hasDigestAuth) return et(Te(r = Et(r, { headers: { Authorization: wt(r, e) } })), (function(c) {
1909
- return c.status == 401 ? e.hasDigestAuth = !1 : e.nc++, n = !0, c;
1910
- }));
1911
- })();
1912
- e.nc++;
1913
- })()) && u.then ? u.then(a) : a(u);
1914
- var a, u;
1915
- }));
1916
- })), nn = it((function(r, e) {
1917
- return et(Te(r), (function(t) {
1918
- return t.ok ? (e.authType = J.Password, t) : t.status == 401 && Dt(t) ? (e.authType = J.Digest, tr(e, e.username, e.password, void 0, void 0), r._digest = e.digest, or(r)) : t;
1919
- }));
1920
- })), B = it((function(r, e) {
1921
- return e.authType === J.Auto ? nn(r, e) : r._digest ? or(r) : Te(r);
1922
- }));
1923
- function q(r, e, t) {
1924
- const n = Ae(r);
1925
- return n.headers = De(e.headers, n.headers || {}, t.headers || {}), t.data !== void 0 && (n.data = t.data), t.signal && (n.signal = t.signal), e.httpAgent && (n.httpAgent = e.httpAgent), e.httpsAgent && (n.httpsAgent = e.httpsAgent), e.digest && (n._digest = e.digest), typeof e.withCredentials == "boolean" && (n.withCredentials = e.withCredentials), n;
1926
- }
1927
- function Te(r) {
1928
- const e = rr();
1929
- return e.patchInline("request", ((t) => e.patchInline("fetch", Jr, t.url, (function(n) {
1930
- let a = {};
1931
- const u = { method: n.method };
1932
- if (n.headers && (a = De(a, n.headers)), n.data !== void 0) {
1933
- const [c, i] = (function(h) {
1934
- if (typeof h == "string") return [h, {}];
1935
- if (ir(h)) return [h, {}];
1936
- if (sr(h)) return [h, {}];
1937
- if (h && typeof h == "object") return [JSON.stringify(h), { "content-type": "application/json" }];
1938
- throw new Error("Unable to convert request body: Unexpected body type: " + typeof h);
1939
- })(n.data);
1940
- u.body = c, a = De(a, i);
1941
- }
1942
- return n.signal && (u.signal = n.signal), n.withCredentials && (u.credentials = "include"), u.headers = a, u;
1943
- })(t))), r);
1944
- }
1945
- var sn = R(285);
1946
- const Oe = (r) => {
1947
- if (typeof r != "string") throw new TypeError("invalid pattern");
1948
- if (r.length > 65536) throw new TypeError("pattern is too long");
1949
- }, on = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0], "[:alpha:]": ["\\p{L}\\p{Nl}", !0], "[:ascii:]": ["\\x00-\\x7f", !1], "[:blank:]": ["\\p{Zs}\\t", !0], "[:cntrl:]": ["\\p{Cc}", !0], "[:digit:]": ["\\p{Nd}", !0], "[:graph:]": ["\\p{Z}\\p{C}", !0, !0], "[:lower:]": ["\\p{Ll}", !0], "[:print:]": ["\\p{C}", !0], "[:punct:]": ["\\p{P}", !0], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0], "[:upper:]": ["\\p{Lu}", !0], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0], "[:xdigit:]": ["A-Fa-f0-9", !1] }, pe = (r) => r.replace(/[[\]\\-]/g, "\\$&"), At = (r) => r.join(""), an = (r, e) => {
1950
- const t = e;
1951
- if (r.charAt(t) !== "[") throw new Error("not in a brace expression");
1952
- const n = [], a = [];
1953
- let u = t + 1, c = !1, i = !1, h = !1, o = !1, s = t, f = "";
1954
- e: for (; u < r.length; ) {
1955
- const m = r.charAt(u);
1956
- if (m !== "!" && m !== "^" || u !== t + 1) {
1957
- if (m === "]" && c && !h) {
1958
- s = u + 1;
1959
- break;
1960
- }
1961
- if (c = !0, m !== "\\" || h) {
1962
- if (m === "[" && !h) {
1963
- for (const [w, [v, p, y]] of Object.entries(on)) if (r.startsWith(w, u)) {
1964
- if (f) return ["$.", !1, r.length - t, !0];
1965
- u += w.length, y ? a.push(v) : n.push(v), i = i || p;
1966
- continue e;
1967
- }
1968
- }
1969
- h = !1, f ? (m > f ? n.push(pe(f) + "-" + pe(m)) : m === f && n.push(pe(m)), f = "", u++) : r.startsWith("-]", u + 1) ? (n.push(pe(m + "-")), u += 2) : r.startsWith("-", u + 1) ? (f = m, u += 2) : (n.push(pe(m)), u++);
1970
- } else h = !0, u++;
1971
- } else o = !0, u++;
1972
- }
1973
- if (s < u) return ["", !1, 0, !1];
1974
- if (!n.length && !a.length) return ["$.", !1, r.length - t, !0];
1975
- if (a.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !o)
1976
- return [(l = n[0].length === 2 ? n[0].slice(-1) : n[0], l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")), !1, s - t, !1];
1977
- var l;
1978
- const g = "[" + (o ? "^" : "") + At(n) + "]", d = "[" + (o ? "" : "^") + At(a) + "]";
1979
- return [n.length && a.length ? "(" + g + "|" + d + ")" : n.length ? g : d, i, s - t, !0];
1980
- }, ge = function(r) {
1981
- let { windowsPathsNoEscape: e = !1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1982
- return e ? r.replace(/\[([^\/\\])\]/g, "$1") : r.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
1983
- }, un = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), Tt = (r) => un.has(r), Re = "(?!\\.)", ln = /* @__PURE__ */ new Set(["[", "."]), cn = /* @__PURE__ */ new Set(["..", "."]), hn = new Set("().*{}+?[]^$\\!"), ot = "[^/]", Ot = ot + "*?", Ct = ot + "+?";
1984
- class Z {
1985
- type;
1986
- #r;
1987
- #n;
1988
- #i = !1;
1989
- #e = [];
1990
- #t;
1991
- #o;
1992
- #u;
1993
- #a = !1;
1994
- #s;
1995
- #l;
1996
- #h = !1;
1997
- constructor(e, t) {
1998
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1999
- this.type = e, e && (this.#n = !0), this.#t = t, this.#r = this.#t ? this.#t.#r : this, this.#s = this.#r === this ? n : this.#r.#s, this.#u = this.#r === this ? [] : this.#r.#u, e !== "!" || this.#r.#a || this.#u.push(this), this.#o = this.#t ? this.#t.#e.length : 0;
2000
- }
2001
- get hasMagic() {
2002
- if (this.#n !== void 0) return this.#n;
2003
- for (const e of this.#e) if (typeof e != "string" && (e.type || e.hasMagic)) return this.#n = !0;
2004
- return this.#n;
2005
- }
2006
- toString() {
2007
- return this.#l !== void 0 ? this.#l : this.type ? this.#l = this.type + "(" + this.#e.map(((e) => String(e))).join("|") + ")" : this.#l = this.#e.map(((e) => String(e))).join("");
2008
- }
2009
- #p() {
2010
- if (this !== this.#r) throw new Error("should only call on root");
2011
- if (this.#a) return this;
2012
- let e;
2013
- for (this.toString(), this.#a = !0; e = this.#u.pop(); ) {
2014
- if (e.type !== "!") continue;
2015
- let t = e, n = t.#t;
2016
- for (; n; ) {
2017
- for (let a = t.#o + 1; !n.type && a < n.#e.length; a++) for (const u of e.#e) {
2018
- if (typeof u == "string") throw new Error("string part in extglob AST??");
2019
- u.copyIn(n.#e[a]);
2020
- }
2021
- t = n, n = t.#t;
2022
- }
2023
- }
2024
- return this;
2025
- }
2026
- push() {
2027
- for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
2028
- for (const a of t) if (a !== "") {
2029
- if (typeof a != "string" && !(a instanceof Z && a.#t === this)) throw new Error("invalid part: " + a);
2030
- this.#e.push(a);
2031
- }
2032
- }
2033
- toJSON() {
2034
- const e = this.type === null ? this.#e.slice().map(((t) => typeof t == "string" ? t : t.toJSON())) : [this.type, ...this.#e.map(((t) => t.toJSON()))];
2035
- return this.isStart() && !this.type && e.unshift([]), this.isEnd() && (this === this.#r || this.#r.#a && this.#t?.type === "!") && e.push({}), e;
2036
- }
2037
- isStart() {
2038
- if (this.#r === this) return !0;
2039
- if (!this.#t?.isStart()) return !1;
2040
- if (this.#o === 0) return !0;
2041
- const e = this.#t;
2042
- for (let t = 0; t < this.#o; t++) {
2043
- const n = e.#e[t];
2044
- if (!(n instanceof Z && n.type === "!")) return !1;
2045
- }
2046
- return !0;
2047
- }
2048
- isEnd() {
2049
- if (this.#r === this || this.#t?.type === "!") return !0;
2050
- if (!this.#t?.isEnd()) return !1;
2051
- if (!this.type) return this.#t?.isEnd();
2052
- const e = this.#t ? this.#t.#e.length : 0;
2053
- return this.#o === e - 1;
2054
- }
2055
- copyIn(e) {
2056
- typeof e == "string" ? this.push(e) : this.push(e.clone(this));
2057
- }
2058
- clone(e) {
2059
- const t = new Z(this.type, e);
2060
- for (const n of this.#e) t.copyIn(n);
2061
- return t;
2062
- }
2063
- static #c(e, t, n, a) {
2064
- let u = !1, c = !1, i = -1, h = !1;
2065
- if (t.type === null) {
2066
- let g = n, d = "";
2067
- for (; g < e.length; ) {
2068
- const m = e.charAt(g++);
2069
- if (u || m === "\\") u = !u, d += m;
2070
- else if (c) g === i + 1 ? m !== "^" && m !== "!" || (h = !0) : m !== "]" || g === i + 2 && h || (c = !1), d += m;
2071
- else if (m !== "[") if (a.noext || !Tt(m) || e.charAt(g) !== "(") d += m;
2072
- else {
2073
- t.push(d), d = "";
2074
- const w = new Z(m, t);
2075
- g = Z.#c(e, w, g, a), t.push(w);
2076
- }
2077
- else c = !0, i = g, h = !1, d += m;
2078
- }
2079
- return t.push(d), g;
2080
- }
2081
- let o = n + 1, s = new Z(null, t);
2082
- const f = [];
2083
- let l = "";
2084
- for (; o < e.length; ) {
2085
- const g = e.charAt(o++);
2086
- if (u || g === "\\") u = !u, l += g;
2087
- else if (c) o === i + 1 ? g !== "^" && g !== "!" || (h = !0) : g !== "]" || o === i + 2 && h || (c = !1), l += g;
2088
- else if (g !== "[") if (Tt(g) && e.charAt(o) === "(") {
2089
- s.push(l), l = "";
2090
- const d = new Z(g, s);
2091
- s.push(d), o = Z.#c(e, d, o, a);
2092
- } else if (g !== "|") {
2093
- if (g === ")") return l === "" && t.#e.length === 0 && (t.#h = !0), s.push(l), l = "", t.push(...f, s), o;
2094
- l += g;
2095
- } else s.push(l), l = "", f.push(s), s = new Z(null, t);
2096
- else c = !0, i = o, h = !1, l += g;
2097
- }
2098
- return t.type = null, t.#n = void 0, t.#e = [e.substring(n - 1)], o;
2099
- }
2100
- static fromGlob(e) {
2101
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2102
- const n = new Z(null, void 0, t);
2103
- return Z.#c(e, n, 0, t), n;
2104
- }
2105
- toMMPattern() {
2106
- if (this !== this.#r) return this.#r.toMMPattern();
2107
- const e = this.toString(), [t, n, a, u] = this.toRegExpSource();
2108
- if (!(a || this.#n || this.#s.nocase && !this.#s.nocaseMagicOnly && e.toUpperCase() !== e.toLowerCase())) return n;
2109
- const c = (this.#s.nocase ? "i" : "") + (u ? "u" : "");
2110
- return Object.assign(new RegExp(`^${t}$`, c), { _src: t, _glob: e });
2111
- }
2112
- get options() {
2113
- return this.#s;
2114
- }
2115
- toRegExpSource(e) {
2116
- const t = e ?? !!this.#s.dot;
2117
- if (this.#r === this && this.#p(), !this.type) {
2118
- const h = this.isStart() && this.isEnd(), o = this.#e.map(((l) => {
2119
- const [g, d, m, w] = typeof l == "string" ? Z.#g(l, this.#n, h) : l.toRegExpSource(e);
2120
- return this.#n = this.#n || m, this.#i = this.#i || w, g;
2121
- })).join("");
2122
- let s = "";
2123
- if (this.isStart() && typeof this.#e[0] == "string" && (this.#e.length !== 1 || !cn.has(this.#e[0]))) {
2124
- const l = ln, g = t && l.has(o.charAt(0)) || o.startsWith("\\.") && l.has(o.charAt(2)) || o.startsWith("\\.\\.") && l.has(o.charAt(4)), d = !t && !e && l.has(o.charAt(0));
2125
- s = g ? "(?!(?:^|/)\\.\\.?(?:$|/))" : d ? Re : "";
2126
- }
2127
- let f = "";
2128
- return this.isEnd() && this.#r.#a && this.#t?.type === "!" && (f = "(?:$|\\/)"), [s + o + f, ge(o), this.#n = !!this.#n, this.#i];
2129
- }
2130
- const n = this.type === "*" || this.type === "+", a = this.type === "!" ? "(?:(?!(?:" : "(?:";
2131
- let u = this.#f(t);
2132
- if (this.isStart() && this.isEnd() && !u && this.type !== "!") {
2133
- const h = this.toString();
2134
- return this.#e = [h], this.type = null, this.#n = void 0, [h, ge(this.toString()), !1, !1];
2135
- }
2136
- let c = !n || e || t ? "" : this.#f(!0);
2137
- c === u && (c = ""), c && (u = `(?:${u})(?:${c})*?`);
2138
- let i = "";
2139
- return i = this.type === "!" && this.#h ? (this.isStart() && !t ? Re : "") + Ct : a + u + (this.type === "!" ? "))" + (!this.isStart() || t || e ? "" : Re) + Ot + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && c ? ")" : this.type === "*" && c ? ")?" : `)${this.type}`), [i, ge(u), this.#n = !!this.#n, this.#i];
2140
- }
2141
- #f(e) {
2142
- return this.#e.map(((t) => {
2143
- if (typeof t == "string") throw new Error("string type in extglob ast??");
2144
- const [n, a, u, c] = t.toRegExpSource(e);
2145
- return this.#i = this.#i || c, n;
2146
- })).filter(((t) => !(this.isStart() && this.isEnd() && !t))).join("|");
2147
- }
2148
- static #g(e, t) {
2149
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], a = !1, u = "", c = !1;
2150
- for (let i = 0; i < e.length; i++) {
2151
- const h = e.charAt(i);
2152
- if (a) a = !1, u += (hn.has(h) ? "\\" : "") + h;
2153
- else if (h !== "\\") {
2154
- if (h === "[") {
2155
- const [o, s, f, l] = an(e, i);
2156
- if (f) {
2157
- u += o, c = c || s, i += f - 1, t = t || l;
2158
- continue;
2159
- }
2160
- }
2161
- h !== "*" ? h !== "?" ? u += h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") : (u += ot, t = !0) : (u += n && e === "*" ? Ct : Ot, t = !0);
2162
- } else i === e.length - 1 ? u += "\\\\" : a = !0;
2163
- }
2164
- return [u, ge(e), !!t, c];
2165
- }
2166
- }
2167
- const H = function(r, e) {
2168
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2169
- return Oe(e), !(!t.nocomment && e.charAt(0) === "#") && new Ce(e, t).match(r);
2170
- }, fn = /^\*+([^+@!?\*\[\(]*)$/, pn = (r) => (e) => !e.startsWith(".") && e.endsWith(r), gn = (r) => (e) => e.endsWith(r), dn = (r) => (r = r.toLowerCase(), (e) => !e.startsWith(".") && e.toLowerCase().endsWith(r)), mn = (r) => (r = r.toLowerCase(), (e) => e.toLowerCase().endsWith(r)), bn = /^\*+\.\*+$/, yn = (r) => !r.startsWith(".") && r.includes("."), vn = (r) => r !== "." && r !== ".." && r.includes("."), wn = /^\.\*+$/, Nn = (r) => r !== "." && r !== ".." && r.startsWith("."), xn = /^\*+$/, Pn = (r) => r.length !== 0 && !r.startsWith("."), En = (r) => r.length !== 0 && r !== "." && r !== "..", An = /^\?+([^+@!?\*\[\(]*)?$/, Tn = (r) => {
2171
- let [e, t = ""] = r;
2172
- const n = ar([e]);
2173
- return t ? (t = t.toLowerCase(), (a) => n(a) && a.toLowerCase().endsWith(t)) : n;
2174
- }, On = (r) => {
2175
- let [e, t = ""] = r;
2176
- const n = ur([e]);
2177
- return t ? (t = t.toLowerCase(), (a) => n(a) && a.toLowerCase().endsWith(t)) : n;
2178
- }, Cn = (r) => {
2179
- let [e, t = ""] = r;
2180
- const n = ur([e]);
2181
- return t ? (a) => n(a) && a.endsWith(t) : n;
2182
- }, In = (r) => {
2183
- let [e, t = ""] = r;
2184
- const n = ar([e]);
2185
- return t ? (a) => n(a) && a.endsWith(t) : n;
2186
- }, ar = (r) => {
2187
- let [e] = r;
2188
- const t = e.length;
2189
- return (n) => n.length === t && !n.startsWith(".");
2190
- }, ur = (r) => {
2191
- let [e] = r;
2192
- const t = e.length;
2193
- return (n) => n.length === t && n !== "." && n !== "..";
2194
- }, lr = typeof oe == "object" && oe ? typeof oe.env == "object" && oe.env && oe.env.__MINIMATCH_TESTING_PLATFORM__ || oe.platform : "posix";
2195
- H.sep = lr === "win32" ? "\\" : "/";
2196
- const D = /* @__PURE__ */ Symbol("globstar **");
2197
- H.GLOBSTAR = D, H.filter = function(r) {
2198
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2199
- return (t) => H(t, r, e);
2200
- };
2201
- const Q = function(r) {
2202
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2203
- return Object.assign({}, r, e);
2204
- };
2205
- H.defaults = (r) => {
2206
- if (!r || typeof r != "object" || !Object.keys(r).length) return H;
2207
- const e = H;
2208
- return Object.assign((function(t, n) {
2209
- return e(t, n, Q(r, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}));
2210
- }), { Minimatch: class extends e.Minimatch {
2211
- constructor(t) {
2212
- super(t, Q(r, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}));
2213
- }
2214
- static defaults(t) {
2215
- return e.defaults(Q(r, t)).Minimatch;
2216
- }
2217
- }, AST: class extends e.AST {
2218
- constructor(t, n) {
2219
- super(t, n, Q(r, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}));
2220
- }
2221
- static fromGlob(t) {
2222
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2223
- return e.AST.fromGlob(t, Q(r, n));
2224
- }
2225
- }, unescape: function(t) {
2226
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2227
- return e.unescape(t, Q(r, n));
2228
- }, escape: function(t) {
2229
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2230
- return e.escape(t, Q(r, n));
2231
- }, filter: function(t) {
2232
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2233
- return e.filter(t, Q(r, n));
2234
- }, defaults: (t) => e.defaults(Q(r, t)), makeRe: function(t) {
2235
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2236
- return e.makeRe(t, Q(r, n));
2237
- }, braceExpand: function(t) {
2238
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2239
- return e.braceExpand(t, Q(r, n));
2240
- }, match: function(t, n) {
2241
- let a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2242
- return e.match(t, n, Q(r, a));
2243
- }, sep: e.sep, GLOBSTAR: D });
2244
- };
2245
- const cr = function(r) {
2246
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2247
- return Oe(r), e.nobrace || !/\{(?:(?!\{).)*\}/.test(r) ? [r] : sn(r);
2248
- };
2249
- H.braceExpand = cr, H.makeRe = function(r) {
2250
- return new Ce(r, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}).makeRe();
2251
- }, H.match = function(r, e) {
2252
- const t = new Ce(e, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {});
2253
- return r = r.filter(((n) => t.match(n))), t.options.nonull && !r.length && r.push(e), r;
2254
- };
2255
- const It = /[?*]|[+@!]\(.*?\)|\[|\]/;
2256
- class Ce {
2257
- options;
2258
- set;
2259
- pattern;
2260
- windowsPathsNoEscape;
2261
- nonegate;
2262
- negate;
2263
- comment;
2264
- empty;
2265
- preserveMultipleSlashes;
2266
- partial;
2267
- globSet;
2268
- globParts;
2269
- nocase;
2270
- isWindows;
2271
- platform;
2272
- windowsNoMagicRoot;
2273
- regexp;
2274
- constructor(e) {
2275
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2276
- Oe(e), t = t || {}, this.options = t, this.pattern = e, this.platform = t.platform || lr, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!t.windowsPathsNoEscape || t.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!t.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!t.nonegate, this.comment = !1, this.empty = !1, this.partial = !!t.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = t.windowsNoMagicRoot !== void 0 ? t.windowsNoMagicRoot : !(!this.isWindows || !this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
2277
- }
2278
- hasMagic() {
2279
- if (this.options.magicalBraces && this.set.length > 1) return !0;
2280
- for (const e of this.set) for (const t of e) if (typeof t != "string") return !0;
2281
- return !1;
2282
- }
2283
- debug() {
2284
- }
2285
- make() {
2286
- const e = this.pattern, t = this.options;
2287
- if (!t.nocomment && e.charAt(0) === "#") return void (this.comment = !0);
2288
- if (!e) return void (this.empty = !0);
2289
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], t.debug && (this.debug = function() {
2290
- return console.error(...arguments);
2291
- }), this.debug(this.pattern, this.globSet);
2292
- const n = this.globSet.map(((u) => this.slashSplit(u)));
2293
- this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
2294
- let a = this.globParts.map(((u, c, i) => {
2295
- if (this.isWindows && this.windowsNoMagicRoot) {
2296
- const h = !(u[0] !== "" || u[1] !== "" || u[2] !== "?" && It.test(u[2]) || It.test(u[3])), o = /^[a-z]:/i.test(u[0]);
2297
- if (h) return [...u.slice(0, 4), ...u.slice(4).map(((s) => this.parse(s)))];
2298
- if (o) return [u[0], ...u.slice(1).map(((s) => this.parse(s)))];
2299
- }
2300
- return u.map(((h) => this.parse(h)));
2301
- }));
2302
- if (this.debug(this.pattern, a), this.set = a.filter(((u) => u.indexOf(!1) === -1)), this.isWindows) for (let u = 0; u < this.set.length; u++) {
2303
- const c = this.set[u];
2304
- c[0] === "" && c[1] === "" && this.globParts[u][2] === "?" && typeof c[3] == "string" && /^[a-z]:$/i.test(c[3]) && (c[2] = "?");
2305
- }
2306
- this.debug(this.pattern, this.set);
2307
- }
2308
- preprocess(e) {
2309
- if (this.options.noglobstar) for (let n = 0; n < e.length; n++) for (let a = 0; a < e[n].length; a++) e[n][a] === "**" && (e[n][a] = "*");
2310
- const { optimizationLevel: t = 1 } = this.options;
2311
- return t >= 2 ? (e = this.firstPhasePreProcess(e), e = this.secondPhasePreProcess(e)) : e = t >= 1 ? this.levelOneOptimize(e) : this.adjascentGlobstarOptimize(e), e;
2312
- }
2313
- adjascentGlobstarOptimize(e) {
2314
- return e.map(((t) => {
2315
- let n = -1;
2316
- for (; (n = t.indexOf("**", n + 1)) !== -1; ) {
2317
- let a = n;
2318
- for (; t[a + 1] === "**"; ) a++;
2319
- a !== n && t.splice(n, a - n);
2320
- }
2321
- return t;
2322
- }));
2323
- }
2324
- levelOneOptimize(e) {
2325
- return e.map(((t) => (t = t.reduce(((n, a) => {
2326
- const u = n[n.length - 1];
2327
- return a === "**" && u === "**" ? n : a === ".." && u && u !== ".." && u !== "." && u !== "**" ? (n.pop(), n) : (n.push(a), n);
2328
- }), [])).length === 0 ? [""] : t));
2329
- }
2330
- levelTwoFileOptimize(e) {
2331
- Array.isArray(e) || (e = this.slashSplit(e));
2332
- let t = !1;
2333
- do {
2334
- if (t = !1, !this.preserveMultipleSlashes) {
2335
- for (let a = 1; a < e.length - 1; a++) {
2336
- const u = e[a];
2337
- a === 1 && u === "" && e[0] === "" || u !== "." && u !== "" || (t = !0, e.splice(a, 1), a--);
2338
- }
2339
- e[0] !== "." || e.length !== 2 || e[1] !== "." && e[1] !== "" || (t = !0, e.pop());
2340
- }
2341
- let n = 0;
2342
- for (; (n = e.indexOf("..", n + 1)) !== -1; ) {
2343
- const a = e[n - 1];
2344
- a && a !== "." && a !== ".." && a !== "**" && (t = !0, e.splice(n - 1, 2), n -= 2);
2345
- }
2346
- } while (t);
2347
- return e.length === 0 ? [""] : e;
2348
- }
2349
- firstPhasePreProcess(e) {
2350
- let t = !1;
2351
- do {
2352
- t = !1;
2353
- for (let n of e) {
2354
- let a = -1;
2355
- for (; (a = n.indexOf("**", a + 1)) !== -1; ) {
2356
- let c = a;
2357
- for (; n[c + 1] === "**"; ) c++;
2358
- c > a && n.splice(a + 1, c - a);
2359
- let i = n[a + 1];
2360
- const h = n[a + 2], o = n[a + 3];
2361
- if (i !== ".." || !h || h === "." || h === ".." || !o || o === "." || o === "..") continue;
2362
- t = !0, n.splice(a, 1);
2363
- const s = n.slice(0);
2364
- s[a] = "**", e.push(s), a--;
2365
- }
2366
- if (!this.preserveMultipleSlashes) {
2367
- for (let c = 1; c < n.length - 1; c++) {
2368
- const i = n[c];
2369
- c === 1 && i === "" && n[0] === "" || i !== "." && i !== "" || (t = !0, n.splice(c, 1), c--);
2370
- }
2371
- n[0] !== "." || n.length !== 2 || n[1] !== "." && n[1] !== "" || (t = !0, n.pop());
2372
- }
2373
- let u = 0;
2374
- for (; (u = n.indexOf("..", u + 1)) !== -1; ) {
2375
- const c = n[u - 1];
2376
- if (c && c !== "." && c !== ".." && c !== "**") {
2377
- t = !0;
2378
- const i = u === 1 && n[u + 1] === "**" ? ["."] : [];
2379
- n.splice(u - 1, 2, ...i), n.length === 0 && n.push(""), u -= 2;
2380
- }
2381
- }
2382
- }
2383
- } while (t);
2384
- return e;
2385
- }
2386
- secondPhasePreProcess(e) {
2387
- for (let t = 0; t < e.length - 1; t++) for (let n = t + 1; n < e.length; n++) {
2388
- const a = this.partsMatch(e[t], e[n], !this.preserveMultipleSlashes);
2389
- if (a) {
2390
- e[t] = [], e[n] = a;
2391
- break;
2392
- }
2393
- }
2394
- return e.filter(((t) => t.length));
2395
- }
2396
- partsMatch(e, t) {
2397
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], a = 0, u = 0, c = [], i = "";
2398
- for (; a < e.length && u < t.length; ) if (e[a] === t[u]) c.push(i === "b" ? t[u] : e[a]), a++, u++;
2399
- else if (n && e[a] === "**" && t[u] === e[a + 1]) c.push(e[a]), a++;
2400
- else if (n && t[u] === "**" && e[a] === t[u + 1]) c.push(t[u]), u++;
2401
- else if (e[a] !== "*" || !t[u] || !this.options.dot && t[u].startsWith(".") || t[u] === "**") {
2402
- if (t[u] !== "*" || !e[a] || !this.options.dot && e[a].startsWith(".") || e[a] === "**" || i === "a") return !1;
2403
- i = "b", c.push(t[u]), a++, u++;
2404
- } else {
2405
- if (i === "b") return !1;
2406
- i = "a", c.push(e[a]), a++, u++;
2407
- }
2408
- return e.length === t.length && c;
2409
- }
2410
- parseNegate() {
2411
- if (this.nonegate) return;
2412
- const e = this.pattern;
2413
- let t = !1, n = 0;
2414
- for (let a = 0; a < e.length && e.charAt(a) === "!"; a++) t = !t, n++;
2415
- n && (this.pattern = e.slice(n)), this.negate = t;
2416
- }
2417
- matchOne(e, t) {
2418
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
2419
- const a = this.options;
2420
- if (this.isWindows) {
2421
- const m = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), w = !m && e[0] === "" && e[1] === "" && e[2] === "?" && /^[a-z]:$/i.test(e[3]), v = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), p = w ? 3 : m ? 0 : void 0, y = !v && t[0] === "" && t[1] === "" && t[2] === "?" && typeof t[3] == "string" && /^[a-z]:$/i.test(t[3]) ? 3 : v ? 0 : void 0;
2422
- if (typeof p == "number" && typeof y == "number") {
2423
- const [A, N] = [e[p], t[y]];
2424
- A.toLowerCase() === N.toLowerCase() && (t[y] = A, y > p ? t = t.slice(y) : p > y && (e = e.slice(p)));
2425
- }
2426
- }
2427
- const { optimizationLevel: u = 1 } = this.options;
2428
- u >= 2 && (e = this.levelTwoFileOptimize(e)), this.debug("matchOne", this, { file: e, pattern: t }), this.debug("matchOne", e.length, t.length);
2429
- for (var c = 0, i = 0, h = e.length, o = t.length; c < h && i < o; c++, i++) {
2430
- this.debug("matchOne loop");
2431
- var s = t[i], f = e[c];
2432
- if (this.debug(t, s, f), s === !1) return !1;
2433
- if (s === D) {
2434
- this.debug("GLOBSTAR", [t, s, f]);
2435
- var l = c, g = i + 1;
2436
- if (g === o) {
2437
- for (this.debug("** at the end"); c < h; c++) if (e[c] === "." || e[c] === ".." || !a.dot && e[c].charAt(0) === ".") return !1;
2438
- return !0;
2439
- }
2440
- for (; l < h; ) {
2441
- var d = e[l];
2442
- if (this.debug(`
2443
- globstar while`, e, l, t, g, d), this.matchOne(e.slice(l), t.slice(g), n)) return this.debug("globstar found match!", l, h, d), !0;
2444
- if (d === "." || d === ".." || !a.dot && d.charAt(0) === ".") {
2445
- this.debug("dot detected!", e, l, t, g);
2446
- break;
2447
- }
2448
- this.debug("globstar swallow a segment, and continue"), l++;
2449
- }
2450
- return !(!n || (this.debug(`
2451
- >>> no match, partial?`, e, l, t, g), l !== h));
2452
- }
2453
- let m;
2454
- if (typeof s == "string" ? (m = f === s, this.debug("string match", s, f, m)) : (m = s.test(f), this.debug("pattern match", s, f, m)), !m) return !1;
2455
- }
2456
- if (c === h && i === o) return !0;
2457
- if (c === h) return n;
2458
- if (i === o) return c === h - 1 && e[c] === "";
2459
- throw new Error("wtf?");
2460
- }
2461
- braceExpand() {
2462
- return cr(this.pattern, this.options);
2463
- }
2464
- parse(e) {
2465
- Oe(e);
2466
- const t = this.options;
2467
- if (e === "**") return D;
2468
- if (e === "") return "";
2469
- let n, a = null;
2470
- (n = e.match(xn)) ? a = t.dot ? En : Pn : (n = e.match(fn)) ? a = (t.nocase ? t.dot ? mn : dn : t.dot ? gn : pn)(n[1]) : (n = e.match(An)) ? a = (t.nocase ? t.dot ? On : Tn : t.dot ? Cn : In)(n) : (n = e.match(bn)) ? a = t.dot ? vn : yn : (n = e.match(wn)) && (a = Nn);
2471
- const u = Z.fromGlob(e, this.options).toMMPattern();
2472
- return a && typeof u == "object" && Reflect.defineProperty(u, "test", { value: a }), u;
2473
- }
2474
- makeRe() {
2475
- if (this.regexp || this.regexp === !1) return this.regexp;
2476
- const e = this.set;
2477
- if (!e.length) return this.regexp = !1, this.regexp;
2478
- const t = this.options, n = t.noglobstar ? "[^/]*?" : t.dot ? "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?" : "(?:(?!(?:\\/|^)\\.).)*?", a = new Set(t.nocase ? ["i"] : []);
2479
- let u = e.map(((h) => {
2480
- const o = h.map(((s) => {
2481
- if (s instanceof RegExp) for (const f of s.flags.split("")) a.add(f);
2482
- return typeof s == "string" ? s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") : s === D ? D : s._src;
2483
- }));
2484
- return o.forEach(((s, f) => {
2485
- const l = o[f + 1], g = o[f - 1];
2486
- s === D && g !== D && (g === void 0 ? l !== void 0 && l !== D ? o[f + 1] = "(?:\\/|" + n + "\\/)?" + l : o[f] = n : l === void 0 ? o[f - 1] = g + "(?:\\/|" + n + ")?" : l !== D && (o[f - 1] = g + "(?:\\/|\\/" + n + "\\/)" + l, o[f + 1] = D));
2487
- })), o.filter(((s) => s !== D)).join("/");
2488
- })).join("|");
2489
- const [c, i] = e.length > 1 ? ["(?:", ")"] : ["", ""];
2490
- u = "^" + c + u + i + "$", this.negate && (u = "^(?!" + u + ").+$");
2491
- try {
2492
- this.regexp = new RegExp(u, [...a].join(""));
2493
- } catch {
2494
- this.regexp = !1;
2495
- }
2496
- return this.regexp;
2497
- }
2498
- slashSplit(e) {
2499
- return this.preserveMultipleSlashes ? e.split("/") : this.isWindows && /^\/\/[^\/]+/.test(e) ? ["", ...e.split(/\/+/)] : e.split(/\/+/);
2500
- }
2501
- match(e) {
2502
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.partial;
2503
- if (this.debug("match", e, this.pattern), this.comment) return !1;
2504
- if (this.empty) return e === "";
2505
- if (e === "/" && t) return !0;
2506
- const n = this.options;
2507
- this.isWindows && (e = e.split("\\").join("/"));
2508
- const a = this.slashSplit(e);
2509
- this.debug(this.pattern, "split", a);
2510
- const u = this.set;
2511
- this.debug(this.pattern, "set", u);
2512
- let c = a[a.length - 1];
2513
- if (!c) for (let i = a.length - 2; !c && i >= 0; i--) c = a[i];
2514
- for (let i = 0; i < u.length; i++) {
2515
- const h = u[i];
2516
- let o = a;
2517
- if (n.matchBase && h.length === 1 && (o = [c]), this.matchOne(o, h, t)) return !!n.flipNegate || !this.negate;
2518
- }
2519
- return !n.flipNegate && this.negate;
2520
- }
2521
- static defaults(e) {
2522
- return H.defaults(e).Minimatch;
2523
- }
2524
- }
2525
- function at(r) {
2526
- const e = new Error(`${arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""}Invalid response: ${r.status} ${r.statusText}`);
2527
- return e.status = r.status, e.response = r, e;
2528
- }
2529
- function W(r, e) {
2530
- const { status: t } = e;
2531
- if (t === 401 && r.digest) return e;
2532
- if (t >= 400) throw at(e);
2533
- return e;
2534
- }
2535
- function ae(r, e) {
2536
- return arguments.length > 2 && arguments[2] !== void 0 && arguments[2] ? { data: e, headers: r.headers ? en(r.headers) : {}, status: r.status, statusText: r.statusText } : e;
2537
- }
2538
- H.AST = Z, H.Minimatch = Ce, H.escape = function(r) {
2539
- let { windowsPathsNoEscape: e = !1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2540
- return e ? r.replace(/[?*()[\]]/g, "[$&]") : r.replace(/[?*()[\]\\]/g, "\\$&");
2541
- }, H.unescape = ge;
2542
- const Sn = (St = function(r, e, t) {
2543
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
2544
- const a = q({ url: U(r.remoteURL, k(e)), method: "COPY", headers: { Destination: U(r.remoteURL, k(t)), Overwrite: n.overwrite === !1 ? "F" : "T", Depth: n.shallow ? "0" : "infinity" } }, r, n);
2545
- return c = function(i) {
2546
- W(r, i);
2547
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
2548
- var u, c;
2549
- }, function() {
2550
- for (var r = [], e = 0; e < arguments.length; e++) r[e] = arguments[e];
2551
- try {
2552
- return Promise.resolve(St.apply(this, r));
2553
- } catch (t) {
2554
- return Promise.reject(t);
2555
- }
2556
- });
2557
- var St, ut = R(635), Fn = R(829), te = R.n(Fn), le = (function(r) {
2558
- return r.Array = "array", r.Object = "object", r.Original = "original", r;
2559
- })(le || {});
2560
- function Ne(r, e) {
2561
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : le.Original;
2562
- const n = te().get(r, e);
2563
- return t === "array" && Array.isArray(n) === !1 ? [n] : t === "object" && Array.isArray(n) ? n[0] : n;
2564
- }
2565
- function ye(r) {
2566
- return new Promise(((e) => {
2567
- e((function(t) {
2568
- const { multistatus: n } = t;
2569
- if (n === "") return { multistatus: { response: [] } };
2570
- if (!n) throw new Error("Invalid response: No root multistatus found");
2571
- const a = { multistatus: Array.isArray(n) ? n[0] : n };
2572
- return te().set(a, "multistatus.response", Ne(a, "multistatus.response", le.Array)), te().set(a, "multistatus.response", te().get(a, "multistatus.response").map(((u) => (function(c) {
2573
- const i = Object.assign({}, c);
2574
- return i.status ? te().set(i, "status", Ne(i, "status", le.Object)) : (te().set(i, "propstat", Ne(i, "propstat", le.Object)), te().set(i, "propstat.prop", Ne(i, "propstat.prop", le.Object))), i;
2575
- })(u)))), a;
2576
- })(new ut.XMLParser({ allowBooleanAttributes: !0, attributeNamePrefix: "", textNodeName: "text", ignoreAttributes: !1, removeNSPrefix: !0, numberParseOptions: { hex: !0, leadingZeros: !1 }, attributeValueProcessor: (t, n, a) => n === "true" || n === "false" ? n === "true" : n, tagValueProcessor(t, n, a) {
2577
- if (!a.endsWith("propstat.prop.displayname")) return n;
2578
- } }).parse(r)));
2579
- }));
2580
- }
2581
- function Se(r, e) {
2582
- let t = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
2583
- const { getlastmodified: n = null, getcontentlength: a = "0", resourcetype: u = null, getcontenttype: c = null, getetag: i = null } = r, h = u && typeof u == "object" && u.collection !== void 0 ? "directory" : "file", o = { filename: e, basename: Pe().basename(e), lastmod: n, size: parseInt(a, 10), type: h, etag: typeof i == "string" ? i.replace(/"/g, "") : null };
2584
- return h === "file" && (o.mime = c && typeof c == "string" ? c.split(";")[0] : ""), t && (r.displayname !== void 0 && (r.displayname = String(r.displayname)), o.props = r), o;
2585
- }
2586
- function hr(r, e) {
2587
- let t = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], n = null;
2588
- try {
2589
- r.multistatus.response[0].propstat && (n = r.multistatus.response[0]);
2590
- } catch {
2591
- }
2592
- if (!n) throw new Error("Failed getting item stat: bad response");
2593
- const { propstat: { prop: a, status: u } } = n, [c, i, h] = u.split(" ", 3), o = parseInt(i, 10);
2594
- if (o >= 400) {
2595
- const s = new Error(`Invalid response: ${o} ${h}`);
2596
- throw s.status = o, s;
2597
- }
2598
- return Se(a, be(e), t);
2599
- }
2600
- function fr(r) {
2601
- switch (String(r)) {
2602
- case "-3":
2603
- return "unlimited";
2604
- case "-2":
2605
- case "-1":
2606
- return "unknown";
2607
- default:
2608
- return parseInt(String(r), 10);
2609
- }
2610
- }
2611
- function Le(r, e, t) {
2612
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2613
- }
2614
- const lt = /* @__PURE__ */ (function(r) {
2615
- return function() {
2616
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2617
- try {
2618
- return Promise.resolve(r.apply(this, e));
2619
- } catch (n) {
2620
- return Promise.reject(n);
2621
- }
2622
- };
2623
- })((function(r, e) {
2624
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2625
- const { details: n = !1 } = t, a = q({ url: U(r.remoteURL, k(e)), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: "0" } }, r, t);
2626
- return Le(B(a, r), (function(u) {
2627
- return W(r, u), Le(u.text(), (function(c) {
2628
- return Le(ye(c), (function(i) {
2629
- const h = hr(i, e, n);
2630
- return ae(u, h, n);
2631
- }));
2632
- }));
2633
- }));
2634
- }));
2635
- function pr(r, e, t) {
2636
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2637
- }
2638
- const jn = gr((function(r, e) {
2639
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2640
- const n = (function(u) {
2641
- if (!u || u === "/") return [];
2642
- let c = u;
2643
- const i = [];
2644
- do
2645
- i.push(c), c = Pe().dirname(c);
2646
- while (c && c !== "/");
2647
- return i;
2648
- })(be(e));
2649
- n.sort(((u, c) => u.length > c.length ? 1 : c.length > u.length ? -1 : 0));
2650
- let a = !1;
2651
- return (function(u, c, i) {
2652
- if (typeof u[jt] == "function") {
2653
- let m = function(w) {
2654
- try {
2655
- for (; !(h = f.next()).done; ) if ((w = c(h.value)) && w.then) {
2656
- if (!$t(w)) return void w.then(m, s || (s = Y.bind(null, o = new ce(), 2)));
2657
- w = w.v;
2658
- }
2659
- o ? Y(o, 1, w) : o = w;
2660
- } catch (v) {
2661
- Y(o || (o = new ce()), 2, v);
2662
- }
2663
- };
2664
- var h, o, s, f = u[jt]();
2665
- if (m(), f.return) {
2666
- var l = function(w) {
2667
- try {
2668
- h.done || f.return();
2669
- } catch {
2670
- }
2671
- return w;
2672
- };
2673
- if (o && o.then) return o.then(l, (function(w) {
2674
- throw l(w);
2675
- }));
2676
- l();
2677
- }
2678
- return o;
2679
- }
2680
- if (!("length" in u)) throw new TypeError("Object is not iterable");
2681
- for (var g = [], d = 0; d < u.length; d++) g.push(u[d]);
2682
- return (function(m, w, v) {
2683
- var p, y, A = -1;
2684
- return (function N(b) {
2685
- try {
2686
- for (; ++A < m.length && (!v || !v()); ) if ((b = w(A)) && b.then) {
2687
- if (!$t(b)) return void b.then(N, y || (y = Y.bind(null, p = new ce(), 2)));
2688
- b = b.v;
2689
- }
2690
- p ? Y(p, 1, b) : p = b;
2691
- } catch (E) {
2692
- Y(p || (p = new ce()), 2, E);
2693
- }
2694
- })(), p;
2695
- })(g, (function(m) {
2696
- return c(g[m]);
2697
- }), i);
2698
- })(n, (function(u) {
2699
- return c = function() {
2700
- return (function(h, o) {
2701
- try {
2702
- var s = pr(lt(r, u), (function(f) {
2703
- if (f.type !== "directory") throw new Error(`Path includes a file: ${e}`);
2704
- }));
2705
- } catch (f) {
2706
- return o(f);
2707
- }
2708
- return s && s.then ? s.then(void 0, o) : s;
2709
- })(0, (function(h) {
2710
- const o = h;
2711
- return (function() {
2712
- if (o.status === 404) return a = !0, Ft(tt(r, u, { ...t, recursive: !1 }));
2713
- throw h;
2714
- })();
2715
- }));
2716
- }, (i = (function() {
2717
- if (a) return Ft(tt(r, u, { ...t, recursive: !1 }));
2718
- })()) && i.then ? i.then(c) : c();
2719
- var c, i;
2720
- }), (function() {
2721
- return !1;
2722
- }));
2723
- }));
2724
- function gr(r) {
2725
- return function() {
2726
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2727
- try {
2728
- return Promise.resolve(r.apply(this, e));
2729
- } catch (n) {
2730
- return Promise.reject(n);
2731
- }
2732
- };
2733
- }
2734
- function $n() {
2735
- }
2736
- function Ft(r, e) {
2737
- return r && r.then ? r.then($n) : Promise.resolve();
2738
- }
2739
- const jt = typeof Symbol < "u" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
2740
- function Y(r, e, t) {
2741
- if (!r.s) {
2742
- if (t instanceof ce) {
2743
- if (!t.s) return void (t.o = Y.bind(null, r, e));
2744
- 1 & e && (e = t.s), t = t.v;
2745
- }
2746
- if (t && t.then) return void t.then(Y.bind(null, r, e), Y.bind(null, r, 2));
2747
- r.s = e, r.v = t;
2748
- const n = r.o;
2749
- n && n(r);
2750
- }
2751
- }
2752
- const ce = (function() {
2753
- function r() {
2754
- }
2755
- return r.prototype.then = function(e, t) {
2756
- const n = new r(), a = this.s;
2757
- if (a) {
2758
- const u = 1 & a ? e : t;
2759
- if (u) {
2760
- try {
2761
- Y(n, 1, u(this.v));
2762
- } catch (c) {
2763
- Y(n, 2, c);
2764
- }
2765
- return n;
2766
- }
2767
- return this;
2768
- }
2769
- return this.o = function(u) {
2770
- try {
2771
- const c = u.v;
2772
- 1 & u.s ? Y(n, 1, e ? e(c) : c) : t ? Y(n, 1, t(c)) : Y(n, 2, c);
2773
- } catch (c) {
2774
- Y(n, 2, c);
2775
- }
2776
- }, n;
2777
- }, r;
2778
- })();
2779
- function $t(r) {
2780
- return r instanceof ce && 1 & r.s;
2781
- }
2782
- const tt = gr((function(r, e) {
2783
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2784
- if (t.recursive === !0) return jn(r, e, t);
2785
- const n = q({ url: U(r.remoteURL, (a = k(e), a.endsWith("/") ? a : a + "/")), method: "MKCOL" }, r, t);
2786
- var a;
2787
- return pr(B(n, r), (function(u) {
2788
- W(r, u);
2789
- }));
2790
- }));
2791
- var Rn = R(388), Rt = R.n(Rn);
2792
- const Ln = /* @__PURE__ */ (function(r) {
2793
- return function() {
2794
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2795
- try {
2796
- return Promise.resolve(r.apply(this, e));
2797
- } catch (n) {
2798
- return Promise.reject(n);
2799
- }
2800
- };
2801
- })((function(r, e) {
2802
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2803
- const n = {};
2804
- if (typeof t.range == "object" && typeof t.range.start == "number") {
2805
- let i = `bytes=${t.range.start}-`;
2806
- typeof t.range.end == "number" && (i = `${i}${t.range.end}`), n.Range = i;
2807
- }
2808
- const a = q({ url: U(r.remoteURL, k(e)), method: "GET", headers: n }, r, t);
2809
- return c = function(i) {
2810
- if (W(r, i), n.Range && i.status !== 206) {
2811
- const h = new Error(`Invalid response code for partial request: ${i.status}`);
2812
- throw h.status = i.status, h;
2813
- }
2814
- return t.callback && setTimeout((() => {
2815
- t.callback(i);
2816
- }), 0), i.body;
2817
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
2818
- var u, c;
2819
- })), kn = () => {
2820
- }, Un = /* @__PURE__ */ (function(r) {
2821
- return function() {
2822
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2823
- try {
2824
- return Promise.resolve(r.apply(this, e));
2825
- } catch (n) {
2826
- return Promise.reject(n);
2827
- }
2828
- };
2829
- })((function(r, e, t) {
2830
- t.url || (t.url = U(r.remoteURL, k(e)));
2831
- const n = q(t, r, {});
2832
- return u = function(c) {
2833
- return W(r, c), c;
2834
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
2835
- var a, u;
2836
- })), _n = /* @__PURE__ */ (function(r) {
2837
- return function() {
2838
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2839
- try {
2840
- return Promise.resolve(r.apply(this, e));
2841
- } catch (n) {
2842
- return Promise.reject(n);
2843
- }
2844
- };
2845
- })((function(r, e) {
2846
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2847
- const n = q({ url: U(r.remoteURL, k(e)), method: "DELETE" }, r, t);
2848
- return u = function(c) {
2849
- W(r, c);
2850
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
2851
- var a, u;
2852
- })), Mn = /* @__PURE__ */ (function(r) {
2853
- return function() {
2854
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2855
- try {
2856
- return Promise.resolve(r.apply(this, e));
2857
- } catch (n) {
2858
- return Promise.reject(n);
2859
- }
2860
- };
2861
- })((function(r, e) {
2862
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2863
- return (function(n, a) {
2864
- try {
2865
- var u = (c = lt(r, e, t), i = function() {
2866
- return !0;
2867
- }, h ? i ? i(c) : c : (c && c.then || (c = Promise.resolve(c)), i ? c.then(i) : c));
2868
- } catch (o) {
2869
- return a(o);
2870
- }
2871
- var c, i, h;
2872
- return u && u.then ? u.then(void 0, a) : u;
2873
- })(0, (function(n) {
2874
- if (n.status === 404) return !1;
2875
- throw n;
2876
- }));
2877
- }));
2878
- function ke(r, e, t) {
2879
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2880
- }
2881
- const Vn = /* @__PURE__ */ (function(r) {
2882
- return function() {
2883
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2884
- try {
2885
- return Promise.resolve(r.apply(this, e));
2886
- } catch (n) {
2887
- return Promise.reject(n);
2888
- }
2889
- };
2890
- })((function(r, e) {
2891
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2892
- const n = q({ url: U(r.remoteURL, k(e), "/"), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: t.deep ? "infinity" : "1" } }, r, t);
2893
- return ke(B(n, r), (function(a) {
2894
- return W(r, a), ke(a.text(), (function(u) {
2895
- if (!u) throw new Error("Failed parsing directory contents: Empty response");
2896
- return ke(ye(u), (function(c) {
2897
- const i = vt(e);
2898
- let h = (function(o, s, f) {
2899
- let l = arguments.length > 3 && arguments[3] !== void 0 && arguments[3], g = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
2900
- const d = Pe().join(s, "/"), { multistatus: { response: m } } = o, w = m.map(((v) => {
2901
- const p = (function(A) {
2902
- try {
2903
- return A.replace(/^https?:\/\/[^\/]+/, "");
2904
- } catch (N) {
2905
- throw new K(N, "Failed normalising HREF");
2906
- }
2907
- })(v.href), { propstat: { prop: y } } = v;
2908
- return Se(y, d === "/" ? decodeURIComponent(be(p)) : be(Pe().relative(decodeURIComponent(d), decodeURIComponent(p))), l);
2909
- }));
2910
- return g ? w : w.filter(((v) => v.basename && (v.type === "file" || v.filename !== f.replace(/\/$/, ""))));
2911
- })(c, vt(r.remoteBasePath || r.remotePath), i, t.details, t.includeSelf);
2912
- return t.glob && (h = (function(o, s) {
2913
- return o.filter(((f) => H(f.filename, s, { matchBase: !0 })));
2914
- })(h, t.glob)), ae(a, h, t.details);
2915
- }));
2916
- }));
2917
- }));
2918
- }));
2919
- function ct(r) {
2920
- return function() {
2921
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2922
- try {
2923
- return Promise.resolve(r.apply(this, e));
2924
- } catch (n) {
2925
- return Promise.reject(n);
2926
- }
2927
- };
2928
- }
2929
- const Bn = ct((function(r, e) {
2930
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2931
- const n = q({ url: U(r.remoteURL, k(e)), method: "GET", headers: { Accept: "text/plain" }, transformResponse: [Xn] }, r, t);
2932
- return Ie(B(n, r), (function(a) {
2933
- return W(r, a), Ie(a.text(), (function(u) {
2934
- return ae(a, u, t.details);
2935
- }));
2936
- }));
2937
- }));
2938
- function Ie(r, e, t) {
2939
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2940
- }
2941
- const qn = ct((function(r, e) {
2942
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2943
- const n = q({ url: U(r.remoteURL, k(e)), method: "GET" }, r, t);
2944
- return Ie(B(n, r), (function(a) {
2945
- let u;
2946
- return W(r, a), (function(c, i) {
2947
- var h = c();
2948
- return h && h.then ? h.then(i) : i();
2949
- })((function() {
2950
- return Ie(a.arrayBuffer(), (function(c) {
2951
- u = c;
2952
- }));
2953
- }), (function() {
2954
- return ae(a, u, t.details);
2955
- }));
2956
- }));
2957
- })), Wn = ct((function(r, e) {
2958
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2959
- const { format: n = "binary" } = t;
2960
- if (n !== "binary" && n !== "text") throw new K({ info: { code: ne.InvalidOutputFormat } }, `Invalid output format: ${n}`);
2961
- return n === "text" ? Bn(r, e, t) : qn(r, e, t);
2962
- })), Xn = (r) => r;
2963
- function Gn(r) {
2964
- return new ut.XMLBuilder({ attributeNamePrefix: "@_", format: !0, ignoreAttributes: !1, suppressEmptyNode: !0 }).build(dr({ lockinfo: { "@_xmlns:d": "DAV:", lockscope: { exclusive: {} }, locktype: { write: {} }, owner: { href: r } } }, "d"));
2965
- }
2966
- function dr(r, e) {
2967
- const t = { ...r };
2968
- for (const n in t) t.hasOwnProperty(n) && (t[n] && typeof t[n] == "object" && n.indexOf(":") === -1 ? (t[`${e}:${n}`] = dr(t[n], e), delete t[n]) : /^@_/.test(n) === !1 && (t[`${e}:${n}`] = t[n], delete t[n]));
2969
- return t;
2970
- }
2971
- function rt(r, e, t) {
2972
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2973
- }
2974
- function mr(r) {
2975
- return function() {
2976
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2977
- try {
2978
- return Promise.resolve(r.apply(this, e));
2979
- } catch (n) {
2980
- return Promise.reject(n);
2981
- }
2982
- };
2983
- }
2984
- const zn = mr((function(r, e, t) {
2985
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
2986
- const a = q({ url: U(r.remoteURL, k(e)), method: "UNLOCK", headers: { "Lock-Token": t } }, r, n);
2987
- return rt(B(a, r), (function(u) {
2988
- if (W(r, u), u.status !== 204 && u.status !== 200) throw at(u);
2989
- }));
2990
- })), Hn = mr((function(r, e) {
2991
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2992
- const { refreshToken: n, timeout: a = Zn } = t, u = { Accept: "text/plain,application/xml", Timeout: a };
2993
- n && (u.If = n);
2994
- const c = q({ url: U(r.remoteURL, k(e)), method: "LOCK", headers: u, data: Gn(r.contactHref) }, r, t);
2995
- return rt(B(c, r), (function(i) {
2996
- return W(r, i), rt(i.text(), (function(h) {
2997
- const o = (l = h, new ut.XMLParser({ removeNSPrefix: !0, parseAttributeValue: !0, parseTagValue: !0 }).parse(l)), s = te().get(o, "prop.lockdiscovery.activelock.locktoken.href"), f = te().get(o, "prop.lockdiscovery.activelock.timeout");
2998
- var l;
2999
- if (!s) throw at(i, "No lock token received: ");
3000
- return { token: s, serverTimeout: f };
3001
- }));
3002
- }));
3003
- })), Zn = "Infinite, Second-4100000000";
3004
- function Ue(r, e, t) {
3005
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3006
- }
3007
- const Jn = /* @__PURE__ */ (function(r) {
3008
- return function() {
3009
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3010
- try {
3011
- return Promise.resolve(r.apply(this, e));
3012
- } catch (n) {
3013
- return Promise.reject(n);
3014
- }
3015
- };
3016
- })((function(r) {
3017
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3018
- const t = e.path || "/", n = q({ url: U(r.remoteURL, t), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: "0" } }, r, e);
3019
- return Ue(B(n, r), (function(a) {
3020
- return W(r, a), Ue(a.text(), (function(u) {
3021
- return Ue(ye(u), (function(c) {
3022
- const i = (function(h) {
3023
- try {
3024
- const [o] = h.multistatus.response, { propstat: { prop: { "quota-used-bytes": s, "quota-available-bytes": f } } } = o;
3025
- return s !== void 0 && f !== void 0 ? { used: parseInt(String(s), 10), available: fr(f) } : null;
3026
- } catch {
3027
- }
3028
- return null;
3029
- })(c);
3030
- return ae(a, i, e.details);
3031
- }));
3032
- }));
3033
- }));
3034
- }));
3035
- function _e(r, e, t) {
3036
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3037
- }
3038
- const Yn = /* @__PURE__ */ (function(r) {
3039
- return function() {
3040
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3041
- try {
3042
- return Promise.resolve(r.apply(this, e));
3043
- } catch (n) {
3044
- return Promise.reject(n);
3045
- }
3046
- };
3047
- })((function(r, e) {
3048
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3049
- const { details: n = !1 } = t, a = q({ url: U(r.remoteURL, k(e)), method: "SEARCH", headers: { Accept: "text/plain,application/xml", "Content-Type": r.headers["Content-Type"] || "application/xml; charset=utf-8" } }, r, t);
3050
- return _e(B(a, r), (function(u) {
3051
- return W(r, u), _e(u.text(), (function(c) {
3052
- return _e(ye(c), (function(i) {
3053
- const h = (function(o, s, f) {
3054
- const l = { truncated: !1, results: [] };
3055
- return l.truncated = o.multistatus.response.some(((g) => (g.status || g.propstat?.status).split(" ", 3)?.[1] === "507" && g.href.replace(/\/$/, "").endsWith(k(s).replace(/\/$/, "")))), o.multistatus.response.forEach(((g) => {
3056
- if (g.propstat === void 0) return;
3057
- const d = g.href.split("/").map(decodeURIComponent).join("/");
3058
- l.results.push(Se(g.propstat.prop, d, f));
3059
- })), l;
3060
- })(i, e, n);
3061
- return ae(u, h, n);
3062
- }));
3063
- }));
3064
- }));
3065
- })), Kn = /* @__PURE__ */ (function(r) {
3066
- return function() {
3067
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3068
- try {
3069
- return Promise.resolve(r.apply(this, e));
3070
- } catch (n) {
3071
- return Promise.reject(n);
3072
- }
3073
- };
3074
- })((function(r, e, t) {
3075
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
3076
- const a = q({ url: U(r.remoteURL, k(e)), method: "MOVE", headers: { Destination: U(r.remoteURL, k(t)), Overwrite: n.overwrite === !1 ? "F" : "T" } }, r, n);
3077
- return c = function(i) {
3078
- W(r, i);
3079
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
3080
- var u, c;
3081
- }));
3082
- var Qn = R(172);
3083
- const Dn = /* @__PURE__ */ (function(r) {
3084
- return function() {
3085
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3086
- try {
3087
- return Promise.resolve(r.apply(this, e));
3088
- } catch (n) {
3089
- return Promise.reject(n);
3090
- }
3091
- };
3092
- })((function(r, e, t) {
3093
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
3094
- const { contentLength: a = !0, overwrite: u = !0 } = n, c = { "Content-Type": "application/octet-stream" };
3095
- a === !1 || (c["Content-Length"] = typeof a == "number" ? `${a}` : `${(function(s) {
3096
- if (sr(s)) return s.byteLength;
3097
- if (ir(s)) return s.length;
3098
- if (typeof s == "string") return (0, Qn.d)(s);
3099
- throw new K({ info: { code: ne.DataTypeNoLength } }, "Cannot calculate data length: Invalid type");
3100
- })(t)}`), u || (c["If-None-Match"] = "*");
3101
- const i = q({ url: U(r.remoteURL, k(e)), method: "PUT", headers: c, data: t }, r, n);
3102
- return o = function(s) {
3103
- try {
3104
- W(r, s);
3105
- } catch (f) {
3106
- const l = f;
3107
- if (l.status !== 412 || u) throw l;
3108
- return !1;
3109
- }
3110
- return !0;
3111
- }, (h = B(i, r)) && h.then || (h = Promise.resolve(h)), o ? h.then(o) : h;
3112
- var h, o;
3113
- })), br = /* @__PURE__ */ (function(r) {
3114
- return function() {
3115
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3116
- try {
3117
- return Promise.resolve(r.apply(this, e));
3118
- } catch (n) {
3119
- return Promise.reject(n);
3120
- }
3121
- };
3122
- })((function(r, e) {
3123
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3124
- const n = q({ url: U(r.remoteURL, k(e)), method: "OPTIONS" }, r, t);
3125
- return u = function(c) {
3126
- try {
3127
- W(r, c);
3128
- } catch (i) {
3129
- throw i;
3130
- }
3131
- return { compliance: (c.headers.get("DAV") ?? "").split(",").map(((i) => i.trim())), server: c.headers.get("Server") ?? "" };
3132
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
3133
- var a, u;
3134
- }));
3135
- function de(r, e, t) {
3136
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3137
- }
3138
- const es = ht((function(r, e, t, n, a) {
3139
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3140
- if (t > n || t < 0) throw new K({ info: { code: ne.InvalidUpdateRange } }, `Invalid update range ${t} for partial update`);
3141
- const c = { "Content-Type": "application/octet-stream", "Content-Length": "" + (n - t + 1), "Content-Range": `bytes ${t}-${n}/*` }, i = q({ url: U(r.remoteURL, k(e)), method: "PUT", headers: c, data: a }, r, u);
3142
- return de(B(i, r), (function(h) {
3143
- W(r, h);
3144
- }));
3145
- }));
3146
- function Lt(r, e) {
3147
- var t = r();
3148
- return t && t.then ? t.then(e) : e(t);
3149
- }
3150
- const ts = ht((function(r, e, t, n, a) {
3151
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3152
- if (t > n || t < 0) throw new K({ info: { code: ne.InvalidUpdateRange } }, `Invalid update range ${t} for partial update`);
3153
- const c = { "Content-Type": "application/x-sabredav-partialupdate", "Content-Length": "" + (n - t + 1), "X-Update-Range": `bytes=${t}-${n}` }, i = q({ url: U(r.remoteURL, k(e)), method: "PATCH", headers: c, data: a }, r, u);
3154
- return de(B(i, r), (function(h) {
3155
- W(r, h);
3156
- }));
3157
- }));
3158
- function ht(r) {
3159
- return function() {
3160
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3161
- try {
3162
- return Promise.resolve(r.apply(this, e));
3163
- } catch (n) {
3164
- return Promise.reject(n);
3165
- }
3166
- };
3167
- }
3168
- const rs = ht((function(r, e, t, n, a) {
3169
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3170
- return de(br(r, e, u), (function(c) {
3171
- let i = !1;
3172
- return Lt((function() {
3173
- if (c.compliance.includes("sabredav-partialupdate")) return de(ts(r, e, t, n, a, u), (function(h) {
3174
- return i = !0, h;
3175
- }));
3176
- }), (function(h) {
3177
- let o = !1;
3178
- return i ? h : Lt((function() {
3179
- if (c.server.includes("Apache") && c.compliance.includes("<http://apache.org/dav/propset/fs/1>")) return de(es(r, e, t, n, a, u), (function(s) {
3180
- return o = !0, s;
3181
- }));
3182
- }), (function(s) {
3183
- if (o) return s;
3184
- throw new K({ info: { code: ne.NotSupported } }, "Not supported");
3185
- }));
3186
- }));
3187
- }));
3188
- })), ns = "https://github.com/perry-mitchell/webdav-client/blob/master/LOCK_CONTACT.md";
3189
- function ss(r) {
3190
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3191
- const { authType: t = null, remoteBasePath: n, contactHref: a = ns, ha1: u, headers: c = {}, httpAgent: i, httpsAgent: h, password: o, token: s, username: f, withCredentials: l } = e;
3192
- let g = t;
3193
- g || (g = f || o ? J.Password : J.None);
3194
- const d = { authType: g, remoteBasePath: n, contactHref: a, ha1: u, headers: Object.assign({}, c), httpAgent: i, httpsAgent: h, password: o, remotePath: Gr(r), remoteURL: r, token: s, username: f, withCredentials: l };
3195
- return tr(d, f, o, s, u), { copyFile: (m, w, v) => Sn(d, m, w, v), createDirectory: (m, w) => tt(d, m, w), createReadStream: (m, w) => (function(v, p) {
3196
- let y = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3197
- const A = new (Rt()).PassThrough();
3198
- return Ln(v, p, y).then(((N) => {
3199
- N.pipe(A);
3200
- })).catch(((N) => {
3201
- A.emit("error", N);
3202
- })), A;
3203
- })(d, m, w), createWriteStream: (m, w, v) => (function(p, y) {
3204
- let A = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, N = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : kn;
3205
- const b = new (Rt()).PassThrough(), E = {};
3206
- A.overwrite === !1 && (E["If-None-Match"] = "*");
3207
- const x = q({ url: U(p.remoteURL, k(y)), method: "PUT", headers: E, data: b, maxRedirects: 0 }, p, A);
3208
- return B(x, p).then(((T) => W(p, T))).then(((T) => {
3209
- setTimeout((() => {
3210
- N(T);
3211
- }), 0);
3212
- })).catch(((T) => {
3213
- b.emit("error", T);
3214
- })), b;
3215
- })(d, m, w, v), customRequest: (m, w) => Un(d, m, w), deleteFile: (m, w) => _n(d, m, w), exists: (m, w) => Mn(d, m, w), getDirectoryContents: (m, w) => Vn(d, m, w), getFileContents: (m, w) => Wn(d, m, w), getFileDownloadLink: (m) => (function(w, v) {
3216
- let p = U(w.remoteURL, k(v));
3217
- const y = /^https:/i.test(p) ? "https" : "http";
3218
- switch (w.authType) {
3219
- case J.None:
3220
- break;
3221
- case J.Password: {
3222
- const A = Nt(w.headers.Authorization.replace(/^Basic /i, "").trim());
3223
- p = p.replace(/^https?:\/\//, `${y}://${A}@`);
3224
- break;
3225
- }
3226
- default:
3227
- throw new K({ info: { code: ne.LinkUnsupportedAuthType } }, `Unsupported auth type for file link: ${w.authType}`);
3228
- }
3229
- return p;
3230
- })(d, m), getFileUploadLink: (m) => (function(w, v) {
3231
- let p = `${U(w.remoteURL, k(v))}?Content-Type=application/octet-stream`;
3232
- const y = /^https:/i.test(p) ? "https" : "http";
3233
- switch (w.authType) {
3234
- case J.None:
3235
- break;
3236
- case J.Password: {
3237
- const A = Nt(w.headers.Authorization.replace(/^Basic /i, "").trim());
3238
- p = p.replace(/^https?:\/\//, `${y}://${A}@`);
3239
- break;
3240
- }
3241
- default:
3242
- throw new K({ info: { code: ne.LinkUnsupportedAuthType } }, `Unsupported auth type for file link: ${w.authType}`);
3243
- }
3244
- return p;
3245
- })(d, m), getHeaders: () => Object.assign({}, d.headers), getQuota: (m) => Jn(d, m), lock: (m, w) => Hn(d, m, w), moveFile: (m, w, v) => Kn(d, m, w, v), putFileContents: (m, w, v) => Dn(d, m, w, v), partialUpdateFileContents: (m, w, v, p, y) => rs(d, m, w, v, p, y), getDAVCompliance: (m) => br(d, m), search: (m, w) => Yn(d, m, w), setHeaders: (m) => {
3246
- d.headers = Object.assign({}, m);
3247
- }, stat: (m, w) => lt(d, m, w), unlock: (m, w, v) => zn(d, m, w, v) };
3248
- }
3249
- ee.hT;
3250
- ee.O4;
3251
- ee.Kd;
3252
- ee.YK;
3253
- var is = ee.UU;
3254
- ee.Gu;
3255
- ee.ky;
3256
- var os = ee.h4, as = ee.ch;
3257
- ee.hq;
3258
- ee.i5;
3259
- const G = [];
3260
- for (let r = 0; r < 256; ++r)
3261
- G.push((r + 256).toString(16).slice(1));
3262
- function us(r, e = 0) {
3263
- return (G[r[e + 0]] + G[r[e + 1]] + G[r[e + 2]] + G[r[e + 3]] + "-" + G[r[e + 4]] + G[r[e + 5]] + "-" + G[r[e + 6]] + G[r[e + 7]] + "-" + G[r[e + 8]] + G[r[e + 9]] + "-" + G[r[e + 10]] + G[r[e + 11]] + G[r[e + 12]] + G[r[e + 13]] + G[r[e + 14]] + G[r[e + 15]]).toLowerCase();
3264
- }
3265
- let Me;
3266
- const ls = new Uint8Array(16);
3267
- function cs() {
3268
- if (!Me) {
3269
- if (typeof crypto > "u" || !crypto.getRandomValues)
3270
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
3271
- Me = crypto.getRandomValues.bind(crypto);
3272
- }
3273
- return Me(ls);
3274
- }
3275
- const hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kt = { randomUUID: hs };
3276
- function fs(r, e, t) {
3277
- r = r || {};
3278
- const n = r.random ?? r.rng?.() ?? cs();
3279
- if (n.length < 16)
3280
- throw new Error("Random bytes length must be >= 16");
3281
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, us(n);
3282
- }
3283
- function ps(r, e, t) {
3284
- return kt.randomUUID && !r ? kt.randomUUID() : fs(r);
3285
- }
3286
- var Ve = {}, Be = {}, Ut;
3287
- function ft() {
3288
- return Ut || (Ut = 1, (function(r) {
3289
- const e = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", t = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", n = "[" + e + "][" + t + "]*", a = new RegExp("^" + n + "$"), u = function(i, h) {
3290
- const o = [];
3291
- let s = h.exec(i);
3292
- for (; s; ) {
3293
- const f = [];
3294
- f.startIndex = h.lastIndex - s[0].length;
3295
- const l = s.length;
3296
- for (let g = 0; g < l; g++)
3297
- f.push(s[g]);
3298
- o.push(f), s = h.exec(i);
3299
- }
3300
- return o;
3301
- }, c = function(i) {
3302
- const h = a.exec(i);
3303
- return !(h === null || typeof h > "u");
3304
- };
3305
- r.isExist = function(i) {
3306
- return typeof i < "u";
3307
- }, r.isEmptyObject = function(i) {
3308
- return Object.keys(i).length === 0;
3309
- }, r.merge = function(i, h, o) {
3310
- if (h) {
3311
- const s = Object.keys(h), f = s.length;
3312
- for (let l = 0; l < f; l++)
3313
- o === "strict" ? i[s[l]] = [h[s[l]]] : i[s[l]] = h[s[l]];
3314
- }
3315
- }, r.getValue = function(i) {
3316
- return r.isExist(i) ? i : "";
3317
- }, r.isName = c, r.getAllMatches = u, r.nameRegexp = n;
3318
- })(Be)), Be;
3319
- }
3320
- var _t;
3321
- function yr() {
3322
- if (_t) return Ve;
3323
- _t = 1;
3324
- const r = ft(), e = {
3325
- allowBooleanAttributes: !1,
3326
- //A tag can have attributes without any value
3327
- unpairedTags: []
3328
- };
3329
- Ve.validate = function(v, p) {
3330
- p = Object.assign({}, e, p);
3331
- const y = [];
3332
- let A = !1, N = !1;
3333
- v[0] === "\uFEFF" && (v = v.substr(1));
3334
- for (let b = 0; b < v.length; b++)
3335
- if (v[b] === "<" && v[b + 1] === "?") {
3336
- if (b += 2, b = n(v, b), b.err) return b;
3337
- } else if (v[b] === "<") {
3338
- let E = b;
3339
- if (b++, v[b] === "!") {
3340
- b = a(v, b);
3341
- continue;
3342
- } else {
3343
- let x = !1;
3344
- v[b] === "/" && (x = !0, b++);
3345
- let T = "";
3346
- for (; b < v.length && v[b] !== ">" && v[b] !== " " && v[b] !== " " && v[b] !== `
3347
- ` && v[b] !== "\r"; b++)
3348
- T += v[b];
3349
- if (T = T.trim(), T[T.length - 1] === "/" && (T = T.substring(0, T.length - 1), b--), !d(T)) {
3350
- let C;
3351
- return T.trim().length === 0 ? C = "Invalid space after '<'." : C = "Tag '" + T + "' is an invalid name.", l("InvalidTag", C, m(v, b));
3352
- }
3353
- const O = i(v, b);
3354
- if (O === !1)
3355
- return l("InvalidAttr", "Attributes for '" + T + "' have open quote.", m(v, b));
3356
- let I = O.value;
3357
- if (b = O.index, I[I.length - 1] === "/") {
3358
- const C = b - I.length;
3359
- I = I.substring(0, I.length - 1);
3360
- const P = o(I, p);
3361
- if (P === !0)
3362
- A = !0;
3363
- else
3364
- return l(P.err.code, P.err.msg, m(v, C + P.err.line));
3365
- } else if (x)
3366
- if (O.tagClosed) {
3367
- if (I.trim().length > 0)
3368
- return l("InvalidTag", "Closing tag '" + T + "' can't have attributes or invalid starting.", m(v, E));
3369
- if (y.length === 0)
3370
- return l("InvalidTag", "Closing tag '" + T + "' has not been opened.", m(v, E));
3371
- {
3372
- const C = y.pop();
3373
- if (T !== C.tagName) {
3374
- let P = m(v, C.tagStartPos);
3375
- return l(
3376
- "InvalidTag",
3377
- "Expected closing tag '" + C.tagName + "' (opened in line " + P.line + ", col " + P.col + ") instead of closing tag '" + T + "'.",
3378
- m(v, E)
3379
- );
3380
- }
3381
- y.length == 0 && (N = !0);
3382
- }
3383
- } else return l("InvalidTag", "Closing tag '" + T + "' doesn't have proper closing.", m(v, b));
3384
- else {
3385
- const C = o(I, p);
3386
- if (C !== !0)
3387
- return l(C.err.code, C.err.msg, m(v, b - I.length + C.err.line));
3388
- if (N === !0)
3389
- return l("InvalidXml", "Multiple possible root nodes found.", m(v, b));
3390
- p.unpairedTags.indexOf(T) !== -1 || y.push({ tagName: T, tagStartPos: E }), A = !0;
3391
- }
3392
- for (b++; b < v.length; b++)
3393
- if (v[b] === "<")
3394
- if (v[b + 1] === "!") {
3395
- b++, b = a(v, b);
3396
- continue;
3397
- } else if (v[b + 1] === "?") {
3398
- if (b = n(v, ++b), b.err) return b;
3399
- } else
3400
- break;
3401
- else if (v[b] === "&") {
3402
- const C = f(v, b);
3403
- if (C == -1)
3404
- return l("InvalidChar", "char '&' is not expected.", m(v, b));
3405
- b = C;
3406
- } else if (N === !0 && !t(v[b]))
3407
- return l("InvalidXml", "Extra text at the end", m(v, b));
3408
- v[b] === "<" && b--;
3409
- }
3410
- } else {
3411
- if (t(v[b]))
3412
- continue;
3413
- return l("InvalidChar", "char '" + v[b] + "' is not expected.", m(v, b));
3414
- }
3415
- if (A) {
3416
- if (y.length == 1)
3417
- return l("InvalidTag", "Unclosed tag '" + y[0].tagName + "'.", m(v, y[0].tagStartPos));
3418
- if (y.length > 0)
3419
- return l("InvalidXml", "Invalid '" + JSON.stringify(y.map((b) => b.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
3420
- } else return l("InvalidXml", "Start tag expected.", 1);
3421
- return !0;
3422
- };
3423
- function t(v) {
3424
- return v === " " || v === " " || v === `
3425
- ` || v === "\r";
3426
- }
3427
- function n(v, p) {
3428
- const y = p;
3429
- for (; p < v.length; p++)
3430
- if (v[p] == "?" || v[p] == " ") {
3431
- const A = v.substr(y, p - y);
3432
- if (p > 5 && A === "xml")
3433
- return l("InvalidXml", "XML declaration allowed only at the start of the document.", m(v, p));
3434
- if (v[p] == "?" && v[p + 1] == ">") {
3435
- p++;
3436
- break;
3437
- } else
3438
- continue;
3439
- }
3440
- return p;
3441
- }
3442
- function a(v, p) {
3443
- if (v.length > p + 5 && v[p + 1] === "-" && v[p + 2] === "-") {
3444
- for (p += 3; p < v.length; p++)
3445
- if (v[p] === "-" && v[p + 1] === "-" && v[p + 2] === ">") {
3446
- p += 2;
3447
- break;
3448
- }
3449
- } else if (v.length > p + 8 && v[p + 1] === "D" && v[p + 2] === "O" && v[p + 3] === "C" && v[p + 4] === "T" && v[p + 5] === "Y" && v[p + 6] === "P" && v[p + 7] === "E") {
3450
- let y = 1;
3451
- for (p += 8; p < v.length; p++)
3452
- if (v[p] === "<")
3453
- y++;
3454
- else if (v[p] === ">" && (y--, y === 0))
3455
- break;
3456
- } else if (v.length > p + 9 && v[p + 1] === "[" && v[p + 2] === "C" && v[p + 3] === "D" && v[p + 4] === "A" && v[p + 5] === "T" && v[p + 6] === "A" && v[p + 7] === "[") {
3457
- for (p += 8; p < v.length; p++)
3458
- if (v[p] === "]" && v[p + 1] === "]" && v[p + 2] === ">") {
3459
- p += 2;
3460
- break;
3461
- }
3462
- }
3463
- return p;
3464
- }
3465
- const u = '"', c = "'";
3466
- function i(v, p) {
3467
- let y = "", A = "", N = !1;
3468
- for (; p < v.length; p++) {
3469
- if (v[p] === u || v[p] === c)
3470
- A === "" ? A = v[p] : A !== v[p] || (A = "");
3471
- else if (v[p] === ">" && A === "") {
3472
- N = !0;
3473
- break;
3474
- }
3475
- y += v[p];
3476
- }
3477
- return A !== "" ? !1 : {
3478
- value: y,
3479
- index: p,
3480
- tagClosed: N
3481
- };
3482
- }
3483
- const h = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
3484
- function o(v, p) {
3485
- const y = r.getAllMatches(v, h), A = {};
3486
- for (let N = 0; N < y.length; N++) {
3487
- if (y[N][1].length === 0)
3488
- return l("InvalidAttr", "Attribute '" + y[N][2] + "' has no space in starting.", w(y[N]));
3489
- if (y[N][3] !== void 0 && y[N][4] === void 0)
3490
- return l("InvalidAttr", "Attribute '" + y[N][2] + "' is without value.", w(y[N]));
3491
- if (y[N][3] === void 0 && !p.allowBooleanAttributes)
3492
- return l("InvalidAttr", "boolean attribute '" + y[N][2] + "' is not allowed.", w(y[N]));
3493
- const b = y[N][2];
3494
- if (!g(b))
3495
- return l("InvalidAttr", "Attribute '" + b + "' is an invalid name.", w(y[N]));
3496
- if (!A.hasOwnProperty(b))
3497
- A[b] = 1;
3498
- else
3499
- return l("InvalidAttr", "Attribute '" + b + "' is repeated.", w(y[N]));
3500
- }
3501
- return !0;
3502
- }
3503
- function s(v, p) {
3504
- let y = /\d/;
3505
- for (v[p] === "x" && (p++, y = /[\da-fA-F]/); p < v.length; p++) {
3506
- if (v[p] === ";")
3507
- return p;
3508
- if (!v[p].match(y))
3509
- break;
3510
- }
3511
- return -1;
3512
- }
3513
- function f(v, p) {
3514
- if (p++, v[p] === ";")
3515
- return -1;
3516
- if (v[p] === "#")
3517
- return p++, s(v, p);
3518
- let y = 0;
3519
- for (; p < v.length; p++, y++)
3520
- if (!(v[p].match(/\w/) && y < 20)) {
3521
- if (v[p] === ";")
3522
- break;
3523
- return -1;
3524
- }
3525
- return p;
3526
- }
3527
- function l(v, p, y) {
3528
- return {
3529
- err: {
3530
- code: v,
3531
- msg: p,
3532
- line: y.line || y,
3533
- col: y.col
3534
- }
3535
- };
3536
- }
3537
- function g(v) {
3538
- return r.isName(v);
3539
- }
3540
- function d(v) {
3541
- return r.isName(v);
3542
- }
3543
- function m(v, p) {
3544
- const y = v.substring(0, p).split(/\r?\n/);
3545
- return {
3546
- line: y.length,
3547
- // column number is last line's length + 1, because column numbering starts at 1:
3548
- col: y[y.length - 1].length + 1
3549
- };
3550
- }
3551
- function w(v) {
3552
- return v.startIndex + v[1].length;
3553
- }
3554
- return Ve;
3555
- }
3556
- var xe = {}, Mt;
3557
- function gs() {
3558
- if (Mt) return xe;
3559
- Mt = 1;
3560
- const r = {
3561
- preserveOrder: !1,
3562
- attributeNamePrefix: "@_",
3563
- attributesGroupName: !1,
3564
- textNodeName: "#text",
3565
- ignoreAttributes: !0,
3566
- removeNSPrefix: !1,
3567
- // remove NS from tag name or attribute name if true
3568
- allowBooleanAttributes: !1,
3569
- //a tag can have attributes without any value
3570
- //ignoreRootElement : false,
3571
- parseTagValue: !0,
3572
- parseAttributeValue: !1,
3573
- trimValues: !0,
3574
- //Trim string values of tag and attributes
3575
- cdataPropName: !1,
3576
- numberParseOptions: {
3577
- hex: !0,
3578
- leadingZeros: !0,
3579
- eNotation: !0
3580
- },
3581
- tagValueProcessor: function(t, n) {
3582
- return n;
3583
- },
3584
- attributeValueProcessor: function(t, n) {
3585
- return n;
3586
- },
3587
- stopNodes: [],
3588
- //nested tags will not be parsed even for errors
3589
- alwaysCreateTextNode: !1,
3590
- isArray: () => !1,
3591
- commentPropName: !1,
3592
- unpairedTags: [],
3593
- processEntities: !0,
3594
- htmlEntities: !1,
3595
- ignoreDeclaration: !1,
3596
- ignorePiTags: !1,
3597
- transformTagName: !1,
3598
- transformAttributeName: !1,
3599
- updateTag: function(t, n, a) {
3600
- return t;
3601
- }
3602
- // skipEmptyListItem: false
3603
- }, e = function(t) {
3604
- return Object.assign({}, r, t);
3605
- };
3606
- return xe.buildOptions = e, xe.defaultOptions = r, xe;
3607
- }
3608
- var qe, Vt;
3609
- function ds() {
3610
- if (Vt) return qe;
3611
- Vt = 1;
3612
- class r {
3613
- constructor(t) {
3614
- this.tagname = t, this.child = [], this[":@"] = {};
3615
- }
3616
- add(t, n) {
3617
- t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: n });
3618
- }
3619
- addChild(t) {
3620
- t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child });
3621
- }
3622
- }
3623
- return qe = r, qe;
3624
- }
3625
- var We, Bt;
3626
- function ms() {
3627
- if (Bt) return We;
3628
- Bt = 1;
3629
- const r = ft();
3630
- function e(o, s) {
3631
- const f = {};
3632
- if (o[s + 3] === "O" && o[s + 4] === "C" && o[s + 5] === "T" && o[s + 6] === "Y" && o[s + 7] === "P" && o[s + 8] === "E") {
3633
- s = s + 9;
3634
- let l = 1, g = !1, d = !1, m = "";
3635
- for (; s < o.length; s++)
3636
- if (o[s] === "<" && !d) {
3637
- if (g && a(o, s)) {
3638
- s += 7;
3639
- let w, v;
3640
- [w, v, s] = t(o, s + 1), v.indexOf("&") === -1 && (f[h(w)] = {
3641
- regx: RegExp(`&${w};`, "g"),
3642
- val: v
3643
- });
3644
- } else if (g && u(o, s)) s += 8;
3645
- else if (g && c(o, s)) s += 8;
3646
- else if (g && i(o, s)) s += 9;
3647
- else if (n) d = !0;
3648
- else throw new Error("Invalid DOCTYPE");
3649
- l++, m = "";
3650
- } else if (o[s] === ">") {
3651
- if (d ? o[s - 1] === "-" && o[s - 2] === "-" && (d = !1, l--) : l--, l === 0)
3652
- break;
3653
- } else o[s] === "[" ? g = !0 : m += o[s];
3654
- if (l !== 0)
3655
- throw new Error("Unclosed DOCTYPE");
3656
- } else
3657
- throw new Error("Invalid Tag instead of DOCTYPE");
3658
- return { entities: f, i: s };
3659
- }
3660
- function t(o, s) {
3661
- let f = "";
3662
- for (; s < o.length && o[s] !== "'" && o[s] !== '"'; s++)
3663
- f += o[s];
3664
- if (f = f.trim(), f.indexOf(" ") !== -1) throw new Error("External entites are not supported");
3665
- const l = o[s++];
3666
- let g = "";
3667
- for (; s < o.length && o[s] !== l; s++)
3668
- g += o[s];
3669
- return [f, g, s];
3670
- }
3671
- function n(o, s) {
3672
- return o[s + 1] === "!" && o[s + 2] === "-" && o[s + 3] === "-";
3673
- }
3674
- function a(o, s) {
3675
- return o[s + 1] === "!" && o[s + 2] === "E" && o[s + 3] === "N" && o[s + 4] === "T" && o[s + 5] === "I" && o[s + 6] === "T" && o[s + 7] === "Y";
3676
- }
3677
- function u(o, s) {
3678
- return o[s + 1] === "!" && o[s + 2] === "E" && o[s + 3] === "L" && o[s + 4] === "E" && o[s + 5] === "M" && o[s + 6] === "E" && o[s + 7] === "N" && o[s + 8] === "T";
3679
- }
3680
- function c(o, s) {
3681
- return o[s + 1] === "!" && o[s + 2] === "A" && o[s + 3] === "T" && o[s + 4] === "T" && o[s + 5] === "L" && o[s + 6] === "I" && o[s + 7] === "S" && o[s + 8] === "T";
3682
- }
3683
- function i(o, s) {
3684
- return o[s + 1] === "!" && o[s + 2] === "N" && o[s + 3] === "O" && o[s + 4] === "T" && o[s + 5] === "A" && o[s + 6] === "T" && o[s + 7] === "I" && o[s + 8] === "O" && o[s + 9] === "N";
3685
- }
3686
- function h(o) {
3687
- if (r.isName(o))
3688
- return o;
3689
- throw new Error(`Invalid entity name ${o}`);
3690
- }
3691
- return We = e, We;
3692
- }
3693
- var Xe, qt;
3694
- function bs() {
3695
- if (qt) return Xe;
3696
- qt = 1;
3697
- const r = /^[-+]?0x[a-fA-F0-9]+$/, e = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, t = {
3698
- hex: !0,
3699
- // oct: false,
3700
- leadingZeros: !0,
3701
- decimalPoint: ".",
3702
- eNotation: !0
3703
- //skipLike: /regex/
3704
- };
3705
- function n(c, i = {}) {
3706
- if (i = Object.assign({}, t, i), !c || typeof c != "string") return c;
3707
- let h = c.trim();
3708
- if (i.skipLike !== void 0 && i.skipLike.test(h)) return c;
3709
- if (c === "0") return 0;
3710
- if (i.hex && r.test(h))
3711
- return u(h, 16);
3712
- if (h.search(/[eE]/) !== -1) {
3713
- const o = h.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
3714
- if (o) {
3715
- if (i.leadingZeros)
3716
- h = (o[1] || "") + o[3];
3717
- else if (!(o[2] === "0" && o[3][0] === ".")) return c;
3718
- return i.eNotation ? Number(h) : c;
3719
- } else
3720
- return c;
3721
- } else {
3722
- const o = e.exec(h);
3723
- if (o) {
3724
- const s = o[1], f = o[2];
3725
- let l = a(o[3]);
3726
- if (!i.leadingZeros && f.length > 0 && s && h[2] !== ".") return c;
3727
- if (!i.leadingZeros && f.length > 0 && !s && h[1] !== ".") return c;
3728
- if (i.leadingZeros && f === c) return 0;
3729
- {
3730
- const g = Number(h), d = "" + g;
3731
- return d.search(/[eE]/) !== -1 ? i.eNotation ? g : c : h.indexOf(".") !== -1 ? d === "0" && l === "" || d === l || s && d === "-" + l ? g : c : f ? l === d || s + l === d ? g : c : h === d || h === s + d ? g : c;
3732
- }
3733
- } else
3734
- return c;
3735
- }
3736
- }
3737
- function a(c) {
3738
- return c && c.indexOf(".") !== -1 && (c = c.replace(/0+$/, ""), c === "." ? c = "0" : c[0] === "." ? c = "0" + c : c[c.length - 1] === "." && (c = c.substr(0, c.length - 1))), c;
3739
- }
3740
- function u(c, i) {
3741
- if (parseInt) return parseInt(c, i);
3742
- if (Number.parseInt) return Number.parseInt(c, i);
3743
- if (window && window.parseInt) return window.parseInt(c, i);
3744
- throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
3745
- }
3746
- return Xe = n, Xe;
3747
- }
3748
- var Ge, Wt;
3749
- function vr() {
3750
- if (Wt) return Ge;
3751
- Wt = 1;
3752
- function r(e) {
3753
- return typeof e == "function" ? e : Array.isArray(e) ? (t) => {
3754
- for (const n of e)
3755
- if (typeof n == "string" && t === n || n instanceof RegExp && n.test(t))
3756
- return !0;
3757
- } : () => !1;
3758
- }
3759
- return Ge = r, Ge;
3760
- }
3761
- var ze, Xt;
3762
- function ys() {
3763
- if (Xt) return ze;
3764
- Xt = 1;
3765
- const r = ft(), e = ds(), t = ms(), n = bs(), a = vr();
3766
- class u {
3767
- constructor(b) {
3768
- this.options = b, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
3769
- apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
3770
- gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
3771
- lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
3772
- quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
3773
- }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
3774
- space: { regex: /&(nbsp|#160);/g, val: " " },
3775
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
3776
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
3777
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
3778
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
3779
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
3780
- cent: { regex: /&(cent|#162);/g, val: "¢" },
3781
- pound: { regex: /&(pound|#163);/g, val: "£" },
3782
- yen: { regex: /&(yen|#165);/g, val: "¥" },
3783
- euro: { regex: /&(euro|#8364);/g, val: "€" },
3784
- copyright: { regex: /&(copy|#169);/g, val: "©" },
3785
- reg: { regex: /&(reg|#174);/g, val: "®" },
3786
- inr: { regex: /&(inr|#8377);/g, val: "₹" },
3787
- num_dec: { regex: /&#([0-9]{1,7});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 10)) },
3788
- num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 16)) }
3789
- }, this.addExternalEntities = c, this.parseXml = f, this.parseTextData = i, this.resolveNameSpace = h, this.buildAttributesMap = s, this.isItStopNode = m, this.replaceEntitiesValue = g, this.readStopNodeData = y, this.saveTextToParentTag = d, this.addChild = l, this.ignoreAttributesFn = a(this.options.ignoreAttributes);
3790
- }
3791
- }
3792
- function c(N) {
3793
- const b = Object.keys(N);
3794
- for (let E = 0; E < b.length; E++) {
3795
- const x = b[E];
3796
- this.lastEntities[x] = {
3797
- regex: new RegExp("&" + x + ";", "g"),
3798
- val: N[x]
3799
- };
3800
- }
3801
- }
3802
- function i(N, b, E, x, T, O, I) {
3803
- if (N !== void 0 && (this.options.trimValues && !x && (N = N.trim()), N.length > 0)) {
3804
- I || (N = this.replaceEntitiesValue(N));
3805
- const C = this.options.tagValueProcessor(b, N, E, T, O);
3806
- return C == null ? N : typeof C != typeof N || C !== N ? C : this.options.trimValues ? A(N, this.options.parseTagValue, this.options.numberParseOptions) : N.trim() === N ? A(N, this.options.parseTagValue, this.options.numberParseOptions) : N;
3807
- }
3808
- }
3809
- function h(N) {
3810
- if (this.options.removeNSPrefix) {
3811
- const b = N.split(":"), E = N.charAt(0) === "/" ? "/" : "";
3812
- if (b[0] === "xmlns")
3813
- return "";
3814
- b.length === 2 && (N = E + b[1]);
3815
- }
3816
- return N;
3817
- }
3818
- const o = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
3819
- function s(N, b, E) {
3820
- if (this.options.ignoreAttributes !== !0 && typeof N == "string") {
3821
- const x = r.getAllMatches(N, o), T = x.length, O = {};
3822
- for (let I = 0; I < T; I++) {
3823
- const C = this.resolveNameSpace(x[I][1]);
3824
- if (this.ignoreAttributesFn(C, b))
3825
- continue;
3826
- let P = x[I][4], F = this.options.attributeNamePrefix + C;
3827
- if (C.length)
3828
- if (this.options.transformAttributeName && (F = this.options.transformAttributeName(F)), F === "__proto__" && (F = "#__proto__"), P !== void 0) {
3829
- this.options.trimValues && (P = P.trim()), P = this.replaceEntitiesValue(P);
3830
- const S = this.options.attributeValueProcessor(C, P, b);
3831
- S == null ? O[F] = P : typeof S != typeof P || S !== P ? O[F] = S : O[F] = A(
3832
- P,
3833
- this.options.parseAttributeValue,
3834
- this.options.numberParseOptions
3835
- );
3836
- } else this.options.allowBooleanAttributes && (O[F] = !0);
3837
- }
3838
- if (!Object.keys(O).length)
3839
- return;
3840
- if (this.options.attributesGroupName) {
3841
- const I = {};
3842
- return I[this.options.attributesGroupName] = O, I;
3843
- }
3844
- return O;
3845
- }
3846
- }
3847
- const f = function(N) {
3848
- N = N.replace(/\r\n?/g, `
3849
- `);
3850
- const b = new e("!xml");
3851
- let E = b, x = "", T = "";
3852
- for (let O = 0; O < N.length; O++)
3853
- if (N[O] === "<")
3854
- if (N[O + 1] === "/") {
3855
- const C = v(N, ">", O, "Closing Tag is not closed.");
3856
- let P = N.substring(O + 2, C).trim();
3857
- if (this.options.removeNSPrefix) {
3858
- const j = P.indexOf(":");
3859
- j !== -1 && (P = P.substr(j + 1));
3860
- }
3861
- this.options.transformTagName && (P = this.options.transformTagName(P)), E && (x = this.saveTextToParentTag(x, E, T));
3862
- const F = T.substring(T.lastIndexOf(".") + 1);
3863
- if (P && this.options.unpairedTags.indexOf(P) !== -1)
3864
- throw new Error(`Unpaired tag can not be used as closing tag: </${P}>`);
3865
- let S = 0;
3866
- F && this.options.unpairedTags.indexOf(F) !== -1 ? (S = T.lastIndexOf(".", T.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : S = T.lastIndexOf("."), T = T.substring(0, S), E = this.tagsNodeStack.pop(), x = "", O = C;
3867
- } else if (N[O + 1] === "?") {
3868
- let C = p(N, O, !1, "?>");
3869
- if (!C) throw new Error("Pi Tag is not closed.");
3870
- if (x = this.saveTextToParentTag(x, E, T), !(this.options.ignoreDeclaration && C.tagName === "?xml" || this.options.ignorePiTags)) {
3871
- const P = new e(C.tagName);
3872
- P.add(this.options.textNodeName, ""), C.tagName !== C.tagExp && C.attrExpPresent && (P[":@"] = this.buildAttributesMap(C.tagExp, T, C.tagName)), this.addChild(E, P, T);
3873
- }
3874
- O = C.closeIndex + 1;
3875
- } else if (N.substr(O + 1, 3) === "!--") {
3876
- const C = v(N, "-->", O + 4, "Comment is not closed.");
3877
- if (this.options.commentPropName) {
3878
- const P = N.substring(O + 4, C - 2);
3879
- x = this.saveTextToParentTag(x, E, T), E.add(this.options.commentPropName, [{ [this.options.textNodeName]: P }]);
3880
- }
3881
- O = C;
3882
- } else if (N.substr(O + 1, 2) === "!D") {
3883
- const C = t(N, O);
3884
- this.docTypeEntities = C.entities, O = C.i;
3885
- } else if (N.substr(O + 1, 2) === "![") {
3886
- const C = v(N, "]]>", O, "CDATA is not closed.") - 2, P = N.substring(O + 9, C);
3887
- x = this.saveTextToParentTag(x, E, T);
3888
- let F = this.parseTextData(P, E.tagname, T, !0, !1, !0, !0);
3889
- F == null && (F = ""), this.options.cdataPropName ? E.add(this.options.cdataPropName, [{ [this.options.textNodeName]: P }]) : E.add(this.options.textNodeName, F), O = C + 2;
3890
- } else {
3891
- let C = p(N, O, this.options.removeNSPrefix), P = C.tagName;
3892
- const F = C.rawTagName;
3893
- let S = C.tagExp, j = C.attrExpPresent, V = C.closeIndex;
3894
- this.options.transformTagName && (P = this.options.transformTagName(P)), E && x && E.tagname !== "!xml" && (x = this.saveTextToParentTag(x, E, T, !1));
3895
- const _ = E;
3896
- if (_ && this.options.unpairedTags.indexOf(_.tagname) !== -1 && (E = this.tagsNodeStack.pop(), T = T.substring(0, T.lastIndexOf("."))), P !== b.tagname && (T += T ? "." + P : P), this.isItStopNode(this.options.stopNodes, T, P)) {
3897
- let $ = "";
3898
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1)
3899
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), T = T.substr(0, T.length - 1), S = P) : S = S.substr(0, S.length - 1), O = C.closeIndex;
3900
- else if (this.options.unpairedTags.indexOf(P) !== -1)
3901
- O = C.closeIndex;
3902
- else {
3903
- const L = this.readStopNodeData(N, F, V + 1);
3904
- if (!L) throw new Error(`Unexpected end of ${F}`);
3905
- O = L.i, $ = L.tagContent;
3906
- }
3907
- const z = new e(P);
3908
- P !== S && j && (z[":@"] = this.buildAttributesMap(S, T, P)), $ && ($ = this.parseTextData($, P, T, !0, j, !0, !0)), T = T.substr(0, T.lastIndexOf(".")), z.add(this.options.textNodeName, $), this.addChild(E, z, T);
3909
- } else {
3910
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) {
3911
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), T = T.substr(0, T.length - 1), S = P) : S = S.substr(0, S.length - 1), this.options.transformTagName && (P = this.options.transformTagName(P));
3912
- const $ = new e(P);
3913
- P !== S && j && ($[":@"] = this.buildAttributesMap(S, T, P)), this.addChild(E, $, T), T = T.substr(0, T.lastIndexOf("."));
3914
- } else {
3915
- const $ = new e(P);
3916
- this.tagsNodeStack.push(E), P !== S && j && ($[":@"] = this.buildAttributesMap(S, T, P)), this.addChild(E, $, T), E = $;
3917
- }
3918
- x = "", O = V;
3919
- }
3920
- }
3921
- else
3922
- x += N[O];
3923
- return b.child;
3924
- };
3925
- function l(N, b, E) {
3926
- const x = this.options.updateTag(b.tagname, E, b[":@"]);
3927
- x === !1 || (typeof x == "string" && (b.tagname = x), N.addChild(b));
3928
- }
3929
- const g = function(N) {
3930
- if (this.options.processEntities) {
3931
- for (let b in this.docTypeEntities) {
3932
- const E = this.docTypeEntities[b];
3933
- N = N.replace(E.regx, E.val);
3934
- }
3935
- for (let b in this.lastEntities) {
3936
- const E = this.lastEntities[b];
3937
- N = N.replace(E.regex, E.val);
3938
- }
3939
- if (this.options.htmlEntities)
3940
- for (let b in this.htmlEntities) {
3941
- const E = this.htmlEntities[b];
3942
- N = N.replace(E.regex, E.val);
3943
- }
3944
- N = N.replace(this.ampEntity.regex, this.ampEntity.val);
3945
- }
3946
- return N;
3947
- };
3948
- function d(N, b, E, x) {
3949
- return N && (x === void 0 && (x = b.child.length === 0), N = this.parseTextData(
3950
- N,
3951
- b.tagname,
3952
- E,
3953
- !1,
3954
- b[":@"] ? Object.keys(b[":@"]).length !== 0 : !1,
3955
- x
3956
- ), N !== void 0 && N !== "" && b.add(this.options.textNodeName, N), N = ""), N;
3957
- }
3958
- function m(N, b, E) {
3959
- const x = "*." + E;
3960
- for (const T in N) {
3961
- const O = N[T];
3962
- if (x === O || b === O) return !0;
3963
- }
3964
- return !1;
3965
- }
3966
- function w(N, b, E = ">") {
3967
- let x, T = "";
3968
- for (let O = b; O < N.length; O++) {
3969
- let I = N[O];
3970
- if (x)
3971
- I === x && (x = "");
3972
- else if (I === '"' || I === "'")
3973
- x = I;
3974
- else if (I === E[0])
3975
- if (E[1]) {
3976
- if (N[O + 1] === E[1])
3977
- return {
3978
- data: T,
3979
- index: O
3980
- };
3981
- } else
3982
- return {
3983
- data: T,
3984
- index: O
3985
- };
3986
- else I === " " && (I = " ");
3987
- T += I;
3988
- }
3989
- }
3990
- function v(N, b, E, x) {
3991
- const T = N.indexOf(b, E);
3992
- if (T === -1)
3993
- throw new Error(x);
3994
- return T + b.length - 1;
3995
- }
3996
- function p(N, b, E, x = ">") {
3997
- const T = w(N, b + 1, x);
3998
- if (!T) return;
3999
- let O = T.data;
4000
- const I = T.index, C = O.search(/\s/);
4001
- let P = O, F = !0;
4002
- C !== -1 && (P = O.substring(0, C), O = O.substring(C + 1).trimStart());
4003
- const S = P;
4004
- if (E) {
4005
- const j = P.indexOf(":");
4006
- j !== -1 && (P = P.substr(j + 1), F = P !== T.data.substr(j + 1));
4007
- }
4008
- return {
4009
- tagName: P,
4010
- tagExp: O,
4011
- closeIndex: I,
4012
- attrExpPresent: F,
4013
- rawTagName: S
4014
- };
4015
- }
4016
- function y(N, b, E) {
4017
- const x = E;
4018
- let T = 1;
4019
- for (; E < N.length; E++)
4020
- if (N[E] === "<")
4021
- if (N[E + 1] === "/") {
4022
- const O = v(N, ">", E, `${b} is not closed`);
4023
- if (N.substring(E + 2, O).trim() === b && (T--, T === 0))
4024
- return {
4025
- tagContent: N.substring(x, E),
4026
- i: O
4027
- };
4028
- E = O;
4029
- } else if (N[E + 1] === "?")
4030
- E = v(N, "?>", E + 1, "StopNode is not closed.");
4031
- else if (N.substr(E + 1, 3) === "!--")
4032
- E = v(N, "-->", E + 3, "StopNode is not closed.");
4033
- else if (N.substr(E + 1, 2) === "![")
4034
- E = v(N, "]]>", E, "StopNode is not closed.") - 2;
4035
- else {
4036
- const O = p(N, E, ">");
4037
- O && ((O && O.tagName) === b && O.tagExp[O.tagExp.length - 1] !== "/" && T++, E = O.closeIndex);
4038
- }
4039
- }
4040
- function A(N, b, E) {
4041
- if (b && typeof N == "string") {
4042
- const x = N.trim();
4043
- return x === "true" ? !0 : x === "false" ? !1 : n(N, E);
4044
- } else
4045
- return r.isExist(N) ? N : "";
4046
- }
4047
- return ze = u, ze;
4048
- }
4049
- var He = {}, Gt;
4050
- function vs() {
4051
- if (Gt) return He;
4052
- Gt = 1;
4053
- function r(u, c) {
4054
- return e(u, c);
4055
- }
4056
- function e(u, c, i) {
4057
- let h;
4058
- const o = {};
4059
- for (let s = 0; s < u.length; s++) {
4060
- const f = u[s], l = t(f);
4061
- let g = "";
4062
- if (i === void 0 ? g = l : g = i + "." + l, l === c.textNodeName)
4063
- h === void 0 ? h = f[l] : h += "" + f[l];
4064
- else {
4065
- if (l === void 0)
4066
- continue;
4067
- if (f[l]) {
4068
- let d = e(f[l], c, g);
4069
- const m = a(d, c);
4070
- f[":@"] ? n(d, f[":@"], g, c) : Object.keys(d).length === 1 && d[c.textNodeName] !== void 0 && !c.alwaysCreateTextNode ? d = d[c.textNodeName] : Object.keys(d).length === 0 && (c.alwaysCreateTextNode ? d[c.textNodeName] = "" : d = ""), o[l] !== void 0 && o.hasOwnProperty(l) ? (Array.isArray(o[l]) || (o[l] = [o[l]]), o[l].push(d)) : c.isArray(l, g, m) ? o[l] = [d] : o[l] = d;
4071
- }
4072
- }
4073
- }
4074
- return typeof h == "string" ? h.length > 0 && (o[c.textNodeName] = h) : h !== void 0 && (o[c.textNodeName] = h), o;
4075
- }
4076
- function t(u) {
4077
- const c = Object.keys(u);
4078
- for (let i = 0; i < c.length; i++) {
4079
- const h = c[i];
4080
- if (h !== ":@") return h;
4081
- }
4082
- }
4083
- function n(u, c, i, h) {
4084
- if (c) {
4085
- const o = Object.keys(c), s = o.length;
4086
- for (let f = 0; f < s; f++) {
4087
- const l = o[f];
4088
- h.isArray(l, i + "." + l, !0, !0) ? u[l] = [c[l]] : u[l] = c[l];
4089
- }
4090
- }
4091
- }
4092
- function a(u, c) {
4093
- const { textNodeName: i } = c, h = Object.keys(u).length;
4094
- return !!(h === 0 || h === 1 && (u[i] || typeof u[i] == "boolean" || u[i] === 0));
4095
- }
4096
- return He.prettify = r, He;
4097
- }
4098
- var Ze, zt;
4099
- function ws() {
4100
- if (zt) return Ze;
4101
- zt = 1;
4102
- const { buildOptions: r } = gs(), e = ys(), { prettify: t } = vs(), n = yr();
4103
- class a {
4104
- constructor(c) {
4105
- this.externalEntities = {}, this.options = r(c);
4106
- }
4107
- /**
4108
- * Parse XML dats to JS object
4109
- * @param {string|Buffer} xmlData
4110
- * @param {boolean|Object} validationOption
4111
- */
4112
- parse(c, i) {
4113
- if (typeof c != "string") if (c.toString)
4114
- c = c.toString();
4115
- else
4116
- throw new Error("XML data is accepted in String or Bytes[] form.");
4117
- if (i) {
4118
- i === !0 && (i = {});
4119
- const s = n.validate(c, i);
4120
- if (s !== !0)
4121
- throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`);
4122
- }
4123
- const h = new e(this.options);
4124
- h.addExternalEntities(this.externalEntities);
4125
- const o = h.parseXml(c);
4126
- return this.options.preserveOrder || o === void 0 ? o : t(o, this.options);
4127
- }
4128
- /**
4129
- * Add Entity which is not by default supported by this library
4130
- * @param {string} key
4131
- * @param {string} value
4132
- */
4133
- addEntity(c, i) {
4134
- if (i.indexOf("&") !== -1)
4135
- throw new Error("Entity value can't have '&'");
4136
- if (c.indexOf("&") !== -1 || c.indexOf(";") !== -1)
4137
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
4138
- if (i === "&")
4139
- throw new Error("An entity with value '&' is not permitted");
4140
- this.externalEntities[c] = i;
4141
- }
4142
- }
4143
- return Ze = a, Ze;
4144
- }
4145
- var Je, Ht;
4146
- function Ns() {
4147
- if (Ht) return Je;
4148
- Ht = 1;
4149
- const r = `
4150
- `;
4151
- function e(i, h) {
4152
- let o = "";
4153
- return h.format && h.indentBy.length > 0 && (o = r), t(i, h, "", o);
4154
- }
4155
- function t(i, h, o, s) {
4156
- let f = "", l = !1;
4157
- for (let g = 0; g < i.length; g++) {
4158
- const d = i[g], m = n(d);
4159
- if (m === void 0) continue;
4160
- let w = "";
4161
- if (o.length === 0 ? w = m : w = `${o}.${m}`, m === h.textNodeName) {
4162
- let N = d[m];
4163
- u(w, h) || (N = h.tagValueProcessor(m, N), N = c(N, h)), l && (f += s), f += N, l = !1;
4164
- continue;
4165
- } else if (m === h.cdataPropName) {
4166
- l && (f += s), f += `<![CDATA[${d[m][0][h.textNodeName]}]]>`, l = !1;
4167
- continue;
4168
- } else if (m === h.commentPropName) {
4169
- f += s + `<!--${d[m][0][h.textNodeName]}-->`, l = !0;
4170
- continue;
4171
- } else if (m[0] === "?") {
4172
- const N = a(d[":@"], h), b = m === "?xml" ? "" : s;
4173
- let E = d[m][0][h.textNodeName];
4174
- E = E.length !== 0 ? " " + E : "", f += b + `<${m}${E}${N}?>`, l = !0;
4175
- continue;
4176
- }
4177
- let v = s;
4178
- v !== "" && (v += h.indentBy);
4179
- const p = a(d[":@"], h), y = s + `<${m}${p}`, A = t(d[m], h, w, v);
4180
- h.unpairedTags.indexOf(m) !== -1 ? h.suppressUnpairedNode ? f += y + ">" : f += y + "/>" : (!A || A.length === 0) && h.suppressEmptyNode ? f += y + "/>" : A && A.endsWith(">") ? f += y + `>${A}${s}</${m}>` : (f += y + ">", A && s !== "" && (A.includes("/>") || A.includes("</")) ? f += s + h.indentBy + A + s : f += A, f += `</${m}>`), l = !0;
4181
- }
4182
- return f;
4183
- }
4184
- function n(i) {
4185
- const h = Object.keys(i);
4186
- for (let o = 0; o < h.length; o++) {
4187
- const s = h[o];
4188
- if (i.hasOwnProperty(s) && s !== ":@")
4189
- return s;
4190
- }
4191
- }
4192
- function a(i, h) {
4193
- let o = "";
4194
- if (i && !h.ignoreAttributes)
4195
- for (let s in i) {
4196
- if (!i.hasOwnProperty(s)) continue;
4197
- let f = h.attributeValueProcessor(s, i[s]);
4198
- f = c(f, h), f === !0 && h.suppressBooleanAttributes ? o += ` ${s.substr(h.attributeNamePrefix.length)}` : o += ` ${s.substr(h.attributeNamePrefix.length)}="${f}"`;
4199
- }
4200
- return o;
4201
- }
4202
- function u(i, h) {
4203
- i = i.substr(0, i.length - h.textNodeName.length - 1);
4204
- let o = i.substr(i.lastIndexOf(".") + 1);
4205
- for (let s in h.stopNodes)
4206
- if (h.stopNodes[s] === i || h.stopNodes[s] === "*." + o) return !0;
4207
- return !1;
4208
- }
4209
- function c(i, h) {
4210
- if (i && i.length > 0 && h.processEntities)
4211
- for (let o = 0; o < h.entities.length; o++) {
4212
- const s = h.entities[o];
4213
- i = i.replace(s.regex, s.val);
4214
- }
4215
- return i;
4216
- }
4217
- return Je = e, Je;
4218
- }
4219
- var Ye, Zt;
4220
- function xs() {
4221
- if (Zt) return Ye;
4222
- Zt = 1;
4223
- const r = Ns(), e = vr(), t = {
4224
- attributeNamePrefix: "@_",
4225
- attributesGroupName: !1,
4226
- textNodeName: "#text",
4227
- ignoreAttributes: !0,
4228
- cdataPropName: !1,
4229
- format: !1,
4230
- indentBy: " ",
4231
- suppressEmptyNode: !1,
4232
- suppressUnpairedNode: !0,
4233
- suppressBooleanAttributes: !0,
4234
- tagValueProcessor: function(i, h) {
4235
- return h;
4236
- },
4237
- attributeValueProcessor: function(i, h) {
4238
- return h;
4239
- },
4240
- preserveOrder: !1,
4241
- commentPropName: !1,
4242
- unpairedTags: [],
4243
- entities: [
4244
- { regex: new RegExp("&", "g"), val: "&amp;" },
4245
- //it must be on top
4246
- { regex: new RegExp(">", "g"), val: "&gt;" },
4247
- { regex: new RegExp("<", "g"), val: "&lt;" },
4248
- { regex: new RegExp("'", "g"), val: "&apos;" },
4249
- { regex: new RegExp('"', "g"), val: "&quot;" }
4250
- ],
4251
- processEntities: !0,
4252
- stopNodes: [],
4253
- // transformTagName: false,
4254
- // transformAttributeName: false,
4255
- oneListGroup: !1
4256
- };
4257
- function n(i) {
4258
- this.options = Object.assign({}, t, i), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
4259
- return !1;
4260
- } : (this.ignoreAttributesFn = e(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = c), this.processTextOrObjNode = a, this.options.format ? (this.indentate = u, this.tagEndChar = `>
4261
- `, this.newLine = `
4262
- `) : (this.indentate = function() {
4263
- return "";
4264
- }, this.tagEndChar = ">", this.newLine = "");
4265
- }
4266
- n.prototype.build = function(i) {
4267
- return this.options.preserveOrder ? r(i, this.options) : (Array.isArray(i) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (i = {
4268
- [this.options.arrayNodeName]: i
4269
- }), this.j2x(i, 0, []).val);
4270
- }, n.prototype.j2x = function(i, h, o) {
4271
- let s = "", f = "";
4272
- const l = o.join(".");
4273
- for (let g in i)
4274
- if (Object.prototype.hasOwnProperty.call(i, g))
4275
- if (typeof i[g] > "u")
4276
- this.isAttribute(g) && (f += "");
4277
- else if (i[g] === null)
4278
- this.isAttribute(g) || g === this.options.cdataPropName ? f += "" : g[0] === "?" ? f += this.indentate(h) + "<" + g + "?" + this.tagEndChar : f += this.indentate(h) + "<" + g + "/" + this.tagEndChar;
4279
- else if (i[g] instanceof Date)
4280
- f += this.buildTextValNode(i[g], g, "", h);
4281
- else if (typeof i[g] != "object") {
4282
- const d = this.isAttribute(g);
4283
- if (d && !this.ignoreAttributesFn(d, l))
4284
- s += this.buildAttrPairStr(d, "" + i[g]);
4285
- else if (!d)
4286
- if (g === this.options.textNodeName) {
4287
- let m = this.options.tagValueProcessor(g, "" + i[g]);
4288
- f += this.replaceEntitiesValue(m);
4289
- } else
4290
- f += this.buildTextValNode(i[g], g, "", h);
4291
- } else if (Array.isArray(i[g])) {
4292
- const d = i[g].length;
4293
- let m = "", w = "";
4294
- for (let v = 0; v < d; v++) {
4295
- const p = i[g][v];
4296
- if (!(typeof p > "u")) if (p === null)
4297
- g[0] === "?" ? f += this.indentate(h) + "<" + g + "?" + this.tagEndChar : f += this.indentate(h) + "<" + g + "/" + this.tagEndChar;
4298
- else if (typeof p == "object")
4299
- if (this.options.oneListGroup) {
4300
- const y = this.j2x(p, h + 1, o.concat(g));
4301
- m += y.val, this.options.attributesGroupName && p.hasOwnProperty(this.options.attributesGroupName) && (w += y.attrStr);
4302
- } else
4303
- m += this.processTextOrObjNode(p, g, h, o);
4304
- else if (this.options.oneListGroup) {
4305
- let y = this.options.tagValueProcessor(g, p);
4306
- y = this.replaceEntitiesValue(y), m += y;
4307
- } else
4308
- m += this.buildTextValNode(p, g, "", h);
4309
- }
4310
- this.options.oneListGroup && (m = this.buildObjectNode(m, g, w, h)), f += m;
4311
- } else if (this.options.attributesGroupName && g === this.options.attributesGroupName) {
4312
- const d = Object.keys(i[g]), m = d.length;
4313
- for (let w = 0; w < m; w++)
4314
- s += this.buildAttrPairStr(d[w], "" + i[g][d[w]]);
4315
- } else
4316
- f += this.processTextOrObjNode(i[g], g, h, o);
4317
- return { attrStr: s, val: f };
4318
- }, n.prototype.buildAttrPairStr = function(i, h) {
4319
- return h = this.options.attributeValueProcessor(i, "" + h), h = this.replaceEntitiesValue(h), this.options.suppressBooleanAttributes && h === "true" ? " " + i : " " + i + '="' + h + '"';
4320
- };
4321
- function a(i, h, o, s) {
4322
- const f = this.j2x(i, o + 1, s.concat(h));
4323
- return i[this.options.textNodeName] !== void 0 && Object.keys(i).length === 1 ? this.buildTextValNode(i[this.options.textNodeName], h, f.attrStr, o) : this.buildObjectNode(f.val, h, f.attrStr, o);
4324
- }
4325
- n.prototype.buildObjectNode = function(i, h, o, s) {
4326
- if (i === "")
4327
- return h[0] === "?" ? this.indentate(s) + "<" + h + o + "?" + this.tagEndChar : this.indentate(s) + "<" + h + o + this.closeTag(h) + this.tagEndChar;
4328
- {
4329
- let f = "</" + h + this.tagEndChar, l = "";
4330
- return h[0] === "?" && (l = "?", f = ""), (o || o === "") && i.indexOf("<") === -1 ? this.indentate(s) + "<" + h + o + l + ">" + i + f : this.options.commentPropName !== !1 && h === this.options.commentPropName && l.length === 0 ? this.indentate(s) + `<!--${i}-->` + this.newLine : this.indentate(s) + "<" + h + o + l + this.tagEndChar + i + this.indentate(s) + f;
4331
- }
4332
- }, n.prototype.closeTag = function(i) {
4333
- let h = "";
4334
- return this.options.unpairedTags.indexOf(i) !== -1 ? this.options.suppressUnpairedNode || (h = "/") : this.options.suppressEmptyNode ? h = "/" : h = `></${i}`, h;
4335
- }, n.prototype.buildTextValNode = function(i, h, o, s) {
4336
- if (this.options.cdataPropName !== !1 && h === this.options.cdataPropName)
4337
- return this.indentate(s) + `<![CDATA[${i}]]>` + this.newLine;
4338
- if (this.options.commentPropName !== !1 && h === this.options.commentPropName)
4339
- return this.indentate(s) + `<!--${i}-->` + this.newLine;
4340
- if (h[0] === "?")
4341
- return this.indentate(s) + "<" + h + o + "?" + this.tagEndChar;
4342
- {
4343
- let f = this.options.tagValueProcessor(h, i);
4344
- return f = this.replaceEntitiesValue(f), f === "" ? this.indentate(s) + "<" + h + o + this.closeTag(h) + this.tagEndChar : this.indentate(s) + "<" + h + o + ">" + f + "</" + h + this.tagEndChar;
4345
- }
4346
- }, n.prototype.replaceEntitiesValue = function(i) {
4347
- if (i && i.length > 0 && this.options.processEntities)
4348
- for (let h = 0; h < this.options.entities.length; h++) {
4349
- const o = this.options.entities[h];
4350
- i = i.replace(o.regex, o.val);
4351
- }
4352
- return i;
4353
- };
4354
- function u(i) {
4355
- return this.options.indentBy.repeat(i);
4356
- }
4357
- function c(i) {
4358
- return i.startsWith(this.options.attributeNamePrefix) && i !== this.options.textNodeName ? i.substr(this.attrPrefixLen) : !1;
4359
- }
4360
- return Ye = n, Ye;
4361
- }
4362
- var Ke, Jt;
4363
- function Ps() {
4364
- if (Jt) return Ke;
4365
- Jt = 1;
4366
- const r = yr(), e = ws(), t = xs();
4367
- return Ke = {
4368
- XMLParser: e,
4369
- XMLValidator: r,
4370
- XMLBuilder: t
4371
- }, Ke;
4372
- }
4373
- var pt = Ps();
4374
- const nt = (r, e) => Object.fromEntries(
4375
- Object.entries(r).map(([t, n]) => e.includes(t) ? [t, n || ""] : [me.DavNamespace.includes(t) ? `d:${t}` : `oc:${t}`, n || ""])
4376
- ), Yt = (r = [], {
4377
- pattern: e,
4378
- filterRules: t,
4379
- limit: n = 0,
4380
- extraProps: a = []
4381
- }) => {
4382
- let u = "d:propfind";
4383
- e && (u = "oc:search-files"), t && (u = "oc:filter-files");
4384
- const c = r.reduce((s, f) => Object.assign(s, { [f]: null }), {}), i = nt(c, a), h = {
4385
- [u]: {
4386
- "d:prop": i,
4387
- "@@xmlns:d": "DAV:",
4388
- "@@xmlns:oc": "http://owncloud.org/ns",
4389
- ...e && {
4390
- "oc:search": { "oc:pattern": e, "oc:limit": n }
4391
- },
4392
- ...t && {
4393
- "oc:filter-rules": nt(t, [])
4394
- }
4395
- }
4396
- };
4397
- return new pt.XMLBuilder({
4398
- format: !0,
4399
- ignoreAttributes: !1,
4400
- attributeNamePrefix: "@@",
4401
- suppressEmptyNode: !0
4402
- }).build(h);
4403
- }, Es = (r) => {
4404
- const e = {
4405
- "d:propertyupdate": {
4406
- "d:set": { "d:prop": nt(r, []) },
4407
- "@@xmlns:d": "DAV:",
4408
- "@@xmlns:oc": "http://owncloud.org/ns"
4409
- }
4410
- };
4411
- return new pt.XMLBuilder({
4412
- format: !0,
4413
- ignoreAttributes: !1,
4414
- attributeNamePrefix: "@@",
4415
- suppressEmptyNode: !0
4416
- }).build(e);
4417
- }, As = (r) => {
4418
- const e = {}, t = r.get("tus-version");
4419
- return t ? (e.version = t.split(","), r.get("tus-extension") && (e.extension = r.get("tus-extension").split(",")), r.get("tus-resumable") && (e.resumable = r.get("tus-resumable")), r.get("tus-max-size") && (e.maxSize = parseInt(r.get("tus-max-size"), 10)), e) : null;
4420
- }, Ts = async (r) => {
4421
- const e = (n) => {
4422
- const a = decodeURIComponent(n);
4423
- return n?.startsWith("/remote.php/dav/") ? M(a.replace("/remote.php/dav/", ""), {
4424
- leadingSlash: !0,
4425
- trailingSlash: !1
4426
- }) : a;
4427
- };
4428
- return (await os(r)).multistatus.response.map(({ href: n, propstat: a }) => {
4429
- const u = {
4430
- ...as(a.prop, e(n), !0),
4431
- processing: a.status === "HTTP/1.1 425 TOO EARLY"
4432
- };
4433
- return u.props.name && (u.props.name = u.props.name.toString()), u;
4434
- });
4435
- }, Os = (r) => {
4436
- const e = new pt.XMLParser(), t = {
4437
- message: "Unknown error",
4438
- errorCode: void 0
4439
- };
4440
- try {
4441
- const n = e.parse(r);
4442
- if (!n["d:error"])
4443
- return t;
4444
- if (n["d:error"]["s:message"]) {
4445
- const a = n["d:error"]["s:message"];
4446
- typeof a == "string" && (t.message = a);
4447
- }
4448
- if (n["d:error"]["s:errorcode"]) {
4449
- const a = n["d:error"]["s:errorcode"];
4450
- typeof a == "string" && (t.errorCode = a);
4451
- }
4452
- } catch {
4453
- return t;
4454
- }
4455
- return t;
4456
- };
4457
- class Cs {
4458
- client;
4459
- davPath;
4460
- headers;
4461
- extraProps;
4462
- constructor({ baseUrl: e, headers: t }) {
4463
- this.davPath = M(e, "remote.php/dav"), this.client = is(this.davPath, {}), this.headers = t, this.extraProps = [];
4464
- }
4465
- mkcol(e, t = {}) {
4466
- return this.request(e, { method: se.mkcol, ...t });
4467
- }
4468
- async propfind(e, {
4469
- depth: t = 1,
4470
- properties: n = [],
4471
- headers: a = {},
4472
- ...u
4473
- } = {}) {
4474
- const c = { ...a, Depth: t.toString() }, { body: i, result: h } = await this.request(e, {
4475
- method: se.propfind,
4476
- data: Yt(n, { extraProps: this.extraProps }),
4477
- headers: c,
4478
- ...u
4479
- });
4480
- return i?.length && (i[0].tusSupport = As(h.headers)), i;
4481
- }
4482
- async report(e, {
4483
- pattern: t = "",
4484
- filterRules: n = null,
4485
- limit: a = 30,
4486
- properties: u,
4487
- ...c
4488
- } = {}) {
4489
- const { body: i, result: h } = await this.request(e, {
4490
- method: se.report,
4491
- data: Yt(u, {
4492
- pattern: t,
4493
- filterRules: n,
4494
- limit: a,
4495
- extraProps: this.extraProps
4496
- }),
4497
- ...c
4498
- });
4499
- return {
4500
- results: i,
4501
- range: h.headers.get("content-range")
4502
- };
4503
- }
4504
- copy(e, t, { overwrite: n = !1, headers: a = {}, ...u } = {}) {
4505
- const c = M(this.davPath, we(t));
4506
- return this.request(e, {
4507
- method: se.copy,
4508
- headers: { ...a, Destination: c, overwrite: n ? "T" : "F" },
4509
- ...u
4510
- });
4511
- }
4512
- move(e, t, { overwrite: n = !1, headers: a = {}, ...u } = {}) {
4513
- const c = M(this.davPath, we(t));
4514
- return this.request(e, {
4515
- method: se.move,
4516
- headers: { ...a, Destination: c, overwrite: n ? "T" : "F" },
4517
- ...u
4518
- });
4519
- }
4520
- put(e, t, {
4521
- headers: n = {},
4522
- onUploadProgress: a,
4523
- previousEntityTag: u,
4524
- overwrite: c,
4525
- ...i
4526
- } = {}) {
4527
- const h = { ...n };
4528
- return u ? h["If-Match"] = u : c || (h["If-None-Match"] = "*"), this.request(e, {
4529
- method: se.put,
4530
- data: t,
4531
- headers: h,
4532
- onUploadProgress: a,
4533
- ...i
4534
- });
4535
- }
4536
- delete(e, t = {}) {
4537
- return this.request(e, { method: se.delete, ...t });
4538
- }
4539
- propPatch(e, t, n = {}) {
4540
- const a = Es(t);
4541
- return this.request(e, { method: se.proppatch, data: a, ...n });
4542
- }
4543
- getFileUrl(e) {
4544
- return M(this.davPath, we(e));
4545
- }
4546
- buildHeaders(e = {}) {
4547
- return {
4548
- "Content-Type": "application/xml; charset=utf-8",
4549
- "X-Requested-With": "XMLHttpRequest",
4550
- "X-Request-ID": ps(),
4551
- ...this.headers && { ...this.headers() },
4552
- ...e
4553
- };
4554
- }
4555
- async request(e, t) {
4556
- const n = M(this.davPath, we(e), { leadingSlash: !0 }), a = {
4557
- ...t,
4558
- url: n,
4559
- headers: this.buildHeaders(t.headers || {})
4560
- };
4561
- try {
4562
- const u = await this.client.customRequest("", a);
4563
- let c;
4564
- if (u.status === 207) {
4565
- const i = await u.text();
4566
- c = await Ts(i);
4567
- }
4568
- return {
4569
- body: c,
4570
- status: u.status,
4571
- result: u
4572
- };
4573
- } catch (u) {
4574
- const { response: c } = u, i = await c.text(), h = Os(i);
4575
- throw new Ar(
4576
- h.message,
4577
- h.errorCode,
4578
- c,
4579
- c.status
4580
- );
4581
- }
4582
- }
4583
- }
4584
- const Is = (r, e) => ({
4585
- async listFileVersions(t, n = {}) {
4586
- const [a, ...u] = await r.propfind(
4587
- M("meta", t, "v", { leadingSlash: !0 }),
4588
- n
4589
- );
4590
- return u.map((c) => ue(c, r.extraProps));
4591
- }
4592
- }), Ss = (r, e) => ({
4593
- setFavorite(t, { path: n }, a, u = {}) {
4594
- const c = { [he.IsFavorite]: a ? "true" : "false" };
4595
- return r.propPatch(M(t.webDavPath, n), c, u);
4596
- }
4597
- }), Fs = (r, e) => ({
4598
- listFavoriteFiles({
4599
- davProperties: t = me.Default,
4600
- username: n = "",
4601
- ...a
4602
- } = {}) {
4603
- return r.report(M("files", n), {
4604
- properties: t,
4605
- filterRules: { favorite: 1 },
4606
- ...a
4607
- });
4608
- }
4609
- }), Us = (r, e) => {
4610
- const t = Nr.create();
4611
- e && t.interceptors.request.use((P) => (Object.assign(P.headers, e()), P));
4612
- const n = { axiosClient: t, baseUrl: r }, a = new Cs({ baseUrl: r, headers: e }), u = (P) => {
4613
- a.extraProps.push(P);
4614
- }, c = Vr(a), { getPathForFileId: i } = c, h = jr(a, c), { listFiles: o } = h, s = Ir(h), { getFileInfo: f } = s, { createFolder: l } = Or(a, s), g = Cr(a, n), { getFileContents: d } = g, { putFileContents: m } = Rr(a, s), { getFileUrl: w, revokeUrl: v } = Sr(
4615
- a,
4616
- g,
4617
- s,
4618
- n
4619
- ), { getPublicFileUrl: p } = Fr(a), { copyFiles: y } = Tr(a), { moveFiles: A } = $r(a), { deleteFile: N } = Lr(a), { restoreFile: b } = kr(a), { listFileVersions: E } = Is(a), { restoreFileVersion: x } = Ur(a), { clearTrashBin: T } = _r(a), { search: O } = Mr(a), { listFavoriteFiles: I } = Fs(a), { setFavorite: C } = Ss(a);
4620
- return {
4621
- copyFiles: y,
4622
- createFolder: l,
4623
- deleteFile: N,
4624
- restoreFile: b,
4625
- restoreFileVersion: x,
4626
- getFileContents: d,
4627
- getFileInfo: f,
4628
- getFileUrl: w,
4629
- getPublicFileUrl: p,
4630
- getPathForFileId: i,
4631
- listFiles: o,
4632
- listFileVersions: E,
4633
- moveFiles: A,
4634
- putFileContents: m,
4635
- revokeUrl: v,
4636
- clearTrashBin: T,
4637
- search: O,
4638
- listFavoriteFiles: I,
4639
- setFavorite: C,
4640
- registerExtraProp: u
4641
- };
4642
- };
4643
- export {
4644
- Ar as D,
4645
- Qt as H,
4646
- we as e,
4647
- Us as w
4648
- };