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