@next-feature/client 0.1.1-beta.2 → 0.1.1-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,4908 @@
1
+ function $t(t, e) {
2
+ return function() {
3
+ return t.apply(e, arguments);
4
+ };
5
+ }
6
+ const { toString: yr } = Object.prototype, { getPrototypeOf: _t } = Object, { iterator: qe, toStringTag: Mt } = Symbol, Ve = /* @__PURE__ */ ((t) => (e) => {
7
+ const r = yr.call(e);
8
+ return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
9
+ })(/* @__PURE__ */ Object.create(null)), $ = (t) => (t = t.toLowerCase(), (e) => Ve(e) === t), He = (t) => (e) => typeof e === t, { isArray: fe } = Array, ve = He("undefined");
10
+ function gr(t) {
11
+ return t !== null && !ve(t) && t.constructor !== null && !ve(t.constructor) && L(t.constructor.isBuffer) && t.constructor.isBuffer(t);
12
+ }
13
+ const Bt = $("ArrayBuffer");
14
+ function _r(t) {
15
+ let e;
16
+ return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && Bt(t.buffer), e;
17
+ }
18
+ const vr = He("string"), L = He("function"), zt = He("number"), We = (t) => t !== null && typeof t == "object", br = (t) => t === !0 || t === !1, Te = (t) => {
19
+ if (Ve(t) !== "object")
20
+ return !1;
21
+ const e = _t(t);
22
+ return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(Mt in t) && !(qe in t);
23
+ }, wr = $("Date"), xr = $("File"), kr = $("Blob"), Er = $("FileList"), Rr = (t) => We(t) && L(t.pipe), Tr = (t) => {
24
+ let e;
25
+ return t && (typeof FormData == "function" && t instanceof FormData || L(t.append) && ((e = Ve(t)) === "formdata" || // detect form-data instance
26
+ e === "object" && L(t.toString) && t.toString() === "[object FormData]"));
27
+ }, Sr = $("URLSearchParams"), [Ar, Or, Cr, Nr] = ["ReadableStream", "Request", "Response", "Headers"].map($), jr = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
28
+ function ke(t, e, { allOwnKeys: r = !1 } = {}) {
29
+ if (t === null || typeof t > "u")
30
+ return;
31
+ let n, s;
32
+ if (typeof t != "object" && (t = [t]), fe(t))
33
+ for (n = 0, s = t.length; n < s; n++)
34
+ e.call(null, t[n], n, t);
35
+ else {
36
+ const i = r ? Object.getOwnPropertyNames(t) : Object.keys(t), a = i.length;
37
+ let o;
38
+ for (n = 0; n < a; n++)
39
+ o = i[n], e.call(null, t[o], o, t);
40
+ }
41
+ }
42
+ function qt(t, e) {
43
+ e = e.toLowerCase();
44
+ const r = Object.keys(t);
45
+ let n = r.length, s;
46
+ for (; n-- > 0; )
47
+ if (s = r[n], e === s.toLowerCase())
48
+ return s;
49
+ return null;
50
+ }
51
+ const te = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Vt = (t) => !ve(t) && t !== te;
52
+ function rt() {
53
+ const { caseless: t } = Vt(this) && this || {}, e = {}, r = (n, s) => {
54
+ const i = t && qt(e, s) || s;
55
+ Te(e[i]) && Te(n) ? e[i] = rt(e[i], n) : Te(n) ? e[i] = rt({}, n) : fe(n) ? e[i] = n.slice() : e[i] = n;
56
+ };
57
+ for (let n = 0, s = arguments.length; n < s; n++)
58
+ arguments[n] && ke(arguments[n], r);
59
+ return e;
60
+ }
61
+ const Pr = (t, e, r, { allOwnKeys: n } = {}) => (ke(e, (s, i) => {
62
+ r && L(s) ? t[i] = $t(s, r) : t[i] = s;
63
+ }, { allOwnKeys: n }), t), Dr = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), Ir = (t, e, r, n) => {
64
+ t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
65
+ value: e.prototype
66
+ }), r && Object.assign(t.prototype, r);
67
+ }, Lr = (t, e, r, n) => {
68
+ let s, i, a;
69
+ const o = {};
70
+ if (e = e || {}, t == null) return e;
71
+ do {
72
+ for (s = Object.getOwnPropertyNames(t), i = s.length; i-- > 0; )
73
+ a = s[i], (!n || n(a, t, e)) && !o[a] && (e[a] = t[a], o[a] = !0);
74
+ t = r !== !1 && _t(t);
75
+ } while (t && (!r || r(t, e)) && t !== Object.prototype);
76
+ return e;
77
+ }, Ur = (t, e, r) => {
78
+ t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
79
+ const n = t.indexOf(e, r);
80
+ return n !== -1 && n === r;
81
+ }, Fr = (t) => {
82
+ if (!t) return null;
83
+ if (fe(t)) return t;
84
+ let e = t.length;
85
+ if (!zt(e)) return null;
86
+ const r = new Array(e);
87
+ for (; e-- > 0; )
88
+ r[e] = t[e];
89
+ return r;
90
+ }, Zr = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && _t(Uint8Array)), $r = (t, e) => {
91
+ const n = (t && t[qe]).call(t);
92
+ let s;
93
+ for (; (s = n.next()) && !s.done; ) {
94
+ const i = s.value;
95
+ e.call(t, i[0], i[1]);
96
+ }
97
+ }, Mr = (t, e) => {
98
+ let r;
99
+ const n = [];
100
+ for (; (r = t.exec(e)) !== null; )
101
+ n.push(r);
102
+ return n;
103
+ }, Br = $("HTMLFormElement"), zr = (t) => t.toLowerCase().replace(
104
+ /[-_\s]([a-z\d])(\w*)/g,
105
+ function(r, n, s) {
106
+ return n.toUpperCase() + s;
107
+ }
108
+ ), kt = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), qr = $("RegExp"), Ht = (t, e) => {
109
+ const r = Object.getOwnPropertyDescriptors(t), n = {};
110
+ ke(r, (s, i) => {
111
+ let a;
112
+ (a = e(s, i, t)) !== !1 && (n[i] = a || s);
113
+ }), Object.defineProperties(t, n);
114
+ }, Vr = (t) => {
115
+ Ht(t, (e, r) => {
116
+ if (L(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
117
+ return !1;
118
+ const n = t[r];
119
+ if (L(n)) {
120
+ if (e.enumerable = !1, "writable" in e) {
121
+ e.writable = !1;
122
+ return;
123
+ }
124
+ e.set || (e.set = () => {
125
+ throw Error("Can not rewrite read-only method '" + r + "'");
126
+ });
127
+ }
128
+ });
129
+ }, Hr = (t, e) => {
130
+ const r = {}, n = (s) => {
131
+ s.forEach((i) => {
132
+ r[i] = !0;
133
+ });
134
+ };
135
+ return fe(t) ? n(t) : n(String(t).split(e)), r;
136
+ }, Wr = () => {
137
+ }, Jr = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
138
+ function Kr(t) {
139
+ return !!(t && L(t.append) && t[Mt] === "FormData" && t[qe]);
140
+ }
141
+ const Xr = (t) => {
142
+ const e = new Array(10), r = (n, s) => {
143
+ if (We(n)) {
144
+ if (e.indexOf(n) >= 0)
145
+ return;
146
+ if (!("toJSON" in n)) {
147
+ e[s] = n;
148
+ const i = fe(n) ? [] : {};
149
+ return ke(n, (a, o) => {
150
+ const d = r(a, s + 1);
151
+ !ve(d) && (i[o] = d);
152
+ }), e[s] = void 0, i;
153
+ }
154
+ }
155
+ return n;
156
+ };
157
+ return r(t, 0);
158
+ }, Gr = $("AsyncFunction"), Yr = (t) => t && (We(t) || L(t)) && L(t.then) && L(t.catch), Wt = ((t, e) => t ? setImmediate : e ? ((r, n) => (te.addEventListener("message", ({ source: s, data: i }) => {
159
+ s === te && i === r && n.length && n.shift()();
160
+ }, !1), (s) => {
161
+ n.push(s), te.postMessage(r, "*");
162
+ }))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
163
+ typeof setImmediate == "function",
164
+ L(te.postMessage)
165
+ ), Qr = typeof queueMicrotask < "u" ? queueMicrotask.bind(te) : typeof process < "u" && process.nextTick || Wt, en = (t) => t != null && L(t[qe]), u = {
166
+ isArray: fe,
167
+ isArrayBuffer: Bt,
168
+ isBuffer: gr,
169
+ isFormData: Tr,
170
+ isArrayBufferView: _r,
171
+ isString: vr,
172
+ isNumber: zt,
173
+ isBoolean: br,
174
+ isObject: We,
175
+ isPlainObject: Te,
176
+ isReadableStream: Ar,
177
+ isRequest: Or,
178
+ isResponse: Cr,
179
+ isHeaders: Nr,
180
+ isUndefined: ve,
181
+ isDate: wr,
182
+ isFile: xr,
183
+ isBlob: kr,
184
+ isRegExp: qr,
185
+ isFunction: L,
186
+ isStream: Rr,
187
+ isURLSearchParams: Sr,
188
+ isTypedArray: Zr,
189
+ isFileList: Er,
190
+ forEach: ke,
191
+ merge: rt,
192
+ extend: Pr,
193
+ trim: jr,
194
+ stripBOM: Dr,
195
+ inherits: Ir,
196
+ toFlatObject: Lr,
197
+ kindOf: Ve,
198
+ kindOfTest: $,
199
+ endsWith: Ur,
200
+ toArray: Fr,
201
+ forEachEntry: $r,
202
+ matchAll: Mr,
203
+ isHTMLForm: Br,
204
+ hasOwnProperty: kt,
205
+ hasOwnProp: kt,
206
+ // an alias to avoid ESLint no-prototype-builtins detection
207
+ reduceDescriptors: Ht,
208
+ freezeMethods: Vr,
209
+ toObjectSet: Hr,
210
+ toCamelCase: zr,
211
+ noop: Wr,
212
+ toFiniteNumber: Jr,
213
+ findKey: qt,
214
+ global: te,
215
+ isContextDefined: Vt,
216
+ isSpecCompliantForm: Kr,
217
+ toJSONObject: Xr,
218
+ isAsyncFn: Gr,
219
+ isThenable: Yr,
220
+ setImmediate: Wt,
221
+ asap: Qr,
222
+ isIterable: en
223
+ };
224
+ function w(t, e, r, n, s) {
225
+ Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
226
+ }
227
+ u.inherits(w, Error, {
228
+ toJSON: function() {
229
+ return {
230
+ // Standard
231
+ message: this.message,
232
+ name: this.name,
233
+ // Microsoft
234
+ description: this.description,
235
+ number: this.number,
236
+ // Mozilla
237
+ fileName: this.fileName,
238
+ lineNumber: this.lineNumber,
239
+ columnNumber: this.columnNumber,
240
+ stack: this.stack,
241
+ // Axios
242
+ config: u.toJSONObject(this.config),
243
+ code: this.code,
244
+ status: this.status
245
+ };
246
+ }
247
+ });
248
+ const Jt = w.prototype, Kt = {};
249
+ [
250
+ "ERR_BAD_OPTION_VALUE",
251
+ "ERR_BAD_OPTION",
252
+ "ECONNABORTED",
253
+ "ETIMEDOUT",
254
+ "ERR_NETWORK",
255
+ "ERR_FR_TOO_MANY_REDIRECTS",
256
+ "ERR_DEPRECATED",
257
+ "ERR_BAD_RESPONSE",
258
+ "ERR_BAD_REQUEST",
259
+ "ERR_CANCELED",
260
+ "ERR_NOT_SUPPORT",
261
+ "ERR_INVALID_URL"
262
+ // eslint-disable-next-line func-names
263
+ ].forEach((t) => {
264
+ Kt[t] = { value: t };
265
+ });
266
+ Object.defineProperties(w, Kt);
267
+ Object.defineProperty(Jt, "isAxiosError", { value: !0 });
268
+ w.from = (t, e, r, n, s, i) => {
269
+ const a = Object.create(Jt);
270
+ return u.toFlatObject(t, a, function(d) {
271
+ return d !== Error.prototype;
272
+ }, (o) => o !== "isAxiosError"), w.call(a, t.message, e, r, n, s), a.cause = t, a.name = t.name, i && Object.assign(a, i), a;
273
+ };
274
+ const tn = null;
275
+ function nt(t) {
276
+ return u.isPlainObject(t) || u.isArray(t);
277
+ }
278
+ function Xt(t) {
279
+ return u.endsWith(t, "[]") ? t.slice(0, -2) : t;
280
+ }
281
+ function Et(t, e, r) {
282
+ return t ? t.concat(e).map(function(s, i) {
283
+ return s = Xt(s), !r && i ? "[" + s + "]" : s;
284
+ }).join(r ? "." : "") : e;
285
+ }
286
+ function rn(t) {
287
+ return u.isArray(t) && !t.some(nt);
288
+ }
289
+ const nn = u.toFlatObject(u, {}, null, function(e) {
290
+ return /^is[A-Z]/.test(e);
291
+ });
292
+ function Je(t, e, r) {
293
+ if (!u.isObject(t))
294
+ throw new TypeError("target must be an object");
295
+ e = e || new FormData(), r = u.toFlatObject(r, {
296
+ metaTokens: !0,
297
+ dots: !1,
298
+ indexes: !1
299
+ }, !1, function(k, _) {
300
+ return !u.isUndefined(_[k]);
301
+ });
302
+ const n = r.metaTokens, s = r.visitor || l, i = r.dots, a = r.indexes, d = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(e);
303
+ if (!u.isFunction(s))
304
+ throw new TypeError("visitor must be a function");
305
+ function c(g) {
306
+ if (g === null) return "";
307
+ if (u.isDate(g))
308
+ return g.toISOString();
309
+ if (!d && u.isBlob(g))
310
+ throw new w("Blob is not supported. Use a Buffer instead.");
311
+ return u.isArrayBuffer(g) || u.isTypedArray(g) ? d && typeof Blob == "function" ? new Blob([g]) : Buffer.from(g) : g;
312
+ }
313
+ function l(g, k, _) {
314
+ let C = g;
315
+ if (g && !_ && typeof g == "object") {
316
+ if (u.endsWith(k, "{}"))
317
+ k = n ? k : k.slice(0, -2), g = JSON.stringify(g);
318
+ else if (u.isArray(g) && rn(g) || (u.isFileList(g) || u.endsWith(k, "[]")) && (C = u.toArray(g)))
319
+ return k = Xt(k), C.forEach(function(j, V) {
320
+ !(u.isUndefined(j) || j === null) && e.append(
321
+ // eslint-disable-next-line no-nested-ternary
322
+ a === !0 ? Et([k], V, i) : a === null ? k : k + "[]",
323
+ c(j)
324
+ );
325
+ }), !1;
326
+ }
327
+ return nt(g) ? !0 : (e.append(Et(_, k, i), c(g)), !1);
328
+ }
329
+ const m = [], T = Object.assign(nn, {
330
+ defaultVisitor: l,
331
+ convertValue: c,
332
+ isVisitable: nt
333
+ });
334
+ function S(g, k) {
335
+ if (!u.isUndefined(g)) {
336
+ if (m.indexOf(g) !== -1)
337
+ throw Error("Circular reference detected in " + k.join("."));
338
+ m.push(g), u.forEach(g, function(C, N) {
339
+ (!(u.isUndefined(C) || C === null) && s.call(
340
+ e,
341
+ C,
342
+ u.isString(N) ? N.trim() : N,
343
+ k,
344
+ T
345
+ )) === !0 && S(C, k ? k.concat(N) : [N]);
346
+ }), m.pop();
347
+ }
348
+ }
349
+ if (!u.isObject(t))
350
+ throw new TypeError("data must be an object");
351
+ return S(t), e;
352
+ }
353
+ function Rt(t) {
354
+ const e = {
355
+ "!": "%21",
356
+ "'": "%27",
357
+ "(": "%28",
358
+ ")": "%29",
359
+ "~": "%7E",
360
+ "%20": "+",
361
+ "%00": "\0"
362
+ };
363
+ return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) {
364
+ return e[n];
365
+ });
366
+ }
367
+ function vt(t, e) {
368
+ this._pairs = [], t && Je(t, this, e);
369
+ }
370
+ const Gt = vt.prototype;
371
+ Gt.append = function(e, r) {
372
+ this._pairs.push([e, r]);
373
+ };
374
+ Gt.toString = function(e) {
375
+ const r = e ? function(n) {
376
+ return e.call(this, n, Rt);
377
+ } : Rt;
378
+ return this._pairs.map(function(s) {
379
+ return r(s[0]) + "=" + r(s[1]);
380
+ }, "").join("&");
381
+ };
382
+ function sn(t) {
383
+ return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
384
+ }
385
+ function Yt(t, e, r) {
386
+ if (!e)
387
+ return t;
388
+ const n = r && r.encode || sn;
389
+ u.isFunction(r) && (r = {
390
+ serialize: r
391
+ });
392
+ const s = r && r.serialize;
393
+ let i;
394
+ if (s ? i = s(e, r) : i = u.isURLSearchParams(e) ? e.toString() : new vt(e, r).toString(n), i) {
395
+ const a = t.indexOf("#");
396
+ a !== -1 && (t = t.slice(0, a)), t += (t.indexOf("?") === -1 ? "?" : "&") + i;
397
+ }
398
+ return t;
399
+ }
400
+ class Tt {
401
+ constructor() {
402
+ this.handlers = [];
403
+ }
404
+ /**
405
+ * Add a new interceptor to the stack
406
+ *
407
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
408
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
409
+ *
410
+ * @return {Number} An ID used to remove interceptor later
411
+ */
412
+ use(e, r, n) {
413
+ return this.handlers.push({
414
+ fulfilled: e,
415
+ rejected: r,
416
+ synchronous: n ? n.synchronous : !1,
417
+ runWhen: n ? n.runWhen : null
418
+ }), this.handlers.length - 1;
419
+ }
420
+ /**
421
+ * Remove an interceptor from the stack
422
+ *
423
+ * @param {Number} id The ID that was returned by `use`
424
+ *
425
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
426
+ */
427
+ eject(e) {
428
+ this.handlers[e] && (this.handlers[e] = null);
429
+ }
430
+ /**
431
+ * Clear all interceptors from the stack
432
+ *
433
+ * @returns {void}
434
+ */
435
+ clear() {
436
+ this.handlers && (this.handlers = []);
437
+ }
438
+ /**
439
+ * Iterate over all the registered interceptors
440
+ *
441
+ * This method is particularly useful for skipping over any
442
+ * interceptors that may have become `null` calling `eject`.
443
+ *
444
+ * @param {Function} fn The function to call for each interceptor
445
+ *
446
+ * @returns {void}
447
+ */
448
+ forEach(e) {
449
+ u.forEach(this.handlers, function(n) {
450
+ n !== null && e(n);
451
+ });
452
+ }
453
+ }
454
+ const Qt = {
455
+ silentJSONParsing: !0,
456
+ forcedJSONParsing: !0,
457
+ clarifyTimeoutError: !1
458
+ }, an = typeof URLSearchParams < "u" ? URLSearchParams : vt, on = typeof FormData < "u" ? FormData : null, cn = typeof Blob < "u" ? Blob : null, un = {
459
+ isBrowser: !0,
460
+ classes: {
461
+ URLSearchParams: an,
462
+ FormData: on,
463
+ Blob: cn
464
+ },
465
+ protocols: ["http", "https", "file", "blob", "url", "data"]
466
+ }, bt = typeof window < "u" && typeof document < "u", st = typeof navigator == "object" && navigator || void 0, ln = bt && (!st || ["ReactNative", "NativeScript", "NS"].indexOf(st.product) < 0), dn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
467
+ self instanceof WorkerGlobalScope && typeof self.importScripts == "function", fn = bt && window.location.href || "http://localhost", hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
468
+ __proto__: null,
469
+ hasBrowserEnv: bt,
470
+ hasStandardBrowserEnv: ln,
471
+ hasStandardBrowserWebWorkerEnv: dn,
472
+ navigator: st,
473
+ origin: fn
474
+ }, Symbol.toStringTag, { value: "Module" })), P = {
475
+ ...hn,
476
+ ...un
477
+ };
478
+ function pn(t, e) {
479
+ return Je(t, new P.classes.URLSearchParams(), Object.assign({
480
+ visitor: function(r, n, s, i) {
481
+ return P.isNode && u.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments);
482
+ }
483
+ }, e));
484
+ }
485
+ function mn(t) {
486
+ return u.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
487
+ }
488
+ function yn(t) {
489
+ const e = {}, r = Object.keys(t);
490
+ let n;
491
+ const s = r.length;
492
+ let i;
493
+ for (n = 0; n < s; n++)
494
+ i = r[n], e[i] = t[i];
495
+ return e;
496
+ }
497
+ function er(t) {
498
+ function e(r, n, s, i) {
499
+ let a = r[i++];
500
+ if (a === "__proto__") return !0;
501
+ const o = Number.isFinite(+a), d = i >= r.length;
502
+ return a = !a && u.isArray(s) ? s.length : a, d ? (u.hasOwnProp(s, a) ? s[a] = [s[a], n] : s[a] = n, !o) : ((!s[a] || !u.isObject(s[a])) && (s[a] = []), e(r, n, s[a], i) && u.isArray(s[a]) && (s[a] = yn(s[a])), !o);
503
+ }
504
+ if (u.isFormData(t) && u.isFunction(t.entries)) {
505
+ const r = {};
506
+ return u.forEachEntry(t, (n, s) => {
507
+ e(mn(n), s, r, 0);
508
+ }), r;
509
+ }
510
+ return null;
511
+ }
512
+ function gn(t, e, r) {
513
+ if (u.isString(t))
514
+ try {
515
+ return (e || JSON.parse)(t), u.trim(t);
516
+ } catch (n) {
517
+ if (n.name !== "SyntaxError")
518
+ throw n;
519
+ }
520
+ return (r || JSON.stringify)(t);
521
+ }
522
+ const Ee = {
523
+ transitional: Qt,
524
+ adapter: ["xhr", "http", "fetch"],
525
+ transformRequest: [function(e, r) {
526
+ const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, i = u.isObject(e);
527
+ if (i && u.isHTMLForm(e) && (e = new FormData(e)), u.isFormData(e))
528
+ return s ? JSON.stringify(er(e)) : e;
529
+ if (u.isArrayBuffer(e) || u.isBuffer(e) || u.isStream(e) || u.isFile(e) || u.isBlob(e) || u.isReadableStream(e))
530
+ return e;
531
+ if (u.isArrayBufferView(e))
532
+ return e.buffer;
533
+ if (u.isURLSearchParams(e))
534
+ return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
535
+ let o;
536
+ if (i) {
537
+ if (n.indexOf("application/x-www-form-urlencoded") > -1)
538
+ return pn(e, this.formSerializer).toString();
539
+ if ((o = u.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
540
+ const d = this.env && this.env.FormData;
541
+ return Je(
542
+ o ? { "files[]": e } : e,
543
+ d && new d(),
544
+ this.formSerializer
545
+ );
546
+ }
547
+ }
548
+ return i || s ? (r.setContentType("application/json", !1), gn(e)) : e;
549
+ }],
550
+ transformResponse: [function(e) {
551
+ const r = this.transitional || Ee.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
552
+ if (u.isResponse(e) || u.isReadableStream(e))
553
+ return e;
554
+ if (e && u.isString(e) && (n && !this.responseType || s)) {
555
+ const a = !(r && r.silentJSONParsing) && s;
556
+ try {
557
+ return JSON.parse(e);
558
+ } catch (o) {
559
+ if (a)
560
+ throw o.name === "SyntaxError" ? w.from(o, w.ERR_BAD_RESPONSE, this, null, this.response) : o;
561
+ }
562
+ }
563
+ return e;
564
+ }],
565
+ /**
566
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
567
+ * timeout is not created.
568
+ */
569
+ timeout: 0,
570
+ xsrfCookieName: "XSRF-TOKEN",
571
+ xsrfHeaderName: "X-XSRF-TOKEN",
572
+ maxContentLength: -1,
573
+ maxBodyLength: -1,
574
+ env: {
575
+ FormData: P.classes.FormData,
576
+ Blob: P.classes.Blob
577
+ },
578
+ validateStatus: function(e) {
579
+ return e >= 200 && e < 300;
580
+ },
581
+ headers: {
582
+ common: {
583
+ Accept: "application/json, text/plain, */*",
584
+ "Content-Type": void 0
585
+ }
586
+ }
587
+ };
588
+ u.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
589
+ Ee.headers[t] = {};
590
+ });
591
+ const _n = u.toObjectSet([
592
+ "age",
593
+ "authorization",
594
+ "content-length",
595
+ "content-type",
596
+ "etag",
597
+ "expires",
598
+ "from",
599
+ "host",
600
+ "if-modified-since",
601
+ "if-unmodified-since",
602
+ "last-modified",
603
+ "location",
604
+ "max-forwards",
605
+ "proxy-authorization",
606
+ "referer",
607
+ "retry-after",
608
+ "user-agent"
609
+ ]), vn = (t) => {
610
+ const e = {};
611
+ let r, n, s;
612
+ return t && t.split(`
613
+ `).forEach(function(a) {
614
+ s = a.indexOf(":"), r = a.substring(0, s).trim().toLowerCase(), n = a.substring(s + 1).trim(), !(!r || e[r] && _n[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
615
+ }), e;
616
+ }, St = Symbol("internals");
617
+ function pe(t) {
618
+ return t && String(t).trim().toLowerCase();
619
+ }
620
+ function Se(t) {
621
+ return t === !1 || t == null ? t : u.isArray(t) ? t.map(Se) : String(t);
622
+ }
623
+ function bn(t) {
624
+ const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
625
+ let n;
626
+ for (; n = r.exec(t); )
627
+ e[n[1]] = n[2];
628
+ return e;
629
+ }
630
+ const wn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
631
+ function Ye(t, e, r, n, s) {
632
+ if (u.isFunction(n))
633
+ return n.call(this, e, r);
634
+ if (s && (e = r), !!u.isString(e)) {
635
+ if (u.isString(n))
636
+ return e.indexOf(n) !== -1;
637
+ if (u.isRegExp(n))
638
+ return n.test(e);
639
+ }
640
+ }
641
+ function xn(t) {
642
+ return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
643
+ }
644
+ function kn(t, e) {
645
+ const r = u.toCamelCase(" " + e);
646
+ ["get", "set", "has"].forEach((n) => {
647
+ Object.defineProperty(t, n + r, {
648
+ value: function(s, i, a) {
649
+ return this[n].call(this, e, s, i, a);
650
+ },
651
+ configurable: !0
652
+ });
653
+ });
654
+ }
655
+ let U = class {
656
+ constructor(e) {
657
+ e && this.set(e);
658
+ }
659
+ set(e, r, n) {
660
+ const s = this;
661
+ function i(o, d, c) {
662
+ const l = pe(d);
663
+ if (!l)
664
+ throw new Error("header name must be a non-empty string");
665
+ const m = u.findKey(s, l);
666
+ (!m || s[m] === void 0 || c === !0 || c === void 0 && s[m] !== !1) && (s[m || d] = Se(o));
667
+ }
668
+ const a = (o, d) => u.forEach(o, (c, l) => i(c, l, d));
669
+ if (u.isPlainObject(e) || e instanceof this.constructor)
670
+ a(e, r);
671
+ else if (u.isString(e) && (e = e.trim()) && !wn(e))
672
+ a(vn(e), r);
673
+ else if (u.isObject(e) && u.isIterable(e)) {
674
+ let o = {}, d, c;
675
+ for (const l of e) {
676
+ if (!u.isArray(l))
677
+ throw TypeError("Object iterator must return a key-value pair");
678
+ o[c = l[0]] = (d = o[c]) ? u.isArray(d) ? [...d, l[1]] : [d, l[1]] : l[1];
679
+ }
680
+ a(o, r);
681
+ } else
682
+ e != null && i(r, e, n);
683
+ return this;
684
+ }
685
+ get(e, r) {
686
+ if (e = pe(e), e) {
687
+ const n = u.findKey(this, e);
688
+ if (n) {
689
+ const s = this[n];
690
+ if (!r)
691
+ return s;
692
+ if (r === !0)
693
+ return bn(s);
694
+ if (u.isFunction(r))
695
+ return r.call(this, s, n);
696
+ if (u.isRegExp(r))
697
+ return r.exec(s);
698
+ throw new TypeError("parser must be boolean|regexp|function");
699
+ }
700
+ }
701
+ }
702
+ has(e, r) {
703
+ if (e = pe(e), e) {
704
+ const n = u.findKey(this, e);
705
+ return !!(n && this[n] !== void 0 && (!r || Ye(this, this[n], n, r)));
706
+ }
707
+ return !1;
708
+ }
709
+ delete(e, r) {
710
+ const n = this;
711
+ let s = !1;
712
+ function i(a) {
713
+ if (a = pe(a), a) {
714
+ const o = u.findKey(n, a);
715
+ o && (!r || Ye(n, n[o], o, r)) && (delete n[o], s = !0);
716
+ }
717
+ }
718
+ return u.isArray(e) ? e.forEach(i) : i(e), s;
719
+ }
720
+ clear(e) {
721
+ const r = Object.keys(this);
722
+ let n = r.length, s = !1;
723
+ for (; n--; ) {
724
+ const i = r[n];
725
+ (!e || Ye(this, this[i], i, e, !0)) && (delete this[i], s = !0);
726
+ }
727
+ return s;
728
+ }
729
+ normalize(e) {
730
+ const r = this, n = {};
731
+ return u.forEach(this, (s, i) => {
732
+ const a = u.findKey(n, i);
733
+ if (a) {
734
+ r[a] = Se(s), delete r[i];
735
+ return;
736
+ }
737
+ const o = e ? xn(i) : String(i).trim();
738
+ o !== i && delete r[i], r[o] = Se(s), n[o] = !0;
739
+ }), this;
740
+ }
741
+ concat(...e) {
742
+ return this.constructor.concat(this, ...e);
743
+ }
744
+ toJSON(e) {
745
+ const r = /* @__PURE__ */ Object.create(null);
746
+ return u.forEach(this, (n, s) => {
747
+ n != null && n !== !1 && (r[s] = e && u.isArray(n) ? n.join(", ") : n);
748
+ }), r;
749
+ }
750
+ [Symbol.iterator]() {
751
+ return Object.entries(this.toJSON())[Symbol.iterator]();
752
+ }
753
+ toString() {
754
+ return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).join(`
755
+ `);
756
+ }
757
+ getSetCookie() {
758
+ return this.get("set-cookie") || [];
759
+ }
760
+ get [Symbol.toStringTag]() {
761
+ return "AxiosHeaders";
762
+ }
763
+ static from(e) {
764
+ return e instanceof this ? e : new this(e);
765
+ }
766
+ static concat(e, ...r) {
767
+ const n = new this(e);
768
+ return r.forEach((s) => n.set(s)), n;
769
+ }
770
+ static accessor(e) {
771
+ const n = (this[St] = this[St] = {
772
+ accessors: {}
773
+ }).accessors, s = this.prototype;
774
+ function i(a) {
775
+ const o = pe(a);
776
+ n[o] || (kn(s, a), n[o] = !0);
777
+ }
778
+ return u.isArray(e) ? e.forEach(i) : i(e), this;
779
+ }
780
+ };
781
+ U.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
782
+ u.reduceDescriptors(U.prototype, ({ value: t }, e) => {
783
+ let r = e[0].toUpperCase() + e.slice(1);
784
+ return {
785
+ get: () => t,
786
+ set(n) {
787
+ this[r] = n;
788
+ }
789
+ };
790
+ });
791
+ u.freezeMethods(U);
792
+ function Qe(t, e) {
793
+ const r = this || Ee, n = e || r, s = U.from(n.headers);
794
+ let i = n.data;
795
+ return u.forEach(t, function(o) {
796
+ i = o.call(r, i, s.normalize(), e ? e.status : void 0);
797
+ }), s.normalize(), i;
798
+ }
799
+ function tr(t) {
800
+ return !!(t && t.__CANCEL__);
801
+ }
802
+ function he(t, e, r) {
803
+ w.call(this, t ?? "canceled", w.ERR_CANCELED, e, r), this.name = "CanceledError";
804
+ }
805
+ u.inherits(he, w, {
806
+ __CANCEL__: !0
807
+ });
808
+ function rr(t, e, r) {
809
+ const n = r.config.validateStatus;
810
+ !r.status || !n || n(r.status) ? t(r) : e(new w(
811
+ "Request failed with status code " + r.status,
812
+ [w.ERR_BAD_REQUEST, w.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
813
+ r.config,
814
+ r.request,
815
+ r
816
+ ));
817
+ }
818
+ function En(t) {
819
+ const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
820
+ return e && e[1] || "";
821
+ }
822
+ function Rn(t, e) {
823
+ t = t || 10;
824
+ const r = new Array(t), n = new Array(t);
825
+ let s = 0, i = 0, a;
826
+ return e = e !== void 0 ? e : 1e3, function(d) {
827
+ const c = Date.now(), l = n[i];
828
+ a || (a = c), r[s] = d, n[s] = c;
829
+ let m = i, T = 0;
830
+ for (; m !== s; )
831
+ T += r[m++], m = m % t;
832
+ if (s = (s + 1) % t, s === i && (i = (i + 1) % t), c - a < e)
833
+ return;
834
+ const S = l && c - l;
835
+ return S ? Math.round(T * 1e3 / S) : void 0;
836
+ };
837
+ }
838
+ function Tn(t, e) {
839
+ let r = 0, n = 1e3 / e, s, i;
840
+ const a = (c, l = Date.now()) => {
841
+ r = l, s = null, i && (clearTimeout(i), i = null), t.apply(null, c);
842
+ };
843
+ return [(...c) => {
844
+ const l = Date.now(), m = l - r;
845
+ m >= n ? a(c, l) : (s = c, i || (i = setTimeout(() => {
846
+ i = null, a(s);
847
+ }, n - m)));
848
+ }, () => s && a(s)];
849
+ }
850
+ const Oe = (t, e, r = 3) => {
851
+ let n = 0;
852
+ const s = Rn(50, 250);
853
+ return Tn((i) => {
854
+ const a = i.loaded, o = i.lengthComputable ? i.total : void 0, d = a - n, c = s(d), l = a <= o;
855
+ n = a;
856
+ const m = {
857
+ loaded: a,
858
+ total: o,
859
+ progress: o ? a / o : void 0,
860
+ bytes: d,
861
+ rate: c || void 0,
862
+ estimated: c && o && l ? (o - a) / c : void 0,
863
+ event: i,
864
+ lengthComputable: o != null,
865
+ [e ? "download" : "upload"]: !0
866
+ };
867
+ t(m);
868
+ }, r);
869
+ }, At = (t, e) => {
870
+ const r = t != null;
871
+ return [(n) => e[0]({
872
+ lengthComputable: r,
873
+ total: t,
874
+ loaded: n
875
+ }), e[1]];
876
+ }, Ot = (t) => (...e) => u.asap(() => t(...e)), Sn = P.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, P.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
877
+ new URL(P.origin),
878
+ P.navigator && /(msie|trident)/i.test(P.navigator.userAgent)
879
+ ) : () => !0, An = P.hasStandardBrowserEnv ? (
880
+ // Standard browser envs support document.cookie
881
+ {
882
+ write(t, e, r, n, s, i) {
883
+ const a = [t + "=" + encodeURIComponent(e)];
884
+ u.isNumber(r) && a.push("expires=" + new Date(r).toGMTString()), u.isString(n) && a.push("path=" + n), u.isString(s) && a.push("domain=" + s), i === !0 && a.push("secure"), document.cookie = a.join("; ");
885
+ },
886
+ read(t) {
887
+ const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
888
+ return e ? decodeURIComponent(e[3]) : null;
889
+ },
890
+ remove(t) {
891
+ this.write(t, "", Date.now() - 864e5);
892
+ }
893
+ }
894
+ ) : (
895
+ // Non-standard browser env (web workers, react-native) lack needed support.
896
+ {
897
+ write() {
898
+ },
899
+ read() {
900
+ return null;
901
+ },
902
+ remove() {
903
+ }
904
+ }
905
+ );
906
+ function On(t) {
907
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
908
+ }
909
+ function Cn(t, e) {
910
+ return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
911
+ }
912
+ function nr(t, e, r) {
913
+ let n = !On(e);
914
+ return t && (n || r == !1) ? Cn(t, e) : e;
915
+ }
916
+ const Ct = (t) => t instanceof U ? { ...t } : t;
917
+ function ne(t, e) {
918
+ e = e || {};
919
+ const r = {};
920
+ function n(c, l, m, T) {
921
+ return u.isPlainObject(c) && u.isPlainObject(l) ? u.merge.call({ caseless: T }, c, l) : u.isPlainObject(l) ? u.merge({}, l) : u.isArray(l) ? l.slice() : l;
922
+ }
923
+ function s(c, l, m, T) {
924
+ if (u.isUndefined(l)) {
925
+ if (!u.isUndefined(c))
926
+ return n(void 0, c, m, T);
927
+ } else return n(c, l, m, T);
928
+ }
929
+ function i(c, l) {
930
+ if (!u.isUndefined(l))
931
+ return n(void 0, l);
932
+ }
933
+ function a(c, l) {
934
+ if (u.isUndefined(l)) {
935
+ if (!u.isUndefined(c))
936
+ return n(void 0, c);
937
+ } else return n(void 0, l);
938
+ }
939
+ function o(c, l, m) {
940
+ if (m in e)
941
+ return n(c, l);
942
+ if (m in t)
943
+ return n(void 0, c);
944
+ }
945
+ const d = {
946
+ url: i,
947
+ method: i,
948
+ data: i,
949
+ baseURL: a,
950
+ transformRequest: a,
951
+ transformResponse: a,
952
+ paramsSerializer: a,
953
+ timeout: a,
954
+ timeoutMessage: a,
955
+ withCredentials: a,
956
+ withXSRFToken: a,
957
+ adapter: a,
958
+ responseType: a,
959
+ xsrfCookieName: a,
960
+ xsrfHeaderName: a,
961
+ onUploadProgress: a,
962
+ onDownloadProgress: a,
963
+ decompress: a,
964
+ maxContentLength: a,
965
+ maxBodyLength: a,
966
+ beforeRedirect: a,
967
+ transport: a,
968
+ httpAgent: a,
969
+ httpsAgent: a,
970
+ cancelToken: a,
971
+ socketPath: a,
972
+ responseEncoding: a,
973
+ validateStatus: o,
974
+ headers: (c, l, m) => s(Ct(c), Ct(l), m, !0)
975
+ };
976
+ return u.forEach(Object.keys(Object.assign({}, t, e)), function(l) {
977
+ const m = d[l] || s, T = m(t[l], e[l], l);
978
+ u.isUndefined(T) && m !== o || (r[l] = T);
979
+ }), r;
980
+ }
981
+ const sr = (t) => {
982
+ const e = ne({}, t);
983
+ let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: i, headers: a, auth: o } = e;
984
+ e.headers = a = U.from(a), e.url = Yt(nr(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), o && a.set(
985
+ "Authorization",
986
+ "Basic " + btoa((o.username || "") + ":" + (o.password ? unescape(encodeURIComponent(o.password)) : ""))
987
+ );
988
+ let d;
989
+ if (u.isFormData(r)) {
990
+ if (P.hasStandardBrowserEnv || P.hasStandardBrowserWebWorkerEnv)
991
+ a.setContentType(void 0);
992
+ else if ((d = a.getContentType()) !== !1) {
993
+ const [c, ...l] = d ? d.split(";").map((m) => m.trim()).filter(Boolean) : [];
994
+ a.setContentType([c || "multipart/form-data", ...l].join("; "));
995
+ }
996
+ }
997
+ if (P.hasStandardBrowserEnv && (n && u.isFunction(n) && (n = n(e)), n || n !== !1 && Sn(e.url))) {
998
+ const c = s && i && An.read(i);
999
+ c && a.set(s, c);
1000
+ }
1001
+ return e;
1002
+ }, Nn = typeof XMLHttpRequest < "u", jn = Nn && function(t) {
1003
+ return new Promise(function(r, n) {
1004
+ const s = sr(t);
1005
+ let i = s.data;
1006
+ const a = U.from(s.headers).normalize();
1007
+ let { responseType: o, onUploadProgress: d, onDownloadProgress: c } = s, l, m, T, S, g;
1008
+ function k() {
1009
+ S && S(), g && g(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
1010
+ }
1011
+ let _ = new XMLHttpRequest();
1012
+ _.open(s.method.toUpperCase(), s.url, !0), _.timeout = s.timeout;
1013
+ function C() {
1014
+ if (!_)
1015
+ return;
1016
+ const j = U.from(
1017
+ "getAllResponseHeaders" in _ && _.getAllResponseHeaders()
1018
+ ), I = {
1019
+ data: !o || o === "text" || o === "json" ? _.responseText : _.response,
1020
+ status: _.status,
1021
+ statusText: _.statusText,
1022
+ headers: j,
1023
+ config: t,
1024
+ request: _
1025
+ };
1026
+ rr(function(ee) {
1027
+ r(ee), k();
1028
+ }, function(ee) {
1029
+ n(ee), k();
1030
+ }, I), _ = null;
1031
+ }
1032
+ "onloadend" in _ ? _.onloadend = C : _.onreadystatechange = function() {
1033
+ !_ || _.readyState !== 4 || _.status === 0 && !(_.responseURL && _.responseURL.indexOf("file:") === 0) || setTimeout(C);
1034
+ }, _.onabort = function() {
1035
+ _ && (n(new w("Request aborted", w.ECONNABORTED, t, _)), _ = null);
1036
+ }, _.onerror = function() {
1037
+ n(new w("Network Error", w.ERR_NETWORK, t, _)), _ = null;
1038
+ }, _.ontimeout = function() {
1039
+ let V = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
1040
+ const I = s.transitional || Qt;
1041
+ s.timeoutErrorMessage && (V = s.timeoutErrorMessage), n(new w(
1042
+ V,
1043
+ I.clarifyTimeoutError ? w.ETIMEDOUT : w.ECONNABORTED,
1044
+ t,
1045
+ _
1046
+ )), _ = null;
1047
+ }, i === void 0 && a.setContentType(null), "setRequestHeader" in _ && u.forEach(a.toJSON(), function(V, I) {
1048
+ _.setRequestHeader(I, V);
1049
+ }), u.isUndefined(s.withCredentials) || (_.withCredentials = !!s.withCredentials), o && o !== "json" && (_.responseType = s.responseType), c && ([T, g] = Oe(c, !0), _.addEventListener("progress", T)), d && _.upload && ([m, S] = Oe(d), _.upload.addEventListener("progress", m), _.upload.addEventListener("loadend", S)), (s.cancelToken || s.signal) && (l = (j) => {
1050
+ _ && (n(!j || j.type ? new he(null, t, _) : j), _.abort(), _ = null);
1051
+ }, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
1052
+ const N = En(s.url);
1053
+ if (N && P.protocols.indexOf(N) === -1) {
1054
+ n(new w("Unsupported protocol " + N + ":", w.ERR_BAD_REQUEST, t));
1055
+ return;
1056
+ }
1057
+ _.send(i || null);
1058
+ });
1059
+ }, Pn = (t, e) => {
1060
+ const { length: r } = t = t ? t.filter(Boolean) : [];
1061
+ if (e || r) {
1062
+ let n = new AbortController(), s;
1063
+ const i = function(c) {
1064
+ if (!s) {
1065
+ s = !0, o();
1066
+ const l = c instanceof Error ? c : this.reason;
1067
+ n.abort(l instanceof w ? l : new he(l instanceof Error ? l.message : l));
1068
+ }
1069
+ };
1070
+ let a = e && setTimeout(() => {
1071
+ a = null, i(new w(`timeout ${e} of ms exceeded`, w.ETIMEDOUT));
1072
+ }, e);
1073
+ const o = () => {
1074
+ t && (a && clearTimeout(a), a = null, t.forEach((c) => {
1075
+ c.unsubscribe ? c.unsubscribe(i) : c.removeEventListener("abort", i);
1076
+ }), t = null);
1077
+ };
1078
+ t.forEach((c) => c.addEventListener("abort", i));
1079
+ const { signal: d } = n;
1080
+ return d.unsubscribe = () => u.asap(o), d;
1081
+ }
1082
+ }, Dn = function* (t, e) {
1083
+ let r = t.byteLength;
1084
+ if (r < e) {
1085
+ yield t;
1086
+ return;
1087
+ }
1088
+ let n = 0, s;
1089
+ for (; n < r; )
1090
+ s = n + e, yield t.slice(n, s), n = s;
1091
+ }, In = async function* (t, e) {
1092
+ for await (const r of Ln(t))
1093
+ yield* Dn(r, e);
1094
+ }, Ln = async function* (t) {
1095
+ if (t[Symbol.asyncIterator]) {
1096
+ yield* t;
1097
+ return;
1098
+ }
1099
+ const e = t.getReader();
1100
+ try {
1101
+ for (; ; ) {
1102
+ const { done: r, value: n } = await e.read();
1103
+ if (r)
1104
+ break;
1105
+ yield n;
1106
+ }
1107
+ } finally {
1108
+ await e.cancel();
1109
+ }
1110
+ }, Nt = (t, e, r, n) => {
1111
+ const s = In(t, e);
1112
+ let i = 0, a, o = (d) => {
1113
+ a || (a = !0, n && n(d));
1114
+ };
1115
+ return new ReadableStream({
1116
+ async pull(d) {
1117
+ try {
1118
+ const { done: c, value: l } = await s.next();
1119
+ if (c) {
1120
+ o(), d.close();
1121
+ return;
1122
+ }
1123
+ let m = l.byteLength;
1124
+ if (r) {
1125
+ let T = i += m;
1126
+ r(T);
1127
+ }
1128
+ d.enqueue(new Uint8Array(l));
1129
+ } catch (c) {
1130
+ throw o(c), c;
1131
+ }
1132
+ },
1133
+ cancel(d) {
1134
+ return o(d), s.return();
1135
+ }
1136
+ }, {
1137
+ highWaterMark: 2
1138
+ });
1139
+ }, Ke = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", ir = Ke && typeof ReadableStream == "function", Un = Ke && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), ar = (t, ...e) => {
1140
+ try {
1141
+ return !!t(...e);
1142
+ } catch {
1143
+ return !1;
1144
+ }
1145
+ }, Fn = ir && ar(() => {
1146
+ let t = !1;
1147
+ const e = new Request(P.origin, {
1148
+ body: new ReadableStream(),
1149
+ method: "POST",
1150
+ get duplex() {
1151
+ return t = !0, "half";
1152
+ }
1153
+ }).headers.has("Content-Type");
1154
+ return t && !e;
1155
+ }), jt = 64 * 1024, it = ir && ar(() => u.isReadableStream(new Response("").body)), Ce = {
1156
+ stream: it && ((t) => t.body)
1157
+ };
1158
+ Ke && ((t) => {
1159
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
1160
+ !Ce[e] && (Ce[e] = u.isFunction(t[e]) ? (r) => r[e]() : (r, n) => {
1161
+ throw new w(`Response type '${e}' is not supported`, w.ERR_NOT_SUPPORT, n);
1162
+ });
1163
+ });
1164
+ })(new Response());
1165
+ const Zn = async (t) => {
1166
+ if (t == null)
1167
+ return 0;
1168
+ if (u.isBlob(t))
1169
+ return t.size;
1170
+ if (u.isSpecCompliantForm(t))
1171
+ return (await new Request(P.origin, {
1172
+ method: "POST",
1173
+ body: t
1174
+ }).arrayBuffer()).byteLength;
1175
+ if (u.isArrayBufferView(t) || u.isArrayBuffer(t))
1176
+ return t.byteLength;
1177
+ if (u.isURLSearchParams(t) && (t = t + ""), u.isString(t))
1178
+ return (await Un(t)).byteLength;
1179
+ }, $n = async (t, e) => {
1180
+ const r = u.toFiniteNumber(t.getContentLength());
1181
+ return r ?? Zn(e);
1182
+ }, Mn = Ke && (async (t) => {
1183
+ let {
1184
+ url: e,
1185
+ method: r,
1186
+ data: n,
1187
+ signal: s,
1188
+ cancelToken: i,
1189
+ timeout: a,
1190
+ onDownloadProgress: o,
1191
+ onUploadProgress: d,
1192
+ responseType: c,
1193
+ headers: l,
1194
+ withCredentials: m = "same-origin",
1195
+ fetchOptions: T
1196
+ } = sr(t);
1197
+ c = c ? (c + "").toLowerCase() : "text";
1198
+ let S = Pn([s, i && i.toAbortSignal()], a), g;
1199
+ const k = S && S.unsubscribe && (() => {
1200
+ S.unsubscribe();
1201
+ });
1202
+ let _;
1203
+ try {
1204
+ if (d && Fn && r !== "get" && r !== "head" && (_ = await $n(l, n)) !== 0) {
1205
+ let I = new Request(e, {
1206
+ method: "POST",
1207
+ body: n,
1208
+ duplex: "half"
1209
+ }), G;
1210
+ if (u.isFormData(n) && (G = I.headers.get("content-type")) && l.setContentType(G), I.body) {
1211
+ const [ee, Re] = At(
1212
+ _,
1213
+ Oe(Ot(d))
1214
+ );
1215
+ n = Nt(I.body, jt, ee, Re);
1216
+ }
1217
+ }
1218
+ u.isString(m) || (m = m ? "include" : "omit");
1219
+ const C = "credentials" in Request.prototype;
1220
+ g = new Request(e, {
1221
+ ...T,
1222
+ signal: S,
1223
+ method: r.toUpperCase(),
1224
+ headers: l.normalize().toJSON(),
1225
+ body: n,
1226
+ duplex: "half",
1227
+ credentials: C ? m : void 0
1228
+ });
1229
+ let N = await fetch(g);
1230
+ const j = it && (c === "stream" || c === "response");
1231
+ if (it && (o || j && k)) {
1232
+ const I = {};
1233
+ ["status", "statusText", "headers"].forEach((xt) => {
1234
+ I[xt] = N[xt];
1235
+ });
1236
+ const G = u.toFiniteNumber(N.headers.get("content-length")), [ee, Re] = o && At(
1237
+ G,
1238
+ Oe(Ot(o), !0)
1239
+ ) || [];
1240
+ N = new Response(
1241
+ Nt(N.body, jt, ee, () => {
1242
+ Re && Re(), k && k();
1243
+ }),
1244
+ I
1245
+ );
1246
+ }
1247
+ c = c || "text";
1248
+ let V = await Ce[u.findKey(Ce, c) || "text"](N, t);
1249
+ return !j && k && k(), await new Promise((I, G) => {
1250
+ rr(I, G, {
1251
+ data: V,
1252
+ headers: U.from(N.headers),
1253
+ status: N.status,
1254
+ statusText: N.statusText,
1255
+ config: t,
1256
+ request: g
1257
+ });
1258
+ });
1259
+ } catch (C) {
1260
+ throw k && k(), C && C.name === "TypeError" && /Load failed|fetch/i.test(C.message) ? Object.assign(
1261
+ new w("Network Error", w.ERR_NETWORK, t, g),
1262
+ {
1263
+ cause: C.cause || C
1264
+ }
1265
+ ) : w.from(C, C && C.code, t, g);
1266
+ }
1267
+ }), at = {
1268
+ http: tn,
1269
+ xhr: jn,
1270
+ fetch: Mn
1271
+ };
1272
+ u.forEach(at, (t, e) => {
1273
+ if (t) {
1274
+ try {
1275
+ Object.defineProperty(t, "name", { value: e });
1276
+ } catch {
1277
+ }
1278
+ Object.defineProperty(t, "adapterName", { value: e });
1279
+ }
1280
+ });
1281
+ const Pt = (t) => `- ${t}`, Bn = (t) => u.isFunction(t) || t === null || t === !1, or = {
1282
+ getAdapter: (t) => {
1283
+ t = u.isArray(t) ? t : [t];
1284
+ const { length: e } = t;
1285
+ let r, n;
1286
+ const s = {};
1287
+ for (let i = 0; i < e; i++) {
1288
+ r = t[i];
1289
+ let a;
1290
+ if (n = r, !Bn(r) && (n = at[(a = String(r)).toLowerCase()], n === void 0))
1291
+ throw new w(`Unknown adapter '${a}'`);
1292
+ if (n)
1293
+ break;
1294
+ s[a || "#" + i] = n;
1295
+ }
1296
+ if (!n) {
1297
+ const i = Object.entries(s).map(
1298
+ ([o, d]) => `adapter ${o} ` + (d === !1 ? "is not supported by the environment" : "is not available in the build")
1299
+ );
1300
+ let a = e ? i.length > 1 ? `since :
1301
+ ` + i.map(Pt).join(`
1302
+ `) : " " + Pt(i[0]) : "as no adapter specified";
1303
+ throw new w(
1304
+ "There is no suitable adapter to dispatch the request " + a,
1305
+ "ERR_NOT_SUPPORT"
1306
+ );
1307
+ }
1308
+ return n;
1309
+ },
1310
+ adapters: at
1311
+ };
1312
+ function et(t) {
1313
+ if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
1314
+ throw new he(null, t);
1315
+ }
1316
+ function Dt(t) {
1317
+ return et(t), t.headers = U.from(t.headers), t.data = Qe.call(
1318
+ t,
1319
+ t.transformRequest
1320
+ ), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), or.getAdapter(t.adapter || Ee.adapter)(t).then(function(n) {
1321
+ return et(t), n.data = Qe.call(
1322
+ t,
1323
+ t.transformResponse,
1324
+ n
1325
+ ), n.headers = U.from(n.headers), n;
1326
+ }, function(n) {
1327
+ return tr(n) || (et(t), n && n.response && (n.response.data = Qe.call(
1328
+ t,
1329
+ t.transformResponse,
1330
+ n.response
1331
+ ), n.response.headers = U.from(n.response.headers))), Promise.reject(n);
1332
+ });
1333
+ }
1334
+ const cr = "1.9.0", Xe = {};
1335
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
1336
+ Xe[t] = function(n) {
1337
+ return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
1338
+ };
1339
+ });
1340
+ const It = {};
1341
+ Xe.transitional = function(e, r, n) {
1342
+ function s(i, a) {
1343
+ return "[Axios v" + cr + "] Transitional option '" + i + "'" + a + (n ? ". " + n : "");
1344
+ }
1345
+ return (i, a, o) => {
1346
+ if (e === !1)
1347
+ throw new w(
1348
+ s(a, " has been removed" + (r ? " in " + r : "")),
1349
+ w.ERR_DEPRECATED
1350
+ );
1351
+ return r && !It[a] && (It[a] = !0, console.warn(
1352
+ s(
1353
+ a,
1354
+ " has been deprecated since v" + r + " and will be removed in the near future"
1355
+ )
1356
+ )), e ? e(i, a, o) : !0;
1357
+ };
1358
+ };
1359
+ Xe.spelling = function(e) {
1360
+ return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1361
+ };
1362
+ function zn(t, e, r) {
1363
+ if (typeof t != "object")
1364
+ throw new w("options must be an object", w.ERR_BAD_OPTION_VALUE);
1365
+ const n = Object.keys(t);
1366
+ let s = n.length;
1367
+ for (; s-- > 0; ) {
1368
+ const i = n[s], a = e[i];
1369
+ if (a) {
1370
+ const o = t[i], d = o === void 0 || a(o, i, t);
1371
+ if (d !== !0)
1372
+ throw new w("option " + i + " must be " + d, w.ERR_BAD_OPTION_VALUE);
1373
+ continue;
1374
+ }
1375
+ if (r !== !0)
1376
+ throw new w("Unknown option " + i, w.ERR_BAD_OPTION);
1377
+ }
1378
+ }
1379
+ const Ae = {
1380
+ assertOptions: zn,
1381
+ validators: Xe
1382
+ }, M = Ae.validators;
1383
+ let re = class {
1384
+ constructor(e) {
1385
+ this.defaults = e || {}, this.interceptors = {
1386
+ request: new Tt(),
1387
+ response: new Tt()
1388
+ };
1389
+ }
1390
+ /**
1391
+ * Dispatch a request
1392
+ *
1393
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
1394
+ * @param {?Object} config
1395
+ *
1396
+ * @returns {Promise} The Promise to be fulfilled
1397
+ */
1398
+ async request(e, r) {
1399
+ try {
1400
+ return await this._request(e, r);
1401
+ } catch (n) {
1402
+ if (n instanceof Error) {
1403
+ let s = {};
1404
+ Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
1405
+ const i = s.stack ? s.stack.replace(/^.+\n/, "") : "";
1406
+ try {
1407
+ n.stack ? i && !String(n.stack).endsWith(i.replace(/^.+\n.+\n/, "")) && (n.stack += `
1408
+ ` + i) : n.stack = i;
1409
+ } catch {
1410
+ }
1411
+ }
1412
+ throw n;
1413
+ }
1414
+ }
1415
+ _request(e, r) {
1416
+ typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = ne(this.defaults, r);
1417
+ const { transitional: n, paramsSerializer: s, headers: i } = r;
1418
+ n !== void 0 && Ae.assertOptions(n, {
1419
+ silentJSONParsing: M.transitional(M.boolean),
1420
+ forcedJSONParsing: M.transitional(M.boolean),
1421
+ clarifyTimeoutError: M.transitional(M.boolean)
1422
+ }, !1), s != null && (u.isFunction(s) ? r.paramsSerializer = {
1423
+ serialize: s
1424
+ } : Ae.assertOptions(s, {
1425
+ encode: M.function,
1426
+ serialize: M.function
1427
+ }, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), Ae.assertOptions(r, {
1428
+ baseUrl: M.spelling("baseURL"),
1429
+ withXsrfToken: M.spelling("withXSRFToken")
1430
+ }, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
1431
+ let a = i && u.merge(
1432
+ i.common,
1433
+ i[r.method]
1434
+ );
1435
+ i && u.forEach(
1436
+ ["delete", "get", "head", "post", "put", "patch", "common"],
1437
+ (g) => {
1438
+ delete i[g];
1439
+ }
1440
+ ), r.headers = U.concat(a, i);
1441
+ const o = [];
1442
+ let d = !0;
1443
+ this.interceptors.request.forEach(function(k) {
1444
+ typeof k.runWhen == "function" && k.runWhen(r) === !1 || (d = d && k.synchronous, o.unshift(k.fulfilled, k.rejected));
1445
+ });
1446
+ const c = [];
1447
+ this.interceptors.response.forEach(function(k) {
1448
+ c.push(k.fulfilled, k.rejected);
1449
+ });
1450
+ let l, m = 0, T;
1451
+ if (!d) {
1452
+ const g = [Dt.bind(this), void 0];
1453
+ for (g.unshift.apply(g, o), g.push.apply(g, c), T = g.length, l = Promise.resolve(r); m < T; )
1454
+ l = l.then(g[m++], g[m++]);
1455
+ return l;
1456
+ }
1457
+ T = o.length;
1458
+ let S = r;
1459
+ for (m = 0; m < T; ) {
1460
+ const g = o[m++], k = o[m++];
1461
+ try {
1462
+ S = g(S);
1463
+ } catch (_) {
1464
+ k.call(this, _);
1465
+ break;
1466
+ }
1467
+ }
1468
+ try {
1469
+ l = Dt.call(this, S);
1470
+ } catch (g) {
1471
+ return Promise.reject(g);
1472
+ }
1473
+ for (m = 0, T = c.length; m < T; )
1474
+ l = l.then(c[m++], c[m++]);
1475
+ return l;
1476
+ }
1477
+ getUri(e) {
1478
+ e = ne(this.defaults, e);
1479
+ const r = nr(e.baseURL, e.url, e.allowAbsoluteUrls);
1480
+ return Yt(r, e.params, e.paramsSerializer);
1481
+ }
1482
+ };
1483
+ u.forEach(["delete", "get", "head", "options"], function(e) {
1484
+ re.prototype[e] = function(r, n) {
1485
+ return this.request(ne(n || {}, {
1486
+ method: e,
1487
+ url: r,
1488
+ data: (n || {}).data
1489
+ }));
1490
+ };
1491
+ });
1492
+ u.forEach(["post", "put", "patch"], function(e) {
1493
+ function r(n) {
1494
+ return function(i, a, o) {
1495
+ return this.request(ne(o || {}, {
1496
+ method: e,
1497
+ headers: n ? {
1498
+ "Content-Type": "multipart/form-data"
1499
+ } : {},
1500
+ url: i,
1501
+ data: a
1502
+ }));
1503
+ };
1504
+ }
1505
+ re.prototype[e] = r(), re.prototype[e + "Form"] = r(!0);
1506
+ });
1507
+ let qn = class ur {
1508
+ constructor(e) {
1509
+ if (typeof e != "function")
1510
+ throw new TypeError("executor must be a function.");
1511
+ let r;
1512
+ this.promise = new Promise(function(i) {
1513
+ r = i;
1514
+ });
1515
+ const n = this;
1516
+ this.promise.then((s) => {
1517
+ if (!n._listeners) return;
1518
+ let i = n._listeners.length;
1519
+ for (; i-- > 0; )
1520
+ n._listeners[i](s);
1521
+ n._listeners = null;
1522
+ }), this.promise.then = (s) => {
1523
+ let i;
1524
+ const a = new Promise((o) => {
1525
+ n.subscribe(o), i = o;
1526
+ }).then(s);
1527
+ return a.cancel = function() {
1528
+ n.unsubscribe(i);
1529
+ }, a;
1530
+ }, e(function(i, a, o) {
1531
+ n.reason || (n.reason = new he(i, a, o), r(n.reason));
1532
+ });
1533
+ }
1534
+ /**
1535
+ * Throws a `CanceledError` if cancellation has been requested.
1536
+ */
1537
+ throwIfRequested() {
1538
+ if (this.reason)
1539
+ throw this.reason;
1540
+ }
1541
+ /**
1542
+ * Subscribe to the cancel signal
1543
+ */
1544
+ subscribe(e) {
1545
+ if (this.reason) {
1546
+ e(this.reason);
1547
+ return;
1548
+ }
1549
+ this._listeners ? this._listeners.push(e) : this._listeners = [e];
1550
+ }
1551
+ /**
1552
+ * Unsubscribe from the cancel signal
1553
+ */
1554
+ unsubscribe(e) {
1555
+ if (!this._listeners)
1556
+ return;
1557
+ const r = this._listeners.indexOf(e);
1558
+ r !== -1 && this._listeners.splice(r, 1);
1559
+ }
1560
+ toAbortSignal() {
1561
+ const e = new AbortController(), r = (n) => {
1562
+ e.abort(n);
1563
+ };
1564
+ return this.subscribe(r), e.signal.unsubscribe = () => this.unsubscribe(r), e.signal;
1565
+ }
1566
+ /**
1567
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
1568
+ * cancels the `CancelToken`.
1569
+ */
1570
+ static source() {
1571
+ let e;
1572
+ return {
1573
+ token: new ur(function(s) {
1574
+ e = s;
1575
+ }),
1576
+ cancel: e
1577
+ };
1578
+ }
1579
+ };
1580
+ function Vn(t) {
1581
+ return function(r) {
1582
+ return t.apply(null, r);
1583
+ };
1584
+ }
1585
+ function Hn(t) {
1586
+ return u.isObject(t) && t.isAxiosError === !0;
1587
+ }
1588
+ const ot = {
1589
+ Continue: 100,
1590
+ SwitchingProtocols: 101,
1591
+ Processing: 102,
1592
+ EarlyHints: 103,
1593
+ Ok: 200,
1594
+ Created: 201,
1595
+ Accepted: 202,
1596
+ NonAuthoritativeInformation: 203,
1597
+ NoContent: 204,
1598
+ ResetContent: 205,
1599
+ PartialContent: 206,
1600
+ MultiStatus: 207,
1601
+ AlreadyReported: 208,
1602
+ ImUsed: 226,
1603
+ MultipleChoices: 300,
1604
+ MovedPermanently: 301,
1605
+ Found: 302,
1606
+ SeeOther: 303,
1607
+ NotModified: 304,
1608
+ UseProxy: 305,
1609
+ Unused: 306,
1610
+ TemporaryRedirect: 307,
1611
+ PermanentRedirect: 308,
1612
+ BadRequest: 400,
1613
+ Unauthorized: 401,
1614
+ PaymentRequired: 402,
1615
+ Forbidden: 403,
1616
+ NotFound: 404,
1617
+ MethodNotAllowed: 405,
1618
+ NotAcceptable: 406,
1619
+ ProxyAuthenticationRequired: 407,
1620
+ RequestTimeout: 408,
1621
+ Conflict: 409,
1622
+ Gone: 410,
1623
+ LengthRequired: 411,
1624
+ PreconditionFailed: 412,
1625
+ PayloadTooLarge: 413,
1626
+ UriTooLong: 414,
1627
+ UnsupportedMediaType: 415,
1628
+ RangeNotSatisfiable: 416,
1629
+ ExpectationFailed: 417,
1630
+ ImATeapot: 418,
1631
+ MisdirectedRequest: 421,
1632
+ UnprocessableEntity: 422,
1633
+ Locked: 423,
1634
+ FailedDependency: 424,
1635
+ TooEarly: 425,
1636
+ UpgradeRequired: 426,
1637
+ PreconditionRequired: 428,
1638
+ TooManyRequests: 429,
1639
+ RequestHeaderFieldsTooLarge: 431,
1640
+ UnavailableForLegalReasons: 451,
1641
+ InternalServerError: 500,
1642
+ NotImplemented: 501,
1643
+ BadGateway: 502,
1644
+ ServiceUnavailable: 503,
1645
+ GatewayTimeout: 504,
1646
+ HttpVersionNotSupported: 505,
1647
+ VariantAlsoNegotiates: 506,
1648
+ InsufficientStorage: 507,
1649
+ LoopDetected: 508,
1650
+ NotExtended: 510,
1651
+ NetworkAuthenticationRequired: 511
1652
+ };
1653
+ Object.entries(ot).forEach(([t, e]) => {
1654
+ ot[e] = t;
1655
+ });
1656
+ function lr(t) {
1657
+ const e = new re(t), r = $t(re.prototype.request, e);
1658
+ return u.extend(r, re.prototype, e, { allOwnKeys: !0 }), u.extend(r, e, null, { allOwnKeys: !0 }), r.create = function(s) {
1659
+ return lr(ne(t, s));
1660
+ }, r;
1661
+ }
1662
+ const O = lr(Ee);
1663
+ O.Axios = re;
1664
+ O.CanceledError = he;
1665
+ O.CancelToken = qn;
1666
+ O.isCancel = tr;
1667
+ O.VERSION = cr;
1668
+ O.toFormData = Je;
1669
+ O.AxiosError = w;
1670
+ O.Cancel = O.CanceledError;
1671
+ O.all = function(e) {
1672
+ return Promise.all(e);
1673
+ };
1674
+ O.spread = Vn;
1675
+ O.isAxiosError = Hn;
1676
+ O.mergeConfig = ne;
1677
+ O.AxiosHeaders = U;
1678
+ O.formToJSON = (t) => er(u.isHTMLForm(t) ? new FormData(t) : t);
1679
+ O.getAdapter = or.getAdapter;
1680
+ O.HttpStatusCode = ot;
1681
+ O.default = O;
1682
+ const {
1683
+ Axios: bs,
1684
+ AxiosError: Wn,
1685
+ CanceledError: ws,
1686
+ isCancel: xs,
1687
+ CancelToken: ks,
1688
+ VERSION: Es,
1689
+ all: Rs,
1690
+ Cancel: Ts,
1691
+ isAxiosError: Ss,
1692
+ spread: As,
1693
+ toFormData: Os,
1694
+ AxiosHeaders: Cs,
1695
+ HttpStatusCode: ct,
1696
+ formToJSON: Ns,
1697
+ getAdapter: js,
1698
+ mergeConfig: Ps
1699
+ } = O;
1700
+ var R;
1701
+ (function(t) {
1702
+ t.assertEqual = (s) => s;
1703
+ function e(s) {
1704
+ }
1705
+ t.assertIs = e;
1706
+ function r(s) {
1707
+ throw new Error();
1708
+ }
1709
+ t.assertNever = r, t.arrayToEnum = (s) => {
1710
+ const i = {};
1711
+ for (const a of s)
1712
+ i[a] = a;
1713
+ return i;
1714
+ }, t.getValidEnumValues = (s) => {
1715
+ const i = t.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), a = {};
1716
+ for (const o of i)
1717
+ a[o] = s[o];
1718
+ return t.objectValues(a);
1719
+ }, t.objectValues = (s) => t.objectKeys(s).map(function(i) {
1720
+ return s[i];
1721
+ }), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
1722
+ const i = [];
1723
+ for (const a in s)
1724
+ Object.prototype.hasOwnProperty.call(s, a) && i.push(a);
1725
+ return i;
1726
+ }, t.find = (s, i) => {
1727
+ for (const a of s)
1728
+ if (i(a))
1729
+ return a;
1730
+ }, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
1731
+ function n(s, i = " | ") {
1732
+ return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(i);
1733
+ }
1734
+ t.joinValues = n, t.jsonStringifyReplacer = (s, i) => typeof i == "bigint" ? i.toString() : i;
1735
+ })(R || (R = {}));
1736
+ var Lt;
1737
+ (function(t) {
1738
+ t.mergeShapes = (e, r) => ({
1739
+ ...e,
1740
+ ...r
1741
+ // second overwrites first
1742
+ });
1743
+ })(Lt || (Lt = {}));
1744
+ const p = R.arrayToEnum([
1745
+ "string",
1746
+ "nan",
1747
+ "number",
1748
+ "integer",
1749
+ "float",
1750
+ "boolean",
1751
+ "date",
1752
+ "bigint",
1753
+ "symbol",
1754
+ "function",
1755
+ "undefined",
1756
+ "null",
1757
+ "array",
1758
+ "object",
1759
+ "unknown",
1760
+ "promise",
1761
+ "void",
1762
+ "never",
1763
+ "map",
1764
+ "set"
1765
+ ]), Y = (t) => {
1766
+ switch (typeof t) {
1767
+ case "undefined":
1768
+ return p.undefined;
1769
+ case "string":
1770
+ return p.string;
1771
+ case "number":
1772
+ return isNaN(t) ? p.nan : p.number;
1773
+ case "boolean":
1774
+ return p.boolean;
1775
+ case "function":
1776
+ return p.function;
1777
+ case "bigint":
1778
+ return p.bigint;
1779
+ case "symbol":
1780
+ return p.symbol;
1781
+ case "object":
1782
+ return Array.isArray(t) ? p.array : t === null ? p.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? p.promise : typeof Map < "u" && t instanceof Map ? p.map : typeof Set < "u" && t instanceof Set ? p.set : typeof Date < "u" && t instanceof Date ? p.date : p.object;
1783
+ default:
1784
+ return p.unknown;
1785
+ }
1786
+ }, f = R.arrayToEnum([
1787
+ "invalid_type",
1788
+ "invalid_literal",
1789
+ "custom",
1790
+ "invalid_union",
1791
+ "invalid_union_discriminator",
1792
+ "invalid_enum_value",
1793
+ "unrecognized_keys",
1794
+ "invalid_arguments",
1795
+ "invalid_return_type",
1796
+ "invalid_date",
1797
+ "invalid_string",
1798
+ "too_small",
1799
+ "too_big",
1800
+ "invalid_intersection_types",
1801
+ "not_multiple_of",
1802
+ "not_finite"
1803
+ ]);
1804
+ class Z extends Error {
1805
+ get errors() {
1806
+ return this.issues;
1807
+ }
1808
+ constructor(e) {
1809
+ super(), this.issues = [], this.addIssue = (n) => {
1810
+ this.issues = [...this.issues, n];
1811
+ }, this.addIssues = (n = []) => {
1812
+ this.issues = [...this.issues, ...n];
1813
+ };
1814
+ const r = new.target.prototype;
1815
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
1816
+ }
1817
+ format(e) {
1818
+ const r = e || function(i) {
1819
+ return i.message;
1820
+ }, n = { _errors: [] }, s = (i) => {
1821
+ for (const a of i.issues)
1822
+ if (a.code === "invalid_union")
1823
+ a.unionErrors.map(s);
1824
+ else if (a.code === "invalid_return_type")
1825
+ s(a.returnTypeError);
1826
+ else if (a.code === "invalid_arguments")
1827
+ s(a.argumentsError);
1828
+ else if (a.path.length === 0)
1829
+ n._errors.push(r(a));
1830
+ else {
1831
+ let o = n, d = 0;
1832
+ for (; d < a.path.length; ) {
1833
+ const c = a.path[d];
1834
+ d === a.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(r(a))) : o[c] = o[c] || { _errors: [] }, o = o[c], d++;
1835
+ }
1836
+ }
1837
+ };
1838
+ return s(this), n;
1839
+ }
1840
+ static assert(e) {
1841
+ if (!(e instanceof Z))
1842
+ throw new Error(`Not a ZodError: ${e}`);
1843
+ }
1844
+ toString() {
1845
+ return this.message;
1846
+ }
1847
+ get message() {
1848
+ return JSON.stringify(this.issues, R.jsonStringifyReplacer, 2);
1849
+ }
1850
+ get isEmpty() {
1851
+ return this.issues.length === 0;
1852
+ }
1853
+ flatten(e = (r) => r.message) {
1854
+ const r = {}, n = [];
1855
+ for (const s of this.issues)
1856
+ s.path.length > 0 ? (r[s.path[0]] = r[s.path[0]] || [], r[s.path[0]].push(e(s))) : n.push(e(s));
1857
+ return { formErrors: n, fieldErrors: r };
1858
+ }
1859
+ get formErrors() {
1860
+ return this.flatten();
1861
+ }
1862
+ }
1863
+ Z.create = (t) => new Z(t);
1864
+ const be = (t, e) => {
1865
+ let r;
1866
+ switch (t.code) {
1867
+ case f.invalid_type:
1868
+ t.received === p.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
1869
+ break;
1870
+ case f.invalid_literal:
1871
+ r = `Invalid literal value, expected ${JSON.stringify(t.expected, R.jsonStringifyReplacer)}`;
1872
+ break;
1873
+ case f.unrecognized_keys:
1874
+ r = `Unrecognized key(s) in object: ${R.joinValues(t.keys, ", ")}`;
1875
+ break;
1876
+ case f.invalid_union:
1877
+ r = "Invalid input";
1878
+ break;
1879
+ case f.invalid_union_discriminator:
1880
+ r = `Invalid discriminator value. Expected ${R.joinValues(t.options)}`;
1881
+ break;
1882
+ case f.invalid_enum_value:
1883
+ r = `Invalid enum value. Expected ${R.joinValues(t.options)}, received '${t.received}'`;
1884
+ break;
1885
+ case f.invalid_arguments:
1886
+ r = "Invalid function arguments";
1887
+ break;
1888
+ case f.invalid_return_type:
1889
+ r = "Invalid function return type";
1890
+ break;
1891
+ case f.invalid_date:
1892
+ r = "Invalid date";
1893
+ break;
1894
+ case f.invalid_string:
1895
+ typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : R.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
1896
+ break;
1897
+ case f.too_small:
1898
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
1899
+ break;
1900
+ case f.too_big:
1901
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
1902
+ break;
1903
+ case f.custom:
1904
+ r = "Invalid input";
1905
+ break;
1906
+ case f.invalid_intersection_types:
1907
+ r = "Intersection results could not be merged";
1908
+ break;
1909
+ case f.not_multiple_of:
1910
+ r = `Number must be a multiple of ${t.multipleOf}`;
1911
+ break;
1912
+ case f.not_finite:
1913
+ r = "Number must be finite";
1914
+ break;
1915
+ default:
1916
+ r = e.defaultError, R.assertNever(t);
1917
+ }
1918
+ return { message: r };
1919
+ };
1920
+ let Jn = be;
1921
+ function ut() {
1922
+ return Jn;
1923
+ }
1924
+ const lt = (t) => {
1925
+ const { data: e, path: r, errorMaps: n, issueData: s } = t, i = [...r, ...s.path || []], a = {
1926
+ ...s,
1927
+ path: i
1928
+ };
1929
+ if (s.message !== void 0)
1930
+ return {
1931
+ ...s,
1932
+ path: i,
1933
+ message: s.message
1934
+ };
1935
+ let o = "";
1936
+ const d = n.filter((c) => !!c).slice().reverse();
1937
+ for (const c of d)
1938
+ o = c(a, { data: e, defaultError: o }).message;
1939
+ return {
1940
+ ...s,
1941
+ path: i,
1942
+ message: o
1943
+ };
1944
+ };
1945
+ function h(t, e) {
1946
+ const r = ut(), n = lt({
1947
+ issueData: e,
1948
+ data: t.data,
1949
+ path: t.path,
1950
+ errorMaps: [
1951
+ t.common.contextualErrorMap,
1952
+ // contextual error map is first priority
1953
+ t.schemaErrorMap,
1954
+ // then schema-bound map if available
1955
+ r,
1956
+ // then global override map
1957
+ r === be ? void 0 : be
1958
+ // then global default map
1959
+ ].filter((s) => !!s)
1960
+ });
1961
+ t.common.issues.push(n);
1962
+ }
1963
+ class D {
1964
+ constructor() {
1965
+ this.value = "valid";
1966
+ }
1967
+ dirty() {
1968
+ this.value === "valid" && (this.value = "dirty");
1969
+ }
1970
+ abort() {
1971
+ this.value !== "aborted" && (this.value = "aborted");
1972
+ }
1973
+ static mergeArray(e, r) {
1974
+ const n = [];
1975
+ for (const s of r) {
1976
+ if (s.status === "aborted")
1977
+ return b;
1978
+ s.status === "dirty" && e.dirty(), n.push(s.value);
1979
+ }
1980
+ return { status: e.value, value: n };
1981
+ }
1982
+ static async mergeObjectAsync(e, r) {
1983
+ const n = [];
1984
+ for (const s of r) {
1985
+ const i = await s.key, a = await s.value;
1986
+ n.push({
1987
+ key: i,
1988
+ value: a
1989
+ });
1990
+ }
1991
+ return D.mergeObjectSync(e, n);
1992
+ }
1993
+ static mergeObjectSync(e, r) {
1994
+ const n = {};
1995
+ for (const s of r) {
1996
+ const { key: i, value: a } = s;
1997
+ if (i.status === "aborted" || a.status === "aborted")
1998
+ return b;
1999
+ i.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), i.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) && (n[i.value] = a.value);
2000
+ }
2001
+ return { status: e.value, value: n };
2002
+ }
2003
+ }
2004
+ const b = Object.freeze({
2005
+ status: "aborted"
2006
+ }), me = (t) => ({ status: "dirty", value: t }), F = (t) => ({ status: "valid", value: t }), Ut = (t) => t.status === "aborted", Ft = (t) => t.status === "dirty", ce = (t) => t.status === "valid", Ne = (t) => typeof Promise < "u" && t instanceof Promise;
2007
+ function je(t, e, r, n) {
2008
+ if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
2009
+ return e.get(t);
2010
+ }
2011
+ function dr(t, e, r, n, s) {
2012
+ if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2013
+ return e.set(t, r), r;
2014
+ }
2015
+ var y;
2016
+ (function(t) {
2017
+ t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
2018
+ })(y || (y = {}));
2019
+ var ye, ge;
2020
+ class q {
2021
+ constructor(e, r, n, s) {
2022
+ this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
2023
+ }
2024
+ get path() {
2025
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
2026
+ }
2027
+ }
2028
+ const Zt = (t, e) => {
2029
+ if (ce(e))
2030
+ return { success: !0, data: e.value };
2031
+ if (!t.common.issues.length)
2032
+ throw new Error("Validation failed but no issues detected.");
2033
+ return {
2034
+ success: !1,
2035
+ get error() {
2036
+ if (this._error)
2037
+ return this._error;
2038
+ const r = new Z(t.common.issues);
2039
+ return this._error = r, this._error;
2040
+ }
2041
+ };
2042
+ };
2043
+ function x(t) {
2044
+ if (!t)
2045
+ return {};
2046
+ const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
2047
+ if (e && (r || n))
2048
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
2049
+ return e ? { errorMap: e, description: s } : { errorMap: (a, o) => {
2050
+ var d, c;
2051
+ const { message: l } = t;
2052
+ return a.code === "invalid_enum_value" ? { message: l ?? o.defaultError } : typeof o.data > "u" ? { message: (d = l ?? n) !== null && d !== void 0 ? d : o.defaultError } : a.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = l ?? r) !== null && c !== void 0 ? c : o.defaultError };
2053
+ }, description: s };
2054
+ }
2055
+ class E {
2056
+ get description() {
2057
+ return this._def.description;
2058
+ }
2059
+ _getType(e) {
2060
+ return Y(e.data);
2061
+ }
2062
+ _getOrReturnCtx(e, r) {
2063
+ return r || {
2064
+ common: e.parent.common,
2065
+ data: e.data,
2066
+ parsedType: Y(e.data),
2067
+ schemaErrorMap: this._def.errorMap,
2068
+ path: e.path,
2069
+ parent: e.parent
2070
+ };
2071
+ }
2072
+ _processInputParams(e) {
2073
+ return {
2074
+ status: new D(),
2075
+ ctx: {
2076
+ common: e.parent.common,
2077
+ data: e.data,
2078
+ parsedType: Y(e.data),
2079
+ schemaErrorMap: this._def.errorMap,
2080
+ path: e.path,
2081
+ parent: e.parent
2082
+ }
2083
+ };
2084
+ }
2085
+ _parseSync(e) {
2086
+ const r = this._parse(e);
2087
+ if (Ne(r))
2088
+ throw new Error("Synchronous parse encountered promise.");
2089
+ return r;
2090
+ }
2091
+ _parseAsync(e) {
2092
+ const r = this._parse(e);
2093
+ return Promise.resolve(r);
2094
+ }
2095
+ parse(e, r) {
2096
+ const n = this.safeParse(e, r);
2097
+ if (n.success)
2098
+ return n.data;
2099
+ throw n.error;
2100
+ }
2101
+ safeParse(e, r) {
2102
+ var n;
2103
+ const s = {
2104
+ common: {
2105
+ issues: [],
2106
+ async: (n = r?.async) !== null && n !== void 0 ? n : !1,
2107
+ contextualErrorMap: r?.errorMap
2108
+ },
2109
+ path: r?.path || [],
2110
+ schemaErrorMap: this._def.errorMap,
2111
+ parent: null,
2112
+ data: e,
2113
+ parsedType: Y(e)
2114
+ }, i = this._parseSync({ data: e, path: s.path, parent: s });
2115
+ return Zt(s, i);
2116
+ }
2117
+ "~validate"(e) {
2118
+ var r, n;
2119
+ const s = {
2120
+ common: {
2121
+ issues: [],
2122
+ async: !!this["~standard"].async
2123
+ },
2124
+ path: [],
2125
+ schemaErrorMap: this._def.errorMap,
2126
+ parent: null,
2127
+ data: e,
2128
+ parsedType: Y(e)
2129
+ };
2130
+ if (!this["~standard"].async)
2131
+ try {
2132
+ const i = this._parseSync({ data: e, path: [], parent: s });
2133
+ return ce(i) ? {
2134
+ value: i.value
2135
+ } : {
2136
+ issues: s.common.issues
2137
+ };
2138
+ } catch (i) {
2139
+ !((n = (r = i?.message) === null || r === void 0 ? void 0 : r.toLowerCase()) === null || n === void 0) && n.includes("encountered") && (this["~standard"].async = !0), s.common = {
2140
+ issues: [],
2141
+ async: !0
2142
+ };
2143
+ }
2144
+ return this._parseAsync({ data: e, path: [], parent: s }).then((i) => ce(i) ? {
2145
+ value: i.value
2146
+ } : {
2147
+ issues: s.common.issues
2148
+ });
2149
+ }
2150
+ async parseAsync(e, r) {
2151
+ const n = await this.safeParseAsync(e, r);
2152
+ if (n.success)
2153
+ return n.data;
2154
+ throw n.error;
2155
+ }
2156
+ async safeParseAsync(e, r) {
2157
+ const n = {
2158
+ common: {
2159
+ issues: [],
2160
+ contextualErrorMap: r?.errorMap,
2161
+ async: !0
2162
+ },
2163
+ path: r?.path || [],
2164
+ schemaErrorMap: this._def.errorMap,
2165
+ parent: null,
2166
+ data: e,
2167
+ parsedType: Y(e)
2168
+ }, s = this._parse({ data: e, path: n.path, parent: n }), i = await (Ne(s) ? s : Promise.resolve(s));
2169
+ return Zt(n, i);
2170
+ }
2171
+ refine(e, r) {
2172
+ const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
2173
+ return this._refinement((s, i) => {
2174
+ const a = e(s), o = () => i.addIssue({
2175
+ code: f.custom,
2176
+ ...n(s)
2177
+ });
2178
+ return typeof Promise < "u" && a instanceof Promise ? a.then((d) => d ? !0 : (o(), !1)) : a ? !0 : (o(), !1);
2179
+ });
2180
+ }
2181
+ refinement(e, r) {
2182
+ return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
2183
+ }
2184
+ _refinement(e) {
2185
+ return new X({
2186
+ schema: this,
2187
+ typeName: v.ZodEffects,
2188
+ effect: { type: "refinement", refinement: e }
2189
+ });
2190
+ }
2191
+ superRefine(e) {
2192
+ return this._refinement(e);
2193
+ }
2194
+ constructor(e) {
2195
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
2196
+ version: 1,
2197
+ vendor: "zod",
2198
+ validate: (r) => this["~validate"](r)
2199
+ };
2200
+ }
2201
+ optional() {
2202
+ return J.create(this, this._def);
2203
+ }
2204
+ nullable() {
2205
+ return ie.create(this, this._def);
2206
+ }
2207
+ nullish() {
2208
+ return this.nullable().optional();
2209
+ }
2210
+ array() {
2211
+ return z.create(this);
2212
+ }
2213
+ promise() {
2214
+ return xe.create(this, this._def);
2215
+ }
2216
+ or(e) {
2217
+ return Ie.create([this, e], this._def);
2218
+ }
2219
+ and(e) {
2220
+ return Le.create(this, e, this._def);
2221
+ }
2222
+ transform(e) {
2223
+ return new X({
2224
+ ...x(this._def),
2225
+ schema: this,
2226
+ typeName: v.ZodEffects,
2227
+ effect: { type: "transform", transform: e }
2228
+ });
2229
+ }
2230
+ default(e) {
2231
+ const r = typeof e == "function" ? e : () => e;
2232
+ return new Me({
2233
+ ...x(this._def),
2234
+ innerType: this,
2235
+ defaultValue: r,
2236
+ typeName: v.ZodDefault
2237
+ });
2238
+ }
2239
+ brand() {
2240
+ return new mr({
2241
+ typeName: v.ZodBranded,
2242
+ type: this,
2243
+ ...x(this._def)
2244
+ });
2245
+ }
2246
+ catch(e) {
2247
+ const r = typeof e == "function" ? e : () => e;
2248
+ return new Be({
2249
+ ...x(this._def),
2250
+ innerType: this,
2251
+ catchValue: r,
2252
+ typeName: v.ZodCatch
2253
+ });
2254
+ }
2255
+ describe(e) {
2256
+ const r = this.constructor;
2257
+ return new r({
2258
+ ...this._def,
2259
+ description: e
2260
+ });
2261
+ }
2262
+ pipe(e) {
2263
+ return Ge.create(this, e);
2264
+ }
2265
+ readonly() {
2266
+ return ze.create(this);
2267
+ }
2268
+ isOptional() {
2269
+ return this.safeParse(void 0).success;
2270
+ }
2271
+ isNullable() {
2272
+ return this.safeParse(null).success;
2273
+ }
2274
+ }
2275
+ const Kn = /^c[^\s-]{8,}$/i, Xn = /^[0-9a-z]+$/, Gn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Yn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Qn = /^[a-z0-9_-]{21}$/i, es = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, ts = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, rs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ns = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2276
+ let tt;
2277
+ const ss = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, is = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, as = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, os = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, cs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, us = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, fr = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", ls = new RegExp(`^${fr}$`);
2278
+ function hr(t) {
2279
+ let e = "[0-5]\\d";
2280
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
2281
+ const r = t.precision ? "+" : "?";
2282
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
2283
+ }
2284
+ function ds(t) {
2285
+ return new RegExp(`^${hr(t)}$`);
2286
+ }
2287
+ function fs(t) {
2288
+ let e = `${fr}T${hr(t)}`;
2289
+ const r = [];
2290
+ return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
2291
+ }
2292
+ function hs(t, e) {
2293
+ return !!((e === "v4" || !e) && ss.test(t) || (e === "v6" || !e) && as.test(t));
2294
+ }
2295
+ function ps(t, e) {
2296
+ if (!es.test(t))
2297
+ return !1;
2298
+ try {
2299
+ const [r] = t.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(n));
2300
+ return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
2301
+ } catch {
2302
+ return !1;
2303
+ }
2304
+ }
2305
+ function ms(t, e) {
2306
+ return !!((e === "v4" || !e) && is.test(t) || (e === "v6" || !e) && os.test(t));
2307
+ }
2308
+ class W extends E {
2309
+ _parse(e) {
2310
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
2311
+ const i = this._getOrReturnCtx(e);
2312
+ return h(i, {
2313
+ code: f.invalid_type,
2314
+ expected: p.string,
2315
+ received: i.parsedType
2316
+ }), b;
2317
+ }
2318
+ const n = new D();
2319
+ let s;
2320
+ for (const i of this._def.checks)
2321
+ if (i.kind === "min")
2322
+ e.data.length < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2323
+ code: f.too_small,
2324
+ minimum: i.value,
2325
+ type: "string",
2326
+ inclusive: !0,
2327
+ exact: !1,
2328
+ message: i.message
2329
+ }), n.dirty());
2330
+ else if (i.kind === "max")
2331
+ e.data.length > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
2332
+ code: f.too_big,
2333
+ maximum: i.value,
2334
+ type: "string",
2335
+ inclusive: !0,
2336
+ exact: !1,
2337
+ message: i.message
2338
+ }), n.dirty());
2339
+ else if (i.kind === "length") {
2340
+ const a = e.data.length > i.value, o = e.data.length < i.value;
2341
+ (a || o) && (s = this._getOrReturnCtx(e, s), a ? h(s, {
2342
+ code: f.too_big,
2343
+ maximum: i.value,
2344
+ type: "string",
2345
+ inclusive: !0,
2346
+ exact: !0,
2347
+ message: i.message
2348
+ }) : o && h(s, {
2349
+ code: f.too_small,
2350
+ minimum: i.value,
2351
+ type: "string",
2352
+ inclusive: !0,
2353
+ exact: !0,
2354
+ message: i.message
2355
+ }), n.dirty());
2356
+ } else if (i.kind === "email")
2357
+ rs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2358
+ validation: "email",
2359
+ code: f.invalid_string,
2360
+ message: i.message
2361
+ }), n.dirty());
2362
+ else if (i.kind === "emoji")
2363
+ tt || (tt = new RegExp(ns, "u")), tt.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2364
+ validation: "emoji",
2365
+ code: f.invalid_string,
2366
+ message: i.message
2367
+ }), n.dirty());
2368
+ else if (i.kind === "uuid")
2369
+ Yn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2370
+ validation: "uuid",
2371
+ code: f.invalid_string,
2372
+ message: i.message
2373
+ }), n.dirty());
2374
+ else if (i.kind === "nanoid")
2375
+ Qn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2376
+ validation: "nanoid",
2377
+ code: f.invalid_string,
2378
+ message: i.message
2379
+ }), n.dirty());
2380
+ else if (i.kind === "cuid")
2381
+ Kn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2382
+ validation: "cuid",
2383
+ code: f.invalid_string,
2384
+ message: i.message
2385
+ }), n.dirty());
2386
+ else if (i.kind === "cuid2")
2387
+ Xn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2388
+ validation: "cuid2",
2389
+ code: f.invalid_string,
2390
+ message: i.message
2391
+ }), n.dirty());
2392
+ else if (i.kind === "ulid")
2393
+ Gn.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2394
+ validation: "ulid",
2395
+ code: f.invalid_string,
2396
+ message: i.message
2397
+ }), n.dirty());
2398
+ else if (i.kind === "url")
2399
+ try {
2400
+ new URL(e.data);
2401
+ } catch {
2402
+ s = this._getOrReturnCtx(e, s), h(s, {
2403
+ validation: "url",
2404
+ code: f.invalid_string,
2405
+ message: i.message
2406
+ }), n.dirty();
2407
+ }
2408
+ else i.kind === "regex" ? (i.regex.lastIndex = 0, i.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2409
+ validation: "regex",
2410
+ code: f.invalid_string,
2411
+ message: i.message
2412
+ }), n.dirty())) : i.kind === "trim" ? e.data = e.data.trim() : i.kind === "includes" ? e.data.includes(i.value, i.position) || (s = this._getOrReturnCtx(e, s), h(s, {
2413
+ code: f.invalid_string,
2414
+ validation: { includes: i.value, position: i.position },
2415
+ message: i.message
2416
+ }), n.dirty()) : i.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : i.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : i.kind === "startsWith" ? e.data.startsWith(i.value) || (s = this._getOrReturnCtx(e, s), h(s, {
2417
+ code: f.invalid_string,
2418
+ validation: { startsWith: i.value },
2419
+ message: i.message
2420
+ }), n.dirty()) : i.kind === "endsWith" ? e.data.endsWith(i.value) || (s = this._getOrReturnCtx(e, s), h(s, {
2421
+ code: f.invalid_string,
2422
+ validation: { endsWith: i.value },
2423
+ message: i.message
2424
+ }), n.dirty()) : i.kind === "datetime" ? fs(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2425
+ code: f.invalid_string,
2426
+ validation: "datetime",
2427
+ message: i.message
2428
+ }), n.dirty()) : i.kind === "date" ? ls.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2429
+ code: f.invalid_string,
2430
+ validation: "date",
2431
+ message: i.message
2432
+ }), n.dirty()) : i.kind === "time" ? ds(i).test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2433
+ code: f.invalid_string,
2434
+ validation: "time",
2435
+ message: i.message
2436
+ }), n.dirty()) : i.kind === "duration" ? ts.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2437
+ validation: "duration",
2438
+ code: f.invalid_string,
2439
+ message: i.message
2440
+ }), n.dirty()) : i.kind === "ip" ? hs(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2441
+ validation: "ip",
2442
+ code: f.invalid_string,
2443
+ message: i.message
2444
+ }), n.dirty()) : i.kind === "jwt" ? ps(e.data, i.alg) || (s = this._getOrReturnCtx(e, s), h(s, {
2445
+ validation: "jwt",
2446
+ code: f.invalid_string,
2447
+ message: i.message
2448
+ }), n.dirty()) : i.kind === "cidr" ? ms(e.data, i.version) || (s = this._getOrReturnCtx(e, s), h(s, {
2449
+ validation: "cidr",
2450
+ code: f.invalid_string,
2451
+ message: i.message
2452
+ }), n.dirty()) : i.kind === "base64" ? cs.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2453
+ validation: "base64",
2454
+ code: f.invalid_string,
2455
+ message: i.message
2456
+ }), n.dirty()) : i.kind === "base64url" ? us.test(e.data) || (s = this._getOrReturnCtx(e, s), h(s, {
2457
+ validation: "base64url",
2458
+ code: f.invalid_string,
2459
+ message: i.message
2460
+ }), n.dirty()) : R.assertNever(i);
2461
+ return { status: n.value, value: e.data };
2462
+ }
2463
+ _regex(e, r, n) {
2464
+ return this.refinement((s) => e.test(s), {
2465
+ validation: r,
2466
+ code: f.invalid_string,
2467
+ ...y.errToObj(n)
2468
+ });
2469
+ }
2470
+ _addCheck(e) {
2471
+ return new W({
2472
+ ...this._def,
2473
+ checks: [...this._def.checks, e]
2474
+ });
2475
+ }
2476
+ email(e) {
2477
+ return this._addCheck({ kind: "email", ...y.errToObj(e) });
2478
+ }
2479
+ url(e) {
2480
+ return this._addCheck({ kind: "url", ...y.errToObj(e) });
2481
+ }
2482
+ emoji(e) {
2483
+ return this._addCheck({ kind: "emoji", ...y.errToObj(e) });
2484
+ }
2485
+ uuid(e) {
2486
+ return this._addCheck({ kind: "uuid", ...y.errToObj(e) });
2487
+ }
2488
+ nanoid(e) {
2489
+ return this._addCheck({ kind: "nanoid", ...y.errToObj(e) });
2490
+ }
2491
+ cuid(e) {
2492
+ return this._addCheck({ kind: "cuid", ...y.errToObj(e) });
2493
+ }
2494
+ cuid2(e) {
2495
+ return this._addCheck({ kind: "cuid2", ...y.errToObj(e) });
2496
+ }
2497
+ ulid(e) {
2498
+ return this._addCheck({ kind: "ulid", ...y.errToObj(e) });
2499
+ }
2500
+ base64(e) {
2501
+ return this._addCheck({ kind: "base64", ...y.errToObj(e) });
2502
+ }
2503
+ base64url(e) {
2504
+ return this._addCheck({
2505
+ kind: "base64url",
2506
+ ...y.errToObj(e)
2507
+ });
2508
+ }
2509
+ jwt(e) {
2510
+ return this._addCheck({ kind: "jwt", ...y.errToObj(e) });
2511
+ }
2512
+ ip(e) {
2513
+ return this._addCheck({ kind: "ip", ...y.errToObj(e) });
2514
+ }
2515
+ cidr(e) {
2516
+ return this._addCheck({ kind: "cidr", ...y.errToObj(e) });
2517
+ }
2518
+ datetime(e) {
2519
+ var r, n;
2520
+ return typeof e == "string" ? this._addCheck({
2521
+ kind: "datetime",
2522
+ precision: null,
2523
+ offset: !1,
2524
+ local: !1,
2525
+ message: e
2526
+ }) : this._addCheck({
2527
+ kind: "datetime",
2528
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2529
+ offset: (r = e?.offset) !== null && r !== void 0 ? r : !1,
2530
+ local: (n = e?.local) !== null && n !== void 0 ? n : !1,
2531
+ ...y.errToObj(e?.message)
2532
+ });
2533
+ }
2534
+ date(e) {
2535
+ return this._addCheck({ kind: "date", message: e });
2536
+ }
2537
+ time(e) {
2538
+ return typeof e == "string" ? this._addCheck({
2539
+ kind: "time",
2540
+ precision: null,
2541
+ message: e
2542
+ }) : this._addCheck({
2543
+ kind: "time",
2544
+ precision: typeof e?.precision > "u" ? null : e?.precision,
2545
+ ...y.errToObj(e?.message)
2546
+ });
2547
+ }
2548
+ duration(e) {
2549
+ return this._addCheck({ kind: "duration", ...y.errToObj(e) });
2550
+ }
2551
+ regex(e, r) {
2552
+ return this._addCheck({
2553
+ kind: "regex",
2554
+ regex: e,
2555
+ ...y.errToObj(r)
2556
+ });
2557
+ }
2558
+ includes(e, r) {
2559
+ return this._addCheck({
2560
+ kind: "includes",
2561
+ value: e,
2562
+ position: r?.position,
2563
+ ...y.errToObj(r?.message)
2564
+ });
2565
+ }
2566
+ startsWith(e, r) {
2567
+ return this._addCheck({
2568
+ kind: "startsWith",
2569
+ value: e,
2570
+ ...y.errToObj(r)
2571
+ });
2572
+ }
2573
+ endsWith(e, r) {
2574
+ return this._addCheck({
2575
+ kind: "endsWith",
2576
+ value: e,
2577
+ ...y.errToObj(r)
2578
+ });
2579
+ }
2580
+ min(e, r) {
2581
+ return this._addCheck({
2582
+ kind: "min",
2583
+ value: e,
2584
+ ...y.errToObj(r)
2585
+ });
2586
+ }
2587
+ max(e, r) {
2588
+ return this._addCheck({
2589
+ kind: "max",
2590
+ value: e,
2591
+ ...y.errToObj(r)
2592
+ });
2593
+ }
2594
+ length(e, r) {
2595
+ return this._addCheck({
2596
+ kind: "length",
2597
+ value: e,
2598
+ ...y.errToObj(r)
2599
+ });
2600
+ }
2601
+ /**
2602
+ * Equivalent to `.min(1)`
2603
+ */
2604
+ nonempty(e) {
2605
+ return this.min(1, y.errToObj(e));
2606
+ }
2607
+ trim() {
2608
+ return new W({
2609
+ ...this._def,
2610
+ checks: [...this._def.checks, { kind: "trim" }]
2611
+ });
2612
+ }
2613
+ toLowerCase() {
2614
+ return new W({
2615
+ ...this._def,
2616
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
2617
+ });
2618
+ }
2619
+ toUpperCase() {
2620
+ return new W({
2621
+ ...this._def,
2622
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
2623
+ });
2624
+ }
2625
+ get isDatetime() {
2626
+ return !!this._def.checks.find((e) => e.kind === "datetime");
2627
+ }
2628
+ get isDate() {
2629
+ return !!this._def.checks.find((e) => e.kind === "date");
2630
+ }
2631
+ get isTime() {
2632
+ return !!this._def.checks.find((e) => e.kind === "time");
2633
+ }
2634
+ get isDuration() {
2635
+ return !!this._def.checks.find((e) => e.kind === "duration");
2636
+ }
2637
+ get isEmail() {
2638
+ return !!this._def.checks.find((e) => e.kind === "email");
2639
+ }
2640
+ get isURL() {
2641
+ return !!this._def.checks.find((e) => e.kind === "url");
2642
+ }
2643
+ get isEmoji() {
2644
+ return !!this._def.checks.find((e) => e.kind === "emoji");
2645
+ }
2646
+ get isUUID() {
2647
+ return !!this._def.checks.find((e) => e.kind === "uuid");
2648
+ }
2649
+ get isNANOID() {
2650
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
2651
+ }
2652
+ get isCUID() {
2653
+ return !!this._def.checks.find((e) => e.kind === "cuid");
2654
+ }
2655
+ get isCUID2() {
2656
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
2657
+ }
2658
+ get isULID() {
2659
+ return !!this._def.checks.find((e) => e.kind === "ulid");
2660
+ }
2661
+ get isIP() {
2662
+ return !!this._def.checks.find((e) => e.kind === "ip");
2663
+ }
2664
+ get isCIDR() {
2665
+ return !!this._def.checks.find((e) => e.kind === "cidr");
2666
+ }
2667
+ get isBase64() {
2668
+ return !!this._def.checks.find((e) => e.kind === "base64");
2669
+ }
2670
+ get isBase64url() {
2671
+ return !!this._def.checks.find((e) => e.kind === "base64url");
2672
+ }
2673
+ get minLength() {
2674
+ let e = null;
2675
+ for (const r of this._def.checks)
2676
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2677
+ return e;
2678
+ }
2679
+ get maxLength() {
2680
+ let e = null;
2681
+ for (const r of this._def.checks)
2682
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2683
+ return e;
2684
+ }
2685
+ }
2686
+ W.create = (t) => {
2687
+ var e;
2688
+ return new W({
2689
+ checks: [],
2690
+ typeName: v.ZodString,
2691
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
2692
+ ...x(t)
2693
+ });
2694
+ };
2695
+ function ys(t, e) {
2696
+ const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, i = parseInt(t.toFixed(s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
2697
+ return i % a / Math.pow(10, s);
2698
+ }
2699
+ class ue extends E {
2700
+ constructor() {
2701
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2702
+ }
2703
+ _parse(e) {
2704
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
2705
+ const i = this._getOrReturnCtx(e);
2706
+ return h(i, {
2707
+ code: f.invalid_type,
2708
+ expected: p.number,
2709
+ received: i.parsedType
2710
+ }), b;
2711
+ }
2712
+ let n;
2713
+ const s = new D();
2714
+ for (const i of this._def.checks)
2715
+ i.kind === "int" ? R.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2716
+ code: f.invalid_type,
2717
+ expected: "integer",
2718
+ received: "float",
2719
+ message: i.message
2720
+ }), s.dirty()) : i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2721
+ code: f.too_small,
2722
+ minimum: i.value,
2723
+ type: "number",
2724
+ inclusive: i.inclusive,
2725
+ exact: !1,
2726
+ message: i.message
2727
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2728
+ code: f.too_big,
2729
+ maximum: i.value,
2730
+ type: "number",
2731
+ inclusive: i.inclusive,
2732
+ exact: !1,
2733
+ message: i.message
2734
+ }), s.dirty()) : i.kind === "multipleOf" ? ys(e.data, i.value) !== 0 && (n = this._getOrReturnCtx(e, n), h(n, {
2735
+ code: f.not_multiple_of,
2736
+ multipleOf: i.value,
2737
+ message: i.message
2738
+ }), s.dirty()) : i.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
2739
+ code: f.not_finite,
2740
+ message: i.message
2741
+ }), s.dirty()) : R.assertNever(i);
2742
+ return { status: s.value, value: e.data };
2743
+ }
2744
+ gte(e, r) {
2745
+ return this.setLimit("min", e, !0, y.toString(r));
2746
+ }
2747
+ gt(e, r) {
2748
+ return this.setLimit("min", e, !1, y.toString(r));
2749
+ }
2750
+ lte(e, r) {
2751
+ return this.setLimit("max", e, !0, y.toString(r));
2752
+ }
2753
+ lt(e, r) {
2754
+ return this.setLimit("max", e, !1, y.toString(r));
2755
+ }
2756
+ setLimit(e, r, n, s) {
2757
+ return new ue({
2758
+ ...this._def,
2759
+ checks: [
2760
+ ...this._def.checks,
2761
+ {
2762
+ kind: e,
2763
+ value: r,
2764
+ inclusive: n,
2765
+ message: y.toString(s)
2766
+ }
2767
+ ]
2768
+ });
2769
+ }
2770
+ _addCheck(e) {
2771
+ return new ue({
2772
+ ...this._def,
2773
+ checks: [...this._def.checks, e]
2774
+ });
2775
+ }
2776
+ int(e) {
2777
+ return this._addCheck({
2778
+ kind: "int",
2779
+ message: y.toString(e)
2780
+ });
2781
+ }
2782
+ positive(e) {
2783
+ return this._addCheck({
2784
+ kind: "min",
2785
+ value: 0,
2786
+ inclusive: !1,
2787
+ message: y.toString(e)
2788
+ });
2789
+ }
2790
+ negative(e) {
2791
+ return this._addCheck({
2792
+ kind: "max",
2793
+ value: 0,
2794
+ inclusive: !1,
2795
+ message: y.toString(e)
2796
+ });
2797
+ }
2798
+ nonpositive(e) {
2799
+ return this._addCheck({
2800
+ kind: "max",
2801
+ value: 0,
2802
+ inclusive: !0,
2803
+ message: y.toString(e)
2804
+ });
2805
+ }
2806
+ nonnegative(e) {
2807
+ return this._addCheck({
2808
+ kind: "min",
2809
+ value: 0,
2810
+ inclusive: !0,
2811
+ message: y.toString(e)
2812
+ });
2813
+ }
2814
+ multipleOf(e, r) {
2815
+ return this._addCheck({
2816
+ kind: "multipleOf",
2817
+ value: e,
2818
+ message: y.toString(r)
2819
+ });
2820
+ }
2821
+ finite(e) {
2822
+ return this._addCheck({
2823
+ kind: "finite",
2824
+ message: y.toString(e)
2825
+ });
2826
+ }
2827
+ safe(e) {
2828
+ return this._addCheck({
2829
+ kind: "min",
2830
+ inclusive: !0,
2831
+ value: Number.MIN_SAFE_INTEGER,
2832
+ message: y.toString(e)
2833
+ })._addCheck({
2834
+ kind: "max",
2835
+ inclusive: !0,
2836
+ value: Number.MAX_SAFE_INTEGER,
2837
+ message: y.toString(e)
2838
+ });
2839
+ }
2840
+ get minValue() {
2841
+ let e = null;
2842
+ for (const r of this._def.checks)
2843
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2844
+ return e;
2845
+ }
2846
+ get maxValue() {
2847
+ let e = null;
2848
+ for (const r of this._def.checks)
2849
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2850
+ return e;
2851
+ }
2852
+ get isInt() {
2853
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && R.isInteger(e.value));
2854
+ }
2855
+ get isFinite() {
2856
+ let e = null, r = null;
2857
+ for (const n of this._def.checks) {
2858
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
2859
+ return !0;
2860
+ n.kind === "min" ? (r === null || n.value > r) && (r = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
2861
+ }
2862
+ return Number.isFinite(r) && Number.isFinite(e);
2863
+ }
2864
+ }
2865
+ ue.create = (t) => new ue({
2866
+ checks: [],
2867
+ typeName: v.ZodNumber,
2868
+ coerce: t?.coerce || !1,
2869
+ ...x(t)
2870
+ });
2871
+ class le extends E {
2872
+ constructor() {
2873
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2874
+ }
2875
+ _parse(e) {
2876
+ if (this._def.coerce)
2877
+ try {
2878
+ e.data = BigInt(e.data);
2879
+ } catch {
2880
+ return this._getInvalidInput(e);
2881
+ }
2882
+ if (this._getType(e) !== p.bigint)
2883
+ return this._getInvalidInput(e);
2884
+ let n;
2885
+ const s = new D();
2886
+ for (const i of this._def.checks)
2887
+ i.kind === "min" ? (i.inclusive ? e.data < i.value : e.data <= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2888
+ code: f.too_small,
2889
+ type: "bigint",
2890
+ minimum: i.value,
2891
+ inclusive: i.inclusive,
2892
+ message: i.message
2893
+ }), s.dirty()) : i.kind === "max" ? (i.inclusive ? e.data > i.value : e.data >= i.value) && (n = this._getOrReturnCtx(e, n), h(n, {
2894
+ code: f.too_big,
2895
+ type: "bigint",
2896
+ maximum: i.value,
2897
+ inclusive: i.inclusive,
2898
+ message: i.message
2899
+ }), s.dirty()) : i.kind === "multipleOf" ? e.data % i.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), h(n, {
2900
+ code: f.not_multiple_of,
2901
+ multipleOf: i.value,
2902
+ message: i.message
2903
+ }), s.dirty()) : R.assertNever(i);
2904
+ return { status: s.value, value: e.data };
2905
+ }
2906
+ _getInvalidInput(e) {
2907
+ const r = this._getOrReturnCtx(e);
2908
+ return h(r, {
2909
+ code: f.invalid_type,
2910
+ expected: p.bigint,
2911
+ received: r.parsedType
2912
+ }), b;
2913
+ }
2914
+ gte(e, r) {
2915
+ return this.setLimit("min", e, !0, y.toString(r));
2916
+ }
2917
+ gt(e, r) {
2918
+ return this.setLimit("min", e, !1, y.toString(r));
2919
+ }
2920
+ lte(e, r) {
2921
+ return this.setLimit("max", e, !0, y.toString(r));
2922
+ }
2923
+ lt(e, r) {
2924
+ return this.setLimit("max", e, !1, y.toString(r));
2925
+ }
2926
+ setLimit(e, r, n, s) {
2927
+ return new le({
2928
+ ...this._def,
2929
+ checks: [
2930
+ ...this._def.checks,
2931
+ {
2932
+ kind: e,
2933
+ value: r,
2934
+ inclusive: n,
2935
+ message: y.toString(s)
2936
+ }
2937
+ ]
2938
+ });
2939
+ }
2940
+ _addCheck(e) {
2941
+ return new le({
2942
+ ...this._def,
2943
+ checks: [...this._def.checks, e]
2944
+ });
2945
+ }
2946
+ positive(e) {
2947
+ return this._addCheck({
2948
+ kind: "min",
2949
+ value: BigInt(0),
2950
+ inclusive: !1,
2951
+ message: y.toString(e)
2952
+ });
2953
+ }
2954
+ negative(e) {
2955
+ return this._addCheck({
2956
+ kind: "max",
2957
+ value: BigInt(0),
2958
+ inclusive: !1,
2959
+ message: y.toString(e)
2960
+ });
2961
+ }
2962
+ nonpositive(e) {
2963
+ return this._addCheck({
2964
+ kind: "max",
2965
+ value: BigInt(0),
2966
+ inclusive: !0,
2967
+ message: y.toString(e)
2968
+ });
2969
+ }
2970
+ nonnegative(e) {
2971
+ return this._addCheck({
2972
+ kind: "min",
2973
+ value: BigInt(0),
2974
+ inclusive: !0,
2975
+ message: y.toString(e)
2976
+ });
2977
+ }
2978
+ multipleOf(e, r) {
2979
+ return this._addCheck({
2980
+ kind: "multipleOf",
2981
+ value: e,
2982
+ message: y.toString(r)
2983
+ });
2984
+ }
2985
+ get minValue() {
2986
+ let e = null;
2987
+ for (const r of this._def.checks)
2988
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2989
+ return e;
2990
+ }
2991
+ get maxValue() {
2992
+ let e = null;
2993
+ for (const r of this._def.checks)
2994
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2995
+ return e;
2996
+ }
2997
+ }
2998
+ le.create = (t) => {
2999
+ var e;
3000
+ return new le({
3001
+ checks: [],
3002
+ typeName: v.ZodBigInt,
3003
+ coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
3004
+ ...x(t)
3005
+ });
3006
+ };
3007
+ class dt extends E {
3008
+ _parse(e) {
3009
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
3010
+ const n = this._getOrReturnCtx(e);
3011
+ return h(n, {
3012
+ code: f.invalid_type,
3013
+ expected: p.boolean,
3014
+ received: n.parsedType
3015
+ }), b;
3016
+ }
3017
+ return F(e.data);
3018
+ }
3019
+ }
3020
+ dt.create = (t) => new dt({
3021
+ typeName: v.ZodBoolean,
3022
+ coerce: t?.coerce || !1,
3023
+ ...x(t)
3024
+ });
3025
+ class we extends E {
3026
+ _parse(e) {
3027
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
3028
+ const i = this._getOrReturnCtx(e);
3029
+ return h(i, {
3030
+ code: f.invalid_type,
3031
+ expected: p.date,
3032
+ received: i.parsedType
3033
+ }), b;
3034
+ }
3035
+ if (isNaN(e.data.getTime())) {
3036
+ const i = this._getOrReturnCtx(e);
3037
+ return h(i, {
3038
+ code: f.invalid_date
3039
+ }), b;
3040
+ }
3041
+ const n = new D();
3042
+ let s;
3043
+ for (const i of this._def.checks)
3044
+ i.kind === "min" ? e.data.getTime() < i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3045
+ code: f.too_small,
3046
+ message: i.message,
3047
+ inclusive: !0,
3048
+ exact: !1,
3049
+ minimum: i.value,
3050
+ type: "date"
3051
+ }), n.dirty()) : i.kind === "max" ? e.data.getTime() > i.value && (s = this._getOrReturnCtx(e, s), h(s, {
3052
+ code: f.too_big,
3053
+ message: i.message,
3054
+ inclusive: !0,
3055
+ exact: !1,
3056
+ maximum: i.value,
3057
+ type: "date"
3058
+ }), n.dirty()) : R.assertNever(i);
3059
+ return {
3060
+ status: n.value,
3061
+ value: new Date(e.data.getTime())
3062
+ };
3063
+ }
3064
+ _addCheck(e) {
3065
+ return new we({
3066
+ ...this._def,
3067
+ checks: [...this._def.checks, e]
3068
+ });
3069
+ }
3070
+ min(e, r) {
3071
+ return this._addCheck({
3072
+ kind: "min",
3073
+ value: e.getTime(),
3074
+ message: y.toString(r)
3075
+ });
3076
+ }
3077
+ max(e, r) {
3078
+ return this._addCheck({
3079
+ kind: "max",
3080
+ value: e.getTime(),
3081
+ message: y.toString(r)
3082
+ });
3083
+ }
3084
+ get minDate() {
3085
+ let e = null;
3086
+ for (const r of this._def.checks)
3087
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
3088
+ return e != null ? new Date(e) : null;
3089
+ }
3090
+ get maxDate() {
3091
+ let e = null;
3092
+ for (const r of this._def.checks)
3093
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
3094
+ return e != null ? new Date(e) : null;
3095
+ }
3096
+ }
3097
+ we.create = (t) => new we({
3098
+ checks: [],
3099
+ coerce: t?.coerce || !1,
3100
+ typeName: v.ZodDate,
3101
+ ...x(t)
3102
+ });
3103
+ class ft extends E {
3104
+ _parse(e) {
3105
+ if (this._getType(e) !== p.symbol) {
3106
+ const n = this._getOrReturnCtx(e);
3107
+ return h(n, {
3108
+ code: f.invalid_type,
3109
+ expected: p.symbol,
3110
+ received: n.parsedType
3111
+ }), b;
3112
+ }
3113
+ return F(e.data);
3114
+ }
3115
+ }
3116
+ ft.create = (t) => new ft({
3117
+ typeName: v.ZodSymbol,
3118
+ ...x(t)
3119
+ });
3120
+ class Pe extends E {
3121
+ _parse(e) {
3122
+ if (this._getType(e) !== p.undefined) {
3123
+ const n = this._getOrReturnCtx(e);
3124
+ return h(n, {
3125
+ code: f.invalid_type,
3126
+ expected: p.undefined,
3127
+ received: n.parsedType
3128
+ }), b;
3129
+ }
3130
+ return F(e.data);
3131
+ }
3132
+ }
3133
+ Pe.create = (t) => new Pe({
3134
+ typeName: v.ZodUndefined,
3135
+ ...x(t)
3136
+ });
3137
+ class De extends E {
3138
+ _parse(e) {
3139
+ if (this._getType(e) !== p.null) {
3140
+ const n = this._getOrReturnCtx(e);
3141
+ return h(n, {
3142
+ code: f.invalid_type,
3143
+ expected: p.null,
3144
+ received: n.parsedType
3145
+ }), b;
3146
+ }
3147
+ return F(e.data);
3148
+ }
3149
+ }
3150
+ De.create = (t) => new De({
3151
+ typeName: v.ZodNull,
3152
+ ...x(t)
3153
+ });
3154
+ class ht extends E {
3155
+ constructor() {
3156
+ super(...arguments), this._any = !0;
3157
+ }
3158
+ _parse(e) {
3159
+ return F(e.data);
3160
+ }
3161
+ }
3162
+ ht.create = (t) => new ht({
3163
+ typeName: v.ZodAny,
3164
+ ...x(t)
3165
+ });
3166
+ class oe extends E {
3167
+ constructor() {
3168
+ super(...arguments), this._unknown = !0;
3169
+ }
3170
+ _parse(e) {
3171
+ return F(e.data);
3172
+ }
3173
+ }
3174
+ oe.create = (t) => new oe({
3175
+ typeName: v.ZodUnknown,
3176
+ ...x(t)
3177
+ });
3178
+ class Q extends E {
3179
+ _parse(e) {
3180
+ const r = this._getOrReturnCtx(e);
3181
+ return h(r, {
3182
+ code: f.invalid_type,
3183
+ expected: p.never,
3184
+ received: r.parsedType
3185
+ }), b;
3186
+ }
3187
+ }
3188
+ Q.create = (t) => new Q({
3189
+ typeName: v.ZodNever,
3190
+ ...x(t)
3191
+ });
3192
+ class pt extends E {
3193
+ _parse(e) {
3194
+ if (this._getType(e) !== p.undefined) {
3195
+ const n = this._getOrReturnCtx(e);
3196
+ return h(n, {
3197
+ code: f.invalid_type,
3198
+ expected: p.void,
3199
+ received: n.parsedType
3200
+ }), b;
3201
+ }
3202
+ return F(e.data);
3203
+ }
3204
+ }
3205
+ pt.create = (t) => new pt({
3206
+ typeName: v.ZodVoid,
3207
+ ...x(t)
3208
+ });
3209
+ class z extends E {
3210
+ _parse(e) {
3211
+ const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
3212
+ if (r.parsedType !== p.array)
3213
+ return h(r, {
3214
+ code: f.invalid_type,
3215
+ expected: p.array,
3216
+ received: r.parsedType
3217
+ }), b;
3218
+ if (s.exactLength !== null) {
3219
+ const a = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
3220
+ (a || o) && (h(r, {
3221
+ code: a ? f.too_big : f.too_small,
3222
+ minimum: o ? s.exactLength.value : void 0,
3223
+ maximum: a ? s.exactLength.value : void 0,
3224
+ type: "array",
3225
+ inclusive: !0,
3226
+ exact: !0,
3227
+ message: s.exactLength.message
3228
+ }), n.dirty());
3229
+ }
3230
+ if (s.minLength !== null && r.data.length < s.minLength.value && (h(r, {
3231
+ code: f.too_small,
3232
+ minimum: s.minLength.value,
3233
+ type: "array",
3234
+ inclusive: !0,
3235
+ exact: !1,
3236
+ message: s.minLength.message
3237
+ }), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (h(r, {
3238
+ code: f.too_big,
3239
+ maximum: s.maxLength.value,
3240
+ type: "array",
3241
+ inclusive: !0,
3242
+ exact: !1,
3243
+ message: s.maxLength.message
3244
+ }), n.dirty()), r.common.async)
3245
+ return Promise.all([...r.data].map((a, o) => s.type._parseAsync(new q(r, a, r.path, o)))).then((a) => D.mergeArray(n, a));
3246
+ const i = [...r.data].map((a, o) => s.type._parseSync(new q(r, a, r.path, o)));
3247
+ return D.mergeArray(n, i);
3248
+ }
3249
+ get element() {
3250
+ return this._def.type;
3251
+ }
3252
+ min(e, r) {
3253
+ return new z({
3254
+ ...this._def,
3255
+ minLength: { value: e, message: y.toString(r) }
3256
+ });
3257
+ }
3258
+ max(e, r) {
3259
+ return new z({
3260
+ ...this._def,
3261
+ maxLength: { value: e, message: y.toString(r) }
3262
+ });
3263
+ }
3264
+ length(e, r) {
3265
+ return new z({
3266
+ ...this._def,
3267
+ exactLength: { value: e, message: y.toString(r) }
3268
+ });
3269
+ }
3270
+ nonempty(e) {
3271
+ return this.min(1, e);
3272
+ }
3273
+ }
3274
+ z.create = (t, e) => new z({
3275
+ type: t,
3276
+ minLength: null,
3277
+ maxLength: null,
3278
+ exactLength: null,
3279
+ typeName: v.ZodArray,
3280
+ ...x(e)
3281
+ });
3282
+ function ae(t) {
3283
+ if (t instanceof A) {
3284
+ const e = {};
3285
+ for (const r in t.shape) {
3286
+ const n = t.shape[r];
3287
+ e[r] = J.create(ae(n));
3288
+ }
3289
+ return new A({
3290
+ ...t._def,
3291
+ shape: () => e
3292
+ });
3293
+ } else return t instanceof z ? new z({
3294
+ ...t._def,
3295
+ type: ae(t.element)
3296
+ }) : t instanceof J ? J.create(ae(t.unwrap())) : t instanceof ie ? ie.create(ae(t.unwrap())) : t instanceof K ? K.create(t.items.map((e) => ae(e))) : t;
3297
+ }
3298
+ class A extends E {
3299
+ constructor() {
3300
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
3301
+ }
3302
+ _getCached() {
3303
+ if (this._cached !== null)
3304
+ return this._cached;
3305
+ const e = this._def.shape(), r = R.objectKeys(e);
3306
+ return this._cached = { shape: e, keys: r };
3307
+ }
3308
+ _parse(e) {
3309
+ if (this._getType(e) !== p.object) {
3310
+ const c = this._getOrReturnCtx(e);
3311
+ return h(c, {
3312
+ code: f.invalid_type,
3313
+ expected: p.object,
3314
+ received: c.parsedType
3315
+ }), b;
3316
+ }
3317
+ const { status: n, ctx: s } = this._processInputParams(e), { shape: i, keys: a } = this._getCached(), o = [];
3318
+ if (!(this._def.catchall instanceof Q && this._def.unknownKeys === "strip"))
3319
+ for (const c in s.data)
3320
+ a.includes(c) || o.push(c);
3321
+ const d = [];
3322
+ for (const c of a) {
3323
+ const l = i[c], m = s.data[c];
3324
+ d.push({
3325
+ key: { status: "valid", value: c },
3326
+ value: l._parse(new q(s, m, s.path, c)),
3327
+ alwaysSet: c in s.data
3328
+ });
3329
+ }
3330
+ if (this._def.catchall instanceof Q) {
3331
+ const c = this._def.unknownKeys;
3332
+ if (c === "passthrough")
3333
+ for (const l of o)
3334
+ d.push({
3335
+ key: { status: "valid", value: l },
3336
+ value: { status: "valid", value: s.data[l] }
3337
+ });
3338
+ else if (c === "strict")
3339
+ o.length > 0 && (h(s, {
3340
+ code: f.unrecognized_keys,
3341
+ keys: o
3342
+ }), n.dirty());
3343
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
3344
+ } else {
3345
+ const c = this._def.catchall;
3346
+ for (const l of o) {
3347
+ const m = s.data[l];
3348
+ d.push({
3349
+ key: { status: "valid", value: l },
3350
+ value: c._parse(
3351
+ new q(s, m, s.path, l)
3352
+ //, ctx.child(key), value, getParsedType(value)
3353
+ ),
3354
+ alwaysSet: l in s.data
3355
+ });
3356
+ }
3357
+ }
3358
+ return s.common.async ? Promise.resolve().then(async () => {
3359
+ const c = [];
3360
+ for (const l of d) {
3361
+ const m = await l.key, T = await l.value;
3362
+ c.push({
3363
+ key: m,
3364
+ value: T,
3365
+ alwaysSet: l.alwaysSet
3366
+ });
3367
+ }
3368
+ return c;
3369
+ }).then((c) => D.mergeObjectSync(n, c)) : D.mergeObjectSync(n, d);
3370
+ }
3371
+ get shape() {
3372
+ return this._def.shape();
3373
+ }
3374
+ strict(e) {
3375
+ return y.errToObj, new A({
3376
+ ...this._def,
3377
+ unknownKeys: "strict",
3378
+ ...e !== void 0 ? {
3379
+ errorMap: (r, n) => {
3380
+ var s, i, a, o;
3381
+ const d = (a = (i = (s = this._def).errorMap) === null || i === void 0 ? void 0 : i.call(s, r, n).message) !== null && a !== void 0 ? a : n.defaultError;
3382
+ return r.code === "unrecognized_keys" ? {
3383
+ message: (o = y.errToObj(e).message) !== null && o !== void 0 ? o : d
3384
+ } : {
3385
+ message: d
3386
+ };
3387
+ }
3388
+ } : {}
3389
+ });
3390
+ }
3391
+ strip() {
3392
+ return new A({
3393
+ ...this._def,
3394
+ unknownKeys: "strip"
3395
+ });
3396
+ }
3397
+ passthrough() {
3398
+ return new A({
3399
+ ...this._def,
3400
+ unknownKeys: "passthrough"
3401
+ });
3402
+ }
3403
+ // const AugmentFactory =
3404
+ // <Def extends ZodObjectDef>(def: Def) =>
3405
+ // <Augmentation extends ZodRawShape>(
3406
+ // augmentation: Augmentation
3407
+ // ): ZodObject<
3408
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3409
+ // Def["unknownKeys"],
3410
+ // Def["catchall"]
3411
+ // > => {
3412
+ // return new ZodObject({
3413
+ // ...def,
3414
+ // shape: () => ({
3415
+ // ...def.shape(),
3416
+ // ...augmentation,
3417
+ // }),
3418
+ // }) as any;
3419
+ // };
3420
+ extend(e) {
3421
+ return new A({
3422
+ ...this._def,
3423
+ shape: () => ({
3424
+ ...this._def.shape(),
3425
+ ...e
3426
+ })
3427
+ });
3428
+ }
3429
+ /**
3430
+ * Prior to zod@1.0.12 there was a bug in the
3431
+ * inferred type of merged objects. Please
3432
+ * upgrade if you are experiencing issues.
3433
+ */
3434
+ merge(e) {
3435
+ return new A({
3436
+ unknownKeys: e._def.unknownKeys,
3437
+ catchall: e._def.catchall,
3438
+ shape: () => ({
3439
+ ...this._def.shape(),
3440
+ ...e._def.shape()
3441
+ }),
3442
+ typeName: v.ZodObject
3443
+ });
3444
+ }
3445
+ // merge<
3446
+ // Incoming extends AnyZodObject,
3447
+ // Augmentation extends Incoming["shape"],
3448
+ // NewOutput extends {
3449
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3450
+ // ? Augmentation[k]["_output"]
3451
+ // : k extends keyof Output
3452
+ // ? Output[k]
3453
+ // : never;
3454
+ // },
3455
+ // NewInput extends {
3456
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3457
+ // ? Augmentation[k]["_input"]
3458
+ // : k extends keyof Input
3459
+ // ? Input[k]
3460
+ // : never;
3461
+ // }
3462
+ // >(
3463
+ // merging: Incoming
3464
+ // ): ZodObject<
3465
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3466
+ // Incoming["_def"]["unknownKeys"],
3467
+ // Incoming["_def"]["catchall"],
3468
+ // NewOutput,
3469
+ // NewInput
3470
+ // > {
3471
+ // const merged: any = new ZodObject({
3472
+ // unknownKeys: merging._def.unknownKeys,
3473
+ // catchall: merging._def.catchall,
3474
+ // shape: () =>
3475
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3476
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3477
+ // }) as any;
3478
+ // return merged;
3479
+ // }
3480
+ setKey(e, r) {
3481
+ return this.augment({ [e]: r });
3482
+ }
3483
+ // merge<Incoming extends AnyZodObject>(
3484
+ // merging: Incoming
3485
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3486
+ // ZodObject<
3487
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3488
+ // Incoming["_def"]["unknownKeys"],
3489
+ // Incoming["_def"]["catchall"]
3490
+ // > {
3491
+ // // const mergedShape = objectUtil.mergeShapes(
3492
+ // // this._def.shape(),
3493
+ // // merging._def.shape()
3494
+ // // );
3495
+ // const merged: any = new ZodObject({
3496
+ // unknownKeys: merging._def.unknownKeys,
3497
+ // catchall: merging._def.catchall,
3498
+ // shape: () =>
3499
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3500
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3501
+ // }) as any;
3502
+ // return merged;
3503
+ // }
3504
+ catchall(e) {
3505
+ return new A({
3506
+ ...this._def,
3507
+ catchall: e
3508
+ });
3509
+ }
3510
+ pick(e) {
3511
+ const r = {};
3512
+ return R.objectKeys(e).forEach((n) => {
3513
+ e[n] && this.shape[n] && (r[n] = this.shape[n]);
3514
+ }), new A({
3515
+ ...this._def,
3516
+ shape: () => r
3517
+ });
3518
+ }
3519
+ omit(e) {
3520
+ const r = {};
3521
+ return R.objectKeys(this.shape).forEach((n) => {
3522
+ e[n] || (r[n] = this.shape[n]);
3523
+ }), new A({
3524
+ ...this._def,
3525
+ shape: () => r
3526
+ });
3527
+ }
3528
+ /**
3529
+ * @deprecated
3530
+ */
3531
+ deepPartial() {
3532
+ return ae(this);
3533
+ }
3534
+ partial(e) {
3535
+ const r = {};
3536
+ return R.objectKeys(this.shape).forEach((n) => {
3537
+ const s = this.shape[n];
3538
+ e && !e[n] ? r[n] = s : r[n] = s.optional();
3539
+ }), new A({
3540
+ ...this._def,
3541
+ shape: () => r
3542
+ });
3543
+ }
3544
+ required(e) {
3545
+ const r = {};
3546
+ return R.objectKeys(this.shape).forEach((n) => {
3547
+ if (e && !e[n])
3548
+ r[n] = this.shape[n];
3549
+ else {
3550
+ let i = this.shape[n];
3551
+ for (; i instanceof J; )
3552
+ i = i._def.innerType;
3553
+ r[n] = i;
3554
+ }
3555
+ }), new A({
3556
+ ...this._def,
3557
+ shape: () => r
3558
+ });
3559
+ }
3560
+ keyof() {
3561
+ return pr(R.objectKeys(this.shape));
3562
+ }
3563
+ }
3564
+ A.create = (t, e) => new A({
3565
+ shape: () => t,
3566
+ unknownKeys: "strip",
3567
+ catchall: Q.create(),
3568
+ typeName: v.ZodObject,
3569
+ ...x(e)
3570
+ });
3571
+ A.strictCreate = (t, e) => new A({
3572
+ shape: () => t,
3573
+ unknownKeys: "strict",
3574
+ catchall: Q.create(),
3575
+ typeName: v.ZodObject,
3576
+ ...x(e)
3577
+ });
3578
+ A.lazycreate = (t, e) => new A({
3579
+ shape: t,
3580
+ unknownKeys: "strip",
3581
+ catchall: Q.create(),
3582
+ typeName: v.ZodObject,
3583
+ ...x(e)
3584
+ });
3585
+ class Ie extends E {
3586
+ _parse(e) {
3587
+ const { ctx: r } = this._processInputParams(e), n = this._def.options;
3588
+ function s(i) {
3589
+ for (const o of i)
3590
+ if (o.result.status === "valid")
3591
+ return o.result;
3592
+ for (const o of i)
3593
+ if (o.result.status === "dirty")
3594
+ return r.common.issues.push(...o.ctx.common.issues), o.result;
3595
+ const a = i.map((o) => new Z(o.ctx.common.issues));
3596
+ return h(r, {
3597
+ code: f.invalid_union,
3598
+ unionErrors: a
3599
+ }), b;
3600
+ }
3601
+ if (r.common.async)
3602
+ return Promise.all(n.map(async (i) => {
3603
+ const a = {
3604
+ ...r,
3605
+ common: {
3606
+ ...r.common,
3607
+ issues: []
3608
+ },
3609
+ parent: null
3610
+ };
3611
+ return {
3612
+ result: await i._parseAsync({
3613
+ data: r.data,
3614
+ path: r.path,
3615
+ parent: a
3616
+ }),
3617
+ ctx: a
3618
+ };
3619
+ })).then(s);
3620
+ {
3621
+ let i;
3622
+ const a = [];
3623
+ for (const d of n) {
3624
+ const c = {
3625
+ ...r,
3626
+ common: {
3627
+ ...r.common,
3628
+ issues: []
3629
+ },
3630
+ parent: null
3631
+ }, l = d._parseSync({
3632
+ data: r.data,
3633
+ path: r.path,
3634
+ parent: c
3635
+ });
3636
+ if (l.status === "valid")
3637
+ return l;
3638
+ l.status === "dirty" && !i && (i = { result: l, ctx: c }), c.common.issues.length && a.push(c.common.issues);
3639
+ }
3640
+ if (i)
3641
+ return r.common.issues.push(...i.ctx.common.issues), i.result;
3642
+ const o = a.map((d) => new Z(d));
3643
+ return h(r, {
3644
+ code: f.invalid_union,
3645
+ unionErrors: o
3646
+ }), b;
3647
+ }
3648
+ }
3649
+ get options() {
3650
+ return this._def.options;
3651
+ }
3652
+ }
3653
+ Ie.create = (t, e) => new Ie({
3654
+ options: t,
3655
+ typeName: v.ZodUnion,
3656
+ ...x(e)
3657
+ });
3658
+ const H = (t) => t instanceof Fe ? H(t.schema) : t instanceof X ? H(t.innerType()) : t instanceof Ze ? [t.value] : t instanceof se ? t.options : t instanceof $e ? R.objectValues(t.enum) : t instanceof Me ? H(t._def.innerType) : t instanceof Pe ? [void 0] : t instanceof De ? [null] : t instanceof J ? [void 0, ...H(t.unwrap())] : t instanceof ie ? [null, ...H(t.unwrap())] : t instanceof mr || t instanceof ze ? H(t.unwrap()) : t instanceof Be ? H(t._def.innerType) : [];
3659
+ class wt extends E {
3660
+ _parse(e) {
3661
+ const { ctx: r } = this._processInputParams(e);
3662
+ if (r.parsedType !== p.object)
3663
+ return h(r, {
3664
+ code: f.invalid_type,
3665
+ expected: p.object,
3666
+ received: r.parsedType
3667
+ }), b;
3668
+ const n = this.discriminator, s = r.data[n], i = this.optionsMap.get(s);
3669
+ return i ? r.common.async ? i._parseAsync({
3670
+ data: r.data,
3671
+ path: r.path,
3672
+ parent: r
3673
+ }) : i._parseSync({
3674
+ data: r.data,
3675
+ path: r.path,
3676
+ parent: r
3677
+ }) : (h(r, {
3678
+ code: f.invalid_union_discriminator,
3679
+ options: Array.from(this.optionsMap.keys()),
3680
+ path: [n]
3681
+ }), b);
3682
+ }
3683
+ get discriminator() {
3684
+ return this._def.discriminator;
3685
+ }
3686
+ get options() {
3687
+ return this._def.options;
3688
+ }
3689
+ get optionsMap() {
3690
+ return this._def.optionsMap;
3691
+ }
3692
+ /**
3693
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
3694
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
3695
+ * have a different value for each object in the union.
3696
+ * @param discriminator the name of the discriminator property
3697
+ * @param types an array of object schemas
3698
+ * @param params
3699
+ */
3700
+ static create(e, r, n) {
3701
+ const s = /* @__PURE__ */ new Map();
3702
+ for (const i of r) {
3703
+ const a = H(i.shape[e]);
3704
+ if (!a.length)
3705
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
3706
+ for (const o of a) {
3707
+ if (s.has(o))
3708
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
3709
+ s.set(o, i);
3710
+ }
3711
+ }
3712
+ return new wt({
3713
+ typeName: v.ZodDiscriminatedUnion,
3714
+ discriminator: e,
3715
+ options: r,
3716
+ optionsMap: s,
3717
+ ...x(n)
3718
+ });
3719
+ }
3720
+ }
3721
+ function mt(t, e) {
3722
+ const r = Y(t), n = Y(e);
3723
+ if (t === e)
3724
+ return { valid: !0, data: t };
3725
+ if (r === p.object && n === p.object) {
3726
+ const s = R.objectKeys(e), i = R.objectKeys(t).filter((o) => s.indexOf(o) !== -1), a = { ...t, ...e };
3727
+ for (const o of i) {
3728
+ const d = mt(t[o], e[o]);
3729
+ if (!d.valid)
3730
+ return { valid: !1 };
3731
+ a[o] = d.data;
3732
+ }
3733
+ return { valid: !0, data: a };
3734
+ } else if (r === p.array && n === p.array) {
3735
+ if (t.length !== e.length)
3736
+ return { valid: !1 };
3737
+ const s = [];
3738
+ for (let i = 0; i < t.length; i++) {
3739
+ const a = t[i], o = e[i], d = mt(a, o);
3740
+ if (!d.valid)
3741
+ return { valid: !1 };
3742
+ s.push(d.data);
3743
+ }
3744
+ return { valid: !0, data: s };
3745
+ } else return r === p.date && n === p.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
3746
+ }
3747
+ class Le extends E {
3748
+ _parse(e) {
3749
+ const { status: r, ctx: n } = this._processInputParams(e), s = (i, a) => {
3750
+ if (Ut(i) || Ut(a))
3751
+ return b;
3752
+ const o = mt(i.value, a.value);
3753
+ return o.valid ? ((Ft(i) || Ft(a)) && r.dirty(), { status: r.value, value: o.data }) : (h(n, {
3754
+ code: f.invalid_intersection_types
3755
+ }), b);
3756
+ };
3757
+ return n.common.async ? Promise.all([
3758
+ this._def.left._parseAsync({
3759
+ data: n.data,
3760
+ path: n.path,
3761
+ parent: n
3762
+ }),
3763
+ this._def.right._parseAsync({
3764
+ data: n.data,
3765
+ path: n.path,
3766
+ parent: n
3767
+ })
3768
+ ]).then(([i, a]) => s(i, a)) : s(this._def.left._parseSync({
3769
+ data: n.data,
3770
+ path: n.path,
3771
+ parent: n
3772
+ }), this._def.right._parseSync({
3773
+ data: n.data,
3774
+ path: n.path,
3775
+ parent: n
3776
+ }));
3777
+ }
3778
+ }
3779
+ Le.create = (t, e, r) => new Le({
3780
+ left: t,
3781
+ right: e,
3782
+ typeName: v.ZodIntersection,
3783
+ ...x(r)
3784
+ });
3785
+ class K extends E {
3786
+ _parse(e) {
3787
+ const { status: r, ctx: n } = this._processInputParams(e);
3788
+ if (n.parsedType !== p.array)
3789
+ return h(n, {
3790
+ code: f.invalid_type,
3791
+ expected: p.array,
3792
+ received: n.parsedType
3793
+ }), b;
3794
+ if (n.data.length < this._def.items.length)
3795
+ return h(n, {
3796
+ code: f.too_small,
3797
+ minimum: this._def.items.length,
3798
+ inclusive: !0,
3799
+ exact: !1,
3800
+ type: "array"
3801
+ }), b;
3802
+ !this._def.rest && n.data.length > this._def.items.length && (h(n, {
3803
+ code: f.too_big,
3804
+ maximum: this._def.items.length,
3805
+ inclusive: !0,
3806
+ exact: !1,
3807
+ type: "array"
3808
+ }), r.dirty());
3809
+ const i = [...n.data].map((a, o) => {
3810
+ const d = this._def.items[o] || this._def.rest;
3811
+ return d ? d._parse(new q(n, a, n.path, o)) : null;
3812
+ }).filter((a) => !!a);
3813
+ return n.common.async ? Promise.all(i).then((a) => D.mergeArray(r, a)) : D.mergeArray(r, i);
3814
+ }
3815
+ get items() {
3816
+ return this._def.items;
3817
+ }
3818
+ rest(e) {
3819
+ return new K({
3820
+ ...this._def,
3821
+ rest: e
3822
+ });
3823
+ }
3824
+ }
3825
+ K.create = (t, e) => {
3826
+ if (!Array.isArray(t))
3827
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3828
+ return new K({
3829
+ items: t,
3830
+ typeName: v.ZodTuple,
3831
+ rest: null,
3832
+ ...x(e)
3833
+ });
3834
+ };
3835
+ class Ue extends E {
3836
+ get keySchema() {
3837
+ return this._def.keyType;
3838
+ }
3839
+ get valueSchema() {
3840
+ return this._def.valueType;
3841
+ }
3842
+ _parse(e) {
3843
+ const { status: r, ctx: n } = this._processInputParams(e);
3844
+ if (n.parsedType !== p.object)
3845
+ return h(n, {
3846
+ code: f.invalid_type,
3847
+ expected: p.object,
3848
+ received: n.parsedType
3849
+ }), b;
3850
+ const s = [], i = this._def.keyType, a = this._def.valueType;
3851
+ for (const o in n.data)
3852
+ s.push({
3853
+ key: i._parse(new q(n, o, n.path, o)),
3854
+ value: a._parse(new q(n, n.data[o], n.path, o)),
3855
+ alwaysSet: o in n.data
3856
+ });
3857
+ return n.common.async ? D.mergeObjectAsync(r, s) : D.mergeObjectSync(r, s);
3858
+ }
3859
+ get element() {
3860
+ return this._def.valueType;
3861
+ }
3862
+ static create(e, r, n) {
3863
+ return r instanceof E ? new Ue({
3864
+ keyType: e,
3865
+ valueType: r,
3866
+ typeName: v.ZodRecord,
3867
+ ...x(n)
3868
+ }) : new Ue({
3869
+ keyType: W.create(),
3870
+ valueType: e,
3871
+ typeName: v.ZodRecord,
3872
+ ...x(r)
3873
+ });
3874
+ }
3875
+ }
3876
+ class yt extends E {
3877
+ get keySchema() {
3878
+ return this._def.keyType;
3879
+ }
3880
+ get valueSchema() {
3881
+ return this._def.valueType;
3882
+ }
3883
+ _parse(e) {
3884
+ const { status: r, ctx: n } = this._processInputParams(e);
3885
+ if (n.parsedType !== p.map)
3886
+ return h(n, {
3887
+ code: f.invalid_type,
3888
+ expected: p.map,
3889
+ received: n.parsedType
3890
+ }), b;
3891
+ const s = this._def.keyType, i = this._def.valueType, a = [...n.data.entries()].map(([o, d], c) => ({
3892
+ key: s._parse(new q(n, o, n.path, [c, "key"])),
3893
+ value: i._parse(new q(n, d, n.path, [c, "value"]))
3894
+ }));
3895
+ if (n.common.async) {
3896
+ const o = /* @__PURE__ */ new Map();
3897
+ return Promise.resolve().then(async () => {
3898
+ for (const d of a) {
3899
+ const c = await d.key, l = await d.value;
3900
+ if (c.status === "aborted" || l.status === "aborted")
3901
+ return b;
3902
+ (c.status === "dirty" || l.status === "dirty") && r.dirty(), o.set(c.value, l.value);
3903
+ }
3904
+ return { status: r.value, value: o };
3905
+ });
3906
+ } else {
3907
+ const o = /* @__PURE__ */ new Map();
3908
+ for (const d of a) {
3909
+ const c = d.key, l = d.value;
3910
+ if (c.status === "aborted" || l.status === "aborted")
3911
+ return b;
3912
+ (c.status === "dirty" || l.status === "dirty") && r.dirty(), o.set(c.value, l.value);
3913
+ }
3914
+ return { status: r.value, value: o };
3915
+ }
3916
+ }
3917
+ }
3918
+ yt.create = (t, e, r) => new yt({
3919
+ valueType: e,
3920
+ keyType: t,
3921
+ typeName: v.ZodMap,
3922
+ ...x(r)
3923
+ });
3924
+ class de extends E {
3925
+ _parse(e) {
3926
+ const { status: r, ctx: n } = this._processInputParams(e);
3927
+ if (n.parsedType !== p.set)
3928
+ return h(n, {
3929
+ code: f.invalid_type,
3930
+ expected: p.set,
3931
+ received: n.parsedType
3932
+ }), b;
3933
+ const s = this._def;
3934
+ s.minSize !== null && n.data.size < s.minSize.value && (h(n, {
3935
+ code: f.too_small,
3936
+ minimum: s.minSize.value,
3937
+ type: "set",
3938
+ inclusive: !0,
3939
+ exact: !1,
3940
+ message: s.minSize.message
3941
+ }), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (h(n, {
3942
+ code: f.too_big,
3943
+ maximum: s.maxSize.value,
3944
+ type: "set",
3945
+ inclusive: !0,
3946
+ exact: !1,
3947
+ message: s.maxSize.message
3948
+ }), r.dirty());
3949
+ const i = this._def.valueType;
3950
+ function a(d) {
3951
+ const c = /* @__PURE__ */ new Set();
3952
+ for (const l of d) {
3953
+ if (l.status === "aborted")
3954
+ return b;
3955
+ l.status === "dirty" && r.dirty(), c.add(l.value);
3956
+ }
3957
+ return { status: r.value, value: c };
3958
+ }
3959
+ const o = [...n.data.values()].map((d, c) => i._parse(new q(n, d, n.path, c)));
3960
+ return n.common.async ? Promise.all(o).then((d) => a(d)) : a(o);
3961
+ }
3962
+ min(e, r) {
3963
+ return new de({
3964
+ ...this._def,
3965
+ minSize: { value: e, message: y.toString(r) }
3966
+ });
3967
+ }
3968
+ max(e, r) {
3969
+ return new de({
3970
+ ...this._def,
3971
+ maxSize: { value: e, message: y.toString(r) }
3972
+ });
3973
+ }
3974
+ size(e, r) {
3975
+ return this.min(e, r).max(e, r);
3976
+ }
3977
+ nonempty(e) {
3978
+ return this.min(1, e);
3979
+ }
3980
+ }
3981
+ de.create = (t, e) => new de({
3982
+ valueType: t,
3983
+ minSize: null,
3984
+ maxSize: null,
3985
+ typeName: v.ZodSet,
3986
+ ...x(e)
3987
+ });
3988
+ class _e extends E {
3989
+ constructor() {
3990
+ super(...arguments), this.validate = this.implement;
3991
+ }
3992
+ _parse(e) {
3993
+ const { ctx: r } = this._processInputParams(e);
3994
+ if (r.parsedType !== p.function)
3995
+ return h(r, {
3996
+ code: f.invalid_type,
3997
+ expected: p.function,
3998
+ received: r.parsedType
3999
+ }), b;
4000
+ function n(o, d) {
4001
+ return lt({
4002
+ data: o,
4003
+ path: r.path,
4004
+ errorMaps: [
4005
+ r.common.contextualErrorMap,
4006
+ r.schemaErrorMap,
4007
+ ut(),
4008
+ be
4009
+ ].filter((c) => !!c),
4010
+ issueData: {
4011
+ code: f.invalid_arguments,
4012
+ argumentsError: d
4013
+ }
4014
+ });
4015
+ }
4016
+ function s(o, d) {
4017
+ return lt({
4018
+ data: o,
4019
+ path: r.path,
4020
+ errorMaps: [
4021
+ r.common.contextualErrorMap,
4022
+ r.schemaErrorMap,
4023
+ ut(),
4024
+ be
4025
+ ].filter((c) => !!c),
4026
+ issueData: {
4027
+ code: f.invalid_return_type,
4028
+ returnTypeError: d
4029
+ }
4030
+ });
4031
+ }
4032
+ const i = { errorMap: r.common.contextualErrorMap }, a = r.data;
4033
+ if (this._def.returns instanceof xe) {
4034
+ const o = this;
4035
+ return F(async function(...d) {
4036
+ const c = new Z([]), l = await o._def.args.parseAsync(d, i).catch((S) => {
4037
+ throw c.addIssue(n(d, S)), c;
4038
+ }), m = await Reflect.apply(a, this, l);
4039
+ return await o._def.returns._def.type.parseAsync(m, i).catch((S) => {
4040
+ throw c.addIssue(s(m, S)), c;
4041
+ });
4042
+ });
4043
+ } else {
4044
+ const o = this;
4045
+ return F(function(...d) {
4046
+ const c = o._def.args.safeParse(d, i);
4047
+ if (!c.success)
4048
+ throw new Z([n(d, c.error)]);
4049
+ const l = Reflect.apply(a, this, c.data), m = o._def.returns.safeParse(l, i);
4050
+ if (!m.success)
4051
+ throw new Z([s(l, m.error)]);
4052
+ return m.data;
4053
+ });
4054
+ }
4055
+ }
4056
+ parameters() {
4057
+ return this._def.args;
4058
+ }
4059
+ returnType() {
4060
+ return this._def.returns;
4061
+ }
4062
+ args(...e) {
4063
+ return new _e({
4064
+ ...this._def,
4065
+ args: K.create(e).rest(oe.create())
4066
+ });
4067
+ }
4068
+ returns(e) {
4069
+ return new _e({
4070
+ ...this._def,
4071
+ returns: e
4072
+ });
4073
+ }
4074
+ implement(e) {
4075
+ return this.parse(e);
4076
+ }
4077
+ strictImplement(e) {
4078
+ return this.parse(e);
4079
+ }
4080
+ static create(e, r, n) {
4081
+ return new _e({
4082
+ args: e || K.create([]).rest(oe.create()),
4083
+ returns: r || oe.create(),
4084
+ typeName: v.ZodFunction,
4085
+ ...x(n)
4086
+ });
4087
+ }
4088
+ }
4089
+ class Fe extends E {
4090
+ get schema() {
4091
+ return this._def.getter();
4092
+ }
4093
+ _parse(e) {
4094
+ const { ctx: r } = this._processInputParams(e);
4095
+ return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
4096
+ }
4097
+ }
4098
+ Fe.create = (t, e) => new Fe({
4099
+ getter: t,
4100
+ typeName: v.ZodLazy,
4101
+ ...x(e)
4102
+ });
4103
+ class Ze extends E {
4104
+ _parse(e) {
4105
+ if (e.data !== this._def.value) {
4106
+ const r = this._getOrReturnCtx(e);
4107
+ return h(r, {
4108
+ received: r.data,
4109
+ code: f.invalid_literal,
4110
+ expected: this._def.value
4111
+ }), b;
4112
+ }
4113
+ return { status: "valid", value: e.data };
4114
+ }
4115
+ get value() {
4116
+ return this._def.value;
4117
+ }
4118
+ }
4119
+ Ze.create = (t, e) => new Ze({
4120
+ value: t,
4121
+ typeName: v.ZodLiteral,
4122
+ ...x(e)
4123
+ });
4124
+ function pr(t, e) {
4125
+ return new se({
4126
+ values: t,
4127
+ typeName: v.ZodEnum,
4128
+ ...x(e)
4129
+ });
4130
+ }
4131
+ class se extends E {
4132
+ constructor() {
4133
+ super(...arguments), ye.set(this, void 0);
4134
+ }
4135
+ _parse(e) {
4136
+ if (typeof e.data != "string") {
4137
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4138
+ return h(r, {
4139
+ expected: R.joinValues(n),
4140
+ received: r.parsedType,
4141
+ code: f.invalid_type
4142
+ }), b;
4143
+ }
4144
+ if (je(this, ye) || dr(this, ye, new Set(this._def.values)), !je(this, ye).has(e.data)) {
4145
+ const r = this._getOrReturnCtx(e), n = this._def.values;
4146
+ return h(r, {
4147
+ received: r.data,
4148
+ code: f.invalid_enum_value,
4149
+ options: n
4150
+ }), b;
4151
+ }
4152
+ return F(e.data);
4153
+ }
4154
+ get options() {
4155
+ return this._def.values;
4156
+ }
4157
+ get enum() {
4158
+ const e = {};
4159
+ for (const r of this._def.values)
4160
+ e[r] = r;
4161
+ return e;
4162
+ }
4163
+ get Values() {
4164
+ const e = {};
4165
+ for (const r of this._def.values)
4166
+ e[r] = r;
4167
+ return e;
4168
+ }
4169
+ get Enum() {
4170
+ const e = {};
4171
+ for (const r of this._def.values)
4172
+ e[r] = r;
4173
+ return e;
4174
+ }
4175
+ extract(e, r = this._def) {
4176
+ return se.create(e, {
4177
+ ...this._def,
4178
+ ...r
4179
+ });
4180
+ }
4181
+ exclude(e, r = this._def) {
4182
+ return se.create(this.options.filter((n) => !e.includes(n)), {
4183
+ ...this._def,
4184
+ ...r
4185
+ });
4186
+ }
4187
+ }
4188
+ ye = /* @__PURE__ */ new WeakMap();
4189
+ se.create = pr;
4190
+ class $e extends E {
4191
+ constructor() {
4192
+ super(...arguments), ge.set(this, void 0);
4193
+ }
4194
+ _parse(e) {
4195
+ const r = R.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
4196
+ if (n.parsedType !== p.string && n.parsedType !== p.number) {
4197
+ const s = R.objectValues(r);
4198
+ return h(n, {
4199
+ expected: R.joinValues(s),
4200
+ received: n.parsedType,
4201
+ code: f.invalid_type
4202
+ }), b;
4203
+ }
4204
+ if (je(this, ge) || dr(this, ge, new Set(R.getValidEnumValues(this._def.values))), !je(this, ge).has(e.data)) {
4205
+ const s = R.objectValues(r);
4206
+ return h(n, {
4207
+ received: n.data,
4208
+ code: f.invalid_enum_value,
4209
+ options: s
4210
+ }), b;
4211
+ }
4212
+ return F(e.data);
4213
+ }
4214
+ get enum() {
4215
+ return this._def.values;
4216
+ }
4217
+ }
4218
+ ge = /* @__PURE__ */ new WeakMap();
4219
+ $e.create = (t, e) => new $e({
4220
+ values: t,
4221
+ typeName: v.ZodNativeEnum,
4222
+ ...x(e)
4223
+ });
4224
+ class xe extends E {
4225
+ unwrap() {
4226
+ return this._def.type;
4227
+ }
4228
+ _parse(e) {
4229
+ const { ctx: r } = this._processInputParams(e);
4230
+ if (r.parsedType !== p.promise && r.common.async === !1)
4231
+ return h(r, {
4232
+ code: f.invalid_type,
4233
+ expected: p.promise,
4234
+ received: r.parsedType
4235
+ }), b;
4236
+ const n = r.parsedType === p.promise ? r.data : Promise.resolve(r.data);
4237
+ return F(n.then((s) => this._def.type.parseAsync(s, {
4238
+ path: r.path,
4239
+ errorMap: r.common.contextualErrorMap
4240
+ })));
4241
+ }
4242
+ }
4243
+ xe.create = (t, e) => new xe({
4244
+ type: t,
4245
+ typeName: v.ZodPromise,
4246
+ ...x(e)
4247
+ });
4248
+ class X extends E {
4249
+ innerType() {
4250
+ return this._def.schema;
4251
+ }
4252
+ sourceType() {
4253
+ return this._def.schema._def.typeName === v.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
4254
+ }
4255
+ _parse(e) {
4256
+ const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, i = {
4257
+ addIssue: (a) => {
4258
+ h(n, a), a.fatal ? r.abort() : r.dirty();
4259
+ },
4260
+ get path() {
4261
+ return n.path;
4262
+ }
4263
+ };
4264
+ if (i.addIssue = i.addIssue.bind(i), s.type === "preprocess") {
4265
+ const a = s.transform(n.data, i);
4266
+ if (n.common.async)
4267
+ return Promise.resolve(a).then(async (o) => {
4268
+ if (r.value === "aborted")
4269
+ return b;
4270
+ const d = await this._def.schema._parseAsync({
4271
+ data: o,
4272
+ path: n.path,
4273
+ parent: n
4274
+ });
4275
+ return d.status === "aborted" ? b : d.status === "dirty" || r.value === "dirty" ? me(d.value) : d;
4276
+ });
4277
+ {
4278
+ if (r.value === "aborted")
4279
+ return b;
4280
+ const o = this._def.schema._parseSync({
4281
+ data: a,
4282
+ path: n.path,
4283
+ parent: n
4284
+ });
4285
+ return o.status === "aborted" ? b : o.status === "dirty" || r.value === "dirty" ? me(o.value) : o;
4286
+ }
4287
+ }
4288
+ if (s.type === "refinement") {
4289
+ const a = (o) => {
4290
+ const d = s.refinement(o, i);
4291
+ if (n.common.async)
4292
+ return Promise.resolve(d);
4293
+ if (d instanceof Promise)
4294
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
4295
+ return o;
4296
+ };
4297
+ if (n.common.async === !1) {
4298
+ const o = this._def.schema._parseSync({
4299
+ data: n.data,
4300
+ path: n.path,
4301
+ parent: n
4302
+ });
4303
+ return o.status === "aborted" ? b : (o.status === "dirty" && r.dirty(), a(o.value), { status: r.value, value: o.value });
4304
+ } else
4305
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? b : (o.status === "dirty" && r.dirty(), a(o.value).then(() => ({ status: r.value, value: o.value }))));
4306
+ }
4307
+ if (s.type === "transform")
4308
+ if (n.common.async === !1) {
4309
+ const a = this._def.schema._parseSync({
4310
+ data: n.data,
4311
+ path: n.path,
4312
+ parent: n
4313
+ });
4314
+ if (!ce(a))
4315
+ return a;
4316
+ const o = s.transform(a.value, i);
4317
+ if (o instanceof Promise)
4318
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4319
+ return { status: r.value, value: o };
4320
+ } else
4321
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((a) => ce(a) ? Promise.resolve(s.transform(a.value, i)).then((o) => ({ status: r.value, value: o })) : a);
4322
+ R.assertNever(s);
4323
+ }
4324
+ }
4325
+ X.create = (t, e, r) => new X({
4326
+ schema: t,
4327
+ typeName: v.ZodEffects,
4328
+ effect: e,
4329
+ ...x(r)
4330
+ });
4331
+ X.createWithPreprocess = (t, e, r) => new X({
4332
+ schema: e,
4333
+ effect: { type: "preprocess", transform: t },
4334
+ typeName: v.ZodEffects,
4335
+ ...x(r)
4336
+ });
4337
+ class J extends E {
4338
+ _parse(e) {
4339
+ return this._getType(e) === p.undefined ? F(void 0) : this._def.innerType._parse(e);
4340
+ }
4341
+ unwrap() {
4342
+ return this._def.innerType;
4343
+ }
4344
+ }
4345
+ J.create = (t, e) => new J({
4346
+ innerType: t,
4347
+ typeName: v.ZodOptional,
4348
+ ...x(e)
4349
+ });
4350
+ class ie extends E {
4351
+ _parse(e) {
4352
+ return this._getType(e) === p.null ? F(null) : this._def.innerType._parse(e);
4353
+ }
4354
+ unwrap() {
4355
+ return this._def.innerType;
4356
+ }
4357
+ }
4358
+ ie.create = (t, e) => new ie({
4359
+ innerType: t,
4360
+ typeName: v.ZodNullable,
4361
+ ...x(e)
4362
+ });
4363
+ class Me extends E {
4364
+ _parse(e) {
4365
+ const { ctx: r } = this._processInputParams(e);
4366
+ let n = r.data;
4367
+ return r.parsedType === p.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
4368
+ data: n,
4369
+ path: r.path,
4370
+ parent: r
4371
+ });
4372
+ }
4373
+ removeDefault() {
4374
+ return this._def.innerType;
4375
+ }
4376
+ }
4377
+ Me.create = (t, e) => new Me({
4378
+ innerType: t,
4379
+ typeName: v.ZodDefault,
4380
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
4381
+ ...x(e)
4382
+ });
4383
+ class Be extends E {
4384
+ _parse(e) {
4385
+ const { ctx: r } = this._processInputParams(e), n = {
4386
+ ...r,
4387
+ common: {
4388
+ ...r.common,
4389
+ issues: []
4390
+ }
4391
+ }, s = this._def.innerType._parse({
4392
+ data: n.data,
4393
+ path: n.path,
4394
+ parent: {
4395
+ ...n
4396
+ }
4397
+ });
4398
+ return Ne(s) ? s.then((i) => ({
4399
+ status: "valid",
4400
+ value: i.status === "valid" ? i.value : this._def.catchValue({
4401
+ get error() {
4402
+ return new Z(n.common.issues);
4403
+ },
4404
+ input: n.data
4405
+ })
4406
+ })) : {
4407
+ status: "valid",
4408
+ value: s.status === "valid" ? s.value : this._def.catchValue({
4409
+ get error() {
4410
+ return new Z(n.common.issues);
4411
+ },
4412
+ input: n.data
4413
+ })
4414
+ };
4415
+ }
4416
+ removeCatch() {
4417
+ return this._def.innerType;
4418
+ }
4419
+ }
4420
+ Be.create = (t, e) => new Be({
4421
+ innerType: t,
4422
+ typeName: v.ZodCatch,
4423
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
4424
+ ...x(e)
4425
+ });
4426
+ class gt extends E {
4427
+ _parse(e) {
4428
+ if (this._getType(e) !== p.nan) {
4429
+ const n = this._getOrReturnCtx(e);
4430
+ return h(n, {
4431
+ code: f.invalid_type,
4432
+ expected: p.nan,
4433
+ received: n.parsedType
4434
+ }), b;
4435
+ }
4436
+ return { status: "valid", value: e.data };
4437
+ }
4438
+ }
4439
+ gt.create = (t) => new gt({
4440
+ typeName: v.ZodNaN,
4441
+ ...x(t)
4442
+ });
4443
+ class mr extends E {
4444
+ _parse(e) {
4445
+ const { ctx: r } = this._processInputParams(e), n = r.data;
4446
+ return this._def.type._parse({
4447
+ data: n,
4448
+ path: r.path,
4449
+ parent: r
4450
+ });
4451
+ }
4452
+ unwrap() {
4453
+ return this._def.type;
4454
+ }
4455
+ }
4456
+ class Ge extends E {
4457
+ _parse(e) {
4458
+ const { status: r, ctx: n } = this._processInputParams(e);
4459
+ if (n.common.async)
4460
+ return (async () => {
4461
+ const i = await this._def.in._parseAsync({
4462
+ data: n.data,
4463
+ path: n.path,
4464
+ parent: n
4465
+ });
4466
+ return i.status === "aborted" ? b : i.status === "dirty" ? (r.dirty(), me(i.value)) : this._def.out._parseAsync({
4467
+ data: i.value,
4468
+ path: n.path,
4469
+ parent: n
4470
+ });
4471
+ })();
4472
+ {
4473
+ const s = this._def.in._parseSync({
4474
+ data: n.data,
4475
+ path: n.path,
4476
+ parent: n
4477
+ });
4478
+ return s.status === "aborted" ? b : s.status === "dirty" ? (r.dirty(), {
4479
+ status: "dirty",
4480
+ value: s.value
4481
+ }) : this._def.out._parseSync({
4482
+ data: s.value,
4483
+ path: n.path,
4484
+ parent: n
4485
+ });
4486
+ }
4487
+ }
4488
+ static create(e, r) {
4489
+ return new Ge({
4490
+ in: e,
4491
+ out: r,
4492
+ typeName: v.ZodPipeline
4493
+ });
4494
+ }
4495
+ }
4496
+ class ze extends E {
4497
+ _parse(e) {
4498
+ const r = this._def.innerType._parse(e), n = (s) => (ce(s) && (s.value = Object.freeze(s.value)), s);
4499
+ return Ne(r) ? r.then((s) => n(s)) : n(r);
4500
+ }
4501
+ unwrap() {
4502
+ return this._def.innerType;
4503
+ }
4504
+ }
4505
+ ze.create = (t, e) => new ze({
4506
+ innerType: t,
4507
+ typeName: v.ZodReadonly,
4508
+ ...x(e)
4509
+ });
4510
+ A.lazycreate;
4511
+ var v;
4512
+ (function(t) {
4513
+ t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
4514
+ })(v || (v = {}));
4515
+ W.create;
4516
+ ue.create;
4517
+ gt.create;
4518
+ le.create;
4519
+ dt.create;
4520
+ we.create;
4521
+ ft.create;
4522
+ Pe.create;
4523
+ De.create;
4524
+ ht.create;
4525
+ oe.create;
4526
+ Q.create;
4527
+ pt.create;
4528
+ z.create;
4529
+ A.create;
4530
+ A.strictCreate;
4531
+ Ie.create;
4532
+ wt.create;
4533
+ Le.create;
4534
+ K.create;
4535
+ Ue.create;
4536
+ yt.create;
4537
+ de.create;
4538
+ _e.create;
4539
+ Fe.create;
4540
+ Ze.create;
4541
+ se.create;
4542
+ $e.create;
4543
+ xe.create;
4544
+ X.create;
4545
+ J.create;
4546
+ ie.create;
4547
+ X.createWithPreprocess;
4548
+ Ge.create;
4549
+ class B extends Error {
4550
+ constructor(e, r, n, s) {
4551
+ super(
4552
+ s || r?.detail || r?.title || n?.message || "An error occurred"
4553
+ ), this.status = e, this.problemDetail = r, this.originalError = n, this.name = "ApiError", Object.setPrototypeOf(this, B.prototype);
4554
+ }
4555
+ get isClientError() {
4556
+ return this.status >= 400 && this.status < 500;
4557
+ }
4558
+ get isServerError() {
4559
+ return this.status >= 500;
4560
+ }
4561
+ get isUnauthorized() {
4562
+ return this.status === 401;
4563
+ }
4564
+ get isForbidden() {
4565
+ return this.status === 403;
4566
+ }
4567
+ get isNotFound() {
4568
+ return this.status === 404;
4569
+ }
4570
+ static builder() {
4571
+ return new gs();
4572
+ }
4573
+ static of(e) {
4574
+ return e instanceof B ? e : B.builder().originalError(e).build();
4575
+ }
4576
+ /**
4577
+ * Create ApiError from Zod validation error
4578
+ */
4579
+ static fromZodError(e) {
4580
+ const r = {};
4581
+ return e.errors.forEach((n) => {
4582
+ n.path.forEach((s) => {
4583
+ r[s] = n.message;
4584
+ });
4585
+ }), B.builder().originalError(e).status(ct.BadRequest).message("Validation error").detail("errors", r).build();
4586
+ }
4587
+ }
4588
+ class gs {
4589
+ constructor() {
4590
+ this._status = ct.InternalServerError, this._problemDetail = {
4591
+ status: this._status,
4592
+ title: "",
4593
+ type: "about:blank"
4594
+ }, this._originalError = new Error(), this._message = "";
4595
+ }
4596
+ /**
4597
+ * Set standard ProblemDetail fields
4598
+ */
4599
+ detail(e, r) {
4600
+ return this._problemDetail[e] = r, this;
4601
+ }
4602
+ /**
4603
+ * Set standard ProblemDetail fields
4604
+ */
4605
+ problemDetail(e) {
4606
+ return e && (this._problemDetail = e), this;
4607
+ }
4608
+ originalError(e) {
4609
+ return this._originalError = e, this._problemDetail.title = e.name, e instanceof Wn && this.status(e.status), e instanceof Z && (this.status(ct.BadRequest), this.message("Validation error")), this;
4610
+ }
4611
+ status(e) {
4612
+ return this._status = e, this._problemDetail.status = e, this;
4613
+ }
4614
+ message(e) {
4615
+ return this._message = e, this._problemDetail.detail = e, this;
4616
+ }
4617
+ build() {
4618
+ return new B(
4619
+ this._status,
4620
+ this._problemDetail,
4621
+ this._originalError,
4622
+ this._message
4623
+ );
4624
+ }
4625
+ }
4626
+ class Ds {
4627
+ constructor(e) {
4628
+ this.isRefreshing = !1, this.pendingRequests = [], this.config = {
4629
+ timeout: 3e4,
4630
+ enableRefreshToken: !0,
4631
+ maxRetries: 3,
4632
+ retryDelay: 1e3,
4633
+ onUnauthorized: async () => {
4634
+ typeof window < "u" && (window.location.href = "/login");
4635
+ },
4636
+ onRefreshTokenExpired: async () => {
4637
+ console.error("Session expired. Please login again."), typeof window < "u" && (window.location.href = "/login?expired=true");
4638
+ },
4639
+ onAuthenticated: async (r) => {
4640
+ console.log("Authenticated", r.data);
4641
+ },
4642
+ onRefreshToken: async () => "",
4643
+ ...e
4644
+ }, this.instance = O.create({
4645
+ baseURL: this.config.baseURL,
4646
+ timeout: this.config.timeout,
4647
+ headers: {
4648
+ "Content-Type": "application/json"
4649
+ }
4650
+ }), this.setupInterceptors();
4651
+ }
4652
+ /**
4653
+ * Setup request and response interceptors
4654
+ */
4655
+ setupInterceptors() {
4656
+ this.instance.interceptors.request.use(
4657
+ this.handleRequestFulfilled.bind(this),
4658
+ this.handleRequestRejected.bind(this)
4659
+ ), this.instance.interceptors.response.use(
4660
+ this.handleResponseFulfilled.bind(this),
4661
+ this.handleResponseRejected.bind(this)
4662
+ );
4663
+ }
4664
+ /**
4665
+ * Attach JWT token to request headers
4666
+ */
4667
+ async handleRequestFulfilled(e) {
4668
+ try {
4669
+ return this.config.onAuthenticated && this.config.onAuthenticated(e), e;
4670
+ } catch (r) {
4671
+ return console.error("Error attaching token to request:", r), e;
4672
+ }
4673
+ }
4674
+ /**
4675
+ * Handle request errors
4676
+ */
4677
+ handleRequestRejected(e) {
4678
+ return console.error("Request configuration error:", e), Promise.reject(e);
4679
+ }
4680
+ /**
4681
+ * Pass through successful responses
4682
+ */
4683
+ handleResponseFulfilled(e) {
4684
+ return e;
4685
+ }
4686
+ /**
4687
+ * Handle response errors with retry logic and token refresh
4688
+ */
4689
+ async handleResponseRejected(e) {
4690
+ const r = e.config;
4691
+ return r ? e.response?.status === 401 && this.config.enableRefreshToken ? this.handleUnauthorizedError(e, r) : this.shouldRetry(e, r) ? this.retryRequest(r) : Promise.reject(this.createApiError(e)) : Promise.reject(this.createApiError(e));
4692
+ }
4693
+ /**
4694
+ * Handle 401 errors with token refresh
4695
+ */
4696
+ async handleUnauthorizedError(e, r) {
4697
+ if (r._retry)
4698
+ return this.config.onRefreshTokenExpired && await this.config.onRefreshTokenExpired(), Promise.reject(this.createApiError(e));
4699
+ if (r._retry = !0, this.isRefreshing)
4700
+ return new Promise((n, s) => {
4701
+ this.pendingRequests.push({ resolve: n, reject: s });
4702
+ }).then((n) => (r.headers.Authorization = `Bearer ${n}`, this.instance(r))).catch((n) => Promise.reject(n));
4703
+ this.isRefreshing = !0;
4704
+ try {
4705
+ const n = await this.refreshToken();
4706
+ return r.headers.Authorization = `Bearer ${n}`, this.processPendingRequests(null, n), this.instance(r);
4707
+ } catch (n) {
4708
+ return this.processPendingRequests(n, null), this.config.onUnauthorized && await this.config.onUnauthorized(), Promise.reject(this.createApiError(e));
4709
+ } finally {
4710
+ this.isRefreshing = !1;
4711
+ }
4712
+ }
4713
+ /**
4714
+ * Refresh the JWT token using the refresh token
4715
+ */
4716
+ async refreshToken() {
4717
+ try {
4718
+ const e = this.config.onRefreshToken(), n = (await O.post(
4719
+ `${this.config.baseURL}/auth/refresh`,
4720
+ { refreshToken: e },
4721
+ {
4722
+ headers: {
4723
+ "Content-Type": "application/json"
4724
+ }
4725
+ }
4726
+ )).data.jwtToken;
4727
+ return await this.updateSession(n), n;
4728
+ } catch (e) {
4729
+ throw console.error("Token refresh failed:", e), e;
4730
+ }
4731
+ }
4732
+ /**
4733
+ * Update session with new token
4734
+ * Implement this based on your Next.js auth setup
4735
+ */
4736
+ async updateSession(e) {
4737
+ try {
4738
+ await fetch("/api/auth/update-token", {
4739
+ method: "POST",
4740
+ headers: {
4741
+ "Content-Type": "application/json"
4742
+ },
4743
+ body: JSON.stringify({ jwtToken: e })
4744
+ });
4745
+ } catch (r) {
4746
+ throw console.error("Failed to update session:", r), r;
4747
+ }
4748
+ }
4749
+ /**
4750
+ * Process all pending requests after token refresh
4751
+ */
4752
+ processPendingRequests(e, r) {
4753
+ this.pendingRequests.forEach((n) => {
4754
+ e ? n.reject(e) : r && n.resolve(r);
4755
+ }), this.pendingRequests = [];
4756
+ }
4757
+ /**
4758
+ * Determine if request should be retried
4759
+ */
4760
+ shouldRetry(e, r) {
4761
+ if ((r._retryCount || 0) >= this.config.maxRetries)
4762
+ return !1;
4763
+ if (!e.response)
4764
+ return !0;
4765
+ const s = e.response.status;
4766
+ return s >= 500 && s !== 501 || s === 429;
4767
+ }
4768
+ /**
4769
+ * Retry failed request with exponential backoff
4770
+ */
4771
+ async retryRequest(e) {
4772
+ e._retryCount = (e._retryCount || 0) + 1;
4773
+ const r = this.config.retryDelay * Math.pow(2, e._retryCount - 1);
4774
+ return await this.sleep(r), console.log(
4775
+ `Retrying request (attempt ${e._retryCount}):`,
4776
+ e.url
4777
+ ), this.instance(e);
4778
+ }
4779
+ /**
4780
+ * Sleep helper for retry delays
4781
+ */
4782
+ sleep(e) {
4783
+ return new Promise((r) => setTimeout(r, e));
4784
+ }
4785
+ /**
4786
+ * Create ApiError from AxiosError
4787
+ */
4788
+ createApiError(e) {
4789
+ const r = e.response?.status || 0, n = this.extractProblemDetail(e);
4790
+ return new B(r, n, e);
4791
+ }
4792
+ /**
4793
+ * Extract ProblemDetail from error response
4794
+ */
4795
+ extractProblemDetail(e) {
4796
+ if (!e.response?.data)
4797
+ return null;
4798
+ const r = e.response.data;
4799
+ return typeof r == "object" && "type" in r && "title" in r && "status" in r ? r : null;
4800
+ }
4801
+ /**
4802
+ * HTTP Methods with proper typing
4803
+ */
4804
+ async get(e, r) {
4805
+ return (await this.instance.get(e, r)).data;
4806
+ }
4807
+ async post(e, r, n) {
4808
+ return (await this.instance.post(e, r, n)).data;
4809
+ }
4810
+ async put(e, r, n) {
4811
+ return (await this.instance.put(e, r, n)).data;
4812
+ }
4813
+ async patch(e, r, n) {
4814
+ return (await this.instance.patch(e, r, n)).data;
4815
+ }
4816
+ async delete(e, r) {
4817
+ return (await this.instance.delete(e, r)).data;
4818
+ }
4819
+ /**
4820
+ * Get the underlying Axios instance for advanced usage
4821
+ */
4822
+ getAxiosInstance() {
4823
+ return this.instance;
4824
+ }
4825
+ }
4826
+ function Is(t) {
4827
+ return t instanceof B ? t.problemDetail?.detail ? t.problemDetail.detail : t.problemDetail?.title ? t.problemDetail.title : t.message : t instanceof Error ? t.message : "An unexpected error occurred";
4828
+ }
4829
+ function Ls(t) {
4830
+ if (!t.problemDetail)
4831
+ return t.message;
4832
+ const e = [];
4833
+ return t.problemDetail.title && e.push(`Title: ${t.problemDetail.title}`), t.problemDetail.detail && e.push(`Detail: ${t.problemDetail.detail}`), t.problemDetail.instance && e.push(`Instance: ${t.problemDetail.instance}`), e.join(`
4834
+ `);
4835
+ }
4836
+ function Us(t, e) {
4837
+ return t instanceof B && t.status === e;
4838
+ }
4839
+ function Fs(t) {
4840
+ if (!(t instanceof B)) {
4841
+ console.error("Unexpected error:", t);
4842
+ return;
4843
+ }
4844
+ switch (t.status) {
4845
+ case 400:
4846
+ console.error("Bad Request:", t.problemDetail?.detail);
4847
+ break;
4848
+ case 401:
4849
+ console.error("Unauthorized - Please login");
4850
+ break;
4851
+ case 403:
4852
+ console.error("Forbidden - Access denied");
4853
+ break;
4854
+ case 404:
4855
+ console.error("Not Found:", t.problemDetail?.detail);
4856
+ break;
4857
+ case 409:
4858
+ console.error("Conflict:", t.problemDetail?.detail);
4859
+ break;
4860
+ case 422:
4861
+ console.error("Validation Error:", t.problemDetail);
4862
+ break;
4863
+ case 429:
4864
+ console.error("Too Many Requests - Please slow down");
4865
+ break;
4866
+ case 500:
4867
+ console.error("Server Error:", t.problemDetail?.detail);
4868
+ break;
4869
+ case 503:
4870
+ console.error("Service Unavailable - Please try again later");
4871
+ break;
4872
+ default:
4873
+ console.error(`Error ${t.status}:`, t.message);
4874
+ }
4875
+ }
4876
+ function Zs(t) {
4877
+ if (!t.problemDetail || t.status !== 400)
4878
+ return null;
4879
+ const e = t.problemDetail.errors || t.problemDetail.fieldErrors;
4880
+ if (!e)
4881
+ return null;
4882
+ if (Array.isArray(e)) {
4883
+ const r = {};
4884
+ return e.forEach((n) => {
4885
+ const s = n.field || n.property || "general", i = n.message || n.defaultMessage || "Validation error";
4886
+ r[s] || (r[s] = []), r[s].push(i);
4887
+ }), r;
4888
+ }
4889
+ return e;
4890
+ }
4891
+ function $s(t) {
4892
+ return t;
4893
+ }
4894
+ function Ms(t, e) {
4895
+ return t ? t.errors?.[e] : void 0;
4896
+ }
4897
+ export {
4898
+ Ds as ApiClient,
4899
+ B as ApiError,
4900
+ gs as ApiErrorBuilder,
4901
+ Zs as extractValidationErrors,
4902
+ Ls as formatProblemDetail,
4903
+ Is as getErrorMessage,
4904
+ Ms as getFieldError,
4905
+ Fs as handleApiError,
4906
+ Us as isHttpStatus,
4907
+ $s as showErrorToast
4908
+ };