@fuul/sdk 3.4.0 → 3.4.1
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 +81 -92
- package/dist/index.umd.js +4 -4
- package/dist/tracking.d.ts +2 -2
- package/dist/tracking.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -107,7 +107,7 @@ const St = (e, t, n, { allOwnKeys: r } = {}) => (k(t, (s, i) => {
|
|
|
107
107
|
for (; (n = e.exec(t)) !== null; )
|
|
108
108
|
r.push(n);
|
|
109
109
|
return r;
|
|
110
|
-
},
|
|
110
|
+
}, xt = C("HTMLFormElement"), Nt = (e) => e.toLowerCase().replace(
|
|
111
111
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
112
112
|
function(n, r, s) {
|
|
113
113
|
return r.toUpperCase() + s;
|
|
@@ -206,14 +206,14 @@ const kt = (e) => {
|
|
|
206
206
|
toArray: Ot,
|
|
207
207
|
forEachEntry: Pt,
|
|
208
208
|
matchAll: _t,
|
|
209
|
-
isHTMLForm:
|
|
209
|
+
isHTMLForm: xt,
|
|
210
210
|
hasOwnProperty: ye,
|
|
211
211
|
hasOwnProp: ye,
|
|
212
212
|
// an alias to avoid ESLint no-prototype-builtins detection
|
|
213
213
|
reduceDescriptors: $e,
|
|
214
214
|
freezeMethods: Dt,
|
|
215
215
|
toObjectSet: Ut,
|
|
216
|
-
toCamelCase:
|
|
216
|
+
toCamelCase: Nt,
|
|
217
217
|
noop: Lt,
|
|
218
218
|
toFiniteNumber: Bt,
|
|
219
219
|
findKey: je,
|
|
@@ -1043,7 +1043,7 @@ function Ce(e) {
|
|
|
1043
1043
|
});
|
|
1044
1044
|
}
|
|
1045
1045
|
const Oe = (e) => e instanceof O ? e.toJSON() : e;
|
|
1046
|
-
function
|
|
1046
|
+
function F(e, t) {
|
|
1047
1047
|
t = t || {};
|
|
1048
1048
|
const n = {};
|
|
1049
1049
|
function r(h, l, u) {
|
|
@@ -1154,7 +1154,7 @@ function Sn(e, t, n) {
|
|
|
1154
1154
|
const se = {
|
|
1155
1155
|
assertOptions: Sn,
|
|
1156
1156
|
validators: fe
|
|
1157
|
-
},
|
|
1157
|
+
}, x = se.validators;
|
|
1158
1158
|
let z = class {
|
|
1159
1159
|
constructor(t) {
|
|
1160
1160
|
this.defaults = t, this.interceptors = {
|
|
@@ -1171,17 +1171,17 @@ let z = class {
|
|
|
1171
1171
|
* @returns {Promise} The Promise to be fulfilled
|
|
1172
1172
|
*/
|
|
1173
1173
|
request(t, n) {
|
|
1174
|
-
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n =
|
|
1174
|
+
typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = F(this.defaults, n);
|
|
1175
1175
|
const { transitional: r, paramsSerializer: s, headers: i } = n;
|
|
1176
1176
|
r !== void 0 && se.assertOptions(r, {
|
|
1177
|
-
silentJSONParsing:
|
|
1178
|
-
forcedJSONParsing:
|
|
1179
|
-
clarifyTimeoutError:
|
|
1177
|
+
silentJSONParsing: x.transitional(x.boolean),
|
|
1178
|
+
forcedJSONParsing: x.transitional(x.boolean),
|
|
1179
|
+
clarifyTimeoutError: x.transitional(x.boolean)
|
|
1180
1180
|
}, !1), s != null && (a.isFunction(s) ? n.paramsSerializer = {
|
|
1181
1181
|
serialize: s
|
|
1182
1182
|
} : se.assertOptions(s, {
|
|
1183
|
-
encode:
|
|
1184
|
-
serialize:
|
|
1183
|
+
encode: x.function,
|
|
1184
|
+
serialize: x.function
|
|
1185
1185
|
}, !0)), n.method = (n.method || this.defaults.method || "get").toLowerCase();
|
|
1186
1186
|
let o = i && a.merge(
|
|
1187
1187
|
i.common,
|
|
@@ -1230,14 +1230,14 @@ let z = class {
|
|
|
1230
1230
|
return l;
|
|
1231
1231
|
}
|
|
1232
1232
|
getUri(t) {
|
|
1233
|
-
t =
|
|
1233
|
+
t = F(this.defaults, t);
|
|
1234
1234
|
const n = Qe(t.baseURL, t.url);
|
|
1235
1235
|
return Je(n, t.params, t.paramsSerializer);
|
|
1236
1236
|
}
|
|
1237
1237
|
};
|
|
1238
1238
|
a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
1239
1239
|
z.prototype[t] = function(n, r) {
|
|
1240
|
-
return this.request(
|
|
1240
|
+
return this.request(F(r || {}, {
|
|
1241
1241
|
method: t,
|
|
1242
1242
|
url: n,
|
|
1243
1243
|
data: (r || {}).data
|
|
@@ -1247,7 +1247,7 @@ a.forEach(["delete", "get", "head", "options"], function(t) {
|
|
|
1247
1247
|
a.forEach(["post", "put", "patch"], function(t) {
|
|
1248
1248
|
function n(r) {
|
|
1249
1249
|
return function(i, o, c) {
|
|
1250
|
-
return this.request(
|
|
1250
|
+
return this.request(F(c || {}, {
|
|
1251
1251
|
method: t,
|
|
1252
1252
|
headers: r ? {
|
|
1253
1253
|
"Content-Type": "multipart/form-data"
|
|
@@ -1409,7 +1409,7 @@ const On = oe;
|
|
|
1409
1409
|
function tt(e) {
|
|
1410
1410
|
const t = new v(e), n = Le(v.prototype.request, t);
|
|
1411
1411
|
return a.extend(n, v.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) {
|
|
1412
|
-
return tt(
|
|
1412
|
+
return tt(F(e, s));
|
|
1413
1413
|
}, n;
|
|
1414
1414
|
}
|
|
1415
1415
|
const y = tt(le);
|
|
@@ -1426,29 +1426,29 @@ y.all = function(t) {
|
|
|
1426
1426
|
};
|
|
1427
1427
|
y.spread = Rn;
|
|
1428
1428
|
y.isAxiosError = Cn;
|
|
1429
|
-
y.mergeConfig =
|
|
1429
|
+
y.mergeConfig = F;
|
|
1430
1430
|
y.AxiosHeaders = O;
|
|
1431
1431
|
y.formToJSON = (e) => Ge(a.isHTMLForm(e) ? new FormData(e) : e);
|
|
1432
1432
|
y.getAdapter = Ye.getAdapter;
|
|
1433
1433
|
y.HttpStatusCode = On;
|
|
1434
1434
|
y.default = y;
|
|
1435
1435
|
const nt = y, {
|
|
1436
|
-
Axios:
|
|
1436
|
+
Axios: ar,
|
|
1437
1437
|
AxiosError: ee,
|
|
1438
|
-
CanceledError:
|
|
1439
|
-
isCancel:
|
|
1440
|
-
CancelToken:
|
|
1441
|
-
VERSION:
|
|
1442
|
-
all:
|
|
1443
|
-
Cancel:
|
|
1444
|
-
isAxiosError:
|
|
1445
|
-
spread:
|
|
1446
|
-
toFormData:
|
|
1447
|
-
AxiosHeaders:
|
|
1448
|
-
HttpStatusCode:
|
|
1449
|
-
formToJSON:
|
|
1450
|
-
getAdapter:
|
|
1451
|
-
mergeConfig:
|
|
1438
|
+
CanceledError: cr,
|
|
1439
|
+
isCancel: ur,
|
|
1440
|
+
CancelToken: lr,
|
|
1441
|
+
VERSION: fr,
|
|
1442
|
+
all: dr,
|
|
1443
|
+
Cancel: pr,
|
|
1444
|
+
isAxiosError: hr,
|
|
1445
|
+
spread: mr,
|
|
1446
|
+
toFormData: yr,
|
|
1447
|
+
AxiosHeaders: wr,
|
|
1448
|
+
HttpStatusCode: gr,
|
|
1449
|
+
formToJSON: Er,
|
|
1450
|
+
getAdapter: Sr,
|
|
1451
|
+
mergeConfig: br
|
|
1452
1452
|
} = nt;
|
|
1453
1453
|
class Pe extends Error {
|
|
1454
1454
|
constructor(n) {
|
|
@@ -1464,14 +1464,14 @@ class _e extends Error {
|
|
|
1464
1464
|
this.name = "AddressInUseError", this.address = n;
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
|
-
class
|
|
1467
|
+
class xe extends Error {
|
|
1468
1468
|
constructor(n) {
|
|
1469
1469
|
super("Code already registered.");
|
|
1470
1470
|
S(this, "code");
|
|
1471
1471
|
this.name = "CodeInUseError", this.code = n;
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
|
-
class
|
|
1474
|
+
class Ne extends Error {
|
|
1475
1475
|
constructor() {
|
|
1476
1476
|
super("Invalid signature provided"), this.name = "InvalidSignatureError";
|
|
1477
1477
|
}
|
|
@@ -1496,7 +1496,7 @@ class Tn {
|
|
|
1496
1496
|
const o = (s = i.response) == null ? void 0 : s.data;
|
|
1497
1497
|
if (typeof (o == null ? void 0 : o.message) == "string") {
|
|
1498
1498
|
const c = o.message.toLowerCase();
|
|
1499
|
-
throw c == "invalid signature" ? new
|
|
1499
|
+
throw c == "invalid signature" ? new Ne() : c == "address in use" ? new _e(t) : c == "code in use" ? new xe(n) : new Error(c);
|
|
1500
1500
|
} else if ((o == null ? void 0 : o.message) instanceof Array)
|
|
1501
1501
|
throw new Pe(o.message);
|
|
1502
1502
|
}
|
|
@@ -1516,7 +1516,7 @@ class Tn {
|
|
|
1516
1516
|
const o = (s = i.response) == null ? void 0 : s.data;
|
|
1517
1517
|
if (typeof (o == null ? void 0 : o.message) == "string") {
|
|
1518
1518
|
const c = o.message.toLowerCase();
|
|
1519
|
-
throw c == "invalid signature" ? new
|
|
1519
|
+
throw c == "invalid signature" ? new Ne() : c == "address in use" ? new _e(t) : c == "code in use" ? new xe(n) : new Error(c);
|
|
1520
1520
|
} else if ((o == null ? void 0 : o.message) instanceof Array)
|
|
1521
1521
|
throw new Pe(o.message);
|
|
1522
1522
|
}
|
|
@@ -1550,7 +1550,7 @@ class Pn {
|
|
|
1550
1550
|
}
|
|
1551
1551
|
}
|
|
1552
1552
|
const Fe = "fuul.sent", _n = 60;
|
|
1553
|
-
class
|
|
1553
|
+
class xn {
|
|
1554
1554
|
constructor(t) {
|
|
1555
1555
|
S(this, "debug");
|
|
1556
1556
|
S(this, "httpClient");
|
|
@@ -1583,8 +1583,8 @@ class Nn {
|
|
|
1583
1583
|
localStorage.setItem(n, JSON.stringify(s));
|
|
1584
1584
|
}
|
|
1585
1585
|
}
|
|
1586
|
-
const
|
|
1587
|
-
version:
|
|
1586
|
+
const Nn = "3.4.1", Fn = {
|
|
1587
|
+
version: Nn
|
|
1588
1588
|
};
|
|
1589
1589
|
class Dn {
|
|
1590
1590
|
constructor(t) {
|
|
@@ -1632,7 +1632,7 @@ class Un {
|
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
1634
|
let Ln = (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), "");
|
|
1635
|
-
const Bn = "fuul.tracking_id",
|
|
1635
|
+
const Bn = "fuul.tracking_id", de = () => Hn(Bn, () => Ln()), Ue = () => D("af") || D("referrer"), In = () => document.referrer, jn = () => vn(), kn = () => D("category"), qn = () => D("title"), $n = () => D("tag"), Hn = (e, t) => {
|
|
1636
1636
|
const n = localStorage.getItem(e);
|
|
1637
1637
|
if (n)
|
|
1638
1638
|
return n;
|
|
@@ -1640,34 +1640,23 @@ const Bn = "fuul.tracking_id", In = ["google.com", "bing.com", "yahoo.com"], de
|
|
|
1640
1640
|
const r = t();
|
|
1641
1641
|
return r ? localStorage.setItem(e, r) : localStorage.removeItem(e), r;
|
|
1642
1642
|
}
|
|
1643
|
-
},
|
|
1644
|
-
const e =
|
|
1643
|
+
}, D = (e) => new URLSearchParams(window.location.search).get(e), vn = () => {
|
|
1644
|
+
const e = D("source");
|
|
1645
1645
|
if (e)
|
|
1646
1646
|
return e;
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
var t;
|
|
1653
|
-
try {
|
|
1654
|
-
return (t = new URL(e).hostname) == null ? void 0 : t.split(".").slice(-2).join(".");
|
|
1655
|
-
} catch {
|
|
1656
|
-
return null;
|
|
1657
|
-
}
|
|
1658
|
-
}, Kn = "https://api.fuul.xyz/api/v1/";
|
|
1659
|
-
let F = !1, ie = !1, pe, I, rt, L, G, he;
|
|
1660
|
-
function Jn(e) {
|
|
1661
|
-
F = !!e.debug, !ie && (pe = e.apiKey, sr(), I = or(
|
|
1662
|
-
e.baseApiUrl ?? Kn,
|
|
1647
|
+
}, zn = "https://api.fuul.xyz/api/v1/";
|
|
1648
|
+
let N = !1, ie = !1, pe, I, rt, L, G, he;
|
|
1649
|
+
function Vn(e) {
|
|
1650
|
+
N = !!e.debug, !ie && (pe = e.apiKey, nr(), I = rr(
|
|
1651
|
+
e.baseApiUrl ?? zn,
|
|
1663
1652
|
e.defaultQueryParams ?? {}
|
|
1664
|
-
), rt = new Pn({ httpClient: I, debug:
|
|
1653
|
+
), rt = new Pn({ httpClient: I, debug: N }), G = new xn({ httpClient: I, debug: N }), L = new Tn({ httpClient: I, debug: N }), he = new Un({ httpClient: I, debug: N }), ie = !0, N && console.debug("Fuul SDK: init() complete"));
|
|
1665
1654
|
}
|
|
1666
1655
|
function T() {
|
|
1667
1656
|
if (!ie)
|
|
1668
1657
|
throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods");
|
|
1669
1658
|
}
|
|
1670
|
-
async function
|
|
1659
|
+
async function Kn(e, t) {
|
|
1671
1660
|
T(), me();
|
|
1672
1661
|
const n = {
|
|
1673
1662
|
name: e,
|
|
@@ -1678,7 +1667,7 @@ async function Mn(e, t) {
|
|
|
1678
1667
|
};
|
|
1679
1668
|
await G.sendEvent(n);
|
|
1680
1669
|
}
|
|
1681
|
-
async function
|
|
1670
|
+
async function Jn(e) {
|
|
1682
1671
|
T(), me();
|
|
1683
1672
|
const t = {
|
|
1684
1673
|
name: "pageview",
|
|
@@ -1688,18 +1677,18 @@ async function Wn(e) {
|
|
|
1688
1677
|
},
|
|
1689
1678
|
metadata: {
|
|
1690
1679
|
tracking_id: de(),
|
|
1691
|
-
referrer_url:
|
|
1692
|
-
source:
|
|
1680
|
+
referrer_url: In(),
|
|
1681
|
+
source: jn(),
|
|
1693
1682
|
affiliate_id: Ue() ?? void 0,
|
|
1694
1683
|
referrer: Ue() ?? void 0,
|
|
1695
|
-
category:
|
|
1696
|
-
title:
|
|
1697
|
-
tag:
|
|
1684
|
+
category: kn() ?? void 0,
|
|
1685
|
+
title: qn() ?? void 0,
|
|
1686
|
+
tag: $n() ?? void 0
|
|
1698
1687
|
}
|
|
1699
1688
|
};
|
|
1700
1689
|
await G.sendEvent(t);
|
|
1701
1690
|
}
|
|
1702
|
-
async function
|
|
1691
|
+
async function Mn(e) {
|
|
1703
1692
|
T(), me();
|
|
1704
1693
|
const t = {
|
|
1705
1694
|
name: "connect_wallet",
|
|
@@ -1710,43 +1699,43 @@ async function Gn(e) {
|
|
|
1710
1699
|
};
|
|
1711
1700
|
e != null && e.address && (t.user_address = e.address), e != null && e.signature && (t.signature = e == null ? void 0 : e.signature, t.signature_message = e == null ? void 0 : e.message), await G.sendEvent(t);
|
|
1712
1701
|
}
|
|
1713
|
-
async function
|
|
1702
|
+
async function Wn(e, t, n) {
|
|
1714
1703
|
T(), await L.create(e, t, n);
|
|
1715
1704
|
}
|
|
1716
|
-
async function
|
|
1705
|
+
async function Gn(e, t, n) {
|
|
1717
1706
|
T(), await L.update(e, t, n);
|
|
1718
1707
|
}
|
|
1719
|
-
async function
|
|
1708
|
+
async function Xn(e) {
|
|
1720
1709
|
return T(), await L.getCode(e);
|
|
1721
1710
|
}
|
|
1722
|
-
async function
|
|
1711
|
+
async function Qn(e) {
|
|
1723
1712
|
return T(), await L.isCodeFree(e);
|
|
1724
1713
|
}
|
|
1725
|
-
async function
|
|
1714
|
+
async function Yn(e, t, n) {
|
|
1726
1715
|
T();
|
|
1727
1716
|
const r = await L.getCode(t), s = new URLSearchParams({
|
|
1728
1717
|
af: r ?? t
|
|
1729
1718
|
});
|
|
1730
1719
|
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()}`;
|
|
1731
1720
|
}
|
|
1732
|
-
function
|
|
1721
|
+
function Zn(e) {
|
|
1733
1722
|
return he.getProjectPayoutsLeaderboard(e);
|
|
1734
1723
|
}
|
|
1735
|
-
function
|
|
1724
|
+
function er(e) {
|
|
1736
1725
|
return he.getUserPayouts(e);
|
|
1737
1726
|
}
|
|
1738
|
-
async function
|
|
1727
|
+
async function tr() {
|
|
1739
1728
|
return T(), rt.getAll();
|
|
1740
1729
|
}
|
|
1741
1730
|
function me() {
|
|
1742
1731
|
if (typeof window > "u" || typeof document > "u")
|
|
1743
1732
|
throw new Error("Fuul SDK: Browser context required");
|
|
1744
1733
|
}
|
|
1745
|
-
function
|
|
1734
|
+
function nr() {
|
|
1746
1735
|
if (!pe)
|
|
1747
1736
|
throw new Error("Fuul SDK: Invalid API key");
|
|
1748
1737
|
}
|
|
1749
|
-
function
|
|
1738
|
+
function rr(e, t) {
|
|
1750
1739
|
return new Dn({
|
|
1751
1740
|
baseURL: e,
|
|
1752
1741
|
timeout: 1e4,
|
|
@@ -1754,24 +1743,24 @@ function or(e, t) {
|
|
|
1754
1743
|
queryParams: t
|
|
1755
1744
|
});
|
|
1756
1745
|
}
|
|
1757
|
-
const
|
|
1758
|
-
init:
|
|
1759
|
-
sendEvent:
|
|
1760
|
-
sendPageview:
|
|
1761
|
-
sendConnectWallet:
|
|
1762
|
-
generateTrackingLink:
|
|
1763
|
-
getConversions:
|
|
1764
|
-
createAffiliateCode:
|
|
1765
|
-
updateAffiliateCode:
|
|
1766
|
-
getAffiliateCode:
|
|
1767
|
-
isAffiliateCodeFree:
|
|
1768
|
-
getUserPayouts:
|
|
1769
|
-
getProjectPayoutsLeaderboard:
|
|
1746
|
+
const Ar = {
|
|
1747
|
+
init: Vn,
|
|
1748
|
+
sendEvent: Kn,
|
|
1749
|
+
sendPageview: Jn,
|
|
1750
|
+
sendConnectWallet: Mn,
|
|
1751
|
+
generateTrackingLink: Yn,
|
|
1752
|
+
getConversions: tr,
|
|
1753
|
+
createAffiliateCode: Wn,
|
|
1754
|
+
updateAffiliateCode: Gn,
|
|
1755
|
+
getAffiliateCode: Xn,
|
|
1756
|
+
isAffiliateCodeFree: Qn,
|
|
1757
|
+
getUserPayouts: er,
|
|
1758
|
+
getProjectPayoutsLeaderboard: Zn
|
|
1770
1759
|
};
|
|
1771
1760
|
export {
|
|
1772
1761
|
_e as AddressInUseError,
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1762
|
+
xe as CodeInUseError,
|
|
1763
|
+
Ar as Fuul,
|
|
1764
|
+
Ne as InvalidSignatureError,
|
|
1776
1765
|
Pe as ValidationError
|
|
1777
1766
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(E,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(E=typeof globalThis<"u"?globalThis:E||self,b(E.Fuul={}))})(this,function(E){"use strict";var Qn=Object.defineProperty;var Yn=(E,b,D)=>b in E?Qn(E,b,{enumerable:!0,configurable:!0,writable:!0,value:D}):E[b]=D;var A=(E,b,D)=>(Yn(E,typeof b!="symbol"?b+"":b,D),D);function b(e,t){return function(){return e.apply(t,arguments)}}const{toString:D}=Object.prototype,{getPrototypeOf:Z}=Object,z=(e=>t=>{const n=D.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),O=e=>(e=e.toLowerCase(),t=>z(t)===e),V=e=>t=>typeof t===e,{isArray:L}=Array,k=V("undefined");function it(e){return e!==null&&!k(e)&&e.constructor!==null&&!k(e.constructor)&&R(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Re=O("ArrayBuffer");function at(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Re(e.buffer),t}const ct=V("string"),R=V("function"),Ce=V("number"),K=e=>e!==null&&typeof e=="object",ut=e=>e===!0||e===!1,J=e=>{if(z(e)!=="object")return!1;const t=Z(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},lt=O("Date"),ft=O("File"),dt=O("Blob"),pt=O("FileList"),ht=e=>K(e)&&R(e.pipe),mt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||R(e.append)&&((t=z(e))==="formdata"||t==="object"&&R(e.toString)&&e.toString()==="[object FormData]"))},yt=O("URLSearchParams"),wt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),L(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function Oe(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Te=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Pe=e=>!k(e)&&e!==Te;function ee(){const{caseless:e}=Pe(this)&&this||{},t={},n=(r,s)=>{const i=e&&Oe(t,s)||s;J(t[i])&&J(r)?t[i]=ee(t[i],r):J(r)?t[i]=ee({},r):L(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&$(arguments[r],n);return t}const gt=(e,t,n,{allOwnKeys:r}={})=>($(t,(s,i)=>{n&&R(s)?e[i]=b(s,n):e[i]=s},{allOwnKeys:r}),e),Et=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},bt=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&Z(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},At=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Rt=e=>{if(!e)return null;if(L(e))return e;let t=e.length;if(!Ce(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ct=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Z(Uint8Array)),Ot=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Tt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Pt=O("HTMLFormElement"),_t=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),_e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Nt=O("RegExp"),Ne=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};$(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},xt=e=>{Ne(e,(t,n)=>{if(R(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(R(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ft=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return L(e)?r(e):r(String(e).split(t)),n},Ut=()=>{},Dt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),te="abcdefghijklmnopqrstuvwxyz",xe="0123456789",Fe={DIGIT:xe,ALPHA:te,ALPHA_DIGIT:te+te.toUpperCase()+xe},Lt=(e=16,t=Fe.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Bt(e){return!!(e&&R(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const It=e=>{const t=new Array(10),n=(r,s)=>{if(K(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=L(r)?[]:{};return $(r,(o,c)=>{const p=n(o,s+1);!k(p)&&(i[c]=p)}),t[s]=void 0,i}}return r};return n(e,0)},jt=O("AsyncFunction"),a={isArray:L,isArrayBuffer:Re,isBuffer:it,isFormData:mt,isArrayBufferView:at,isString:ct,isNumber:Ce,isBoolean:ut,isObject:K,isPlainObject:J,isUndefined:k,isDate:lt,isFile:ft,isBlob:dt,isRegExp:Nt,isFunction:R,isStream:ht,isURLSearchParams:yt,isTypedArray:Ct,isFileList:pt,forEach:$,merge:ee,extend:gt,trim:wt,stripBOM:Et,inherits:St,toFlatObject:bt,kindOf:z,kindOfTest:O,endsWith:At,toArray:Rt,forEachEntry:Ot,matchAll:Tt,isHTMLForm:Pt,hasOwnProperty:_e,hasOwnProp:_e,reduceDescriptors:Ne,freezeMethods:xt,toObjectSet:Ft,toCamelCase:_t,noop:Ut,toFiniteNumber:Dt,findKey:Oe,global:Te,isContextDefined:Pe,ALPHABET:Fe,generateString:Lt,isSpecCompliantForm:Bt,toJSONObject:It,isAsyncFn:jt,isThenable:e=>e&&(K(e)||R(e))&&R(e.then)&&R(e.catch)};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ue=m.prototype,De={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{De[e]={value:e}}),Object.defineProperties(m,De),Object.defineProperty(Ue,"isAxiosError",{value:!0}),m.from=(e,t,n,r,s,i)=>{const o=Object.create(Ue);return a.toFlatObject(e,o,function(p){return p!==Error.prototype},c=>c!=="isAxiosError"),m.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const kt=null;function ne(e){return a.isPlainObject(e)||a.isArray(e)}function Le(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,n){return e?e.concat(t).map(function(s,i){return s=Le(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function $t(e){return a.isArray(e)&&!e.some(ne)}const qt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function M(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!a.isUndefined(g[d])});const r=n.metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function h(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(!p&&a.isBlob(f))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,d,g){let S=f;if(f&&!g&&typeof f=="object"){if(a.endsWith(d,"{}"))d=r?d:d.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&$t(f)||(a.isFileList(f)||a.endsWith(d,"[]"))&&(S=a.toArray(f)))return d=Le(d),S.forEach(function(U,Xn){!(a.isUndefined(U)||U===null)&&t.append(o===!0?Be([d],Xn,i):o===null?d:d+"[]",h(U))}),!1}return ne(f)?!0:(t.append(Be(g,d,i),h(f)),!1)}const u=[],w=Object.assign(qt,{defaultVisitor:l,convertValue:h,isVisitable:ne});function C(f,d){if(!a.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(f),a.forEach(f,function(S,F){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(F)?F.trim():F,d,w))===!0&&C(S,d?d.concat(F):[F])}),u.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return C(e),t}function Ie(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function re(e,t){this._pairs=[],e&&M(e,this,t)}const je=re.prototype;je.append=function(t,n){this._pairs.push([t,n])},je.toString=function(t){const n=t?function(r){return t.call(this,r,Ie)}:Ie;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ke(e,t,n){if(!t)return e;const r=n&&n.encode||Ht,s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class vt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const $e=vt,qe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:re,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},He=typeof window<"u"&&typeof document<"u",Vt=(e=>He&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Kt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),T={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:He,hasStandardBrowserEnv:Vt,hasStandardBrowserWebWorkerEnv:Kt},Symbol.toStringTag,{value:"Module"})),...zt};function Jt(e,t){return M(e,new T.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return T.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Mt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wt(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ve(e){function t(n,r,s,i){let o=n[i++];const c=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Wt(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Mt(r),s,n,0)}),n}return null}function Gt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const se={transitional:qe,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(ve(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Jt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return M(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Gt(t)):t}],transformResponse:[function(t){const n=this.transitional||se.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T.classes.FormData,Blob:T.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{se.headers[e]={}});const oe=se,Xt=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Qt=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&
|
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[ze]=this[ze]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=q(o);r[c]||(tn(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};
|
|
1
|
+
(function(E,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(E=typeof globalThis<"u"?globalThis:E||self,b(E.Fuul={}))})(this,function(E){"use strict";var Xn=Object.defineProperty;var Gn=(E,b,D)=>b in E?Xn(E,b,{enumerable:!0,configurable:!0,writable:!0,value:D}):E[b]=D;var A=(E,b,D)=>(Gn(E,typeof b!="symbol"?b+"":b,D),D);function b(e,t){return function(){return e.apply(t,arguments)}}const{toString:D}=Object.prototype,{getPrototypeOf:Z}=Object,z=(e=>t=>{const n=D.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),O=e=>(e=e.toLowerCase(),t=>z(t)===e),V=e=>t=>typeof t===e,{isArray:U}=Array,k=V("undefined");function it(e){return e!==null&&!k(e)&&e.constructor!==null&&!k(e.constructor)&&R(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Re=O("ArrayBuffer");function at(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Re(e.buffer),t}const ct=V("string"),R=V("function"),Ce=V("number"),K=e=>e!==null&&typeof e=="object",ut=e=>e===!0||e===!1,J=e=>{if(z(e)!=="object")return!1;const t=Z(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},lt=O("Date"),ft=O("File"),dt=O("Blob"),pt=O("FileList"),ht=e=>K(e)&&R(e.pipe),mt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||R(e.append)&&((t=z(e))==="formdata"||t==="object"&&R(e.toString)&&e.toString()==="[object FormData]"))},yt=O("URLSearchParams"),wt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),U(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function Oe(e,t){t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const Te=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Pe=e=>!k(e)&&e!==Te;function ee(){const{caseless:e}=Pe(this)&&this||{},t={},n=(r,s)=>{const i=e&&Oe(t,s)||s;J(t[i])&&J(r)?t[i]=ee(t[i],r):J(r)?t[i]=ee({},r):U(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&$(arguments[r],n);return t}const gt=(e,t,n,{allOwnKeys:r}={})=>($(t,(s,i)=>{n&&R(s)?e[i]=b(s,n):e[i]=s},{allOwnKeys:r}),e),Et=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},bt=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&Z(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},At=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Rt=e=>{if(!e)return null;if(U(e))return e;let t=e.length;if(!Ce(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ct=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Z(Uint8Array)),Ot=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Tt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Pt=O("HTMLFormElement"),_t=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),_e=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Nt=O("RegExp"),Ne=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};$(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},xt=e=>{Ne(e,(t,n)=>{if(R(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(R(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ft=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return U(e)?r(e):r(String(e).split(t)),n},Dt=()=>{},Ut=(e,t)=>(e=+e,Number.isFinite(e)?e:t),te="abcdefghijklmnopqrstuvwxyz",xe="0123456789",Fe={DIGIT:xe,ALPHA:te,ALPHA_DIGIT:te+te.toUpperCase()+xe},Lt=(e=16,t=Fe.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Bt(e){return!!(e&&R(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const It=e=>{const t=new Array(10),n=(r,s)=>{if(K(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=U(r)?[]:{};return $(r,(o,c)=>{const p=n(o,s+1);!k(p)&&(i[c]=p)}),t[s]=void 0,i}}return r};return n(e,0)},jt=O("AsyncFunction"),a={isArray:U,isArrayBuffer:Re,isBuffer:it,isFormData:mt,isArrayBufferView:at,isString:ct,isNumber:Ce,isBoolean:ut,isObject:K,isPlainObject:J,isUndefined:k,isDate:lt,isFile:ft,isBlob:dt,isRegExp:Nt,isFunction:R,isStream:ht,isURLSearchParams:yt,isTypedArray:Ct,isFileList:pt,forEach:$,merge:ee,extend:gt,trim:wt,stripBOM:Et,inherits:St,toFlatObject:bt,kindOf:z,kindOfTest:O,endsWith:At,toArray:Rt,forEachEntry:Ot,matchAll:Tt,isHTMLForm:Pt,hasOwnProperty:_e,hasOwnProp:_e,reduceDescriptors:Ne,freezeMethods:xt,toObjectSet:Ft,toCamelCase:_t,noop:Dt,toFiniteNumber:Ut,findKey:Oe,global:Te,isContextDefined:Pe,ALPHABET:Fe,generateString:Lt,isSpecCompliantForm:Bt,toJSONObject:It,isAsyncFn:jt,isThenable:e=>e&&(K(e)||R(e))&&R(e.then)&&R(e.catch)};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const De=m.prototype,Ue={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ue[e]={value:e}}),Object.defineProperties(m,Ue),Object.defineProperty(De,"isAxiosError",{value:!0}),m.from=(e,t,n,r,s,i)=>{const o=Object.create(De);return a.toFlatObject(e,o,function(p){return p!==Error.prototype},c=>c!=="isAxiosError"),m.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const kt=null;function ne(e){return a.isPlainObject(e)||a.isArray(e)}function Le(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,n){return e?e.concat(t).map(function(s,i){return s=Le(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function $t(e){return a.isArray(e)&&!e.some(ne)}const qt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function M(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!a.isUndefined(g[d])});const r=n.metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function h(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(!p&&a.isBlob(f))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,d,g){let S=f;if(f&&!g&&typeof f=="object"){if(a.endsWith(d,"{}"))d=r?d:d.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&$t(f)||(a.isFileList(f)||a.endsWith(d,"[]"))&&(S=a.toArray(f)))return d=Le(d),S.forEach(function(F,Wn){!(a.isUndefined(F)||F===null)&&t.append(o===!0?Be([d],Wn,i):o===null?d:d+"[]",h(F))}),!1}return ne(f)?!0:(t.append(Be(g,d,i),h(f)),!1)}const u=[],w=Object.assign(qt,{defaultVisitor:l,convertValue:h,isVisitable:ne});function C(f,d){if(!a.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(f),a.forEach(f,function(S,x){(!(a.isUndefined(S)||S===null)&&s.call(t,S,a.isString(x)?x.trim():x,d,w))===!0&&C(S,d?d.concat(x):[x])}),u.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return C(e),t}function Ie(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function re(e,t){this._pairs=[],e&&M(e,this,t)}const je=re.prototype;je.append=function(t,n){this._pairs.push([t,n])},je.toString=function(t){const n=t?function(r){return t.call(this,r,Ie)}:Ie;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ke(e,t,n){if(!t)return e;const r=n&&n.encode||Ht,s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class vt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const $e=vt,qe={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:re,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},He=typeof window<"u"&&typeof document<"u",Vt=(e=>He&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator<"u"&&navigator.product),Kt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),T={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:He,hasStandardBrowserEnv:Vt,hasStandardBrowserWebWorkerEnv:Kt},Symbol.toStringTag,{value:"Module"})),...zt};function Jt(e,t){return M(e,new T.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return T.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Mt(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wt(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function ve(e){function t(n,r,s,i){let o=n[i++];const c=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=Wt(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Mt(r),s,n,0)}),n}return null}function Xt(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const se={transitional:qe,adapter:["xhr","http"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s&&s?JSON.stringify(ve(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Jt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return M(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Xt(t)):t}],transformResponse:[function(t){const n=this.transitional||se.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(o)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T.classes.FormData,Blob:T.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{se.headers[e]={}});const oe=se,Gt=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Qt=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Gt[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},ze=Symbol("internals");function q(e){return e&&String(e).trim().toLowerCase()}function W(e){return e===!1||e==null?e:a.isArray(e)?e.map(W):String(e)}function Yt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Zt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ie(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function en(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function tn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let X=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(c,p,h){const l=q(p);if(!l)throw new Error("header name must be a non-empty string");const u=a.findKey(s,l);(!u||s[u]===void 0||h===!0||h===void 0&&s[u]!==!1)&&(s[u||p]=W(c))}const o=(c,p)=>a.forEach(c,(h,l)=>i(h,l,p));return a.isPlainObject(t)||t instanceof this.constructor?o(t,n):a.isString(t)&&(t=t.trim())&&!Zt(t)?o(Qt(t),n):t!=null&&i(n,t,r),this}get(t,n){if(t=q(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Yt(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=q(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ie(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=q(o),o){const c=a.findKey(r,o);c&&(!n||ie(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||ie(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=W(s),delete n[i];return}const c=t?en(i):String(i).trim();c!==i&&delete n[i],n[c]=W(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[ze]=this[ze]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=q(o);r[c]||(tn(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};X.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(X.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),a.freezeMethods(X);const P=X;function ae(e,t){const n=this||oe,r=t||n,s=P.from(r.headers);let i=r.data;return a.forEach(e,function(c){i=c.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Ve(e){return!!(e&&e.__CANCEL__)}function H(e,t,n){m.call(this,e??"canceled",m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(H,m,{__CANCEL__:!0});function nn(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const rn=T.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),a.isString(r)&&o.push("path="+r),a.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function sn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function on(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ke(e,t){return e&&!sn(t)?on(e,t):t}const an=T.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function s(i){let o=i;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(o){const c=a.isString(o)?s(o):o;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function cn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function un(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const h=Date.now(),l=r[i];o||(o=h),n[s]=p,r[s]=h;let u=i,w=0;for(;u!==s;)w+=n[u++],u=u%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),h-o<t)return;const C=l&&h-l;return C?Math.round(w*1e3/C):void 0}}function Je(e,t){let n=0;const r=un(50,250);return s=>{const i=s.loaded,o=s.lengthComputable?s.total:void 0,c=i-n,p=r(c),h=i<=o;n=i;const l={loaded:i,total:o,progress:o?i/o:void 0,bytes:c,rate:p||void 0,estimated:p&&o&&h?(o-i)/p:void 0,event:s};l[t?"download":"upload"]=!0,e(l)}}const ce={http:kt,xhr:typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){let s=e.data;const i=P.from(e.headers).normalize();let{responseType:o,withXSRFToken:c}=e,p;function h(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}let l;if(a.isFormData(s)){if(T.hasStandardBrowserEnv||T.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((l=i.getContentType())!==!1){const[d,...g]=l?l.split(";").map(S=>S.trim()).filter(Boolean):[];i.setContentType([d||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(e.auth){const d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(d+":"+g))}const w=Ke(e.baseURL,e.url);u.open(e.method.toUpperCase(),ke(w,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function C(){if(!u)return;const d=P.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),S={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:d,config:e,request:u};nn(function(F){n(F),h()},function(F){r(F),h()},S),u=null}if("onloadend"in u?u.onloadend=C:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(C)},u.onabort=function(){u&&(r(new m("Request aborted",m.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new m("Network Error",m.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let g=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const S=e.transitional||qe;e.timeoutErrorMessage&&(g=e.timeoutErrorMessage),r(new m(g,S.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,u)),u=null},T.hasStandardBrowserEnv&&(c&&a.isFunction(c)&&(c=c(e)),c||c!==!1&&an(w))){const d=e.xsrfHeaderName&&e.xsrfCookieName&&rn.read(e.xsrfCookieName);d&&i.set(e.xsrfHeaderName,d)}s===void 0&&i.setContentType(null),"setRequestHeader"in u&&a.forEach(i.toJSON(),function(g,S){u.setRequestHeader(S,g)}),a.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),o&&o!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",Je(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",Je(e.onUploadProgress)),(e.cancelToken||e.signal)&&(p=d=>{u&&(r(!d||d.type?new H(null,e,u):d),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(p),e.signal&&(e.signal.aborted?p():e.signal.addEventListener("abort",p)));const f=cn(w);if(f&&T.protocols.indexOf(f)===-1){r(new m("Unsupported protocol "+f+":",m.ERR_BAD_REQUEST,e));return}u.send(s||null)})}};a.forEach(ce,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Me=e=>`- ${e}`,ln=e=>a.isFunction(e)||e===null||e===!1,We={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let i=0;i<t;i++){n=e[i];let o;if(r=n,!ln(n)&&(r=ce[(o=String(n)).toLowerCase()],r===void 0))throw new m(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){const i=Object.entries(s).map(([c,p])=>`adapter ${c} `+(p===!1?"is not supported by the environment":"is not available in the build"));let o=t?i.length>1?`since :
|
|
4
4
|
`+i.map(Me).join(`
|
|
5
|
-
`):" "+Me(i[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:ce};function ue(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new H(null,e)}function Ge(e){return ue(e),e.headers=P.from(e.headers),e.data=ae.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),We.getAdapter(e.adapter||oe.adapter)(e).then(function(r){return ue(e),r.data=ae.call(e,e.transformResponse,r),r.headers=P.from(r.headers),r},function(r){return Ve(r)||(ue(e),r&&r.response&&(r.response.data=ae.call(e,e.transformResponse,r.response),r.response.headers=P.from(r.response.headers))),Promise.reject(r)})}const Xe=e=>e instanceof P?e.toJSON():e;function B(e,t){t=t||{};const n={};function r(h,l,u){return a.isPlainObject(h)&&a.isPlainObject(l)?a.merge.call({caseless:u},h,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(h,l,u){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h,u)}else return r(h,l,u)}function i(h,l){if(!a.isUndefined(l))return r(void 0,l)}function o(h,l){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h)}else return r(void 0,l)}function c(h,l,u){if(u in t)return r(h,l);if(u in e)return r(void 0,h)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(h,l)=>s(Xe(h),Xe(l),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(l){const u=p[l]||s,w=u(e[l],t[l],l);a.isUndefined(w)&&u!==c||(n[l]=w)}),n}const Qe="1.6.3",le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{le[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ye={};le.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Qe+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new m(s(o," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!Ye[o]&&(Ye[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}};function fn(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],p=c===void 0||o(c,i,e);if(p!==!0)throw new m("option "+i+" must be "+p,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const fe={assertOptions:fn,validators:le},N=fe.validators;let X=class{constructor(t){this.defaults=t,this.interceptors={request:new $e,response:new $e}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=B(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:N.function,serialize:N.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=P.concat(o,i);const c=[];let p=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(p=p&&d.synchronous,c.unshift(d.fulfilled,d.rejected))});const h=[];this.interceptors.response.forEach(function(d){h.push(d.fulfilled,d.rejected)});let l,u=0,w;if(!p){const f=[Ge.bind(this),void 0];for(f.unshift.apply(f,c),f.push.apply(f,h),w=f.length,l=Promise.resolve(n);u<w;)l=l.then(f[u++],f[u++]);return l}w=c.length;let C=n;for(u=0;u<w;){const f=c[u++],d=c[u++];try{C=f(C)}catch(g){d.call(this,g);break}}try{l=Ge.call(this,C)}catch(f){return Promise.reject(f)}for(u=0,w=h.length;u<w;)l=l.then(h[u++],h[u++]);return l}getUri(t){t=B(this.defaults,t);const n=Ke(t.baseURL,t.url);return ke(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){X.prototype[t]=function(n,r){return this.request(B(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(B(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}X.prototype[t]=n(),X.prototype[t+"Form"]=n(!0)});const Q=X,dn=class ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new H(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new ot(function(s){t=s}),cancel:t}}};function pn(e){return function(n){return e.apply(null,n)}}function hn(e){return a.isObject(e)&&e.isAxiosError===!0}const de={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(de).forEach(([e,t])=>{de[t]=e});const mn=de;function Ze(e){const t=new Q(e),n=b(Q.prototype.request,t);return a.extend(n,Q.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ze(B(e,s))},n}const y=Ze(oe);y.Axios=Q,y.CanceledError=H,y.CancelToken=dn,y.isCancel=Ve,y.VERSION=Qe,y.toFormData=M,y.AxiosError=m,y.Cancel=y.CanceledError,y.all=function(t){return Promise.all(t)},y.spread=pn,y.isAxiosError=hn,y.mergeConfig=B,y.AxiosHeaders=P,y.formToJSON=e=>ve(a.isHTMLForm(e)?new FormData(e):e),y.getAdapter=We.getAdapter,y.HttpStatusCode=mn,y.default=y;const et=y,{Axios:ar,AxiosError:pe,CanceledError:cr,isCancel:ur,CancelToken:lr,VERSION:fr,all:dr,Cancel:pr,isAxiosError:hr,spread:mr,toFormData:yr,AxiosHeaders:wr,HttpStatusCode:gr,formToJSON:Er,getAdapter:Sr,mergeConfig:br}=et;class he extends Error{constructor(n){super(n.join(", "));A(this,"errors");this.name="ValidationError",this.errors=n}}class me extends Error{constructor(n){super("Address already registered.");A(this,"address");this.name="AddressInUseError",this.address=n}}class ye extends Error{constructor(n){super("Code already registered.");A(this,"code");this.name="CodeInUseError",this.code=n}}class we extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class yn{constructor(t){A(this,"httpClient");A(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async create(t,n,r){var s;try{await this.httpClient.post("/affiliates",{address:t,name:n,code:n,signature:r})}catch(i){if(i instanceof pe){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new we:c=="address in use"?new me(t):c=="code in use"?new ye(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new he(o.message)}throw i}}async update(t,n,r){var s;try{await this.httpClient.post(`/affiliates/${t}`,{code:n,address:t,signature:r})}catch(i){if(i instanceof pe){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new we:c=="address in use"?new me(t):c=="code in use"?new ye(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new he(o.message)}throw i}}async isCodeFree(t){var n;try{return await this.httpClient.get(`/affiliates/codes/${t}`),!1}catch(r){return r instanceof pe&&((n=r.response)==null?void 0:n.status)===404?!0:(console.error("Fuul SDK: Could not check affiliate code",r),!1)}}async getCode(t){try{return(await this.httpClient.get(`/affiliates/${t}`)).data.code}catch(n){return console.error("Fuul SDK: Could not get affiliate code",n),null}}}class wn{constructor(t){A(this,"httpClient");this.httpClient=t.httpClient}async getAll(){const{data:t}=await this.httpClient.get("conversions");return t}}const tt="fuul.sent",gn=60;class En{constructor(t){A(this,"debug");A(this,"httpClient");this.httpClient=t.httpClient,this.debug=!!t.debug}async sendEvent(t){if(this.isDuplicate(t)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}await this.httpClient.post("events",t),this.debug&&console.debug(`Fuul SDK: Sent '${t.name}' event`),this.saveSentEvent(t)}isDuplicate(t){const n=`${tt}_${t.name}`,r=localStorage.getItem(n);if(!r)return!1;const s=JSON.parse(r);if(this.getCurrentTimestamp()-s.timestamp>gn)return!1;let p=!1;t.metadata&&(p=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);let h=!1;return t.args&&s.args&&(h=s.args.page===t.args.page),h&&p}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(t){const n=`${tt}_${t.name}`,r=this.getCurrentTimestamp(),s={...t,timestamp:r};localStorage.setItem(n,JSON.stringify(s))}}const Sn={version:"3.4.0"};class bn{constructor(t){A(this,"client");A(this,"queryParams");this.client=et.create({...t,headers:{Authorization:`Bearer ${t.apiKey}`,"X-Fuul-Sdk-Version":Sn.version}}),this.queryParams=t.queryParams?this.buildQueryParams(t.queryParams):""}buildQueryParams(t){let n="";return Object.keys(t).forEach(r=>{n=n===""?n+`?${r}=${t[r]}`:n+`&${r}=${t[r]}`}),n}async get(t,n){return this.client.get(t+this.queryParams,{params:n})}async post(t,n){return this.client.post(t+this.queryParams,n)}async put(t,n){return this.client.put(t+this.queryParams,n)}async delete(t){return this.client.delete(t+this.queryParams)}}const nt="/payouts";class An{constructor(t){A(this,"httpClient");A(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getProjectPayoutsLeaderboard(t){return(await this.httpClient.get(`${nt}/leaderboard`,t)).data}async getUserPayouts(t){return(await this.httpClient.get(nt,t)).data}}let Rn=(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),"");const Cn="fuul.tracking_id",On=["google.com","bing.com","yahoo.com"],ge=()=>Fn(Cn,()=>Rn()),rt=()=>x("af")||x("referrer"),Tn=()=>document.referrer,Pn=()=>Un(),_n=()=>x("category"),Nn=()=>x("title"),xn=()=>x("tag"),Fn=(e,t)=>{const n=localStorage.getItem(e);if(n)return n;{const r=t();return r?localStorage.setItem(e,r):localStorage.removeItem(e),r}},x=e=>new URLSearchParams(window.location.search).get(e),Un=()=>{const e=x("source"),t=x("af")||x("referrer");if(e)return e;if(t)return"affiliate";const n=Dn(document.referrer);return n&&On.includes(n)?"organic":"direct"},Dn=e=>{var t;try{return(t=new URL(e).hostname)==null?void 0:t.split(".").slice(-2).join(".")}catch{return null}},Ln="https://api.fuul.xyz/api/v1/";let I=!1,Ee=!1,Se,v,st,j,Y,be;function Bn(e){I=!!e.debug,!Ee&&(Se=e.apiKey,Mn(),v=Wn(e.baseApiUrl??Ln,e.defaultQueryParams??{}),st=new wn({httpClient:v,debug:I}),Y=new En({httpClient:v,debug:I}),j=new yn({httpClient:v,debug:I}),be=new An({httpClient:v,debug:I}),Ee=!0,I&&console.debug("Fuul SDK: init() complete"))}function _(){if(!Ee)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function In(e,t){_(),Ae();const n={name:e,args:t??{},metadata:{tracking_id:ge()}};await Y.sendEvent(n)}async function jn(e){_(),Ae();const t={name:"pageview",args:{page:e??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:ge(),referrer_url:Tn(),source:Pn(),affiliate_id:rt()??void 0,referrer:rt()??void 0,category:_n()??void 0,title:Nn()??void 0,tag:xn()??void 0}};await Y.sendEvent(t)}async function kn(e){_(),Ae();const t={name:"connect_wallet",args:{},metadata:{tracking_id:ge()}};e!=null&&e.address&&(t.user_address=e.address),e!=null&&e.signature&&(t.signature=e==null?void 0:e.signature,t.signature_message=e==null?void 0:e.message),await Y.sendEvent(t)}async function $n(e,t,n){_(),await j.create(e,t,n)}async function qn(e,t,n){_(),await j.update(e,t,n)}async function Hn(e){return _(),await j.getCode(e)}async function vn(e){return _(),await j.isCodeFree(e)}async function zn(e,t,n){_();const r=await j.getCode(t),s=new URLSearchParams({af:r??t});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()}`}function Vn(e){return be.getProjectPayoutsLeaderboard(e)}function Kn(e){return be.getUserPayouts(e)}async function Jn(){return _(),st.getAll()}function Ae(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Mn(){if(!Se)throw new Error("Fuul SDK: Invalid API key")}function Wn(e,t){return new bn({baseURL:e,timeout:1e4,apiKey:Se,queryParams:t})}const Gn={init:Bn,sendEvent:In,sendPageview:jn,sendConnectWallet:kn,generateTrackingLink:zn,getConversions:Jn,createAffiliateCode:$n,updateAffiliateCode:qn,getAffiliateCode:Hn,isAffiliateCodeFree:vn,getUserPayouts:Kn,getProjectPayoutsLeaderboard:Vn};E.AddressInUseError=me,E.CodeInUseError=ye,E.Fuul=Gn,E.InvalidSignatureError=we,E.ValidationError=he,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
5
|
+
`):" "+Me(i[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:ce};function ue(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new H(null,e)}function Xe(e){return ue(e),e.headers=P.from(e.headers),e.data=ae.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),We.getAdapter(e.adapter||oe.adapter)(e).then(function(r){return ue(e),r.data=ae.call(e,e.transformResponse,r),r.headers=P.from(r.headers),r},function(r){return Ve(r)||(ue(e),r&&r.response&&(r.response.data=ae.call(e,e.transformResponse,r.response),r.response.headers=P.from(r.response.headers))),Promise.reject(r)})}const Ge=e=>e instanceof P?e.toJSON():e;function L(e,t){t=t||{};const n={};function r(h,l,u){return a.isPlainObject(h)&&a.isPlainObject(l)?a.merge.call({caseless:u},h,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(h,l,u){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h,u)}else return r(h,l,u)}function i(h,l){if(!a.isUndefined(l))return r(void 0,l)}function o(h,l){if(a.isUndefined(l)){if(!a.isUndefined(h))return r(void 0,h)}else return r(void 0,l)}function c(h,l,u){if(u in t)return r(h,l);if(u in e)return r(void 0,h)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(h,l)=>s(Ge(h),Ge(l),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(l){const u=p[l]||s,w=u(e[l],t[l],l);a.isUndefined(w)&&u!==c||(n[l]=w)}),n}const Qe="1.6.3",le={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{le[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ye={};le.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Qe+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new m(s(o," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!Ye[o]&&(Ye[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}};function fn(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],p=c===void 0||o(c,i,e);if(p!==!0)throw new m("option "+i+" must be "+p,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+i,m.ERR_BAD_OPTION)}}const fe={assertOptions:fn,validators:le},N=fe.validators;let G=class{constructor(t){this.defaults=t,this.interceptors={request:new $e,response:new $e}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=L(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&fe.assertOptions(r,{silentJSONParsing:N.transitional(N.boolean),forcedJSONParsing:N.transitional(N.boolean),clarifyTimeoutError:N.transitional(N.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:fe.assertOptions(s,{encode:N.function,serialize:N.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=P.concat(o,i);const c=[];let p=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(n)===!1||(p=p&&d.synchronous,c.unshift(d.fulfilled,d.rejected))});const h=[];this.interceptors.response.forEach(function(d){h.push(d.fulfilled,d.rejected)});let l,u=0,w;if(!p){const f=[Xe.bind(this),void 0];for(f.unshift.apply(f,c),f.push.apply(f,h),w=f.length,l=Promise.resolve(n);u<w;)l=l.then(f[u++],f[u++]);return l}w=c.length;let C=n;for(u=0;u<w;){const f=c[u++],d=c[u++];try{C=f(C)}catch(g){d.call(this,g);break}}try{l=Xe.call(this,C)}catch(f){return Promise.reject(f)}for(u=0,w=h.length;u<w;)l=l.then(h[u++],h[u++]);return l}getUri(t){t=L(this.defaults,t);const n=Ke(t.baseURL,t.url);return ke(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){G.prototype[t]=function(n,r){return this.request(L(r||{},{method:t,url:n,data:(r||{}).data}))}}),a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(L(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}G.prototype[t]=n(),G.prototype[t+"Form"]=n(!0)});const Q=G,dn=class ot{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new H(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new ot(function(s){t=s}),cancel:t}}};function pn(e){return function(n){return e.apply(null,n)}}function hn(e){return a.isObject(e)&&e.isAxiosError===!0}const de={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(de).forEach(([e,t])=>{de[t]=e});const mn=de;function Ze(e){const t=new Q(e),n=b(Q.prototype.request,t);return a.extend(n,Q.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ze(L(e,s))},n}const y=Ze(oe);y.Axios=Q,y.CanceledError=H,y.CancelToken=dn,y.isCancel=Ve,y.VERSION=Qe,y.toFormData=M,y.AxiosError=m,y.Cancel=y.CanceledError,y.all=function(t){return Promise.all(t)},y.spread=pn,y.isAxiosError=hn,y.mergeConfig=L,y.AxiosHeaders=P,y.formToJSON=e=>ve(a.isHTMLForm(e)?new FormData(e):e),y.getAdapter=We.getAdapter,y.HttpStatusCode=mn,y.default=y;const et=y,{Axios:or,AxiosError:pe,CanceledError:ir,isCancel:ar,CancelToken:cr,VERSION:ur,all:lr,Cancel:fr,isAxiosError:dr,spread:pr,toFormData:hr,AxiosHeaders:mr,HttpStatusCode:yr,formToJSON:wr,getAdapter:gr,mergeConfig:Er}=et;class he extends Error{constructor(n){super(n.join(", "));A(this,"errors");this.name="ValidationError",this.errors=n}}class me extends Error{constructor(n){super("Address already registered.");A(this,"address");this.name="AddressInUseError",this.address=n}}class ye extends Error{constructor(n){super("Code already registered.");A(this,"code");this.name="CodeInUseError",this.code=n}}class we extends Error{constructor(){super("Invalid signature provided"),this.name="InvalidSignatureError"}}class yn{constructor(t){A(this,"httpClient");A(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async create(t,n,r){var s;try{await this.httpClient.post("/affiliates",{address:t,name:n,code:n,signature:r})}catch(i){if(i instanceof pe){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new we:c=="address in use"?new me(t):c=="code in use"?new ye(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new he(o.message)}throw i}}async update(t,n,r){var s;try{await this.httpClient.post(`/affiliates/${t}`,{code:n,address:t,signature:r})}catch(i){if(i instanceof pe){const o=(s=i.response)==null?void 0:s.data;if(typeof(o==null?void 0:o.message)=="string"){const c=o.message.toLowerCase();throw c=="invalid signature"?new we:c=="address in use"?new me(t):c=="code in use"?new ye(n):new Error(c)}else if((o==null?void 0:o.message)instanceof Array)throw new he(o.message)}throw i}}async isCodeFree(t){var n;try{return await this.httpClient.get(`/affiliates/codes/${t}`),!1}catch(r){return r instanceof pe&&((n=r.response)==null?void 0:n.status)===404?!0:(console.error("Fuul SDK: Could not check affiliate code",r),!1)}}async getCode(t){try{return(await this.httpClient.get(`/affiliates/${t}`)).data.code}catch(n){return console.error("Fuul SDK: Could not get affiliate code",n),null}}}class wn{constructor(t){A(this,"httpClient");this.httpClient=t.httpClient}async getAll(){const{data:t}=await this.httpClient.get("conversions");return t}}const tt="fuul.sent",gn=60;class En{constructor(t){A(this,"debug");A(this,"httpClient");this.httpClient=t.httpClient,this.debug=!!t.debug}async sendEvent(t){if(this.isDuplicate(t)){this.debug&&console.debug("Fuul SDK: Event is considered duplicate and will not be sent");return}await this.httpClient.post("events",t),this.debug&&console.debug(`Fuul SDK: Sent '${t.name}' event`),this.saveSentEvent(t)}isDuplicate(t){const n=`${tt}_${t.name}`,r=localStorage.getItem(n);if(!r)return!1;const s=JSON.parse(r);if(this.getCurrentTimestamp()-s.timestamp>gn)return!1;let p=!1;t.metadata&&(p=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);let h=!1;return t.args&&s.args&&(h=s.args.page===t.args.page),h&&p}getCurrentTimestamp(){return Date.now()/1e3}saveSentEvent(t){const n=`${tt}_${t.name}`,r=this.getCurrentTimestamp(),s={...t,timestamp:r};localStorage.setItem(n,JSON.stringify(s))}}const Sn={version:"3.4.1"};class bn{constructor(t){A(this,"client");A(this,"queryParams");this.client=et.create({...t,headers:{Authorization:`Bearer ${t.apiKey}`,"X-Fuul-Sdk-Version":Sn.version}}),this.queryParams=t.queryParams?this.buildQueryParams(t.queryParams):""}buildQueryParams(t){let n="";return Object.keys(t).forEach(r=>{n=n===""?n+`?${r}=${t[r]}`:n+`&${r}=${t[r]}`}),n}async get(t,n){return this.client.get(t+this.queryParams,{params:n})}async post(t,n){return this.client.post(t+this.queryParams,n)}async put(t,n){return this.client.put(t+this.queryParams,n)}async delete(t){return this.client.delete(t+this.queryParams)}}const nt="/payouts";class An{constructor(t){A(this,"httpClient");A(this,"_debug");this.httpClient=t.httpClient,this._debug=t.debug}async getProjectPayoutsLeaderboard(t){return(await this.httpClient.get(`${nt}/leaderboard`,t)).data}async getUserPayouts(t){return(await this.httpClient.get(nt,t)).data}}let Rn=(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),"");const Cn="fuul.tracking_id",ge=()=>xn(Cn,()=>Rn()),rt=()=>B("af")||B("referrer"),On=()=>document.referrer,Tn=()=>Fn(),Pn=()=>B("category"),_n=()=>B("title"),Nn=()=>B("tag"),xn=(e,t)=>{const n=localStorage.getItem(e);if(n)return n;{const r=t();return r?localStorage.setItem(e,r):localStorage.removeItem(e),r}},B=e=>new URLSearchParams(window.location.search).get(e),Fn=()=>{const e=B("source");if(e)return e},Dn="https://api.fuul.xyz/api/v1/";let I=!1,Ee=!1,Se,v,st,j,Y,be;function Un(e){I=!!e.debug,!Ee&&(Se=e.apiKey,Kn(),v=Jn(e.baseApiUrl??Dn,e.defaultQueryParams??{}),st=new wn({httpClient:v,debug:I}),Y=new En({httpClient:v,debug:I}),j=new yn({httpClient:v,debug:I}),be=new An({httpClient:v,debug:I}),Ee=!0,I&&console.debug("Fuul SDK: init() complete"))}function _(){if(!Ee)throw new Error("Fuul SDK: You need to call init() to initialize the library before using any methods")}async function Ln(e,t){_(),Ae();const n={name:e,args:t??{},metadata:{tracking_id:ge()}};await Y.sendEvent(n)}async function Bn(e){_(),Ae();const t={name:"pageview",args:{page:e??document.location.pathname,locationOrigin:document.location.origin},metadata:{tracking_id:ge(),referrer_url:On(),source:Tn(),affiliate_id:rt()??void 0,referrer:rt()??void 0,category:Pn()??void 0,title:_n()??void 0,tag:Nn()??void 0}};await Y.sendEvent(t)}async function In(e){_(),Ae();const t={name:"connect_wallet",args:{},metadata:{tracking_id:ge()}};e!=null&&e.address&&(t.user_address=e.address),e!=null&&e.signature&&(t.signature=e==null?void 0:e.signature,t.signature_message=e==null?void 0:e.message),await Y.sendEvent(t)}async function jn(e,t,n){_(),await j.create(e,t,n)}async function kn(e,t,n){_(),await j.update(e,t,n)}async function $n(e){return _(),await j.getCode(e)}async function qn(e){return _(),await j.isCodeFree(e)}async function Hn(e,t,n){_();const r=await j.getCode(t),s=new URLSearchParams({af:r??t});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()}`}function vn(e){return be.getProjectPayoutsLeaderboard(e)}function zn(e){return be.getUserPayouts(e)}async function Vn(){return _(),st.getAll()}function Ae(){if(typeof window>"u"||typeof document>"u")throw new Error("Fuul SDK: Browser context required")}function Kn(){if(!Se)throw new Error("Fuul SDK: Invalid API key")}function Jn(e,t){return new bn({baseURL:e,timeout:1e4,apiKey:Se,queryParams:t})}const Mn={init:Un,sendEvent:Ln,sendPageview:Bn,sendConnectWallet:In,generateTrackingLink:Hn,getConversions:Vn,createAffiliateCode:jn,updateAffiliateCode:kn,getAffiliateCode:$n,isAffiliateCodeFree:qn,getUserPayouts:zn,getProjectPayoutsLeaderboard:vn};E.AddressInUseError=me,E.CodeInUseError=ye,E.Fuul=Mn,E.InvalidSignatureError=we,E.ValidationError=he,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/dist/tracking.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const getTrackingId: () => string;
|
|
2
2
|
export declare const getAffiliateId: () => string | null;
|
|
3
3
|
export declare const getReferrerUrl: () => string;
|
|
4
|
-
export declare const getTrafficSource: () => string;
|
|
4
|
+
export declare const getTrafficSource: () => string | undefined;
|
|
5
5
|
export declare const getTrafficCategory: () => string | null;
|
|
6
6
|
export declare const getTrafficTitle: () => string | null;
|
|
7
7
|
export declare const getTrafficTag: () => string | null;
|
|
8
8
|
export declare const getQueryParam: (key: string) => string | null;
|
|
9
|
-
export declare const detectSource: () => string;
|
|
9
|
+
export declare const detectSource: () => string | undefined;
|
|
10
10
|
//# sourceMappingURL=tracking.d.ts.map
|
package/dist/tracking.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,cAA4D,CAAC;AACvF,eAAO,MAAM,cAAc,qBAAyD,CAAC;AACrF,eAAO,MAAM,cAAc,cAA0B,CAAC;AACtD,eAAO,MAAM,gBAAgB,0BAAuB,CAAC;AACrD,eAAO,MAAM,kBAAkB,qBAAkC,CAAC;AAClE,eAAO,MAAM,eAAe,qBAA+B,CAAC;AAC5D,eAAO,MAAM,aAAa,qBAA6B,CAAC;AAkBxD,eAAO,MAAM,aAAa,QAAS,MAAM,kBAGxC,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,MAAM,GAAG,SAKxC,CAAC"}
|