polarisrx 0.1.0

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