@haus-storefront-react/vendure-plugin-configs 1.0.4-next.7 → 1.0.4-next.9

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +824 -793
  2. package/badge.js +1 -1
  3. package/badge.mjs +439 -424
  4. package/campaign.js +1 -1
  5. package/campaign.mjs +50 -106
  6. package/elastic.js +1 -1
  7. package/elastic.mjs +10 -26
  8. package/index.js +1 -1
  9. package/index.mjs +2 -4
  10. package/lib/configs/vendure-badge-plugin.d.ts +2 -2
  11. package/lib/configs/vendure-related-products-plugin.d.ts +39 -0
  12. package/lib/configs/vendure-related-products-plugin.types.d.ts +16 -0
  13. package/lib/exports/related-products.d.ts +3 -0
  14. package/lib/hooks/use-related-products.d.ts +2 -0
  15. package/package.json +13 -7
  16. package/packagesize.js +1 -1
  17. package/packagesize.mjs +15 -59
  18. package/plugin-config-DrQQb9Ry.js +1 -0
  19. package/plugin-config-DywohMgp.mjs +903 -0
  20. package/product-popularity.js +1 -1
  21. package/product-popularity.mjs +12 -22
  22. package/product-variant-specifications.js +1 -1
  23. package/product-variant-specifications.mjs +8 -18
  24. package/products-by-sku.d.ts +2 -0
  25. package/products-by-sku.js +1 -0
  26. package/products-by-sku.mjs +54 -0
  27. package/purchase-order-payment.js +5 -5
  28. package/purchase-order-payment.mjs +207 -631
  29. package/related-products.d.ts +2 -0
  30. package/related-products.js +1 -0
  31. package/related-products.mjs +36 -0
  32. package/src-BCHcjT-q.mjs +455 -0
  33. package/src-BqcrcEUL.mjs +2718 -0
  34. package/src-Cj3iGasO.js +6 -0
  35. package/src-CvZOxNaX.js +21 -0
  36. package/compiler-runtime-oPPev21o.js +0 -10
  37. package/compiler-runtime-qHgugrLy.mjs +0 -296
  38. package/index-BRlTlK6a.mjs +0 -3768
  39. package/index-BgBC_k8M.js +0 -1
  40. package/index-C0E-40z0.mjs +0 -19
  41. package/index-CgxqXyHf.js +0 -20
  42. package/useSdk-DOrZRSHz.mjs +0 -2634
  43. package/useSdk-YXpk8Wsi.js +0 -21
