@fuul/sdk 2.1.2 → 3.0.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.mjs CHANGED
@@ -1,9 +1,24 @@
1
1
  var Me = Object.defineProperty;
2
- var ve = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var _ = (e, t, n) => (ve(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- class We {
2
+ var We = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var A = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ class Ge {
5
5
  constructor(t) {
6
- _(this, "httpClient");
6
+ A(this, "httpClient");
7
+ A(this, "_debug");
8
+ this.httpClient = t.httpClient, this._debug = t.debug;
9
+ }
10
+ async getCode(t) {
11
+ try {
12
+ const n = await this.httpClient.get(`/affiliates/${t}`);
13
+ return n.status !== 200 ? null : n.data.code;
14
+ } catch (n) {
15
+ return this._debug && console.error("Fuul SDK: Could not get affiliate code", n), null;
16
+ }
17
+ }
18
+ }
19
+ class Ye {
20
+ constructor(t) {
21
+ A(this, "httpClient");
7
22
  this.httpClient = t.httpClient;
8
23
  }
9
24
  async getAll() {
@@ -11,11 +26,11 @@ class We {
11
26
  return t;
12
27
  }
13
28
  }
14
- const fe = "fuul.sent", Ge = 60;
15
- class Ye {
29
+ const fe = "fuul.sent", Qe = 60;
30
+ class Xe {
16
31
  constructor(t) {
17
- _(this, "debug");
18
- _(this, "httpClient");
32
+ A(this, "debug");
33
+ A(this, "httpClient");
19
34
  this.httpClient = t.httpClient, this.debug = !!t.debug;
20
35
  }
21
36
  async sendEvent(t) {
@@ -30,7 +45,7 @@ class Ye {
30
45
  if (!r)
31
46
  return !1;
32
47
  const s = JSON.parse(r);
33
- if (this.getCurrentTimestamp() - s.timestamp > Ge)
48
+ if (this.getCurrentTimestamp() - s.timestamp > Qe)
34
49
  return !1;
35
50
  let d = !1;
36
51
  t.metadata && (d = s.metadata.tracking_id === t.metadata.tracking_id && s.metadata.project_id === t.metadata.project_id && s.metadata.referrer === t.metadata.referrer && s.metadata.source === t.metadata.source && s.metadata.category === t.metadata.category && s.metadata.title === t.metadata.title && s.metadata.tag === t.metadata.tag && s.user_address === t.user_address && s.signature === t.signature && s.signature_message === t.signature_message);
@@ -53,25 +68,25 @@ function Re(e, t) {
53
68
  const { toString: Oe } = Object.prototype, { getPrototypeOf: ne } = Object, re = ((e) => (t) => {
54
69
  const n = Oe.call(t);
55
70
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
56
- })(/* @__PURE__ */ Object.create(null)), O = (e) => (e = e.toLowerCase(), (t) => re(t) === e), $ = (e) => (t) => typeof t === e, { isArray: x } = Array, F = $("undefined");
57
- function Qe(e) {
58
- return e !== null && !F(e) && e.constructor !== null && !F(e.constructor) && P(e.constructor.isBuffer) && e.constructor.isBuffer(e);
71
+ })(/* @__PURE__ */ Object.create(null)), O = (e) => (e = e.toLowerCase(), (t) => re(t) === e), K = (e) => (t) => typeof t === e, { isArray: x } = Array, U = K("undefined");
72
+ function Ze(e) {
73
+ return e !== null && !U(e) && e.constructor !== null && !U(e.constructor) && P(e.constructor.isBuffer) && e.constructor.isBuffer(e);
59
74
  }
60
75
  const Ae = O("ArrayBuffer");
61
- function Xe(e) {
76
+ function et(e) {
62
77
  let t;
63
78
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && Ae(e.buffer), t;
64
79
  }
65
- const Ze = $("string"), P = $("function"), Te = $("number"), se = (e) => e !== null && typeof e == "object", et = (e) => e === !0 || e === !1, j = (e) => {
80
+ const tt = K("string"), P = K("function"), Te = K("number"), se = (e) => e !== null && typeof e == "object", nt = (e) => e === !0 || e === !1, k = (e) => {
66
81
  if (re(e) !== "object")
67
82
  return !1;
68
83
  const t = ne(e);
69
84
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e);
70
- }, tt = O("Date"), nt = O("File"), rt = O("Blob"), st = O("FileList"), ot = (e) => se(e) && P(e.pipe), it = (e) => {
85
+ }, rt = O("Date"), st = O("File"), ot = O("Blob"), it = O("FileList"), at = (e) => se(e) && P(e.pipe), ct = (e) => {
71
86
  const t = "[object FormData]";
72
87
  return e && (typeof FormData == "function" && e instanceof FormData || Oe.call(e) === t || P(e.toString) && e.toString() === t);
73
- }, at = O("URLSearchParams"), ct = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
74
- function U(e, t, { allOwnKeys: n = !1 } = {}) {
88
+ }, ut = O("URLSearchParams"), lt = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
89
+ function L(e, t, { allOwnKeys: n = !1 } = {}) {
75
90
  if (e === null || typeof e > "u")
76
91
  return;
77
92
  let r, s;
@@ -85,7 +100,7 @@ function U(e, t, { allOwnKeys: n = !1 } = {}) {
85
100
  u = o[r], t.call(null, e[u], u, e);
86
101
  }
87
102
  }
88
- function Pe(e, t) {
103
+ function Ce(e, t) {
89
104
  t = t.toLowerCase();
90
105
  const n = Object.keys(e);
91
106
  let r = n.length, s;
@@ -94,23 +109,23 @@ function Pe(e, t) {
94
109
  return s;
95
110
  return null;
96
111
  }
97
- const Ne = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), _e = (e) => !F(e) && e !== Ne;
112
+ const Pe = (() => typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global)(), _e = (e) => !U(e) && e !== Pe;
98
113
  function Q() {
99
114
  const { caseless: e } = _e(this) && this || {}, t = {}, n = (r, s) => {
100
- const o = e && Pe(t, s) || s;
101
- j(t[o]) && j(r) ? t[o] = Q(t[o], r) : j(r) ? t[o] = Q({}, r) : x(r) ? t[o] = r.slice() : t[o] = r;
115
+ const o = e && Ce(t, s) || s;
116
+ k(t[o]) && k(r) ? t[o] = Q(t[o], r) : k(r) ? t[o] = Q({}, r) : x(r) ? t[o] = r.slice() : t[o] = r;
102
117
  };
103
118
  for (let r = 0, s = arguments.length; r < s; r++)
104
- arguments[r] && U(arguments[r], n);
119
+ arguments[r] && L(arguments[r], n);
105
120
  return t;
106
121
  }
107
- const ut = (e, t, n, { allOwnKeys: r } = {}) => (U(t, (s, o) => {
122
+ const ft = (e, t, n, { allOwnKeys: r } = {}) => (L(t, (s, o) => {
108
123
  n && P(s) ? e[o] = Re(s, n) : e[o] = s;
109
- }, { allOwnKeys: r }), e), lt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), ft = (e, t, n, r) => {
124
+ }, { allOwnKeys: r }), e), dt = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), pt = (e, t, n, r) => {
110
125
  e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
111
126
  value: t.prototype
112
127
  }), n && Object.assign(e.prototype, n);
113
- }, dt = (e, t, n, r) => {
128
+ }, ht = (e, t, n, r) => {
114
129
  let s, o, i;
115
130
  const u = {};
116
131
  if (t = t || {}, e == null)
@@ -121,11 +136,11 @@ const ut = (e, t, n, { allOwnKeys: r } = {}) => (U(t, (s, o) => {
121
136
  e = n !== !1 && ne(e);
122
137
  } while (e && (!n || n(e, t)) && e !== Object.prototype);
123
138
  return t;
124
- }, pt = (e, t, n) => {
139
+ }, mt = (e, t, n) => {
125
140
  e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
126
141
  const r = e.indexOf(t, n);
127
142
  return r !== -1 && r === n;
128
- }, ht = (e) => {
143
+ }, yt = (e) => {
129
144
  if (!e)
130
145
  return null;
131
146
  if (x(e))
@@ -137,31 +152,31 @@ const ut = (e, t, n, { allOwnKeys: r } = {}) => (U(t, (s, o) => {
137
152
  for (; t-- > 0; )
138
153
  n[t] = e[t];
139
154
  return n;
140
- }, mt = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ne(Uint8Array)), yt = (e, t) => {
155
+ }, Et = ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && ne(Uint8Array)), wt = (e, t) => {
141
156
  const r = (e && e[Symbol.iterator]).call(e);
142
157
  let s;
143
158
  for (; (s = r.next()) && !s.done; ) {
144
159
  const o = s.value;
145
160
  t.call(e, o[0], o[1]);
146
161
  }
147
- }, Et = (e, t) => {
162
+ }, gt = (e, t) => {
148
163
  let n;
149
164
  const r = [];
150
165
  for (; (n = e.exec(t)) !== null; )
151
166
  r.push(n);
152
167
  return r;
153
- }, wt = O("HTMLFormElement"), gt = (e) => e.toLowerCase().replace(
168
+ }, St = O("HTMLFormElement"), bt = (e) => e.toLowerCase().replace(
154
169
  /[-_\s]([a-z\d])(\w*)/g,
155
170
  function(n, r, s) {
156
171
  return r.toUpperCase() + s;
157
172
  }
158
- ), de = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), St = O("RegExp"), Ce = (e, t) => {
173
+ ), de = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), Rt = O("RegExp"), Ne = (e, t) => {
159
174
  const n = Object.getOwnPropertyDescriptors(e), r = {};
160
- U(n, (s, o) => {
175
+ L(n, (s, o) => {
161
176
  t(s, o, e) !== !1 && (r[o] = s);
162
177
  }), Object.defineProperties(e, r);
163
- }, bt = (e) => {
164
- Ce(e, (t, n) => {
178
+ }, Ot = (e) => {
179
+ Ne(e, (t, n) => {
165
180
  if (P(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
166
181
  return !1;
167
182
  const r = e[n];
@@ -175,26 +190,26 @@ const ut = (e, t, n, { allOwnKeys: r } = {}) => (U(t, (s, o) => {
175
190
  });
176
191
  }
177
192
  });
178
- }, Rt = (e, t) => {
193
+ }, At = (e, t) => {
179
194
  const n = {}, r = (s) => {
180
195
  s.forEach((o) => {
181
196
  n[o] = !0;
182
197
  });
183
198
  };
184
199
  return x(e) ? r(e) : r(String(e).split(t)), n;
185
- }, Ot = () => {
186
- }, At = (e, t) => (e = +e, Number.isFinite(e) ? e : t), M = "abcdefghijklmnopqrstuvwxyz", pe = "0123456789", xe = {
200
+ }, Tt = () => {
201
+ }, Ct = (e, t) => (e = +e, Number.isFinite(e) ? e : t), M = "abcdefghijklmnopqrstuvwxyz", pe = "0123456789", xe = {
187
202
  DIGIT: pe,
188
203
  ALPHA: M,
189
204
  ALPHA_DIGIT: M + M.toUpperCase() + pe
190
- }, Tt = (e = 16, t = xe.ALPHA_DIGIT) => {
205
+ }, Pt = (e = 16, t = xe.ALPHA_DIGIT) => {
191
206
  let n = "";
192
207
  const { length: r } = t;
193
208
  for (; e--; )
194
209
  n += t[Math.random() * r | 0];
195
210
  return n;
196
211
  };
197
- function Pt(e) {
212
+ function _t(e) {
198
213
  return !!(e && P(e.append) && e[Symbol.toStringTag] === "FormData" && e[Symbol.iterator]);
199
214
  }
200
215
  const Nt = (e) => {
@@ -205,9 +220,9 @@ const Nt = (e) => {
205
220
  if (!("toJSON" in r)) {
206
221
  t[s] = r;
207
222
  const o = x(r) ? [] : {};
208
- return U(r, (i, u) => {
223
+ return L(r, (i, u) => {
209
224
  const d = n(i, s + 1);
210
- !F(d) && (o[u] = d);
225
+ !U(d) && (o[u] = d);
211
226
  }), t[s] = void 0, o;
212
227
  }
213
228
  }
@@ -217,53 +232,53 @@ const Nt = (e) => {
217
232
  }, a = {
218
233
  isArray: x,
219
234
  isArrayBuffer: Ae,
220
- isBuffer: Qe,
221
- isFormData: it,
222
- isArrayBufferView: Xe,
223
- isString: Ze,
235
+ isBuffer: Ze,
236
+ isFormData: ct,
237
+ isArrayBufferView: et,
238
+ isString: tt,
224
239
  isNumber: Te,
225
- isBoolean: et,
240
+ isBoolean: nt,
226
241
  isObject: se,
227
- isPlainObject: j,
228
- isUndefined: F,
229
- isDate: tt,
230
- isFile: nt,
231
- isBlob: rt,
232
- isRegExp: St,
242
+ isPlainObject: k,
243
+ isUndefined: U,
244
+ isDate: rt,
245
+ isFile: st,
246
+ isBlob: ot,
247
+ isRegExp: Rt,
233
248
  isFunction: P,
234
- isStream: ot,
235
- isURLSearchParams: at,
236
- isTypedArray: mt,
237
- isFileList: st,
238
- forEach: U,
249
+ isStream: at,
250
+ isURLSearchParams: ut,
251
+ isTypedArray: Et,
252
+ isFileList: it,
253
+ forEach: L,
239
254
  merge: Q,
240
- extend: ut,
241
- trim: ct,
242
- stripBOM: lt,
243
- inherits: ft,
244
- toFlatObject: dt,
255
+ extend: ft,
256
+ trim: lt,
257
+ stripBOM: dt,
258
+ inherits: pt,
259
+ toFlatObject: ht,
245
260
  kindOf: re,
246
261
  kindOfTest: O,
247
- endsWith: pt,
248
- toArray: ht,
249
- forEachEntry: yt,
250
- matchAll: Et,
251
- isHTMLForm: wt,
262
+ endsWith: mt,
263
+ toArray: yt,
264
+ forEachEntry: wt,
265
+ matchAll: gt,
266
+ isHTMLForm: St,
252
267
  hasOwnProperty: de,
253
268
  hasOwnProp: de,
254
269
  // an alias to avoid ESLint no-prototype-builtins detection
255
- reduceDescriptors: Ce,
256
- freezeMethods: bt,
257
- toObjectSet: Rt,
258
- toCamelCase: gt,
259
- noop: Ot,
260
- toFiniteNumber: At,
261
- findKey: Pe,
262
- global: Ne,
270
+ reduceDescriptors: Ne,
271
+ freezeMethods: Ot,
272
+ toObjectSet: At,
273
+ toCamelCase: bt,
274
+ noop: Tt,
275
+ toFiniteNumber: Ct,
276
+ findKey: Ce,
277
+ global: Pe,
263
278
  isContextDefined: _e,
264
279
  ALPHABET: xe,
265
- generateString: Tt,
266
- isSpecCompliantForm: Pt,
280
+ generateString: Pt,
281
+ isSpecCompliantForm: _t,
267
282
  toJSONObject: Nt
268
283
  };
269
284
  function m(e, t, n, r, s) {
@@ -316,7 +331,7 @@ m.from = (e, t, n, r, s, o) => {
316
331
  return d !== Error.prototype;
317
332
  }, (u) => u !== "isAxiosError"), m.call(i, e.message, t, n, r, s), i.cause = e, i.name = e.name, o && Object.assign(i, o), i;
318
333
  };
319
- const _t = null;
334
+ const xt = null;
320
335
  function X(e) {
321
336
  return a.isPlainObject(e) || a.isArray(e);
322
337
  }
@@ -328,13 +343,13 @@ function he(e, t, n) {
328
343
  return s = Ue(s), !n && o ? "[" + s + "]" : s;
329
344
  }).join(n ? "." : "") : t;
330
345
  }
331
- function Ct(e) {
346
+ function Dt(e) {
332
347
  return a.isArray(e) && !e.some(X);
333
348
  }
334
- const xt = a.toFlatObject(a, {}, null, function(t) {
349
+ const Ft = a.toFlatObject(a, {}, null, function(t) {
335
350
  return /^is[A-Z]/.test(t);
336
351
  });
337
- function K(e, t, n) {
352
+ function J(e, t, n) {
338
353
  if (!a.isObject(e))
339
354
  throw new TypeError("target must be an object");
340
355
  t = t || new FormData(), n = a.toFlatObject(n, {
@@ -361,18 +376,18 @@ function K(e, t, n) {
361
376
  if (f && !b && typeof f == "object") {
362
377
  if (a.endsWith(h, "{}"))
363
378
  h = r ? h : h.slice(0, -2), f = JSON.stringify(f);
364
- else if (a.isArray(f) && Ct(f) || (a.isFileList(f) || a.endsWith(h, "[]")) && (g = a.toArray(f)))
365
- return h = Ue(h), g.forEach(function(B, Ve) {
366
- !(a.isUndefined(B) || B === null) && t.append(
379
+ else if (a.isArray(f) && Dt(f) || (a.isFileList(f) || a.endsWith(h, "[]")) && (g = a.toArray(f)))
380
+ return h = Ue(h), g.forEach(function(I, ve) {
381
+ !(a.isUndefined(I) || I === null) && t.append(
367
382
  // eslint-disable-next-line no-nested-ternary
368
- i === !0 ? he([h], Ve, o) : i === null ? h : h + "[]",
369
- c(B)
383
+ i === !0 ? he([h], ve, o) : i === null ? h : h + "[]",
384
+ c(I)
370
385
  );
371
386
  }), !1;
372
387
  }
373
388
  return X(f) ? !0 : (t.append(he(b, h, o), c(f)), !1);
374
389
  }
375
- const p = [], w = Object.assign(xt, {
390
+ const p = [], w = Object.assign(Ft, {
376
391
  defaultVisitor: l,
377
392
  convertValue: c,
378
393
  isVisitable: X
@@ -381,14 +396,14 @@ function K(e, t, n) {
381
396
  if (!a.isUndefined(f)) {
382
397
  if (p.indexOf(f) !== -1)
383
398
  throw Error("Circular reference detected in " + h.join("."));
384
- p.push(f), a.forEach(f, function(g, N) {
399
+ p.push(f), a.forEach(f, function(g, _) {
385
400
  (!(a.isUndefined(g) || g === null) && s.call(
386
401
  t,
387
402
  g,
388
- a.isString(N) ? N.trim() : N,
403
+ a.isString(_) ? _.trim() : _,
389
404
  h,
390
405
  w
391
- )) === !0 && y(g, h ? h.concat(N) : [N]);
406
+ )) === !0 && y(g, h ? h.concat(_) : [_]);
392
407
  }), p.pop();
393
408
  }
394
409
  }
@@ -411,7 +426,7 @@ function me(e) {
411
426
  });
412
427
  }
413
428
  function oe(e, t) {
414
- this._pairs = [], e && K(e, this, t);
429
+ this._pairs = [], e && J(e, this, t);
415
430
  }
416
431
  const Le = oe.prototype;
417
432
  Le.append = function(t, n) {
@@ -425,13 +440,13 @@ Le.toString = function(t) {
425
440
  return n(s[0]) + "=" + n(s[1]);
426
441
  }, "").join("&");
427
442
  };
428
- function Dt(e) {
443
+ function Ut(e) {
429
444
  return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
430
445
  }
431
446
  function Be(e, t, n) {
432
447
  if (!t)
433
448
  return e;
434
- const r = n && n.encode || Dt, s = n && n.serialize;
449
+ const r = n && n.encode || Ut, s = n && n.serialize;
435
450
  let o;
436
451
  if (s ? o = s(t, n) : o = a.isURLSearchParams(t) ? t.toString() : new oe(t, n).toString(r), o) {
437
452
  const i = e.indexOf("#");
@@ -439,7 +454,7 @@ function Be(e, t, n) {
439
454
  }
440
455
  return e;
441
456
  }
442
- class Ft {
457
+ class Lt {
443
458
  constructor() {
444
459
  this.handlers = [];
445
460
  }
@@ -493,36 +508,36 @@ class Ft {
493
508
  });
494
509
  }
495
510
  }
496
- const ye = Ft, Ie = {
511
+ const ye = Lt, Ie = {
497
512
  silentJSONParsing: !0,
498
513
  forcedJSONParsing: !0,
499
514
  clarifyTimeoutError: !1
500
- }, Ut = typeof URLSearchParams < "u" ? URLSearchParams : oe, Lt = typeof FormData < "u" ? FormData : null, Bt = typeof Blob < "u" ? Blob : null, It = (() => {
515
+ }, Bt = typeof URLSearchParams < "u" ? URLSearchParams : oe, It = typeof FormData < "u" ? FormData : null, jt = typeof Blob < "u" ? Blob : null, kt = (() => {
501
516
  let e;
502
517
  return typeof navigator < "u" && ((e = navigator.product) === "ReactNative" || e === "NativeScript" || e === "NS") ? !1 : typeof window < "u" && typeof document < "u";
503
- })(), jt = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
518
+ })(), qt = (() => typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
504
519
  self instanceof WorkerGlobalScope && typeof self.importScripts == "function")(), S = {
505
520
  isBrowser: !0,
506
521
  classes: {
507
- URLSearchParams: Ut,
508
- FormData: Lt,
509
- Blob: Bt
522
+ URLSearchParams: Bt,
523
+ FormData: It,
524
+ Blob: jt
510
525
  },
511
- isStandardBrowserEnv: It,
512
- isStandardBrowserWebWorkerEnv: jt,
526
+ isStandardBrowserEnv: kt,
527
+ isStandardBrowserWebWorkerEnv: qt,
513
528
  protocols: ["http", "https", "file", "blob", "url", "data"]
514
529
  };
515
- function kt(e, t) {
516
- return K(e, new S.classes.URLSearchParams(), Object.assign({
530
+ function Ht(e, t) {
531
+ return J(e, new S.classes.URLSearchParams(), Object.assign({
517
532
  visitor: function(n, r, s, o) {
518
533
  return S.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
519
534
  }
520
535
  }, t));
521
536
  }
522
- function qt(e) {
537
+ function zt(e) {
523
538
  return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
524
539
  }
525
- function Ht(e) {
540
+ function $t(e) {
526
541
  const t = {}, n = Object.keys(e);
527
542
  let r;
528
543
  const s = n.length;
@@ -535,20 +550,20 @@ function je(e) {
535
550
  function t(n, r, s, o) {
536
551
  let i = n[o++];
537
552
  const u = Number.isFinite(+i), d = o >= n.length;
538
- return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !u) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = Ht(s[i])), !u);
553
+ return i = !i && a.isArray(s) ? s.length : i, d ? (a.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !u) : ((!s[i] || !a.isObject(s[i])) && (s[i] = []), t(n, r, s[i], o) && a.isArray(s[i]) && (s[i] = $t(s[i])), !u);
539
554
  }
540
555
  if (a.isFormData(e) && a.isFunction(e.entries)) {
541
556
  const n = {};
542
557
  return a.forEachEntry(e, (r, s) => {
543
- t(qt(r), s, n, 0);
558
+ t(zt(r), s, n, 0);
544
559
  }), n;
545
560
  }
546
561
  return null;
547
562
  }
548
- const zt = {
563
+ const Kt = {
549
564
  "Content-Type": void 0
550
565
  };
551
- function $t(e, t, n) {
566
+ function Jt(e, t, n) {
552
567
  if (a.isString(e))
553
568
  try {
554
569
  return (t || JSON.parse)(e), a.trim(e);
@@ -558,7 +573,7 @@ function $t(e, t, n) {
558
573
  }
559
574
  return (n || JSON.stringify)(e);
560
575
  }
561
- const J = {
576
+ const V = {
562
577
  transitional: Ie,
563
578
  adapter: ["xhr", "http"],
564
579
  transformRequest: [function(t, n) {
@@ -574,20 +589,20 @@ const J = {
574
589
  let u;
575
590
  if (o) {
576
591
  if (r.indexOf("application/x-www-form-urlencoded") > -1)
577
- return kt(t, this.formSerializer).toString();
592
+ return Ht(t, this.formSerializer).toString();
578
593
  if ((u = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
579
594
  const d = this.env && this.env.FormData;
580
- return K(
595
+ return J(
581
596
  u ? { "files[]": t } : t,
582
597
  d && new d(),
583
598
  this.formSerializer
584
599
  );
585
600
  }
586
601
  }
587
- return o || s ? (n.setContentType("application/json", !1), $t(t)) : t;
602
+ return o || s ? (n.setContentType("application/json", !1), Jt(t)) : t;
588
603
  }],
589
604
  transformResponse: [function(t) {
590
- const n = this.transitional || J.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
605
+ const n = this.transitional || V.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
591
606
  if (t && a.isString(t) && (r && !this.responseType || s)) {
592
607
  const i = !(n && n.silentJSONParsing) && s;
593
608
  try {
@@ -622,12 +637,12 @@ const J = {
622
637
  }
623
638
  };
624
639
  a.forEach(["delete", "get", "head"], function(t) {
625
- J.headers[t] = {};
640
+ V.headers[t] = {};
626
641
  });
627
642
  a.forEach(["post", "put", "patch"], function(t) {
628
- J.headers[t] = a.merge(zt);
643
+ V.headers[t] = a.merge(Kt);
629
644
  });
630
- const ie = J, Kt = a.toObjectSet([
645
+ const ie = V, Vt = a.toObjectSet([
631
646
  "age",
632
647
  "authorization",
633
648
  "content-length",
@@ -645,31 +660,31 @@ const ie = J, Kt = a.toObjectSet([
645
660
  "referer",
646
661
  "retry-after",
647
662
  "user-agent"
648
- ]), Jt = (e) => {
663
+ ]), vt = (e) => {
649
664
  const t = {};
650
665
  let n, r, s;
651
666
  return e && e.split(`
652
667
  `).forEach(function(i) {
653
- s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Kt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
668
+ s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Vt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
654
669
  }), t;
655
670
  }, Ee = Symbol("internals");
656
671
  function D(e) {
657
672
  return e && String(e).trim().toLowerCase();
658
673
  }
659
- function k(e) {
660
- return e === !1 || e == null ? e : a.isArray(e) ? e.map(k) : String(e);
674
+ function q(e) {
675
+ return e === !1 || e == null ? e : a.isArray(e) ? e.map(q) : String(e);
661
676
  }
662
- function Vt(e) {
677
+ function Mt(e) {
663
678
  const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
664
679
  let r;
665
680
  for (; r = n.exec(e); )
666
681
  t[r[1]] = r[2];
667
682
  return t;
668
683
  }
669
- function Mt(e) {
684
+ function Wt(e) {
670
685
  return /^[-_a-zA-Z]+$/.test(e.trim());
671
686
  }
672
- function v(e, t, n, r, s) {
687
+ function W(e, t, n, r, s) {
673
688
  if (a.isFunction(r))
674
689
  return r.call(this, t, n);
675
690
  if (s && (t = n), !!a.isString(t)) {
@@ -679,10 +694,10 @@ function v(e, t, n, r, s) {
679
694
  return r.test(t);
680
695
  }
681
696
  }
682
- function vt(e) {
697
+ function Gt(e) {
683
698
  return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
684
699
  }
685
- function Wt(e, t) {
700
+ function Yt(e, t) {
686
701
  const n = a.toCamelCase(" " + t);
687
702
  ["get", "set", "has"].forEach((r) => {
688
703
  Object.defineProperty(e, r + n, {
@@ -693,7 +708,7 @@ function Wt(e, t) {
693
708
  });
694
709
  });
695
710
  }
696
- class V {
711
+ class v {
697
712
  constructor(t) {
698
713
  t && this.set(t);
699
714
  }
@@ -704,10 +719,10 @@ class V {
704
719
  if (!l)
705
720
  throw new Error("header name must be a non-empty string");
706
721
  const p = a.findKey(s, l);
707
- (!p || s[p] === void 0 || c === !0 || c === void 0 && s[p] !== !1) && (s[p || d] = k(u));
722
+ (!p || s[p] === void 0 || c === !0 || c === void 0 && s[p] !== !1) && (s[p || d] = q(u));
708
723
  }
709
724
  const i = (u, d) => a.forEach(u, (c, l) => o(c, l, d));
710
- return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Mt(t) ? i(Jt(t), n) : t != null && o(n, t, r), this;
725
+ return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Wt(t) ? i(vt(t), n) : t != null && o(n, t, r), this;
711
726
  }
712
727
  get(t, n) {
713
728
  if (t = D(t), t) {
@@ -717,7 +732,7 @@ class V {
717
732
  if (!n)
718
733
  return s;
719
734
  if (n === !0)
720
- return Vt(s);
735
+ return Mt(s);
721
736
  if (a.isFunction(n))
722
737
  return n.call(this, s, r);
723
738
  if (a.isRegExp(n))
@@ -729,7 +744,7 @@ class V {
729
744
  has(t, n) {
730
745
  if (t = D(t), t) {
731
746
  const r = a.findKey(this, t);
732
- return !!(r && this[r] !== void 0 && (!n || v(this, this[r], r, n)));
747
+ return !!(r && this[r] !== void 0 && (!n || W(this, this[r], r, n)));
733
748
  }
734
749
  return !1;
735
750
  }
@@ -739,7 +754,7 @@ class V {
739
754
  function o(i) {
740
755
  if (i = D(i), i) {
741
756
  const u = a.findKey(r, i);
742
- u && (!n || v(r, r[u], u, n)) && (delete r[u], s = !0);
757
+ u && (!n || W(r, r[u], u, n)) && (delete r[u], s = !0);
743
758
  }
744
759
  }
745
760
  return a.isArray(t) ? t.forEach(o) : o(t), s;
@@ -749,7 +764,7 @@ class V {
749
764
  let r = n.length, s = !1;
750
765
  for (; r--; ) {
751
766
  const o = n[r];
752
- (!t || v(this, this[o], o, t, !0)) && (delete this[o], s = !0);
767
+ (!t || W(this, this[o], o, t, !0)) && (delete this[o], s = !0);
753
768
  }
754
769
  return s;
755
770
  }
@@ -758,11 +773,11 @@ class V {
758
773
  return a.forEach(this, (s, o) => {
759
774
  const i = a.findKey(r, o);
760
775
  if (i) {
761
- n[i] = k(s), delete n[o];
776
+ n[i] = q(s), delete n[o];
762
777
  return;
763
778
  }
764
- const u = t ? vt(o) : String(o).trim();
765
- u !== o && delete n[o], n[u] = k(s), r[u] = !0;
779
+ const u = t ? Gt(o) : String(o).trim();
780
+ u !== o && delete n[o], n[u] = q(s), r[u] = !0;
766
781
  }), this;
767
782
  }
768
783
  concat(...t) {
@@ -797,16 +812,16 @@ class V {
797
812
  }).accessors, s = this.prototype;
798
813
  function o(i) {
799
814
  const u = D(i);
800
- r[u] || (Wt(s, i), r[u] = !0);
815
+ r[u] || (Yt(s, i), r[u] = !0);
801
816
  }
802
817
  return a.isArray(t) ? t.forEach(o) : o(t), this;
803
818
  }
804
819
  }
805
- V.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
806
- a.freezeMethods(V.prototype);
807
- a.freezeMethods(V);
808
- const R = V;
809
- function W(e, t) {
820
+ v.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
821
+ a.freezeMethods(v.prototype);
822
+ a.freezeMethods(v);
823
+ const R = v;
824
+ function G(e, t) {
810
825
  const n = this || ie, r = t || n, s = R.from(r.headers);
811
826
  let o = r.data;
812
827
  return a.forEach(e, function(u) {
@@ -816,13 +831,13 @@ function W(e, t) {
816
831
  function ke(e) {
817
832
  return !!(e && e.__CANCEL__);
818
833
  }
819
- function L(e, t, n) {
834
+ function B(e, t, n) {
820
835
  m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError";
821
836
  }
822
- a.inherits(L, m, {
837
+ a.inherits(B, m, {
823
838
  __CANCEL__: !0
824
839
  });
825
- function Gt(e, t, n) {
840
+ function Qt(e, t, n) {
826
841
  const r = n.config.validateStatus;
827
842
  !n.status || !r || r(n.status) ? e(n) : t(new m(
828
843
  "Request failed with status code " + n.status,
@@ -832,7 +847,7 @@ function Gt(e, t, n) {
832
847
  n
833
848
  ));
834
849
  }
835
- const Yt = S.isStandardBrowserEnv ? (
850
+ const Xt = S.isStandardBrowserEnv ? (
836
851
  // Standard browser envs support document.cookie
837
852
  function() {
838
853
  return {
@@ -863,16 +878,16 @@ const Yt = S.isStandardBrowserEnv ? (
863
878
  };
864
879
  }()
865
880
  );
866
- function Qt(e) {
881
+ function Zt(e) {
867
882
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
868
883
  }
869
- function Xt(e, t) {
884
+ function en(e, t) {
870
885
  return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
871
886
  }
872
887
  function qe(e, t) {
873
- return e && !Qt(t) ? Xt(e, t) : t;
888
+ return e && !Zt(t) ? en(e, t) : t;
874
889
  }
875
- const Zt = S.isStandardBrowserEnv ? (
890
+ const tn = S.isStandardBrowserEnv ? (
876
891
  // Standard browser envs have full support of the APIs needed to test
877
892
  // whether the request URL is of the same origin as current location.
878
893
  function() {
@@ -904,11 +919,11 @@ const Zt = S.isStandardBrowserEnv ? (
904
919
  };
905
920
  }()
906
921
  );
907
- function en(e) {
922
+ function nn(e) {
908
923
  const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
909
924
  return t && t[1] || "";
910
925
  }
911
- function tn(e, t) {
926
+ function rn(e, t) {
912
927
  e = e || 10;
913
928
  const n = new Array(e), r = new Array(e);
914
929
  let s = 0, o = 0, i;
@@ -926,7 +941,7 @@ function tn(e, t) {
926
941
  }
927
942
  function we(e, t) {
928
943
  let n = 0;
929
- const r = tn(50, 250);
944
+ const r = rn(50, 250);
930
945
  return (s) => {
931
946
  const o = s.loaded, i = s.lengthComputable ? s.total : void 0, u = o - n, d = r(u), c = o <= i;
932
947
  n = o;
@@ -942,7 +957,7 @@ function we(e, t) {
942
957
  l[t ? "download" : "upload"] = !0, e(l);
943
958
  };
944
959
  }
945
- const nn = typeof XMLHttpRequest < "u", rn = nn && function(e) {
960
+ const sn = typeof XMLHttpRequest < "u", on = sn && function(e) {
946
961
  return new Promise(function(n, r) {
947
962
  let s = e.data;
948
963
  const o = R.from(e.headers).normalize(), i = e.responseType;
@@ -971,7 +986,7 @@ const nn = typeof XMLHttpRequest < "u", rn = nn && function(e) {
971
986
  config: e,
972
987
  request: c
973
988
  };
974
- Gt(function(g) {
989
+ Qt(function(g) {
975
990
  n(g), d();
976
991
  }, function(g) {
977
992
  r(g), d();
@@ -993,26 +1008,26 @@ const nn = typeof XMLHttpRequest < "u", rn = nn && function(e) {
993
1008
  c
994
1009
  )), c = null;
995
1010
  }, S.isStandardBrowserEnv) {
996
- const y = (e.withCredentials || Zt(l)) && e.xsrfCookieName && Yt.read(e.xsrfCookieName);
1011
+ const y = (e.withCredentials || tn(l)) && e.xsrfCookieName && Xt.read(e.xsrfCookieName);
997
1012
  y && o.set(e.xsrfHeaderName, y);
998
1013
  }
999
1014
  s === void 0 && o.setContentType(null), "setRequestHeader" in c && a.forEach(o.toJSON(), function(f, h) {
1000
1015
  c.setRequestHeader(h, f);
1001
1016
  }), a.isUndefined(e.withCredentials) || (c.withCredentials = !!e.withCredentials), i && i !== "json" && (c.responseType = e.responseType), typeof e.onDownloadProgress == "function" && c.addEventListener("progress", we(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && c.upload && c.upload.addEventListener("progress", we(e.onUploadProgress)), (e.cancelToken || e.signal) && (u = (y) => {
1002
- c && (r(!y || y.type ? new L(null, e, c) : y), c.abort(), c = null);
1017
+ c && (r(!y || y.type ? new B(null, e, c) : y), c.abort(), c = null);
1003
1018
  }, e.cancelToken && e.cancelToken.subscribe(u), e.signal && (e.signal.aborted ? u() : e.signal.addEventListener("abort", u)));
1004
- const w = en(l);
1019
+ const w = nn(l);
1005
1020
  if (w && S.protocols.indexOf(w) === -1) {
1006
1021
  r(new m("Unsupported protocol " + w + ":", m.ERR_BAD_REQUEST, e));
1007
1022
  return;
1008
1023
  }
1009
1024
  c.send(s || null);
1010
1025
  });
1011
- }, q = {
1012
- http: _t,
1013
- xhr: rn
1026
+ }, H = {
1027
+ http: xt,
1028
+ xhr: on
1014
1029
  };
1015
- a.forEach(q, (e, t) => {
1030
+ a.forEach(H, (e, t) => {
1016
1031
  if (e) {
1017
1032
  try {
1018
1033
  Object.defineProperty(e, "name", { value: t });
@@ -1021,42 +1036,42 @@ a.forEach(q, (e, t) => {
1021
1036
  Object.defineProperty(e, "adapterName", { value: t });
1022
1037
  }
1023
1038
  });
1024
- const sn = {
1039
+ const an = {
1025
1040
  getAdapter: (e) => {
1026
1041
  e = a.isArray(e) ? e : [e];
1027
1042
  const { length: t } = e;
1028
1043
  let n, r;
1029
- for (let s = 0; s < t && (n = e[s], !(r = a.isString(n) ? q[n.toLowerCase()] : n)); s++)
1044
+ for (let s = 0; s < t && (n = e[s], !(r = a.isString(n) ? H[n.toLowerCase()] : n)); s++)
1030
1045
  ;
1031
1046
  if (!r)
1032
1047
  throw r === !1 ? new m(
1033
1048
  `Adapter ${n} is not supported by the environment`,
1034
1049
  "ERR_NOT_SUPPORT"
1035
1050
  ) : new Error(
1036
- a.hasOwnProp(q, n) ? `Adapter '${n}' is not available in the build` : `Unknown adapter '${n}'`
1051
+ a.hasOwnProp(H, n) ? `Adapter '${n}' is not available in the build` : `Unknown adapter '${n}'`
1037
1052
  );
1038
1053
  if (!a.isFunction(r))
1039
1054
  throw new TypeError("adapter is not a function");
1040
1055
  return r;
1041
1056
  },
1042
- adapters: q
1057
+ adapters: H
1043
1058
  };
1044
- function G(e) {
1059
+ function Y(e) {
1045
1060
  if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
1046
- throw new L(null, e);
1061
+ throw new B(null, e);
1047
1062
  }
1048
1063
  function ge(e) {
1049
- return G(e), e.headers = R.from(e.headers), e.data = W.call(
1064
+ return Y(e), e.headers = R.from(e.headers), e.data = G.call(
1050
1065
  e,
1051
1066
  e.transformRequest
1052
- ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), sn.getAdapter(e.adapter || ie.adapter)(e).then(function(r) {
1053
- return G(e), r.data = W.call(
1067
+ ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), an.getAdapter(e.adapter || ie.adapter)(e).then(function(r) {
1068
+ return Y(e), r.data = G.call(
1054
1069
  e,
1055
1070
  e.transformResponse,
1056
1071
  r
1057
1072
  ), r.headers = R.from(r.headers), r;
1058
1073
  }, function(r) {
1059
- return ke(r) || (G(e), r && r.response && (r.response.data = W.call(
1074
+ return ke(r) || (Y(e), r && r.response && (r.response.data = G.call(
1060
1075
  e,
1061
1076
  e.transformResponse,
1062
1077
  r.response
@@ -1064,7 +1079,7 @@ function ge(e) {
1064
1079
  });
1065
1080
  }
1066
1081
  const Se = (e) => e instanceof R ? e.toJSON() : e;
1067
- function C(e, t) {
1082
+ function N(e, t) {
1068
1083
  t = t || {};
1069
1084
  const n = {};
1070
1085
  function r(c, l, p) {
@@ -1154,7 +1169,7 @@ ae.transitional = function(t, n, r) {
1154
1169
  )), t ? t(o, i, u) : !0;
1155
1170
  };
1156
1171
  };
1157
- function on(e, t, n) {
1172
+ function cn(e, t, n) {
1158
1173
  if (typeof e != "object")
1159
1174
  throw new m("options must be an object", m.ERR_BAD_OPTION_VALUE);
1160
1175
  const r = Object.keys(e);
@@ -1172,10 +1187,10 @@ function on(e, t, n) {
1172
1187
  }
1173
1188
  }
1174
1189
  const Z = {
1175
- assertOptions: on,
1190
+ assertOptions: cn,
1176
1191
  validators: ae
1177
- }, A = Z.validators;
1178
- class z {
1192
+ }, T = Z.validators;
1193
+ class $ {
1179
1194
  constructor(t) {
1180
1195
  this.defaults = t, this.interceptors = {
1181
1196
  request: new ye(),
@@ -1191,15 +1206,15 @@ class z {
1191
1206
  * @returns {Promise} The Promise to be fulfilled
1192
1207
  */
1193
1208
  request(t, n) {
1194
- typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = C(this.defaults, n);
1209
+ typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = N(this.defaults, n);
1195
1210
  const { transitional: r, paramsSerializer: s, headers: o } = n;
1196
1211
  r !== void 0 && Z.assertOptions(r, {
1197
- silentJSONParsing: A.transitional(A.boolean),
1198
- forcedJSONParsing: A.transitional(A.boolean),
1199
- clarifyTimeoutError: A.transitional(A.boolean)
1212
+ silentJSONParsing: T.transitional(T.boolean),
1213
+ forcedJSONParsing: T.transitional(T.boolean),
1214
+ clarifyTimeoutError: T.transitional(T.boolean)
1200
1215
  }, !1), s !== void 0 && Z.assertOptions(s, {
1201
- encode: A.function,
1202
- serialize: A.function
1216
+ encode: T.function,
1217
+ serialize: T.function
1203
1218
  }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
1204
1219
  let i;
1205
1220
  i = o && a.merge(
@@ -1248,14 +1263,14 @@ class z {
1248
1263
  return l;
1249
1264
  }
1250
1265
  getUri(t) {
1251
- t = C(this.defaults, t);
1266
+ t = N(this.defaults, t);
1252
1267
  const n = qe(t.baseURL, t.url);
1253
1268
  return Be(n, t.params, t.paramsSerializer);
1254
1269
  }
1255
1270
  }
1256
1271
  a.forEach(["delete", "get", "head", "options"], function(t) {
1257
- z.prototype[t] = function(n, r) {
1258
- return this.request(C(r || {}, {
1272
+ $.prototype[t] = function(n, r) {
1273
+ return this.request(N(r || {}, {
1259
1274
  method: t,
1260
1275
  url: n,
1261
1276
  data: (r || {}).data
@@ -1265,7 +1280,7 @@ a.forEach(["delete", "get", "head", "options"], function(t) {
1265
1280
  a.forEach(["post", "put", "patch"], function(t) {
1266
1281
  function n(r) {
1267
1282
  return function(o, i, u) {
1268
- return this.request(C(u || {}, {
1283
+ return this.request(N(u || {}, {
1269
1284
  method: t,
1270
1285
  headers: r ? {
1271
1286
  "Content-Type": "multipart/form-data"
@@ -1275,9 +1290,9 @@ a.forEach(["post", "put", "patch"], function(t) {
1275
1290
  }));
1276
1291
  };
1277
1292
  }
1278
- z.prototype[t] = n(), z.prototype[t + "Form"] = n(!0);
1293
+ $.prototype[t] = n(), $.prototype[t + "Form"] = n(!0);
1279
1294
  });
1280
- const H = z;
1295
+ const z = $;
1281
1296
  class ce {
1282
1297
  constructor(t) {
1283
1298
  if (typeof t != "function")
@@ -1303,7 +1318,7 @@ class ce {
1303
1318
  r.unsubscribe(o);
1304
1319
  }, i;
1305
1320
  }, t(function(o, i, u) {
1306
- r.reason || (r.reason = new L(o, i, u), n(r.reason));
1321
+ r.reason || (r.reason = new B(o, i, u), n(r.reason));
1307
1322
  });
1308
1323
  }
1309
1324
  /**
@@ -1346,13 +1361,13 @@ class ce {
1346
1361
  };
1347
1362
  }
1348
1363
  }
1349
- const an = ce;
1350
- function cn(e) {
1364
+ const un = ce;
1365
+ function ln(e) {
1351
1366
  return function(n) {
1352
1367
  return e.apply(null, n);
1353
1368
  };
1354
1369
  }
1355
- function un(e) {
1370
+ function fn(e) {
1356
1371
  return a.isObject(e) && e.isAxiosError === !0;
1357
1372
  }
1358
1373
  const ee = {
@@ -1423,38 +1438,38 @@ const ee = {
1423
1438
  Object.entries(ee).forEach(([e, t]) => {
1424
1439
  ee[t] = e;
1425
1440
  });
1426
- const ln = ee;
1441
+ const dn = ee;
1427
1442
  function ze(e) {
1428
- const t = new H(e), n = Re(H.prototype.request, t);
1429
- return a.extend(n, H.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1430
- return ze(C(e, s));
1443
+ const t = new z(e), n = Re(z.prototype.request, t);
1444
+ return a.extend(n, z.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
1445
+ return ze(N(e, s));
1431
1446
  }, n;
1432
1447
  }
1433
1448
  const E = ze(ie);
1434
- E.Axios = H;
1435
- E.CanceledError = L;
1436
- E.CancelToken = an;
1449
+ E.Axios = z;
1450
+ E.CanceledError = B;
1451
+ E.CancelToken = un;
1437
1452
  E.isCancel = ke;
1438
1453
  E.VERSION = He;
1439
- E.toFormData = K;
1454
+ E.toFormData = J;
1440
1455
  E.AxiosError = m;
1441
1456
  E.Cancel = E.CanceledError;
1442
1457
  E.all = function(t) {
1443
1458
  return Promise.all(t);
1444
1459
  };
1445
- E.spread = cn;
1446
- E.isAxiosError = un;
1447
- E.mergeConfig = C;
1460
+ E.spread = ln;
1461
+ E.isAxiosError = fn;
1462
+ E.mergeConfig = N;
1448
1463
  E.AxiosHeaders = R;
1449
1464
  E.formToJSON = (e) => je(a.isHTMLForm(e) ? new FormData(e) : e);
1450
- E.HttpStatusCode = ln;
1465
+ E.HttpStatusCode = dn;
1451
1466
  E.default = E;
1452
- const fn = E;
1453
- class dn {
1467
+ const pn = E;
1468
+ class hn {
1454
1469
  constructor(t) {
1455
- _(this, "client");
1456
- _(this, "queryParams");
1457
- this.client = fn.create({
1470
+ A(this, "client");
1471
+ A(this, "queryParams");
1472
+ this.client = pn.create({
1458
1473
  ...t,
1459
1474
  headers: {
1460
1475
  Authorization: `Bearer ${t.apiKey}`
@@ -1480,8 +1495,8 @@ class dn {
1480
1495
  return this.client.delete(t + this.queryParams);
1481
1496
  }
1482
1497
  }
1483
- let pn = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
1484
- const hn = "fuul.tracking_id", mn = ["google.com", "bing.com", "yahoo.com"], yn = () => On(hn, () => pn()), En = () => T("af") || T("referrer"), wn = () => document.referrer, gn = () => An(), Sn = () => T("category"), bn = () => T("title"), Rn = () => T("tag"), On = (e, t) => {
1498
+ let mn = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
1499
+ const yn = "fuul.tracking_id", En = ["google.com", "bing.com", "yahoo.com"], wn = () => Tn(yn, () => mn()), gn = () => C("af") || C("referrer"), Sn = () => document.referrer, bn = () => Cn(), Rn = () => C("category"), On = () => C("title"), An = () => C("tag"), Tn = (e, t) => {
1485
1500
  const n = localStorage.getItem(e);
1486
1501
  if (n)
1487
1502
  return n;
@@ -1489,82 +1504,82 @@ const hn = "fuul.tracking_id", mn = ["google.com", "bing.com", "yahoo.com"], yn
1489
1504
  const r = t();
1490
1505
  return r ? localStorage.setItem(e, r) : localStorage.removeItem(e), r;
1491
1506
  }
1492
- }, T = (e) => new URLSearchParams(window.location.search).get(e), An = () => {
1493
- const e = T("source"), t = T("af") || T("referrer");
1507
+ }, C = (e) => new URLSearchParams(window.location.search).get(e), Cn = () => {
1508
+ const e = C("source"), t = C("af") || C("referrer");
1494
1509
  if (e)
1495
1510
  return e;
1496
1511
  if (t)
1497
1512
  return "affiliate";
1498
- const n = Tn(document.referrer);
1499
- return mn.includes(n) ? "organic" : "direct";
1500
- }, Tn = (e) => {
1513
+ const n = Pn(document.referrer);
1514
+ return En.includes(n) ? "organic" : "direct";
1515
+ }, Pn = (e) => {
1501
1516
  var r;
1502
1517
  return (r = new URL(e).hostname) == null ? void 0 : r.split(".").slice(-2).join(".");
1503
- }, Pn = "https://api.fuul.xyz/api/v1/";
1504
- let I = !1, te = !1, ue, Y, $e, Ke;
1518
+ }, _n = "https://api.fuul.xyz/api/v1/";
1519
+ let F = !1, te = !1, ue, j, $e, Ke, Je;
1505
1520
  function Nn(e) {
1506
- I = !!e.debug, !te && (ue = e.apiKey, Un(), Y = Ln(
1507
- e.baseApiUrl ?? Pn,
1521
+ F = !!e.debug, !te && (ue = e.apiKey, Bn(), j = In(
1522
+ e.baseApiUrl ?? _n,
1508
1523
  e.defaultQueryParams ?? {}
1509
- ), $e = new We({ httpClient: Y, debug: I }), Ke = new Ye({ httpClient: Y, debug: I }), te = !0, I && console.debug("Fuul SDK: init() complete"));
1524
+ ), $e = new Ye({ httpClient: j, debug: F }), Je = new Xe({ httpClient: j, debug: F }), Ke = new Ge({ httpClient: j, debug: F }), te = !0, F && console.debug("Fuul SDK: init() complete"));
1510
1525
  }
1511
- function Je() {
1526
+ function Ve() {
1512
1527
  if (!te)
1513
1528
  throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods");
1514
1529
  }
1515
1530
  async function le(e, t, n) {
1516
- Je(), Fn();
1517
- const r = yn(), s = En(), o = gn(), i = Sn(), u = bn(), d = Rn(), c = wn(), l = {
1531
+ Ve(), Ln();
1532
+ const r = wn(), s = gn(), o = bn(), i = Rn(), u = On(), d = An(), c = Sn(), l = {
1518
1533
  name: e,
1519
1534
  args: t || {},
1520
1535
  metadata: {
1521
1536
  tracking_id: r ?? ""
1522
1537
  }
1523
1538
  };
1524
- n != null && n.address && (l.user_address = n.address), n != null && n.signature && (l.signature = n == null ? void 0 : n.signature, l.signature_message = n == null ? void 0 : n.message), s && (l.metadata.referrer = s, l.metadata.affiliate_id = s), c && (l.metadata.referrer_url = c), o && (l.metadata.source = o), i && (l.metadata.category = i), u && (l.metadata.title = u), d && (l.metadata.tag = d), Ke.sendEvent(l);
1539
+ n != null && n.address && (l.user_address = n.address), n != null && n.signature && (l.signature = n == null ? void 0 : n.signature, l.signature_message = n == null ? void 0 : n.message), s && (l.metadata.referrer = s, l.metadata.affiliate_id = s), c && (l.metadata.referrer_url = c), o && (l.metadata.source = o), i && (l.metadata.category = i), u && (l.metadata.title = u), d && (l.metadata.tag = d), Je.sendEvent(l);
1525
1540
  }
1526
- async function _n(e) {
1541
+ async function xn(e) {
1527
1542
  await le("pageview", {
1528
1543
  page: e ?? document.location.pathname,
1529
1544
  locationOrigin: document.location.origin
1530
1545
  });
1531
1546
  }
1532
- async function Cn(e) {
1547
+ async function Dn(e) {
1533
1548
  await le("connect_wallet", {}, e);
1534
1549
  }
1535
- function xn(e, t, n) {
1536
- const r = new URLSearchParams({
1537
- af: t
1550
+ async function Fn(e, t, n) {
1551
+ const r = await Ke.getCode(t), s = new URLSearchParams({
1552
+ af: r ?? t
1538
1553
  });
1539
- return n != null && n.title && r.append("af_title", n.title), n != null && n.format && r.append("af_format", n.format), n != null && n.place && r.append("af_place", n.place), `${e}?${r.toString()}`;
1554
+ return n != null && n.title && s.append("af_title", n.title), n != null && n.format && s.append("af_format", n.format), n != null && n.place && s.append("af_place", n.place), `${e}?${s.toString()}`;
1540
1555
  }
1541
- async function Dn() {
1542
- return Je(), $e.getAll();
1556
+ async function Un() {
1557
+ return Ve(), $e.getAll();
1543
1558
  }
1544
- function Fn() {
1559
+ function Ln() {
1545
1560
  if (typeof window > "u" || typeof document > "u")
1546
1561
  throw new Error("Fuul SDK: Browser context required");
1547
1562
  }
1548
- function Un() {
1563
+ function Bn() {
1549
1564
  if (!ue)
1550
1565
  throw new Error("Fuul SDK: Invalid API key");
1551
1566
  }
1552
- function Ln(e, t) {
1553
- return new dn({
1567
+ function In(e, t) {
1568
+ return new hn({
1554
1569
  baseURL: e,
1555
1570
  timeout: 1e4,
1556
1571
  apiKey: ue,
1557
1572
  queryParams: t
1558
1573
  });
1559
1574
  }
1560
- const In = {
1575
+ const kn = {
1561
1576
  init: Nn,
1562
1577
  sendEvent: le,
1563
- sendPageview: _n,
1564
- sendConnectWallet: Cn,
1565
- generateTrackingLink: xn,
1566
- getConversions: Dn
1578
+ sendPageview: xn,
1579
+ sendConnectWallet: Dn,
1580
+ generateTrackingLink: Fn,
1581
+ getConversions: Un
1567
1582
  };
1568
1583
  export {
1569
- In as Fuul
1584
+ kn as Fuul
1570
1585
  };