@@ -1,2634 +0,0 @@
1
- import { l as tr } from "./index-BRlTlK6a.mjs";
2
- import "./compiler-runtime-qHgugrLy.mjs";
3
- import { createContext as rr, useContext as nr } from "react";
4
- import { QueryClient as Le } from "@tanstack/react-query";
5
- const or = "debug", C = () => {
6
- try {
7
- if (typeof window > "u" || typeof localStorage > "u")
8
- return !1;
9
- const e = localStorage.getItem(or);
10
- return e === "true" || e === "1";
11
- } catch {
12
- return !1;
13
- }
14
- }, sr = () => {
15
- const e = (t, r, n = []) => r ? typeof t == "string" ? [`<${r}> ${t}`, ...n] : [`<${r}>`, t, ...n] : Array.isArray(t) ? [...t, ...n] : [t, ...n];
16
- return {
17
- log: (t, r, ...n) => {
18
- C() && console.log(...e(t, r, n));
19
- },
20
- info: (t, r, ...n) => {
21
- C() && console.info(...e(t, r, n));
22
- },
23
- warn: (t, r, ...n) => {
24
- C() && console.warn(...e(t, r, n));
25
- },
26
- error: (t, r, ...n) => {
27
- C() && console.error(...e(t, r, n));
28
- },
29
- debug: (t, r, ...n) => {
30
- C() && console.debug(...e(t, r, n));
31
- },
32
- group: (t, r) => {
33
- if (C()) {
34
- const n = typeof t == "string" ? t : void 0;
35
- console.group(r ? n ? `<${r}> ${n}` : `<${r}>` : n);
36
- }
37
- },
38
- groupCollapsed: (t, r) => {
39
- if (C()) {
40
- const n = typeof t == "string" ? t : void 0;
41
- console.groupCollapsed(r ? n ? `<${r}> ${n}` : `<${r}>` : n);
42
- }
43
- },
44
- groupEnd: () => {
45
- C() && console.groupEnd();
46
- },
47
- table: (t, r, n) => {
48
- C() && (r && console.log(`<${r}>`), console.table(t, n));
49
- },
50
- time: (t, r) => {
51
- if (C()) {
52
- const n = typeof t == "string" ? t : void 0;
53
- console.time(r ? n ? `<${r}> ${n}` : `<${r}>` : n);
54
- }
55
- },
56
- timeEnd: (t, r) => {
57
- if (C()) {
58
- const n = typeof t == "string" ? t : void 0;
59
- console.timeEnd(r ? n ? `<${r}> ${n}` : `<${r}>` : n);
60
- }
61
- }
62
- };
63
- }, ir = sr();
64
- function ar(e) {
65
- return { all: e = e || /* @__PURE__ */ new Map(), on: function(t, r) {
66
- var n = e.get(t);
67
- n ? n.push(r) : e.set(t, [r]);
68
- }, off: function(t, r) {
69
- var n = e.get(t);
70
- n && (r ? n.splice(n.indexOf(r) >>> 0, 1) : e.set(t, []));
71
- }, emit: function(t, r) {
72
- var n = e.get(t);
73
- n && n.slice().map(function(o) {
74
- o(r);
75
- }), (n = e.get("*")) && n.slice().map(function(o) {
76
- o(t, r);
77
- });
78
- } };
79
- }
80
- let J;
81
- try {
82
- J = require("@react-native-async-storage/async-storage").default;
83
- } catch {
84
- J = null;
85
- }
86
- let je = null;
87
- try {
88
- const {
89
- AsyncLocalStorage: e
90
- } = require("node:async_hooks");
91
- je = new e();
92
- } catch {
93
- je = null;
94
- }
95
- const V = typeof window < "u" && typeof window.localStorage < "u", Q = !!J, fe = {}, Ce = {
96
- getItem: async () => null,
97
- setItem: async () => {
98
- },
99
- removeItem: async () => {
100
- }
101
- }, qe = () => {
102
- try {
103
- return je?.getStore?.() ?? null;
104
- } catch {
105
- return null;
106
- }
107
- }, Ne = {
108
- getItem: async (e) => {
109
- const t = !V && !Q ? qe() : null;
110
- return t ? t.getItem(e) : Q ? J.getItem(e) : V ? new Promise((r) => {
111
- Promise.resolve().then(() => {
112
- const n = window.localStorage.getItem(e), o = fe[e];
113
- n !== o && (fe[e] = n || ""), r(n);
114
- });
115
- }) : Ce.getItem(e);
116
- },
117
- setItem: async (e, t) => {
118
- const r = !V && !Q ? qe() : null;
119
- return r ? r.setItem(e, t) : Q ? J.setItem(e, t) : V ? new Promise((n, o) => {
120
- Promise.resolve().then(() => {
121
- try {
122
- window.localStorage.setItem(e, t);
123
- const s = window.localStorage.getItem(e);
124
- s === t ? (fe[e] = t, n()) : o(new Error(`Failed to set localStorage item: expected "${t}", got "${s}"`));
125
- } catch (s) {
126
- o(s);
127
- }
128
- });
129
- }) : Ce.setItem(e, t);
130
- },
131
- removeItem: async (e) => {
132
- const t = !V && !Q ? qe() : null;
133
- return t ? t.removeItem(e) : Q ? J.removeItem(e) : V ? new Promise((r, n) => {
134
- Promise.resolve().then(() => {
135
- try {
136
- window.localStorage.removeItem(e);
137
- const o = window.localStorage.getItem(e);
138
- o === null ? (delete fe[e], r()) : n(new Error(`Failed to remove localStorage item: key "${e}" still exists with value "${o}"`));
139
- } catch (o) {
140
- n(o);
141
- }
142
- });
143
- }) : Ce.removeItem(e);
144
- }
145
- }, Ye = 50, M = {
146
- get: async () => {
147
- try {
148
- const e = await Ne.getItem("eventHistory");
149
- return e ? JSON.parse(e) : [];
150
- } catch (e) {
151
- return console.error("Error getting event history", e), [];
152
- }
153
- },
154
- set: async (e) => {
155
- try {
156
- await Ne.setItem("eventHistory", JSON.stringify(e.slice(-Ye)));
157
- } catch (t) {
158
- console.error("Error setting event history", t);
159
- }
160
- },
161
- clear: async () => {
162
- try {
163
- await Ne.removeItem("eventHistory");
164
- } catch (e) {
165
- console.error("Error clearing event history", e);
166
- }
167
- },
168
- push: async (e) => {
169
- const t = await M.get();
170
- await M.set([{
171
- ...e,
172
- timestamp: Date.now()
173
- }, ...t].slice(-Ye));
174
- },
175
- find: async (e) => (await M.get()).find((r) => r.key === e.key && r.identifier === e.identifier),
176
- filter: async (e, t) => {
177
- const r = await M.get();
178
- return t ? r.filter(t) : r.filter(({
179
- key: n,
180
- identifier: o
181
- }) => (!n || e.key === n) && (!o || e.identifier === o));
182
- }
183
- };
184
- function cr() {
185
- const e = globalThis;
186
- return e.__HAUS_EVENT_EMITTER__ ||= ar(), e.__HAUS_EVENT_EMITTER__;
187
- }
188
- function $(e) {
189
- const t = cr(), r = ((...c) => console.error(...c));
190
- M.get().then((c) => {
191
- const f = tr.first(c)?.timestamp;
192
- f && f < Date.now() - 1e3 * 60 * 60 && (ir.info("Clearing event history since it is older than 1 hour:", "eventBus", f), M.clear());
193
- });
194
- const n = (c, l, f) => {
195
- const p = (m) => {
196
- try {
197
- if (typeof m == "object" && m !== null) {
198
- const {
199
- identifier: b,
200
- data: d
201
- } = m;
202
- (!b || b === f) && l(d);
203
- } else
204
- l(m);
205
- } catch (b) {
206
- r(b);
207
- }
208
- };
209
- return t.on(c, p), () => {
210
- o(c, l, f);
211
- };
212
- }, o = (c, l, f) => {
213
- const p = (m) => {
214
- if (typeof m == "object" && m !== null) {
215
- const {
216
- identifier: b
217
- } = m;
218
- (!b || b === f) && t.off(c, l);
219
- }
220
- };
221
- t.off(c, p);
222
- };
223
- return {
224
- on: n,
225
- off: o,
226
- once: (c, l, f) => {
227
- const p = (m) => {
228
- try {
229
- if (typeof m == "object" && m !== null) {
230
- const {
231
- identifier: b,
232
- data: d
233
- } = m;
234
- (!b || b === f) && l(d);
235
- } else
236
- l(m);
237
- } finally {
238
- o(c, p, f);
239
- }
240
- };
241
- t.on(c, p);
242
- },
243
- emit: (c, l, ...f) => {
244
- const p = {
245
- identifier: l,
246
- data: f.length === 1 ? f[0] : f
247
- };
248
- M.push({
249
- key: c,
250
- identifier: l,
251
- payload: p.data
252
- }), t.emit(c, p);
253
- },
254
- getEventHistory: (c, l) => M.filter({
255
- key: c,
256
- identifier: l
257
- })
258
- };
259
- }
260
- $();
261
- $();
262
- $();
263
- $();
264
- $();
265
- $();
266
- $();
267
- const ur = globalThis.__STORE_SDK_CONTEXT__ ||= rr(void 0);
268
- function _t(e, t) {
269
- return function() {
270
- return e.apply(t, arguments);
271
- };
272
- }
273
- const { toString: lr } = Object.prototype, { getPrototypeOf: ke } = Object, { iterator: Ee, toStringTag: xt } = Symbol, Oe = /* @__PURE__ */ ((e) => (t) => {
274
- const r = lr.call(t);
275
- return e[r] || (e[r] = r.slice(8, -1).toLowerCase());
276
- })(/* @__PURE__ */ Object.create(null)), N = (e) => (e = e.toLowerCase(), (t) => Oe(t) === e), Te = (e) => (t) => typeof t === e, { isArray: X } = Array, G = Te("undefined");
277
- function re(e) {
278
- return e !== null && !G(e) && e.constructor !== null && !G(e.constructor) && T(e.constructor.isBuffer) && e.constructor.isBuffer(e);
279
- }
280
- const Ct = N("ArrayBuffer");
281
- function fr(e) {
282
- let t;
283
- return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ct(e.buffer), t;
284
- }
285
- const dr = Te("string"), T = Te("function"), qt = Te("number"), ne = (e) => e !== null && typeof e == "object", pr = (e) => e === !0 || e === !1, be = (e) => {
286
- if (Oe(e) !== "object")
287
- return !1;
288
- const t = ke(e);
289
- return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(xt in e) && !(Ee in e);
290
- }, hr = (e) => {
291
- if (!ne(e) || re(e))
292
- return !1;
293
- try {
294
- return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
295
- } catch {
296
- return !1;
297
- }
298
- }, yr = N("Date"), mr = N("File"), gr = N("Blob"), br = N("FileList"), wr = (e) => ne(e) && T(e.pipe), Ar = (e) => {
299
- let t;
300
- return e && (typeof FormData == "function" && e instanceof FormData || T(e.append) && ((t = Oe(e)) === "formdata" || // detect form-data instance
301
- t === "object" && T(e.toString) && e.toString() === "[object FormData]"));
302
- }, Sr = N("URLSearchParams"), [Er, Or, Tr, vr] = ["ReadableStream", "Request", "Response", "Headers"].map(N), Rr = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
303
- function oe(e, t, { allOwnKeys: r = !1 } = {}) {
304
- if (e === null || typeof e > "u")
305
- return;
306
- let n, o;
307
- if (typeof e != "object" && (e = [e]), X(e))
308
- for (n = 0, o = e.length; n < o; n++)
309
- t.call(null, e[n], n, e);
310
- else {
311
- if (re(e))
312
- return;
313
- const s = r ? Object.getOwnPropertyNames(e) : Object.keys(e), i = s.length;
314
- let a;
315
- for (n = 0; n < i; n++)
316
- a = s[n], t.call(null, e[a], a, e);
317
- }
318
- }
319
- function Nt(e, t) {
320
- if (re(e))
321
- return null;
322
- t = t.toLowerCase();
323
- const r = Object.keys(e);
324
- let n = r.length, o;
325
- for (; n-- > 0; )
326
- if (o = r[n], t === o.toLowerCase())
327
- return o;
328
- return null;
329
- }
330
- const I = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Dt = (e) => !G(e) && e !== I;
331
- function Me() {
332
- const { caseless: e, skipUndefined: t } = Dt(this) && this || {}, r = {}, n = (o, s) => {
333
- const i = e && Nt(r, s) || s;
334
- be(r[i]) && be(o) ? r[i] = Me(r[i], o) : be(o) ? r[i] = Me({}, o) : X(o) ? r[i] = o.slice() : (!t || !G(o)) && (r[i] = o);
335
- };
336
- for (let o = 0, s = arguments.length; o < s; o++)
337
- arguments[o] && oe(arguments[o], n);
338
- return r;
339
- }
340
- const _r = (e, t, r, { allOwnKeys: n } = {}) => (oe(t, (o, s) => {
341
- r && T(o) ? e[s] = _t(o, r) : e[s] = o;
342
- }, { allOwnKeys: n }), e), xr = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Cr = (e, t, r, n) => {
343
- e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", {
344
- value: t.prototype
345
- }), r && Object.assign(e.prototype, r);
346
- }, qr = (e, t, r, n) => {
347
- let o, s, i;
348
- const a = {};
349
- if (t = t || {}, e == null) return t;
350
- do {
351
- for (o = Object.getOwnPropertyNames(e), s = o.length; s-- > 0; )
352
- i = o[s], (!n || n(i, e, t)) && !a[i] && (t[i] = e[i], a[i] = !0);
353
- e = r !== !1 && ke(e);
354
- } while (e && (!r || r(e, t)) && e !== Object.prototype);
355
- return t;
356
- }, Nr = (e, t, r) => {
357
- e = String(e), (r === void 0 || r > e.length) && (r = e.length), r -= t.length;
358
- const n = e.indexOf(t, r);
359
- return n !== -1 && n === r;
360
- }, Dr = (e) => {
361
- if (!e) return null;
362
- if (X(e)) return e;
363
- let t = e.length;
364
- if (!qt(t)) return null;
365
- const r = new Array(t);
366
- for (; t-- > 0; )
367
- r[t] = e[t];
368
- return r;
369
- }, Pr = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ke(Uint8Array)), Fr = (e, t) => {
370
- const n = (e && e[Ee]).call(e);
371
- let o;
372
- for (; (o = n.next()) && !o.done; ) {
373
- const s = o.value;
374
- t.call(e, s[0], s[1]);
375
- }
376
- }, jr = (e, t) => {
377
- let r;
378
- const n = [];
379
- for (; (r = e.exec(t)) !== null; )
380
- n.push(r);
381
- return n;
382
- }, Mr = N("HTMLFormElement"), Ur = (e) => e.toLowerCase().replace(
383
- /[-_\s]([a-z\d])(\w*)/g,
384
- function(r, n, o) {
385
- return n.toUpperCase() + o;
386
- }
387
- ), Ze = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), Br = N("RegExp"), Pt = (e, t) => {
388
- const r = Object.getOwnPropertyDescriptors(e), n = {};
389
- oe(r, (o, s) => {
390
- let i;
391
- (i = t(o, s, e)) !== !1 && (n[s] = i || o);
392
- }), Object.defineProperties(e, n);
393
- }, Ir = (e) => {
394
- Pt(e, (t, r) => {
395
- if (T(e) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
396
- return !1;
397
- const n = e[r];
398
- if (T(n)) {
399
- if (t.enumerable = !1, "writable" in t) {
400
- t.writable = !1;
401
- return;
402
- }
403
- t.set || (t.set = () => {
404
- throw Error("Can not rewrite read-only method '" + r + "'");
405
- });
406
- }
407
- });
408
- }, Lr = (e, t) => {
409
- const r = {}, n = (o) => {
410
- o.forEach((s) => {
411
- r[s] = !0;
412
- });
413
- };
414
- return X(e) ? n(e) : n(String(e).split(t)), r;
415
- }, kr = () => {
416
- }, $r = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
417
- function Hr(e) {
418
- return !!(e && T(e.append) && e[xt] === "FormData" && e[Ee]);
419
- }
420
- const Vr = (e) => {
421
- const t = new Array(10), r = (n, o) => {
422
- if (ne(n)) {
423
- if (t.indexOf(n) >= 0)
424
- return;
425
- if (re(n))
426
- return n;
427
- if (!("toJSON" in n)) {
428
- t[o] = n;
429
- const s = X(n) ? [] : {};
430
- return oe(n, (i, a) => {
431
- const c = r(i, o + 1);
432
- !G(c) && (s[a] = c);
433
- }), t[o] = void 0, s;
434
- }
435
- }
436
- return n;
437
- };
438
- return r(e, 0);
439
- }, Qr = N("AsyncFunction"), Wr = (e) => e && (ne(e) || T(e)) && T(e.then) && T(e.catch), Ft = ((e, t) => e ? setImmediate : t ? ((r, n) => (I.addEventListener("message", ({ source: o, data: s }) => {
440
- o === I && s === r && n.length && n.shift()();
441
- }, !1), (o) => {
442
- n.push(o), I.postMessage(r, "*");
443
- }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
444
- typeof setImmediate == "function",
445
- T(I.postMessage)
446
- ), Kr = typeof queueMicrotask < "u" ? queueMicrotask.bind(I) : typeof process < "u" && process.nextTick || Ft, zr = (e) => e != null && T(e[Ee]), u = {
447
- isArray: X,
448
- isArrayBuffer: Ct,
449
- isBuffer: re,
450
- isFormData: Ar,
451
- isArrayBufferView: fr,
452
- isString: dr,
453
- isNumber: qt,
454
- isBoolean: pr,
455
- isObject: ne,
456
- isPlainObject: be,
457
- isEmptyObject: hr,
458
- isReadableStream: Er,
459
- isRequest: Or,
460
- isResponse: Tr,
461
- isHeaders: vr,
462
- isUndefined: G,
463
- isDate: yr,
464
- isFile: mr,
465
- isBlob: gr,
466
- isRegExp: Br,
467
- isFunction: T,
468
- isStream: wr,
469
- isURLSearchParams: Sr,
470
- isTypedArray: Pr,
471
- isFileList: br,
472
- forEach: oe,
473
- merge: Me,
474
- extend: _r,
475
- trim: Rr,
476
- stripBOM: xr,
477
- inherits: Cr,
478
- toFlatObject: qr,
479
- kindOf: Oe,
480
- kindOfTest: N,
481
- endsWith: Nr,
482
- toArray: Dr,
483
- forEachEntry: Fr,
484
- matchAll: jr,
485
- isHTMLForm: Mr,
486
- hasOwnProperty: Ze,
487
- hasOwnProp: Ze,
488
- // an alias to avoid ESLint no-prototype-builtins detection
489
- reduceDescriptors: Pt,
490
- freezeMethods: Ir,
491
- toObjectSet: Lr,
492
- toCamelCase: Ur,
493
- noop: kr,
494
- toFiniteNumber: $r,
495
- findKey: Nt,
496
- global: I,
497
- isContextDefined: Dt,
498
- isSpecCompliantForm: Hr,
499
- toJSONObject: Vr,
500
- isAsyncFn: Qr,
501
- isThenable: Wr,
502
- setImmediate: Ft,
503
- asap: Kr,
504
- isIterable: zr
505
- };
506
- function g(e, t, r, n, o) {
507
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), r && (this.config = r), n && (this.request = n), o && (this.response = o, this.status = o.status ? o.status : null);
508
- }
509
- u.inherits(g, Error, {
510
- toJSON: function() {
511
- return {
512
- // Standard
513
- message: this.message,
514
- name: this.name,
515
- // Microsoft
516
- description: this.description,
517
- number: this.number,
518
- // Mozilla
519
- fileName: this.fileName,
520
- lineNumber: this.lineNumber,
521
- columnNumber: this.columnNumber,
522
- stack: this.stack,
523
- // Axios
524
- config: u.toJSONObject(this.config),
525
- code: this.code,
526
- status: this.status
527
- };
528
- }
529
- });
530
- const jt = g.prototype, Mt = {};
531
- [
532
- "ERR_BAD_OPTION_VALUE",
533
- "ERR_BAD_OPTION",
534
- "ECONNABORTED",
535
- "ETIMEDOUT",
536
- "ERR_NETWORK",
537
- "ERR_FR_TOO_MANY_REDIRECTS",
538
- "ERR_DEPRECATED",
539
- "ERR_BAD_RESPONSE",
540
- "ERR_BAD_REQUEST",
541
- "ERR_CANCELED",
542
- "ERR_NOT_SUPPORT",
543
- "ERR_INVALID_URL"
544
- // eslint-disable-next-line func-names
545
- ].forEach((e) => {
546
- Mt[e] = { value: e };
547
- });
548
- Object.defineProperties(g, Mt);
549
- Object.defineProperty(jt, "isAxiosError", { value: !0 });
550
- g.from = (e, t, r, n, o, s) => {
551
- const i = Object.create(jt);
552
- u.toFlatObject(e, i, function(f) {
553
- return f !== Error.prototype;
554
- }, (l) => l !== "isAxiosError");
555
- const a = e && e.message ? e.message : "Error", c = t == null && e ? e.code : t;
556
- return g.call(i, a, c, r, n, o), e && i.cause == null && Object.defineProperty(i, "cause", { value: e, configurable: !0 }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
557
- };
558
- const Jr = null;
559
- function Ue(e) {
560
- return u.isPlainObject(e) || u.isArray(e);
561
- }
562
- function Ut(e) {
563
- return u.endsWith(e, "[]") ? e.slice(0, -2) : e;
564
- }
565
- function et(e, t, r) {
566
- return e ? e.concat(t).map(function(o, s) {
567
- return o = Ut(o), !r && s ? "[" + o + "]" : o;
568
- }).join(r ? "." : "") : t;
569
- }
570
- function Gr(e) {
571
- return u.isArray(e) && !e.some(Ue);
572
- }
573
- const Xr = u.toFlatObject(u, {}, null, function(t) {
574
- return /^is[A-Z]/.test(t);
575
- });
576
- function ve(e, t, r) {
577
- if (!u.isObject(e))
578
- throw new TypeError("target must be an object");
579
- t = t || new FormData(), r = u.toFlatObject(r, {
580
- metaTokens: !0,
581
- dots: !1,
582
- indexes: !1
583
- }, !1, function(y, h) {
584
- return !u.isUndefined(h[y]);
585
- });
586
- const n = r.metaTokens, o = r.visitor || f, s = r.dots, i = r.indexes, c = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(t);
587
- if (!u.isFunction(o))
588
- throw new TypeError("visitor must be a function");
589
- function l(d) {
590
- if (d === null) return "";
591
- if (u.isDate(d))
592
- return d.toISOString();
593
- if (u.isBoolean(d))
594
- return d.toString();
595
- if (!c && u.isBlob(d))
596
- throw new g("Blob is not supported. Use a Buffer instead.");
597
- return u.isArrayBuffer(d) || u.isTypedArray(d) ? c && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
598
- }
599
- function f(d, y, h) {
600
- let A = d;
601
- if (d && !h && typeof d == "object") {
602
- if (u.endsWith(y, "{}"))
603
- y = n ? y : y.slice(0, -2), d = JSON.stringify(d);
604
- else if (u.isArray(d) && Gr(d) || (u.isFileList(d) || u.endsWith(y, "[]")) && (A = u.toArray(d)))
605
- return y = Ut(y), A.forEach(function(S, O) {
606
- !(u.isUndefined(S) || S === null) && t.append(
607
- // eslint-disable-next-line no-nested-ternary
608
- i === !0 ? et([y], O, s) : i === null ? y : y + "[]",
609
- l(S)
610
- );
611
- }), !1;
612
- }
613
- return Ue(d) ? !0 : (t.append(et(h, y, s), l(d)), !1);
614
- }
615
- const p = [], m = Object.assign(Xr, {
616
- defaultVisitor: f,
617
- convertValue: l,
618
- isVisitable: Ue
619
- });
620
- function b(d, y) {
621
- if (!u.isUndefined(d)) {
622
- if (p.indexOf(d) !== -1)
623
- throw Error("Circular reference detected in " + y.join("."));
624
- p.push(d), u.forEach(d, function(A, R) {
625
- (!(u.isUndefined(A) || A === null) && o.call(
626
- t,
627
- A,
628
- u.isString(R) ? R.trim() : R,
629
- y,
630
- m
631
- )) === !0 && b(A, y ? y.concat(R) : [R]);
632
- }), p.pop();
633
- }
634
- }
635
- if (!u.isObject(e))
636
- throw new TypeError("data must be an object");
637
- return b(e), t;
638
- }
639
- function tt(e) {
640
- const t = {
641
- "!": "%21",
642
- "'": "%27",
643
- "(": "%28",
644
- ")": "%29",
645
- "~": "%7E",
646
- "%20": "+",
647
- "%00": "\0"
648
- };
649
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(n) {
650
- return t[n];
651
- });
652
- }
653
- function $e(e, t) {
654
- this._pairs = [], e && ve(e, this, t);
655
- }
656
- const Bt = $e.prototype;
657
- Bt.append = function(t, r) {
658
- this._pairs.push([t, r]);
659
- };
660
- Bt.toString = function(t) {
661
- const r = t ? function(n) {
662
- return t.call(this, n, tt);
663
- } : tt;
664
- return this._pairs.map(function(o) {
665
- return r(o[0]) + "=" + r(o[1]);
666
- }, "").join("&");
667
- };
668
- function Yr(e) {
669
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
670
- }
671
- function It(e, t, r) {
672
- if (!t)
673
- return e;
674
- const n = r && r.encode || Yr;
675
- u.isFunction(r) && (r = {
676
- serialize: r
677
- });
678
- const o = r && r.serialize;
679
- let s;
680
- if (o ? s = o(t, r) : s = u.isURLSearchParams(t) ? t.toString() : new $e(t, r).toString(n), s) {
681
- const i = e.indexOf("#");
682
- i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
683
- }
684
- return e;
685
- }
686
- class rt {
687
- constructor() {
688
- this.handlers = [];
689
- }
690
- /**
691
- * Add a new interceptor to the stack
692
- *
693
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
694
- * @param {Function} rejected The function to handle `reject` for a `Promise`
695
- *
696
- * @return {Number} An ID used to remove interceptor later
697
- */
698
- use(t, r, n) {
699
- return this.handlers.push({
700
- fulfilled: t,
701
- rejected: r,
702
- synchronous: n ? n.synchronous : !1,
703
- runWhen: n ? n.runWhen : null
704
- }), this.handlers.length - 1;
705
- }
706
- /**
707
- * Remove an interceptor from the stack
708
- *
709
- * @param {Number} id The ID that was returned by `use`
710
- *
711
- * @returns {void}
712
- */
713
- eject(t) {
714
- this.handlers[t] && (this.handlers[t] = null);
715
- }
716
- /**
717
- * Clear all interceptors from the stack
718
- *
719
- * @returns {void}
720
- */
721
- clear() {
722
- this.handlers && (this.handlers = []);
723
- }
724
- /**
725
- * Iterate over all the registered interceptors
726
- *
727
- * This method is particularly useful for skipping over any
728
- * interceptors that may have become `null` calling `eject`.
729
- *
730
- * @param {Function} fn The function to call for each interceptor
731
- *
732
- * @returns {void}
733
- */
734
- forEach(t) {
735
- u.forEach(this.handlers, function(n) {
736
- n !== null && t(n);
737
- });
738
- }
739
- }
740
- const Lt = {
741
- silentJSONParsing: !0,
742
- forcedJSONParsing: !0,
743
- clarifyTimeoutError: !1
744
- }, Zr = typeof URLSearchParams < "u" ? URLSearchParams : $e, en = typeof FormData < "u" ? FormData : null, tn = typeof Blob < "u" ? Blob : null, rn = {
745
- isBrowser: !0,
746
- classes: {
747
- URLSearchParams: Zr,
748
- FormData: en,
749
- Blob: tn
750
- },
751
- protocols: ["http", "https", "file", "blob", "url", "data"]
752
- }, He = typeof window < "u" && typeof document < "u", Be = typeof navigator == "object" && navigator || void 0, nn = He && (!Be || ["ReactNative", "NativeScript", "NS"].indexOf(Be.product) < 0), on = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
753
- self instanceof WorkerGlobalScope && typeof self.importScripts == "function", sn = He && window.location.href || "http://localhost", an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
754
- __proto__: null,
755
- hasBrowserEnv: He,
756
- hasStandardBrowserEnv: nn,
757
- hasStandardBrowserWebWorkerEnv: on,
758
- navigator: Be,
759
- origin: sn
760
- }, Symbol.toStringTag, { value: "Module" })), E = {
761
- ...an,
762
- ...rn
763
- };
764
- function cn(e, t) {
765
- return ve(e, new E.classes.URLSearchParams(), {
766
- visitor: function(r, n, o, s) {
767
- return E.isNode && u.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
768
- },
769
- ...t
770
- });
771
- }
772
- function un(e) {
773
- return u.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
774
- }
775
- function ln(e) {
776
- const t = {}, r = Object.keys(e);
777
- let n;
778
- const o = r.length;
779
- let s;
780
- for (n = 0; n < o; n++)
781
- s = r[n], t[s] = e[s];
782
- return t;
783
- }
784
- function kt(e) {
785
- function t(r, n, o, s) {
786
- let i = r[s++];
787
- if (i === "__proto__") return !0;
788
- const a = Number.isFinite(+i), c = s >= r.length;
789
- return i = !i && u.isArray(o) ? o.length : i, c ? (u.hasOwnProp(o, i) ? o[i] = [o[i], n] : o[i] = n, !a) : ((!o[i] || !u.isObject(o[i])) && (o[i] = []), t(r, n, o[i], s) && u.isArray(o[i]) && (o[i] = ln(o[i])), !a);
790
- }
791
- if (u.isFormData(e) && u.isFunction(e.entries)) {
792
- const r = {};
793
- return u.forEachEntry(e, (n, o) => {
794
- t(un(n), o, r, 0);
795
- }), r;
796
- }
797
- return null;
798
- }
799
- function fn(e, t, r) {
800
- if (u.isString(e))
801
- try {
802
- return (t || JSON.parse)(e), u.trim(e);
803
- } catch (n) {
804
- if (n.name !== "SyntaxError")
805
- throw n;
806
- }
807
- return (r || JSON.stringify)(e);
808
- }
809
- const se = {
810
- transitional: Lt,
811
- adapter: ["xhr", "http", "fetch"],
812
- transformRequest: [function(t, r) {
813
- const n = r.getContentType() || "", o = n.indexOf("application/json") > -1, s = u.isObject(t);
814
- if (s && u.isHTMLForm(t) && (t = new FormData(t)), u.isFormData(t))
815
- return o ? JSON.stringify(kt(t)) : t;
816
- if (u.isArrayBuffer(t) || u.isBuffer(t) || u.isStream(t) || u.isFile(t) || u.isBlob(t) || u.isReadableStream(t))
817
- return t;
818
- if (u.isArrayBufferView(t))
819
- return t.buffer;
820
- if (u.isURLSearchParams(t))
821
- return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
822
- let a;
823
- if (s) {
824
- if (n.indexOf("application/x-www-form-urlencoded") > -1)
825
- return cn(t, this.formSerializer).toString();
826
- if ((a = u.isFileList(t)) || n.indexOf("multipart/form-data") > -1) {
827
- const c = this.env && this.env.FormData;
828
- return ve(
829
- a ? { "files[]": t } : t,
830
- c && new c(),
831
- this.formSerializer
832
- );
833
- }
834
- }
835
- return s || o ? (r.setContentType("application/json", !1), fn(t)) : t;
836
- }],
837
- transformResponse: [function(t) {
838
- const r = this.transitional || se.transitional, n = r && r.forcedJSONParsing, o = this.responseType === "json";
839
- if (u.isResponse(t) || u.isReadableStream(t))
840
- return t;
841
- if (t && u.isString(t) && (n && !this.responseType || o)) {
842
- const i = !(r && r.silentJSONParsing) && o;
843
- try {
844
- return JSON.parse(t, this.parseReviver);
845
- } catch (a) {
846
- if (i)
847
- throw a.name === "SyntaxError" ? g.from(a, g.ERR_BAD_RESPONSE, this, null, this.response) : a;
848
- }
849
- }
850
- return t;
851
- }],
852
- /**
853
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
854
- * timeout is not created.
855
- */
856
- timeout: 0,
857
- xsrfCookieName: "XSRF-TOKEN",
858
- xsrfHeaderName: "X-XSRF-TOKEN",
859
- maxContentLength: -1,
860
- maxBodyLength: -1,
861
- env: {
862
- FormData: E.classes.FormData,
863
- Blob: E.classes.Blob
864
- },
865
- validateStatus: function(t) {
866
- return t >= 200 && t < 300;
867
- },
868
- headers: {
869
- common: {
870
- Accept: "application/json, text/plain, */*",
871
- "Content-Type": void 0
872
- }
873
- }
874
- };
875
- u.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
876
- se.headers[e] = {};
877
- });
878
- const dn = u.toObjectSet([
879
- "age",
880
- "authorization",
881
- "content-length",
882
- "content-type",
883
- "etag",
884
- "expires",
885
- "from",
886
- "host",
887
- "if-modified-since",
888
- "if-unmodified-since",
889
- "last-modified",
890
- "location",
891
- "max-forwards",
892
- "proxy-authorization",
893
- "referer",
894
- "retry-after",
895
- "user-agent"
896
- ]), pn = (e) => {
897
- const t = {};
898
- let r, n, o;
899
- return e && e.split(`
900
- `).forEach(function(i) {
901
- o = i.indexOf(":"), r = i.substring(0, o).trim().toLowerCase(), n = i.substring(o + 1).trim(), !(!r || t[r] && dn[r]) && (r === "set-cookie" ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
902
- }), t;
903
- }, nt = /* @__PURE__ */ Symbol("internals");
904
- function ee(e) {
905
- return e && String(e).trim().toLowerCase();
906
- }
907
- function we(e) {
908
- return e === !1 || e == null ? e : u.isArray(e) ? e.map(we) : String(e);
909
- }
910
- function hn(e) {
911
- const t = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
912
- let n;
913
- for (; n = r.exec(e); )
914
- t[n[1]] = n[2];
915
- return t;
916
- }
917
- const yn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
918
- function De(e, t, r, n, o) {
919
- if (u.isFunction(n))
920
- return n.call(this, t, r);
921
- if (o && (t = r), !!u.isString(t)) {
922
- if (u.isString(n))
923
- return t.indexOf(n) !== -1;
924
- if (u.isRegExp(n))
925
- return n.test(t);
926
- }
927
- }
928
- function mn(e) {
929
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, r, n) => r.toUpperCase() + n);
930
- }
931
- function gn(e, t) {
932
- const r = u.toCamelCase(" " + t);
933
- ["get", "set", "has"].forEach((n) => {
934
- Object.defineProperty(e, n + r, {
935
- value: function(o, s, i) {
936
- return this[n].call(this, t, o, s, i);
937
- },
938
- configurable: !0
939
- });
940
- });
941
- }
942
- let v = class {
943
- constructor(t) {
944
- t && this.set(t);
945
- }
946
- set(t, r, n) {
947
- const o = this;
948
- function s(a, c, l) {
949
- const f = ee(c);
950
- if (!f)
951
- throw new Error("header name must be a non-empty string");
952
- const p = u.findKey(o, f);
953
- (!p || o[p] === void 0 || l === !0 || l === void 0 && o[p] !== !1) && (o[p || c] = we(a));
954
- }
955
- const i = (a, c) => u.forEach(a, (l, f) => s(l, f, c));
956
- if (u.isPlainObject(t) || t instanceof this.constructor)
957
- i(t, r);
958
- else if (u.isString(t) && (t = t.trim()) && !yn(t))
959
- i(pn(t), r);
960
- else if (u.isObject(t) && u.isIterable(t)) {
961
- let a = {}, c, l;
962
- for (const f of t) {
963
- if (!u.isArray(f))
964
- throw TypeError("Object iterator must return a key-value pair");
965
- a[l = f[0]] = (c = a[l]) ? u.isArray(c) ? [...c, f[1]] : [c, f[1]] : f[1];
966
- }
967
- i(a, r);
968
- } else
969
- t != null && s(r, t, n);
970
- return this;
971
- }
972
- get(t, r) {
973
- if (t = ee(t), t) {
974
- const n = u.findKey(this, t);
975
- if (n) {
976
- const o = this[n];
977
- if (!r)
978
- return o;
979
- if (r === !0)
980
- return hn(o);
981
- if (u.isFunction(r))
982
- return r.call(this, o, n);
983
- if (u.isRegExp(r))
984
- return r.exec(o);
985
- throw new TypeError("parser must be boolean|regexp|function");
986
- }
987
- }
988
- }
989
- has(t, r) {
990
- if (t = ee(t), t) {
991
- const n = u.findKey(this, t);
992
- return !!(n && this[n] !== void 0 && (!r || De(this, this[n], n, r)));
993
- }
994
- return !1;
995
- }
996
- delete(t, r) {
997
- const n = this;
998
- let o = !1;
999
- function s(i) {
1000
- if (i = ee(i), i) {
1001
- const a = u.findKey(n, i);
1002
- a && (!r || De(n, n[a], a, r)) && (delete n[a], o = !0);
1003
- }
1004
- }
1005
- return u.isArray(t) ? t.forEach(s) : s(t), o;
1006
- }
1007
- clear(t) {
1008
- const r = Object.keys(this);
1009
- let n = r.length, o = !1;
1010
- for (; n--; ) {
1011
- const s = r[n];
1012
- (!t || De(this, this[s], s, t, !0)) && (delete this[s], o = !0);
1013
- }
1014
- return o;
1015
- }
1016
- normalize(t) {
1017
- const r = this, n = {};
1018
- return u.forEach(this, (o, s) => {
1019
- const i = u.findKey(n, s);
1020
- if (i) {
1021
- r[i] = we(o), delete r[s];
1022
- return;
1023
- }
1024
- const a = t ? mn(s) : String(s).trim();
1025
- a !== s && delete r[s], r[a] = we(o), n[a] = !0;
1026
- }), this;
1027
- }
1028
- concat(...t) {
1029
- return this.constructor.concat(this, ...t);
1030
- }
1031
- toJSON(t) {
1032
- const r = /* @__PURE__ */ Object.create(null);
1033
- return u.forEach(this, (n, o) => {
1034
- n != null && n !== !1 && (r[o] = t && u.isArray(n) ? n.join(", ") : n);
1035
- }), r;
1036
- }
1037
- [Symbol.iterator]() {
1038
- return Object.entries(this.toJSON())[Symbol.iterator]();
1039
- }
1040
- toString() {
1041
- return Object.entries(this.toJSON()).map(([t, r]) => t + ": " + r).join(`
1042
- `);
1043
- }
1044
- getSetCookie() {
1045
- return this.get("set-cookie") || [];
1046
- }
1047
- get [Symbol.toStringTag]() {
1048
- return "AxiosHeaders";
1049
- }
1050
- static from(t) {
1051
- return t instanceof this ? t : new this(t);
1052
- }
1053
- static concat(t, ...r) {
1054
- const n = new this(t);
1055
- return r.forEach((o) => n.set(o)), n;
1056
- }
1057
- static accessor(t) {
1058
- const n = (this[nt] = this[nt] = {
1059
- accessors: {}
1060
- }).accessors, o = this.prototype;
1061
- function s(i) {
1062
- const a = ee(i);
1063
- n[a] || (gn(o, i), n[a] = !0);
1064
- }
1065
- return u.isArray(t) ? t.forEach(s) : s(t), this;
1066
- }
1067
- };
1068
- v.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1069
- u.reduceDescriptors(v.prototype, ({ value: e }, t) => {
1070
- let r = t[0].toUpperCase() + t.slice(1);
1071
- return {
1072
- get: () => e,
1073
- set(n) {
1074
- this[r] = n;
1075
- }
1076
- };
1077
- });
1078
- u.freezeMethods(v);
1079
- function Pe(e, t) {
1080
- const r = this || se, n = t || r, o = v.from(n.headers);
1081
- let s = n.data;
1082
- return u.forEach(e, function(a) {
1083
- s = a.call(r, s, o.normalize(), t ? t.status : void 0);
1084
- }), o.normalize(), s;
1085
- }
1086
- function $t(e) {
1087
- return !!(e && e.__CANCEL__);
1088
- }
1089
- function Y(e, t, r) {
1090
- g.call(this, e ?? "canceled", g.ERR_CANCELED, t, r), this.name = "CanceledError";
1091
- }
1092
- u.inherits(Y, g, {
1093
- __CANCEL__: !0
1094
- });
1095
- function Ht(e, t, r) {
1096
- const n = r.config.validateStatus;
1097
- !r.status || !n || n(r.status) ? e(r) : t(new g(
1098
- "Request failed with status code " + r.status,
1099
- [g.ERR_BAD_REQUEST, g.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
1100
- r.config,
1101
- r.request,
1102
- r
1103
- ));
1104
- }
1105
- function bn(e) {
1106
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
1107
- return t && t[1] || "";
1108
- }
1109
- function wn(e, t) {
1110
- e = e || 10;
1111
- const r = new Array(e), n = new Array(e);
1112
- let o = 0, s = 0, i;
1113
- return t = t !== void 0 ? t : 1e3, function(c) {
1114
- const l = Date.now(), f = n[s];
1115
- i || (i = l), r[o] = c, n[o] = l;
1116
- let p = s, m = 0;
1117
- for (; p !== o; )
1118
- m += r[p++], p = p % e;
1119
- if (o = (o + 1) % e, o === s && (s = (s + 1) % e), l - i < t)
1120
- return;
1121
- const b = f && l - f;
1122
- return b ? Math.round(m * 1e3 / b) : void 0;
1123
- };
1124
- }
1125
- function An(e, t) {
1126
- let r = 0, n = 1e3 / t, o, s;
1127
- const i = (l, f = Date.now()) => {
1128
- r = f, o = null, s && (clearTimeout(s), s = null), e(...l);
1129
- };
1130
- return [(...l) => {
1131
- const f = Date.now(), p = f - r;
1132
- p >= n ? i(l, f) : (o = l, s || (s = setTimeout(() => {
1133
- s = null, i(o);
1134
- }, n - p)));
1135
- }, () => o && i(o)];
1136
- }
1137
- const Se = (e, t, r = 3) => {
1138
- let n = 0;
1139
- const o = wn(50, 250);
1140
- return An((s) => {
1141
- const i = s.loaded, a = s.lengthComputable ? s.total : void 0, c = i - n, l = o(c), f = i <= a;
1142
- n = i;
1143
- const p = {
1144
- loaded: i,
1145
- total: a,
1146
- progress: a ? i / a : void 0,
1147
- bytes: c,
1148
- rate: l || void 0,
1149
- estimated: l && a && f ? (a - i) / l : void 0,
1150
- event: s,
1151
- lengthComputable: a != null,
1152
- [t ? "download" : "upload"]: !0
1153
- };
1154
- e(p);
1155
- }, r);
1156
- }, ot = (e, t) => {
1157
- const r = e != null;
1158
- return [(n) => t[0]({
1159
- lengthComputable: r,
1160
- total: e,
1161
- loaded: n
1162
- }), t[1]];
1163
- }, st = (e) => (...t) => u.asap(() => e(...t)), Sn = E.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (r) => (r = new URL(r, E.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(
1164
- new URL(E.origin),
1165
- E.navigator && /(msie|trident)/i.test(E.navigator.userAgent)
1166
- ) : () => !0, En = E.hasStandardBrowserEnv ? (
1167
- // Standard browser envs support document.cookie
1168
- {
1169
- write(e, t, r, n, o, s, i) {
1170
- if (typeof document > "u") return;
1171
- const a = [`${e}=${encodeURIComponent(t)}`];
1172
- u.isNumber(r) && a.push(`expires=${new Date(r).toUTCString()}`), u.isString(n) && a.push(`path=${n}`), u.isString(o) && a.push(`domain=${o}`), s === !0 && a.push("secure"), u.isString(i) && a.push(`SameSite=${i}`), document.cookie = a.join("; ");
1173
- },
1174
- read(e) {
1175
- if (typeof document > "u") return null;
1176
- const t = document.cookie.match(new RegExp("(?:^|; )" + e + "=([^;]*)"));
1177
- return t ? decodeURIComponent(t[1]) : null;
1178
- },
1179
- remove(e) {
1180
- this.write(e, "", Date.now() - 864e5, "/");
1181
- }
1182
- }
1183
- ) : (
1184
- // Non-standard browser env (web workers, react-native) lack needed support.
1185
- {
1186
- write() {
1187
- },
1188
- read() {
1189
- return null;
1190
- },
1191
- remove() {
1192
- }
1193
- }
1194
- );
1195
- function On(e) {
1196
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
1197
- }
1198
- function Tn(e, t) {
1199
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
1200
- }
1201
- function Vt(e, t, r) {
1202
- let n = !On(t);
1203
- return e && (n || r == !1) ? Tn(e, t) : t;
1204
- }
1205
- const it = (e) => e instanceof v ? { ...e } : e;
1206
- function k(e, t) {
1207
- t = t || {};
1208
- const r = {};
1209
- function n(l, f, p, m) {
1210
- return u.isPlainObject(l) && u.isPlainObject(f) ? u.merge.call({ caseless: m }, l, f) : u.isPlainObject(f) ? u.merge({}, f) : u.isArray(f) ? f.slice() : f;
1211
- }
1212
- function o(l, f, p, m) {
1213
- if (u.isUndefined(f)) {
1214
- if (!u.isUndefined(l))
1215
- return n(void 0, l, p, m);
1216
- } else return n(l, f, p, m);
1217
- }
1218
- function s(l, f) {
1219
- if (!u.isUndefined(f))
1220
- return n(void 0, f);
1221
- }
1222
- function i(l, f) {
1223
- if (u.isUndefined(f)) {
1224
- if (!u.isUndefined(l))
1225
- return n(void 0, l);
1226
- } else return n(void 0, f);
1227
- }
1228
- function a(l, f, p) {
1229
- if (p in t)
1230
- return n(l, f);
1231
- if (p in e)
1232
- return n(void 0, l);
1233
- }
1234
- const c = {
1235
- url: s,
1236
- method: s,
1237
- data: s,
1238
- baseURL: i,
1239
- transformRequest: i,
1240
- transformResponse: i,
1241
- paramsSerializer: i,
1242
- timeout: i,
1243
- timeoutMessage: i,
1244
- withCredentials: i,
1245
- withXSRFToken: i,
1246
- adapter: i,
1247
- responseType: i,
1248
- xsrfCookieName: i,
1249
- xsrfHeaderName: i,
1250
- onUploadProgress: i,
1251
- onDownloadProgress: i,
1252
- decompress: i,
1253
- maxContentLength: i,
1254
- maxBodyLength: i,
1255
- beforeRedirect: i,
1256
- transport: i,
1257
- httpAgent: i,
1258
- httpsAgent: i,
1259
- cancelToken: i,
1260
- socketPath: i,
1261
- responseEncoding: i,
1262
- validateStatus: a,
1263
- headers: (l, f, p) => o(it(l), it(f), p, !0)
1264
- };
1265
- return u.forEach(Object.keys({ ...e, ...t }), function(f) {
1266
- const p = c[f] || o, m = p(e[f], t[f], f);
1267
- u.isUndefined(m) && p !== a || (r[f] = m);
1268
- }), r;
1269
- }
1270
- const Qt = (e) => {
1271
- const t = k({}, e);
1272
- let { data: r, withXSRFToken: n, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: a } = t;
1273
- if (t.headers = i = v.from(i), t.url = It(Vt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), a && i.set(
1274
- "Authorization",
1275
- "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
1276
- ), u.isFormData(r)) {
1277
- if (E.hasStandardBrowserEnv || E.hasStandardBrowserWebWorkerEnv)
1278
- i.setContentType(void 0);
1279
- else if (u.isFunction(r.getHeaders)) {
1280
- const c = r.getHeaders(), l = ["content-type", "content-length"];
1281
- Object.entries(c).forEach(([f, p]) => {
1282
- l.includes(f.toLowerCase()) && i.set(f, p);
1283
- });
1284
- }
1285
- }
1286
- if (E.hasStandardBrowserEnv && (n && u.isFunction(n) && (n = n(t)), n || n !== !1 && Sn(t.url))) {
1287
- const c = o && s && En.read(s);
1288
- c && i.set(o, c);
1289
- }
1290
- return t;
1291
- }, vn = typeof XMLHttpRequest < "u", Rn = vn && function(e) {
1292
- return new Promise(function(r, n) {
1293
- const o = Qt(e);
1294
- let s = o.data;
1295
- const i = v.from(o.headers).normalize();
1296
- let { responseType: a, onUploadProgress: c, onDownloadProgress: l } = o, f, p, m, b, d;
1297
- function y() {
1298
- b && b(), d && d(), o.cancelToken && o.cancelToken.unsubscribe(f), o.signal && o.signal.removeEventListener("abort", f);
1299
- }
1300
- let h = new XMLHttpRequest();
1301
- h.open(o.method.toUpperCase(), o.url, !0), h.timeout = o.timeout;
1302
- function A() {
1303
- if (!h)
1304
- return;
1305
- const S = v.from(
1306
- "getAllResponseHeaders" in h && h.getAllResponseHeaders()
1307
- ), x = {
1308
- data: !a || a === "text" || a === "json" ? h.responseText : h.response,
1309
- status: h.status,
1310
- statusText: h.statusText,
1311
- headers: S,
1312
- config: e,
1313
- request: h
1314
- };
1315
- Ht(function(_) {
1316
- r(_), y();
1317
- }, function(_) {
1318
- n(_), y();
1319
- }, x), h = null;
1320
- }
1321
- "onloadend" in h ? h.onloadend = A : h.onreadystatechange = function() {
1322
- !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(A);
1323
- }, h.onabort = function() {
1324
- h && (n(new g("Request aborted", g.ECONNABORTED, e, h)), h = null);
1325
- }, h.onerror = function(O) {
1326
- const x = O && O.message ? O.message : "Network Error", U = new g(x, g.ERR_NETWORK, e, h);
1327
- U.event = O || null, n(U), h = null;
1328
- }, h.ontimeout = function() {
1329
- let O = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
1330
- const x = o.transitional || Lt;
1331
- o.timeoutErrorMessage && (O = o.timeoutErrorMessage), n(new g(
1332
- O,
1333
- x.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
1334
- e,
1335
- h
1336
- )), h = null;
1337
- }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && u.forEach(i.toJSON(), function(O, x) {
1338
- h.setRequestHeader(x, O);
1339
- }), u.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), a && a !== "json" && (h.responseType = o.responseType), l && ([m, d] = Se(l, !0), h.addEventListener("progress", m)), c && h.upload && ([p, b] = Se(c), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", b)), (o.cancelToken || o.signal) && (f = (S) => {
1340
- h && (n(!S || S.type ? new Y(null, e, h) : S), h.abort(), h = null);
1341
- }, o.cancelToken && o.cancelToken.subscribe(f), o.signal && (o.signal.aborted ? f() : o.signal.addEventListener("abort", f)));
1342
- const R = bn(o.url);
1343
- if (R && E.protocols.indexOf(R) === -1) {
1344
- n(new g("Unsupported protocol " + R + ":", g.ERR_BAD_REQUEST, e));
1345
- return;
1346
- }
1347
- h.send(s || null);
1348
- });
1349
- }, _n = (e, t) => {
1350
- const { length: r } = e = e ? e.filter(Boolean) : [];
1351
- if (t || r) {
1352
- let n = new AbortController(), o;
1353
- const s = function(l) {
1354
- if (!o) {
1355
- o = !0, a();
1356
- const f = l instanceof Error ? l : this.reason;
1357
- n.abort(f instanceof g ? f : new Y(f instanceof Error ? f.message : f));
1358
- }
1359
- };
1360
- let i = t && setTimeout(() => {
1361
- i = null, s(new g(`timeout ${t} of ms exceeded`, g.ETIMEDOUT));
1362
- }, t);
1363
- const a = () => {
1364
- e && (i && clearTimeout(i), i = null, e.forEach((l) => {
1365
- l.unsubscribe ? l.unsubscribe(s) : l.removeEventListener("abort", s);
1366
- }), e = null);
1367
- };
1368
- e.forEach((l) => l.addEventListener("abort", s));
1369
- const { signal: c } = n;
1370
- return c.unsubscribe = () => u.asap(a), c;
1371
- }
1372
- }, xn = function* (e, t) {
1373
- let r = e.byteLength;
1374
- if (r < t) {
1375
- yield e;
1376
- return;
1377
- }
1378
- let n = 0, o;
1379
- for (; n < r; )
1380
- o = n + t, yield e.slice(n, o), n = o;
1381
- }, Cn = async function* (e, t) {
1382
- for await (const r of qn(e))
1383
- yield* xn(r, t);
1384
- }, qn = async function* (e) {
1385
- if (e[Symbol.asyncIterator]) {
1386
- yield* e;
1387
- return;
1388
- }
1389
- const t = e.getReader();
1390
- try {
1391
- for (; ; ) {
1392
- const { done: r, value: n } = await t.read();
1393
- if (r)
1394
- break;
1395
- yield n;
1396
- }
1397
- } finally {
1398
- await t.cancel();
1399
- }
1400
- }, at = (e, t, r, n) => {
1401
- const o = Cn(e, t);
1402
- let s = 0, i, a = (c) => {
1403
- i || (i = !0, n && n(c));
1404
- };
1405
- return new ReadableStream({
1406
- async pull(c) {
1407
- try {
1408
- const { done: l, value: f } = await o.next();
1409
- if (l) {
1410
- a(), c.close();
1411
- return;
1412
- }
1413
- let p = f.byteLength;
1414
- if (r) {
1415
- let m = s += p;
1416
- r(m);
1417
- }
1418
- c.enqueue(new Uint8Array(f));
1419
- } catch (l) {
1420
- throw a(l), l;
1421
- }
1422
- },
1423
- cancel(c) {
1424
- return a(c), o.return();
1425
- }
1426
- }, {
1427
- highWaterMark: 2
1428
- });
1429
- }, ct = 64 * 1024, { isFunction: de } = u, Nn = (({ Request: e, Response: t }) => ({
1430
- Request: e,
1431
- Response: t
1432
- }))(u.global), {
1433
- ReadableStream: ut,
1434
- TextEncoder: lt
1435
- } = u.global, ft = (e, ...t) => {
1436
- try {
1437
- return !!e(...t);
1438
- } catch {
1439
- return !1;
1440
- }
1441
- }, Dn = (e) => {
1442
- e = u.merge.call({
1443
- skipUndefined: !0
1444
- }, Nn, e);
1445
- const { fetch: t, Request: r, Response: n } = e, o = t ? de(t) : typeof fetch == "function", s = de(r), i = de(n);
1446
- if (!o)
1447
- return !1;
1448
- const a = o && de(ut), c = o && (typeof lt == "function" ? /* @__PURE__ */ ((d) => (y) => d.encode(y))(new lt()) : async (d) => new Uint8Array(await new r(d).arrayBuffer())), l = s && a && ft(() => {
1449
- let d = !1;
1450
- const y = new r(E.origin, {
1451
- body: new ut(),
1452
- method: "POST",
1453
- get duplex() {
1454
- return d = !0, "half";
1455
- }
1456
- }).headers.has("Content-Type");
1457
- return d && !y;
1458
- }), f = i && a && ft(() => u.isReadableStream(new n("").body)), p = {
1459
- stream: f && ((d) => d.body)
1460
- };
1461
- o && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((d) => {
1462
- !p[d] && (p[d] = (y, h) => {
1463
- let A = y && y[d];
1464
- if (A)
1465
- return A.call(y);
1466
- throw new g(`Response type '${d}' is not supported`, g.ERR_NOT_SUPPORT, h);
1467
- });
1468
- });
1469
- const m = async (d) => {
1470
- if (d == null)
1471
- return 0;
1472
- if (u.isBlob(d))
1473
- return d.size;
1474
- if (u.isSpecCompliantForm(d))
1475
- return (await new r(E.origin, {
1476
- method: "POST",
1477
- body: d
1478
- }).arrayBuffer()).byteLength;
1479
- if (u.isArrayBufferView(d) || u.isArrayBuffer(d))
1480
- return d.byteLength;
1481
- if (u.isURLSearchParams(d) && (d = d + ""), u.isString(d))
1482
- return (await c(d)).byteLength;
1483
- }, b = async (d, y) => {
1484
- const h = u.toFiniteNumber(d.getContentLength());
1485
- return h ?? m(y);
1486
- };
1487
- return async (d) => {
1488
- let {
1489
- url: y,
1490
- method: h,
1491
- data: A,
1492
- signal: R,
1493
- cancelToken: S,
1494
- timeout: O,
1495
- onDownloadProgress: x,
1496
- onUploadProgress: U,
1497
- responseType: _,
1498
- headers: _e,
1499
- withCredentials: ce = "same-origin",
1500
- fetchOptions: We
1501
- } = Qt(d), Ke = t || fetch;
1502
- _ = _ ? (_ + "").toLowerCase() : "text";
1503
- let ue = _n([R, S && S.toAbortSignal()], O), Z = null;
1504
- const B = ue && ue.unsubscribe && (() => {
1505
- ue.unsubscribe();
1506
- });
1507
- let ze;
1508
- try {
1509
- if (U && l && h !== "get" && h !== "head" && (ze = await b(_e, A)) !== 0) {
1510
- let j = new r(y, {
1511
- method: "POST",
1512
- body: A,
1513
- duplex: "half"
1514
- }), H;
1515
- if (u.isFormData(A) && (H = j.headers.get("content-type")) && _e.setContentType(H), j.body) {
1516
- const [xe, le] = ot(
1517
- ze,
1518
- Se(st(U))
1519
- );
1520
- A = at(j.body, ct, xe, le);
1521
- }
1522
- }
1523
- u.isString(ce) || (ce = ce ? "include" : "omit");
1524
- const D = s && "credentials" in r.prototype, Je = {
1525
- ...We,
1526
- signal: ue,
1527
- method: h.toUpperCase(),
1528
- headers: _e.normalize().toJSON(),
1529
- body: A,
1530
- duplex: "half",
1531
- credentials: D ? ce : void 0
1532
- };
1533
- Z = s && new r(y, Je);
1534
- let F = await (s ? Ke(Z, We) : Ke(y, Je));
1535
- const Ge = f && (_ === "stream" || _ === "response");
1536
- if (f && (x || Ge && B)) {
1537
- const j = {};
1538
- ["status", "statusText", "headers"].forEach((Xe) => {
1539
- j[Xe] = F[Xe];
1540
- });
1541
- const H = u.toFiniteNumber(F.headers.get("content-length")), [xe, le] = x && ot(
1542
- H,
1543
- Se(st(x), !0)
1544
- ) || [];
1545
- F = new n(
1546
- at(F.body, ct, xe, () => {
1547
- le && le(), B && B();
1548
- }),
1549
- j
1550
- );
1551
- }
1552
- _ = _ || "text";
1553
- let er = await p[u.findKey(p, _) || "text"](F, d);
1554
- return !Ge && B && B(), await new Promise((j, H) => {
1555
- Ht(j, H, {
1556
- data: er,
1557
- headers: v.from(F.headers),
1558
- status: F.status,
1559
- statusText: F.statusText,
1560
- config: d,
1561
- request: Z
1562
- });
1563
- });
1564
- } catch (D) {
1565
- throw B && B(), D && D.name === "TypeError" && /Load failed|fetch/i.test(D.message) ? Object.assign(
1566
- new g("Network Error", g.ERR_NETWORK, d, Z),
1567
- {
1568
- cause: D.cause || D
1569
- }
1570
- ) : g.from(D, D && D.code, d, Z);
1571
- }
1572
- };
1573
- }, Pn = /* @__PURE__ */ new Map(), Wt = (e) => {
1574
- let t = e && e.env || {};
1575
- const { fetch: r, Request: n, Response: o } = t, s = [
1576
- n,
1577
- o,
1578
- r
1579
- ];
1580
- let i = s.length, a = i, c, l, f = Pn;
1581
- for (; a--; )
1582
- c = s[a], l = f.get(c), l === void 0 && f.set(c, l = a ? /* @__PURE__ */ new Map() : Dn(t)), f = l;
1583
- return l;
1584
- };
1585
- Wt();
1586
- const Ve = {
1587
- http: Jr,
1588
- xhr: Rn,
1589
- fetch: {
1590
- get: Wt
1591
- }
1592
- };
1593
- u.forEach(Ve, (e, t) => {
1594
- if (e) {
1595
- try {
1596
- Object.defineProperty(e, "name", { value: t });
1597
- } catch {
1598
- }
1599
- Object.defineProperty(e, "adapterName", { value: t });
1600
- }
1601
- });
1602
- const dt = (e) => `- ${e}`, Fn = (e) => u.isFunction(e) || e === null || e === !1;
1603
- function jn(e, t) {
1604
- e = u.isArray(e) ? e : [e];
1605
- const { length: r } = e;
1606
- let n, o;
1607
- const s = {};
1608
- for (let i = 0; i < r; i++) {
1609
- n = e[i];
1610
- let a;
1611
- if (o = n, !Fn(n) && (o = Ve[(a = String(n)).toLowerCase()], o === void 0))
1612
- throw new g(`Unknown adapter '${a}'`);
1613
- if (o && (u.isFunction(o) || (o = o.get(t))))
1614
- break;
1615
- s[a || "#" + i] = o;
1616
- }
1617
- if (!o) {
1618
- const i = Object.entries(s).map(
1619
- ([c, l]) => `adapter ${c} ` + (l === !1 ? "is not supported by the environment" : "is not available in the build")
1620
- );
1621
- let a = r ? i.length > 1 ? `since :
1622
- ` + i.map(dt).join(`
1623
- `) : " " + dt(i[0]) : "as no adapter specified";
1624
- throw new g(
1625
- "There is no suitable adapter to dispatch the request " + a,
1626
- "ERR_NOT_SUPPORT"
1627
- );
1628
- }
1629
- return o;
1630
- }
1631
- const Kt = {
1632
- /**
1633
- * Resolve an adapter from a list of adapter names or functions.
1634
- * @type {Function}
1635
- */
1636
- getAdapter: jn,
1637
- /**
1638
- * Exposes all known adapters
1639
- * @type {Object<string, Function|Object>}
1640
- */
1641
- adapters: Ve
1642
- };
1643
- function Fe(e) {
1644
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1645
- throw new Y(null, e);
1646
- }
1647
- function pt(e) {
1648
- return Fe(e), e.headers = v.from(e.headers), e.data = Pe.call(
1649
- e,
1650
- e.transformRequest
1651
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Kt.getAdapter(e.adapter || se.adapter, e)(e).then(function(n) {
1652
- return Fe(e), n.data = Pe.call(
1653
- e,
1654
- e.transformResponse,
1655
- n
1656
- ), n.headers = v.from(n.headers), n;
1657
- }, function(n) {
1658
- return $t(n) || (Fe(e), n && n.response && (n.response.data = Pe.call(
1659
- e,
1660
- e.transformResponse,
1661
- n.response
1662
- ), n.response.headers = v.from(n.response.headers))), Promise.reject(n);
1663
- });
1664
- }
1665
- const zt = "1.13.2", Re = {};
1666
- ["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
1667
- Re[e] = function(n) {
1668
- return typeof n === e || "a" + (t < 1 ? "n " : " ") + e;
1669
- };
1670
- });
1671
- const ht = {};
1672
- Re.transitional = function(t, r, n) {
1673
- function o(s, i) {
1674
- return "[Axios v" + zt + "] Transitional option '" + s + "'" + i + (n ? ". " + n : "");
1675
- }
1676
- return (s, i, a) => {
1677
- if (t === !1)
1678
- throw new g(
1679
- o(i, " has been removed" + (r ? " in " + r : "")),
1680
- g.ERR_DEPRECATED
1681
- );
1682
- return r && !ht[i] && (ht[i] = !0, console.warn(
1683
- o(
1684
- i,
1685
- " has been deprecated since v" + r + " and will be removed in the near future"
1686
- )
1687
- )), t ? t(s, i, a) : !0;
1688
- };
1689
- };
1690
- Re.spelling = function(t) {
1691
- return (r, n) => (console.warn(`${n} is likely a misspelling of ${t}`), !0);
1692
- };
1693
- function Mn(e, t, r) {
1694
- if (typeof e != "object")
1695
- throw new g("options must be an object", g.ERR_BAD_OPTION_VALUE);
1696
- const n = Object.keys(e);
1697
- let o = n.length;
1698
- for (; o-- > 0; ) {
1699
- const s = n[o], i = t[s];
1700
- if (i) {
1701
- const a = e[s], c = a === void 0 || i(a, s, e);
1702
- if (c !== !0)
1703
- throw new g("option " + s + " must be " + c, g.ERR_BAD_OPTION_VALUE);
1704
- continue;
1705
- }
1706
- if (r !== !0)
1707
- throw new g("Unknown option " + s, g.ERR_BAD_OPTION);
1708
- }
1709
- }
1710
- const Ae = {
1711
- assertOptions: Mn,
1712
- validators: Re
1713
- }, P = Ae.validators;
1714
- let L = class {
1715
- constructor(t) {
1716
- this.defaults = t || {}, this.interceptors = {
1717
- request: new rt(),
1718
- response: new rt()
1719
- };
1720
- }
1721
- /**
1722
- * Dispatch a request
1723
- *
1724
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1725
- * @param {?Object} config
1726
- *
1727
- * @returns {Promise} The Promise to be fulfilled
1728
- */
1729
- async request(t, r) {
1730
- try {
1731
- return await this._request(t, r);
1732
- } catch (n) {
1733
- if (n instanceof Error) {
1734
- let o = {};
1735
- Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
1736
- const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
1737
- try {
1738
- n.stack ? s && !String(n.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (n.stack += `
1739
- ` + s) : n.stack = s;
1740
- } catch {
1741
- }
1742
- }
1743
- throw n;
1744
- }
1745
- }
1746
- _request(t, r) {
1747
- typeof t == "string" ? (r = r || {}, r.url = t) : r = t || {}, r = k(this.defaults, r);
1748
- const { transitional: n, paramsSerializer: o, headers: s } = r;
1749
- n !== void 0 && Ae.assertOptions(n, {
1750
- silentJSONParsing: P.transitional(P.boolean),
1751
- forcedJSONParsing: P.transitional(P.boolean),
1752
- clarifyTimeoutError: P.transitional(P.boolean)
1753
- }, !1), o != null && (u.isFunction(o) ? r.paramsSerializer = {
1754
- serialize: o
1755
- } : Ae.assertOptions(o, {
1756
- encode: P.function,
1757
- serialize: P.function
1758
- }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Ae.assertOptions(r, {
1759
- baseUrl: P.spelling("baseURL"),
1760
- withXsrfToken: P.spelling("withXSRFToken")
1761
- }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
1762
- let i = s && u.merge(
1763
- s.common,
1764
- s[r.method]
1765
- );
1766
- s && u.forEach(
1767
- ["delete", "get", "head", "post", "put", "patch", "common"],
1768
- (d) => {
1769
- delete s[d];
1770
- }
1771
- ), r.headers = v.concat(i, s);
1772
- const a = [];
1773
- let c = !0;
1774
- this.interceptors.request.forEach(function(y) {
1775
- typeof y.runWhen == "function" && y.runWhen(r) === !1 || (c = c && y.synchronous, a.unshift(y.fulfilled, y.rejected));
1776
- });
1777
- const l = [];
1778
- this.interceptors.response.forEach(function(y) {
1779
- l.push(y.fulfilled, y.rejected);
1780
- });
1781
- let f, p = 0, m;
1782
- if (!c) {
1783
- const d = [pt.bind(this), void 0];
1784
- for (d.unshift(...a), d.push(...l), m = d.length, f = Promise.resolve(r); p < m; )
1785
- f = f.then(d[p++], d[p++]);
1786
- return f;
1787
- }
1788
- m = a.length;
1789
- let b = r;
1790
- for (; p < m; ) {
1791
- const d = a[p++], y = a[p++];
1792
- try {
1793
- b = d(b);
1794
- } catch (h) {
1795
- y.call(this, h);
1796
- break;
1797
- }
1798
- }
1799
- try {
1800
- f = pt.call(this, b);
1801
- } catch (d) {
1802
- return Promise.reject(d);
1803
- }
1804
- for (p = 0, m = l.length; p < m; )
1805
- f = f.then(l[p++], l[p++]);
1806
- return f;
1807
- }
1808
- getUri(t) {
1809
- t = k(this.defaults, t);
1810
- const r = Vt(t.baseURL, t.url, t.allowAbsoluteUrls);
1811
- return It(r, t.params, t.paramsSerializer);
1812
- }
1813
- };
1814
- u.forEach(["delete", "get", "head", "options"], function(t) {
1815
- L.prototype[t] = function(r, n) {
1816
- return this.request(k(n || {}, {
1817
- method: t,
1818
- url: r,
1819
- data: (n || {}).data
1820
- }));
1821
- };
1822
- });
1823
- u.forEach(["post", "put", "patch"], function(t) {
1824
- function r(n) {
1825
- return function(s, i, a) {
1826
- return this.request(k(a || {}, {
1827
- method: t,
1828
- headers: n ? {
1829
- "Content-Type": "multipart/form-data"
1830
- } : {},
1831
- url: s,
1832
- data: i
1833
- }));
1834
- };
1835
- }
1836
- L.prototype[t] = r(), L.prototype[t + "Form"] = r(!0);
1837
- });
1838
- let Un = class Jt {
1839
- constructor(t) {
1840
- if (typeof t != "function")
1841
- throw new TypeError("executor must be a function.");
1842
- let r;
1843
- this.promise = new Promise(function(s) {
1844
- r = s;
1845
- });
1846
- const n = this;
1847
- this.promise.then((o) => {
1848
- if (!n._listeners) return;
1849
- let s = n._listeners.length;
1850
- for (; s-- > 0; )
1851
- n._listeners[s](o);
1852
- n._listeners = null;
1853
- }), this.promise.then = (o) => {
1854
- let s;
1855
- const i = new Promise((a) => {
1856
- n.subscribe(a), s = a;
1857
- }).then(o);
1858
- return i.cancel = function() {
1859
- n.unsubscribe(s);
1860
- }, i;
1861
- }, t(function(s, i, a) {
1862
- n.reason || (n.reason = new Y(s, i, a), r(n.reason));
1863
- });
1864
- }
1865
- /**
1866
- * Throws a `CanceledError` if cancellation has been requested.
1867
- */
1868
- throwIfRequested() {
1869
- if (this.reason)
1870
- throw this.reason;
1871
- }
1872
- /**
1873
- * Subscribe to the cancel signal
1874
- */
1875
- subscribe(t) {
1876
- if (this.reason) {
1877
- t(this.reason);
1878
- return;
1879
- }
1880
- this._listeners ? this._listeners.push(t) : this._listeners = [t];
1881
- }
1882
- /**
1883
- * Unsubscribe from the cancel signal
1884
- */
1885
- unsubscribe(t) {
1886
- if (!this._listeners)
1887
- return;
1888
- const r = this._listeners.indexOf(t);
1889
- r !== -1 && this._listeners.splice(r, 1);
1890
- }
1891
- toAbortSignal() {
1892
- const t = new AbortController(), r = (n) => {
1893
- t.abort(n);
1894
- };
1895
- return this.subscribe(r), t.signal.unsubscribe = () => this.unsubscribe(r), t.signal;
1896
- }
1897
- /**
1898
- * Returns an object that contains a new `CancelToken` and a function that, when called,
1899
- * cancels the `CancelToken`.
1900
- */
1901
- static source() {
1902
- let t;
1903
- return {
1904
- token: new Jt(function(o) {
1905
- t = o;
1906
- }),
1907
- cancel: t
1908
- };
1909
- }
1910
- };
1911
- function Bn(e) {
1912
- return function(r) {
1913
- return e.apply(null, r);
1914
- };
1915
- }
1916
- function In(e) {
1917
- return u.isObject(e) && e.isAxiosError === !0;
1918
- }
1919
- const Ie = {
1920
- Continue: 100,
1921
- SwitchingProtocols: 101,
1922
- Processing: 102,
1923
- EarlyHints: 103,
1924
- Ok: 200,
1925
- Created: 201,
1926
- Accepted: 202,
1927
- NonAuthoritativeInformation: 203,
1928
- NoContent: 204,
1929
- ResetContent: 205,
1930
- PartialContent: 206,
1931
- MultiStatus: 207,
1932
- AlreadyReported: 208,
1933
- ImUsed: 226,
1934
- MultipleChoices: 300,
1935
- MovedPermanently: 301,
1936
- Found: 302,
1937
- SeeOther: 303,
1938
- NotModified: 304,
1939
- UseProxy: 305,
1940
- Unused: 306,
1941
- TemporaryRedirect: 307,
1942
- PermanentRedirect: 308,
1943
- BadRequest: 400,
1944
- Unauthorized: 401,
1945
- PaymentRequired: 402,
1946
- Forbidden: 403,
1947
- NotFound: 404,
1948
- MethodNotAllowed: 405,
1949
- NotAcceptable: 406,
1950
- ProxyAuthenticationRequired: 407,
1951
- RequestTimeout: 408,
1952
- Conflict: 409,
1953
- Gone: 410,
1954
- LengthRequired: 411,
1955
- PreconditionFailed: 412,
1956
- PayloadTooLarge: 413,
1957
- UriTooLong: 414,
1958
- UnsupportedMediaType: 415,
1959
- RangeNotSatisfiable: 416,
1960
- ExpectationFailed: 417,
1961
- ImATeapot: 418,
1962
- MisdirectedRequest: 421,
1963
- UnprocessableEntity: 422,
1964
- Locked: 423,
1965
- FailedDependency: 424,
1966
- TooEarly: 425,
1967
- UpgradeRequired: 426,
1968
- PreconditionRequired: 428,
1969
- TooManyRequests: 429,
1970
- RequestHeaderFieldsTooLarge: 431,
1971
- UnavailableForLegalReasons: 451,
1972
- InternalServerError: 500,
1973
- NotImplemented: 501,
1974
- BadGateway: 502,
1975
- ServiceUnavailable: 503,
1976
- GatewayTimeout: 504,
1977
- HttpVersionNotSupported: 505,
1978
- VariantAlsoNegotiates: 506,
1979
- InsufficientStorage: 507,
1980
- LoopDetected: 508,
1981
- NotExtended: 510,
1982
- NetworkAuthenticationRequired: 511,
1983
- WebServerIsDown: 521,
1984
- ConnectionTimedOut: 522,
1985
- OriginIsUnreachable: 523,
1986
- TimeoutOccurred: 524,
1987
- SslHandshakeFailed: 525,
1988
- InvalidSslCertificate: 526
1989
- };
1990
- Object.entries(Ie).forEach(([e, t]) => {
1991
- Ie[t] = e;
1992
- });
1993
- function Gt(e) {
1994
- const t = new L(e), r = _t(L.prototype.request, t);
1995
- return u.extend(r, L.prototype, t, { allOwnKeys: !0 }), u.extend(r, t, null, { allOwnKeys: !0 }), r.create = function(o) {
1996
- return Gt(k(e, o));
1997
- }, r;
1998
- }
1999
- const w = Gt(se);
2000
- w.Axios = L;
2001
- w.CanceledError = Y;
2002
- w.CancelToken = Un;
2003
- w.isCancel = $t;
2004
- w.VERSION = zt;
2005
- w.toFormData = ve;
2006
- w.AxiosError = g;
2007
- w.Cancel = w.CanceledError;
2008
- w.all = function(t) {
2009
- return Promise.all(t);
2010
- };
2011
- w.spread = Bn;
2012
- w.isAxiosError = In;
2013
- w.mergeConfig = k;
2014
- w.AxiosHeaders = v;
2015
- w.formToJSON = (e) => kt(u.isHTMLForm(e) ? new FormData(e) : e);
2016
- w.getAdapter = Kt.getAdapter;
2017
- w.HttpStatusCode = Ie;
2018
- w.default = w;
2019
- const {
2020
- Axios: oo,
2021
- AxiosError: so,
2022
- CanceledError: io,
2023
- isCancel: ao,
2024
- CancelToken: co,
2025
- VERSION: uo,
2026
- all: lo,
2027
- Cancel: fo,
2028
- isAxiosError: po,
2029
- spread: ho,
2030
- toFormData: yo,
2031
- AxiosHeaders: mo,
2032
- HttpStatusCode: go,
2033
- formToJSON: bo,
2034
- getAdapter: wo,
2035
- mergeConfig: Ao
2036
- } = w, yt = typeof window < "u";
2037
- class Ln {
2038
- constructor(t = {}) {
2039
- this.requestStrategy = async (r, n) => {
2040
- await n(r);
2041
- }, this.responseStrategy = async (r, n) => {
2042
- await n(r);
2043
- }, this.defaultBaseUrl = t.defaultBaseUrl, this.useGlobalSingletons = t.useGlobalSingletons ?? !1, this.globalQueryClientKey = t.globalQueryClientKey || "__STORE_QUERY_CLIENT__", this.globalAxiosKey = t.globalAxiosKey || "__STORE_API_CLIENT__", this.createQueryClientImpl = t.createQueryClient || (() => new Le({
2044
- defaultOptions: {
2045
- queries: {
2046
- refetchOnWindowFocus: !0,
2047
- refetchOnMount: !1,
2048
- retry: 3,
2049
- staleTime: 1e3 * 60 * 5
2050
- }
2051
- }
2052
- })), this.createAxiosImpl = t.createAxios || ((r) => {
2053
- const n = w.create({
2054
- baseURL: r || this.defaultBaseUrl,
2055
- withCredentials: !0
2056
- });
2057
- return this.configureAxios(n);
2058
- });
2059
- }
2060
- getQueryClient(t) {
2061
- if (yt) {
2062
- if (t?.client) return t.client;
2063
- if (this.useGlobalSingletons) {
2064
- const r = globalThis, n = r[this.globalQueryClientKey];
2065
- if (n)
2066
- return n;
2067
- const o = this.createQueryClientImpl();
2068
- return r[this.globalQueryClientKey] = o, o;
2069
- }
2070
- return this.queryClientSingleton || (this.queryClientSingleton = this.createQueryClientImpl()), this.queryClientSingleton;
2071
- }
2072
- return this.createQueryClientImpl();
2073
- }
2074
- getAxiosInstance() {
2075
- if (yt) {
2076
- if (this.useGlobalSingletons) {
2077
- const t = globalThis, r = t[this.globalAxiosKey];
2078
- if (r)
2079
- return r;
2080
- const n = this.configureAxios(this.createAxiosImpl());
2081
- return t[this.globalAxiosKey] = n, n;
2082
- }
2083
- return this.axiosSingleton || (this.axiosSingleton = this.configureAxios(this.createAxiosImpl())), this.axiosSingleton;
2084
- }
2085
- return this.configureAxios(this.createAxiosImpl());
2086
- }
2087
- setDefaultApiBaseUrl(t) {
2088
- this.defaultBaseUrl = t;
2089
- }
2090
- async setApiUrl(t) {
2091
- const r = this.getAxiosInstance();
2092
- r.defaults.baseURL = t;
2093
- }
2094
- setRequestInterceptorStrategy(t) {
2095
- this.requestStrategy = t, this.axiosSingleton && (this.axiosSingleton = this.configureAxios(this.axiosSingleton));
2096
- }
2097
- setResponseInterceptorStrategy(t) {
2098
- this.responseStrategy = t, this.axiosSingleton && (this.axiosSingleton = this.configureAxios(this.axiosSingleton));
2099
- }
2100
- getAxiosProxy() {
2101
- return new Proxy({}, {
2102
- get: (t, r) => {
2103
- const n = this.getAxiosInstance(), o = Reflect.get(n, r);
2104
- return typeof o == "function" ? o.bind(n) : o;
2105
- },
2106
- set: (t, r, n) => Reflect.set(this.getAxiosInstance(), r, n)
2107
- });
2108
- }
2109
- getQueryClientProxy() {
2110
- return new Proxy({}, {
2111
- get: (t, r) => {
2112
- const n = this.getQueryClient(), o = Reflect.get(n, r);
2113
- return typeof o == "function" ? o.bind(n) : o;
2114
- },
2115
- set: (t, r, n) => Reflect.set(this.getQueryClient(), r, n)
2116
- });
2117
- }
2118
- configureAxios(t) {
2119
- return t.interceptors.request.clear(), t.interceptors.response.clear(), t.interceptors.request.use(async (r) => {
2120
- const n = async (o) => {
2121
- };
2122
- return await this.requestStrategy(r, n), r;
2123
- }), t.interceptors.response.use(async (r) => {
2124
- const n = async (o) => {
2125
- };
2126
- return await this.responseStrategy(r, n), r;
2127
- }), t;
2128
- }
2129
- }
2130
- const mt = "__HAUS_NAMED_HTTP_CLIENTS__", kn = typeof window < "u", Xt = "default";
2131
- function Qe() {
2132
- if (kn) {
2133
- const t = globalThis, r = t[mt];
2134
- if (r) return r;
2135
- const n = {};
2136
- return t[mt] = n, n;
2137
- }
2138
- const e = Qe;
2139
- return e._ssr || (e._ssr = {}), e._ssr;
2140
- }
2141
- function Yt(e = {}) {
2142
- return new Ln({
2143
- createQueryClient: e.createQueryClient || (() => new Le({
2144
- defaultOptions: {
2145
- queries: {
2146
- refetchOnWindowFocus: !0,
2147
- refetchOnMount: !1,
2148
- retry: 3,
2149
- staleTime: 1e3 * 60 * 5
2150
- }
2151
- }
2152
- })),
2153
- createAxios: e.createAxios || ((t) => w.create({
2154
- baseURL: t ?? e.defaultBaseUrl,
2155
- withCredentials: !0
2156
- })),
2157
- defaultBaseUrl: e.defaultBaseUrl,
2158
- useGlobalSingletons: e.useGlobalSingletons,
2159
- globalQueryClientKey: e.globalQueryClientKey,
2160
- globalAxiosKey: e.globalAxiosKey
2161
- });
2162
- }
2163
- function $n(e, t = {}, r = {}) {
2164
- const n = Qe();
2165
- if (n[e] && !r.overwrite) return n[e];
2166
- const o = Yt(t);
2167
- return n[e] = o, o;
2168
- }
2169
- function Hn(e, t = {}) {
2170
- const r = Qe();
2171
- return r[e] || (r[e] = Yt(t)), r[e];
2172
- }
2173
- $n(Xt, {
2174
- // Keep WP / multi-react-tree compatibility by using global singletons for the default client
2175
- useGlobalSingletons: !0,
2176
- globalQueryClientKey: "__STORE_QUERY_CLIENT__",
2177
- globalAxiosKey: "__STORE_API_CLIENT__"
2178
- }, {
2179
- overwrite: !1
2180
- });
2181
- const Zt = Hn(Xt, {
2182
- createQueryClient: () => new Le({
2183
- defaultOptions: {
2184
- queries: {
2185
- refetchOnWindowFocus: !0,
2186
- refetchOnMount: !1,
2187
- retry: 3,
2188
- staleTime: 1e3 * 60 * 5
2189
- }
2190
- }
2191
- }),
2192
- createAxios: (e) => w.create({
2193
- baseURL: e,
2194
- withCredentials: !0
2195
- })
2196
- // NOTE: useGlobalSingletons is configured in namedClients.ts for the default client
2197
- });
2198
- Zt.getAxiosProxy();
2199
- Zt.getQueryClientProxy();
2200
- var q = {}, pe = {}, he = {}, ye = {}, gt;
2201
- function ie() {
2202
- if (gt) return ye;
2203
- gt = 1, Object.defineProperty(ye, "__esModule", { value: !0 });
2204
- var e;
2205
- return (function(t) {
2206
- t.Mutation = "mutation", t.Query = "query", t.Subscription = "subscription";
2207
- })(e || (e = {})), ye.default = e, ye;
2208
- }
2209
- var W = {}, te = {}, bt;
2210
- function Vn() {
2211
- if (bt) return te;
2212
- bt = 1, Object.defineProperty(te, "__esModule", { value: !0 }), te.isNestedField = void 0;
2213
- function e(t) {
2214
- return typeof t == "object" && t.hasOwnProperty("operation") && t.hasOwnProperty("variables") && t.hasOwnProperty("fields") || typeof t == "object" && t.hasOwnProperty("operation") && t.hasOwnProperty("fragment") && t.hasOwnProperty("fields");
2215
- }
2216
- return te.isNestedField = e, te;
2217
- }
2218
- var wt;
2219
- function ae() {
2220
- if (wt) return W;
2221
- wt = 1;
2222
- var e = W && W.__assign || function() {
2223
- return e = Object.assign || function(n) {
2224
- for (var o, s = 1, i = arguments.length; s < i; s++) {
2225
- o = arguments[s];
2226
- for (var a in o) Object.prototype.hasOwnProperty.call(o, a) && (n[a] = o[a]);
2227
- }
2228
- return n;
2229
- }, e.apply(this, arguments);
2230
- };
2231
- Object.defineProperty(W, "__esModule", { value: !0 });
2232
- var t = Vn(), r = (
2233
- /** @class */
2234
- (function() {
2235
- function n() {
2236
- }
2237
- return n.resolveVariables = function(o) {
2238
- for (var s = {}, i = 0, a = o; i < a.length; i++) {
2239
- var c = a[i], l = c.variables, f = c.fields;
2240
- s = e(e(e({}, s), l), f && n.getNestedVariables(f) || {});
2241
- }
2242
- return s;
2243
- }, n.queryDataNameAndArgumentMap = function(o) {
2244
- return o && Object.keys(o).length ? "(".concat(Object.entries(o).reduce(function(s, i, a) {
2245
- var c = i[0], l = i[1];
2246
- return "".concat(s).concat(a !== 0 ? ", " : "").concat(l && l.name ? l.name : c, ": $").concat(c);
2247
- }, ""), ")") : "";
2248
- }, n.queryFieldsMap = function(o) {
2249
- var s = this;
2250
- return o ? o.map(function(i) {
2251
- if ((0, t.isNestedField)(i))
2252
- return n.queryNestedFieldMap(i);
2253
- if (typeof i == "object") {
2254
- var a = "";
2255
- return Object.entries(i).forEach(function(c, l, f) {
2256
- var p = c[0], m = c[1];
2257
- a += "".concat(p, " ").concat(m.length > 0 ? "{ " + s.queryFieldsMap(m) + " }" : ""), l < f.length - 1 && (a += ", ");
2258
- }), a;
2259
- } else
2260
- return "".concat(i);
2261
- }).join(", ") : "";
2262
- }, n.operationOrAlias = function(o) {
2263
- return typeof o == "string" ? o : "".concat(o.alias, ": ").concat(o.name);
2264
- }, n.isFragment = function(o) {
2265
- var s;
2266
- return (s = o?.fragment === !0) !== null && s !== void 0 ? s : !1;
2267
- }, n.operationOrFragment = function(o) {
2268
- return n.isFragment(o) ? o.operation : n.operationOrAlias(o.operation);
2269
- }, n.getFragment = function(o) {
2270
- return n.isFragment(o) ? "... on " : "";
2271
- }, n.queryNestedFieldMap = function(o) {
2272
- return "".concat(n.getFragment(o)).concat(n.operationOrFragment(o), " ").concat(this.isFragment(o) ? "" : this.queryDataNameAndArgumentMap(o.variables), " ").concat(o.fields.length > 0 ? "{ " + this.queryFieldsMap(o.fields) + " }" : "");
2273
- }, n.queryVariablesMap = function(o, s) {
2274
- var i = {}, a = function(c) {
2275
- c && Object.keys(c).map(function(l) {
2276
- i[l] = typeof c[l] == "object" ? c[l].value : c[l];
2277
- });
2278
- };
2279
- return a(o), s && typeof s == "object" && a(n.getNestedVariables(s)), i;
2280
- }, n.getNestedVariables = function(o) {
2281
- var s = {};
2282
- function i(a) {
2283
- return a?.forEach(function(c) {
2284
- if ((0, t.isNestedField)(c))
2285
- s = e(e(e({}, c.variables), s), c.fields && i(c.fields));
2286
- else if (typeof c == "object")
2287
- for (var l = 0, f = Object.entries(c); l < f.length; l++) {
2288
- var p = f[l], m = p[1];
2289
- i(m);
2290
- }
2291
- }), s;
2292
- }
2293
- return i(o), s;
2294
- }, n.queryDataType = function(o) {
2295
- var s = "String", i = typeof o == "object" ? o.value : o;
2296
- if (o?.type != null)
2297
- s = o.type;
2298
- else {
2299
- var a = Array.isArray(i) ? i[0] : i;
2300
- switch (typeof a) {
2301
- case "object":
2302
- s = "Object";
2303
- break;
2304
- case "boolean":
2305
- s = "Boolean";
2306
- break;
2307
- case "number":
2308
- s = a % 1 === 0 ? "Int" : "Float";
2309
- break;
2310
- }
2311
- }
2312
- return typeof o == "object" && (o.list === !0 ? s = "[".concat(s, "]") : Array.isArray(o.list) && (s = "[".concat(s).concat(o.list[0] ? "!" : "", "]")), o.required && (s += "!")), s;
2313
- }, n;
2314
- })()
2315
- );
2316
- return W.default = r, W;
2317
- }
2318
- var At;
2319
- function Qn() {
2320
- if (At) return he;
2321
- At = 1, Object.defineProperty(he, "__esModule", { value: !0 });
2322
- var e = ie(), t = ae(), r = (
2323
- /** @class */
2324
- (function() {
2325
- function n(o) {
2326
- Array.isArray(o) ? this.variables = t.default.resolveVariables(o) : (this.variables = o.variables, this.fields = o.fields, this.operation = o.operation);
2327
- }
2328
- return n.prototype.mutationBuilder = function() {
2329
- return this.operationWrapperTemplate(this.variables, this.operationTemplate(this.operation));
2330
- }, n.prototype.mutationsBuilder = function(o) {
2331
- var s = this, i = o.map(function(a) {
2332
- return s.operation = a.operation, s.variables = a.variables, s.fields = a.fields, s.operationTemplate(a.operation);
2333
- });
2334
- return this.operationWrapperTemplate(t.default.resolveVariables(o), i.join(`
2335
- `));
2336
- }, n.prototype.queryDataNameAndArgumentMap = function() {
2337
- return this.variables && Object.keys(this.variables).length ? "(".concat(Object.keys(this.variables).reduce(function(o, s, i) {
2338
- return "".concat(o).concat(i !== 0 ? ", " : "").concat(s, ": $").concat(s);
2339
- }, ""), ")") : "";
2340
- }, n.prototype.queryDataArgumentAndTypeMap = function(o) {
2341
- return Object.keys(o).length ? "(".concat(Object.keys(o).reduce(function(s, i, a) {
2342
- return "".concat(s).concat(a !== 0 ? ", " : "", "$").concat(i, ": ").concat(t.default.queryDataType(o[i]));
2343
- }, ""), ")") : "";
2344
- }, n.prototype.operationWrapperTemplate = function(o, s) {
2345
- var i = typeof this.operation == "string" ? this.operation : this.operation.name;
2346
- return {
2347
- query: "".concat(e.default.Mutation, " ").concat(i.charAt(0).toUpperCase() + i.slice(1), " ").concat(this.queryDataArgumentAndTypeMap(o), ` {
2348
- `).concat(s, `
2349
- }`),
2350
- variables: t.default.queryVariablesMap(o)
2351
- };
2352
- }, n.prototype.operationTemplate = function(o) {
2353
- var s = typeof o == "string" ? o : "".concat(o.alias, ": ").concat(o.name);
2354
- return "".concat(s, " ").concat(this.queryDataNameAndArgumentMap(), ` {
2355
- `).concat(this.queryFieldsMap(this.fields), `
2356
- }`);
2357
- }, n.prototype.queryFieldsMap = function(o) {
2358
- var s = this;
2359
- return Array.isArray(o) ? o.map(function(i) {
2360
- return typeof i == "object" ? "".concat(Object.keys(i)[0], " { ").concat(s.queryFieldsMap(Object.values(i)[0]), " }") : "".concat(i);
2361
- }).join(", ") : "";
2362
- }, n;
2363
- })()
2364
- );
2365
- return he.default = r, he;
2366
- }
2367
- var me = {}, St;
2368
- function Wn() {
2369
- if (St) return me;
2370
- St = 1, Object.defineProperty(me, "__esModule", { value: !0 });
2371
- var e = ie(), t = ae(), r = (
2372
- /** @class */
2373
- (function() {
2374
- function n(o) {
2375
- this.queryDataType = function(s) {
2376
- var i = "String", a = typeof s == "object" ? s.value : s;
2377
- if (s.type !== void 0)
2378
- i = s.type;
2379
- else
2380
- switch (typeof a) {
2381
- case "object":
2382
- i = "Object";
2383
- break;
2384
- case "boolean":
2385
- i = "Boolean";
2386
- break;
2387
- case "number":
2388
- i = a % 1 === 0 ? "Int" : "Float";
2389
- break;
2390
- }
2391
- return typeof s == "object" && s.required && (i += "!"), i;
2392
- }, Array.isArray(o) ? this.variables = t.default.resolveVariables(o) : (this.variables = o.variables, this.fields = o.fields || [], this.operation = o.operation);
2393
- }
2394
- return n.prototype.queryBuilder = function() {
2395
- return this.operationWrapperTemplate(this.operationTemplate());
2396
- }, n.prototype.queriesBuilder = function(o) {
2397
- var s = this, i = function() {
2398
- var a = [];
2399
- return o.forEach(function(c) {
2400
- c && (s.operation = c.operation, s.fields = c.fields, s.variables = c.variables, a.push(s.operationTemplate()));
2401
- }), a.join(" ");
2402
- };
2403
- return this.operationWrapperTemplate(i());
2404
- }, n.prototype.queryDataNameAndArgumentMap = function() {
2405
- return this.variables && Object.keys(this.variables).length ? "(".concat(Object.keys(this.variables).reduce(function(o, s, i) {
2406
- return "".concat(o).concat(i !== 0 ? ", " : "").concat(s, ": $").concat(s);
2407
- }, ""), ")") : "";
2408
- }, n.prototype.queryDataArgumentAndTypeMap = function() {
2409
- var o = this;
2410
- return this.variables && Object.keys(this.variables).length ? "(".concat(Object.keys(this.variables).reduce(function(s, i, a) {
2411
- return "".concat(s).concat(a !== 0 ? ", " : "", "$").concat(i, ": ").concat(o.queryDataType(o.variables[i]));
2412
- }, ""), ")") : "";
2413
- }, n.prototype.operationWrapperTemplate = function(o) {
2414
- var s = typeof this.operation == "string" ? this.operation : this.operation.name;
2415
- return {
2416
- query: "".concat(e.default.Query, " ").concat(s.charAt(0).toUpperCase()).concat(s.slice(1), " ").concat(this.queryDataArgumentAndTypeMap(), " { ").concat(o, " }"),
2417
- variables: t.default.queryVariablesMap(this.variables)
2418
- };
2419
- }, n.prototype.operationTemplate = function() {
2420
- var o = typeof this.operation == "string" ? this.operation : "".concat(this.operation.alias, ": ").concat(this.operation.name);
2421
- return "".concat(o, " ").concat(this.queryDataNameAndArgumentMap(), " { nodes { ").concat(t.default.queryFieldsMap(this.fields), " } }");
2422
- }, n;
2423
- })()
2424
- );
2425
- return me.default = r, me;
2426
- }
2427
- var Et;
2428
- function Kn() {
2429
- if (Et) return pe;
2430
- Et = 1, Object.defineProperty(pe, "__esModule", { value: !0 });
2431
- var e = Qn(), t = Wn();
2432
- return pe.default = { DefaultAppSyncQueryAdapter: t.default, DefaultAppSyncMutationAdapter: e.default }, pe;
2433
- }
2434
- var K = {}, Ot;
2435
- function zn() {
2436
- if (Ot) return K;
2437
- Ot = 1;
2438
- var e = K && K.__assign || function() {
2439
- return e = Object.assign || function(o) {
2440
- for (var s, i = 1, a = arguments.length; i < a; i++) {
2441
- s = arguments[i];
2442
- for (var c in s) Object.prototype.hasOwnProperty.call(s, c) && (o[c] = s[c]);
2443
- }
2444
- return o;
2445
- }, e.apply(this, arguments);
2446
- };
2447
- Object.defineProperty(K, "__esModule", { value: !0 });
2448
- var t = ie(), r = ae(), n = (
2449
- /** @class */
2450
- (function() {
2451
- function o(s, i) {
2452
- var a = this;
2453
- Array.isArray(s) ? this.variables = r.default.resolveVariables(s) : (this.variables = s.variables, this.fields = s.fields, this.operation = s.operation), this.config = {
2454
- operationName: ""
2455
- }, i && Object.entries(i).forEach(function(c) {
2456
- var l = c[0], f = c[1];
2457
- a.config[l] = f;
2458
- });
2459
- }
2460
- return o.prototype.mutationBuilder = function() {
2461
- return this.operationWrapperTemplate(t.default.Mutation, this.variables, this.operationTemplate(this.operation));
2462
- }, o.prototype.mutationsBuilder = function(s) {
2463
- var i = this, a = s.map(function(c) {
2464
- return i.operation = c.operation, i.variables = c.variables, i.fields = c.fields, i.operationTemplate(c.operation);
2465
- });
2466
- return this.operationWrapperTemplate(t.default.Mutation, r.default.resolveVariables(s), a.join(`
2467
- `));
2468
- }, o.prototype.queryDataArgumentAndTypeMap = function(s) {
2469
- return this.fields && typeof this.fields == "object" && (s = e(e({}, r.default.getNestedVariables(this.fields)), s)), s && Object.keys(s).length > 0 ? "(".concat(Object.keys(s).reduce(function(i, a, c) {
2470
- return "".concat(i).concat(c !== 0 ? ", " : "", "$").concat(a, ": ").concat(r.default.queryDataType(s[a]));
2471
- }, ""), ")") : "";
2472
- }, o.prototype.operationWrapperTemplate = function(s, i, a) {
2473
- var c = "".concat(s, " ").concat(this.queryDataArgumentAndTypeMap(i), ` {
2474
- `).concat(a, `
2475
- }`);
2476
- return this.config.operationName && (c = c.replace("mutation", "mutation ".concat(this.config.operationName))), {
2477
- query: c,
2478
- variables: r.default.queryVariablesMap(i, this.fields)
2479
- };
2480
- }, o.prototype.operationTemplate = function(s) {
2481
- var i = typeof s == "string" ? s : "".concat(s.alias, ": ").concat(s.name);
2482
- return "".concat(i, " ").concat(r.default.queryDataNameAndArgumentMap(this.variables), " ").concat(this.fields && this.fields.length > 0 ? `{
2483
- `.concat(r.default.queryFieldsMap(this.fields), `
2484
- }`) : "");
2485
- }, o;
2486
- })()
2487
- );
2488
- return K.default = n, K;
2489
- }
2490
- var z = {}, Tt;
2491
- function Jn() {
2492
- if (Tt) return z;
2493
- Tt = 1;
2494
- var e = z && z.__assign || function() {
2495
- return e = Object.assign || function(o) {
2496
- for (var s, i = 1, a = arguments.length; i < a; i++) {
2497
- s = arguments[i];
2498
- for (var c in s) Object.prototype.hasOwnProperty.call(s, c) && (o[c] = s[c]);
2499
- }
2500
- return o;
2501
- }, e.apply(this, arguments);
2502
- };
2503
- Object.defineProperty(z, "__esModule", { value: !0 });
2504
- var t = ie(), r = ae(), n = (
2505
- /** @class */
2506
- (function() {
2507
- function o(s, i) {
2508
- var a = this;
2509
- this.config = {
2510
- operationName: ""
2511
- }, i && Object.entries(i).forEach(function(c) {
2512
- var l = c[0], f = c[1];
2513
- a.config[l] = f;
2514
- }), Array.isArray(s) ? this.variables = r.default.resolveVariables(s) : (this.variables = s.variables, this.fields = s.fields || [], this.operation = s.operation);
2515
- }
2516
- return o.prototype.queryBuilder = function() {
2517
- return this.operationWrapperTemplate(this.operationTemplate(this.variables));
2518
- }, o.prototype.queriesBuilder = function(s) {
2519
- var i = this, a = function() {
2520
- var c = [];
2521
- return s.forEach(function(l) {
2522
- l && (i.operation = l.operation, i.fields = l.fields, c.push(i.operationTemplate(l.variables)));
2523
- }), c.join(" ");
2524
- };
2525
- return this.operationWrapperTemplate(a());
2526
- }, o.prototype.queryDataArgumentAndTypeMap = function() {
2527
- var s = this.variables;
2528
- return this.fields && typeof this.fields == "object" && (s = e(e({}, r.default.getNestedVariables(this.fields)), s)), s && Object.keys(s).length > 0 ? "(".concat(Object.keys(s).reduce(function(i, a, c) {
2529
- return "".concat(i).concat(c !== 0 ? ", " : "", "$").concat(a, ": ").concat(r.default.queryDataType(s[a]));
2530
- }, ""), ")") : "";
2531
- }, o.prototype.operationWrapperTemplate = function(s) {
2532
- var i = "".concat(t.default.Query, " ").concat(this.queryDataArgumentAndTypeMap(), " { ").concat(s, " }");
2533
- return i = i.replace("query", "query".concat(this.config.operationName !== "" ? " " + this.config.operationName : "")), {
2534
- query: i,
2535
- variables: r.default.queryVariablesMap(this.variables, this.fields)
2536
- };
2537
- }, o.prototype.operationTemplate = function(s) {
2538
- var i = typeof this.operation == "string" ? this.operation : "".concat(this.operation.alias, ": ").concat(this.operation.name);
2539
- return "".concat(i, " ").concat(s ? r.default.queryDataNameAndArgumentMap(s) : "", " ").concat(this.fields && this.fields.length > 0 ? "{ " + r.default.queryFieldsMap(this.fields) + " }" : "");
2540
- }, o;
2541
- })()
2542
- );
2543
- return z.default = n, z;
2544
- }
2545
- var ge = {}, vt;
2546
- function Gn() {
2547
- if (vt) return ge;
2548
- vt = 1, Object.defineProperty(ge, "__esModule", { value: !0 });
2549
- var e = ie(), t = ae(), r = (
2550
- /** @class */
2551
- (function() {
2552
- function n(o) {
2553
- Array.isArray(o) ? this.variables = t.default.resolveVariables(o) : (this.variables = o.variables, this.fields = o.fields, this.operation = o.operation);
2554
- }
2555
- return n.prototype.subscriptionBuilder = function() {
2556
- return this.operationWrapperTemplate(e.default.Subscription, this.variables, this.operationTemplate(this.operation));
2557
- }, n.prototype.subscriptionsBuilder = function(o) {
2558
- var s = this, i = o.map(function(a) {
2559
- return s.operation = a.operation, s.variables = a.variables, s.fields = a.fields, s.operationTemplate(a.operation);
2560
- });
2561
- return this.operationWrapperTemplate(e.default.Subscription, t.default.resolveVariables(o), i.join(`
2562
- `));
2563
- }, n.prototype.queryDataNameAndArgumentMap = function() {
2564
- return this.variables && Object.keys(this.variables).length ? "(".concat(Object.keys(this.variables).reduce(function(o, s, i) {
2565
- return "".concat(o).concat(i !== 0 ? ", " : "").concat(s, ": $").concat(s);
2566
- }, ""), ")") : "";
2567
- }, n.prototype.queryDataArgumentAndTypeMap = function(o) {
2568
- return Object.keys(o).length ? "(".concat(Object.keys(o).reduce(function(s, i, a) {
2569
- return "".concat(s).concat(a !== 0 ? ", " : "", "$").concat(i, ": ").concat(t.default.queryDataType(o[i]));
2570
- }, ""), ")") : "";
2571
- }, n.prototype.operationWrapperTemplate = function(o, s, i) {
2572
- return {
2573
- query: "".concat(o, " ").concat(this.queryDataArgumentAndTypeMap(s), ` {
2574
- `).concat(i, `
2575
- }`),
2576
- variables: t.default.queryVariablesMap(s)
2577
- };
2578
- }, n.prototype.operationTemplate = function(o) {
2579
- var s = typeof this.operation == "string" ? this.operation : "".concat(this.operation.alias, ": ").concat(this.operation.name);
2580
- return "".concat(s, " ").concat(this.queryDataNameAndArgumentMap(), ` {
2581
- `).concat(this.queryFieldsMap(this.fields), `
2582
- }`);
2583
- }, n.prototype.queryFieldsMap = function(o) {
2584
- var s = this;
2585
- return o ? o.map(function(i) {
2586
- return typeof i == "object" ? "".concat(Object.keys(i)[0], " { ").concat(s.queryFieldsMap(Object.values(i)[0]), " }") : "".concat(i);
2587
- }).join(", ") : "";
2588
- }, n;
2589
- })()
2590
- );
2591
- return ge.default = r, ge;
2592
- }
2593
- var Rt;
2594
- function Xn() {
2595
- if (Rt) return q;
2596
- Rt = 1, Object.defineProperty(q, "__esModule", { value: !0 }), q.adapters = q.query = q.mutation = q.subscription = void 0;
2597
- var e = Kn();
2598
- q.adapters = e.default;
2599
- var t = zn(), r = Jn(), n = Gn();
2600
- function o(a, c, l) {
2601
- var f;
2602
- if (Array.isArray(a)) {
2603
- if (c) {
2604
- var p = new c(a, l);
2605
- return p.queriesBuilder(a);
2606
- }
2607
- return f = new r.default(a, l), f.queriesBuilder(a);
2608
- }
2609
- if (c) {
2610
- var p = new c(a, l);
2611
- return p.queryBuilder();
2612
- }
2613
- return f = new r.default(a, l), f.queryBuilder();
2614
- }
2615
- q.query = o;
2616
- function s(a, c, l) {
2617
- var f, p;
2618
- return Array.isArray(a) ? c ? (f = new c(a, l), f.mutationsBuilder(a)) : (p = new t.default(a, l), p.mutationsBuilder(a)) : c ? (f = new c(a, l), f.mutationBuilder()) : (p = new t.default(a, l), p.mutationBuilder());
2619
- }
2620
- q.mutation = s;
2621
- function i(a, c) {
2622
- var l, f;
2623
- return Array.isArray(a) ? c ? (l = new c(a), l.subscriptionsBuilder(a)) : (f = new n.default(a), f.subscriptionsBuilder(a)) : c ? (l = new c(a), l.subscriptionBuilder()) : (f = new n.default(a), f.subscriptionBuilder());
2624
- }
2625
- return q.subscription = i, q;
2626
- }
2627
- Xn();
2628
- const So = () => {
2629
- const t = nr(ur)?.sdk;
2630
- return t || console.error("You must wrap your component in a <DataProvider>"), t?.sdkType === "dummy" || t?.sdkType === "vendure", t;
2631
- };
2632
- export {
2633
- So as u
2634
- };