@naturalcycles/internal-web-lib 1.7.0 → 1.7.2
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/bundle/analyticsClient.js +252 -259
- package/bundle/analyticsClient.js.map +1 -1
- package/bundle/conversionClient.js +199 -206
- package/bundle/conversionClient.js.map +1 -1
- package/bundle/cookieMonster.js +1 -1
- package/bundle/cookieMonster.js.map +1 -1
- package/dist/conversion/conversionClient.js +0 -1
- package/dist/ncuikit/dist/styles/_palette.js +1 -1
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
1
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/is.util.js
|
|
2
2
|
var e = (e) => !!e;
|
|
3
3
|
function t(e) {
|
|
4
4
|
return typeof e == "object" && !!e && !Array.isArray(e) || !1;
|
|
@@ -7,27 +7,18 @@ function n(e) {
|
|
|
7
7
|
for (let t in e) if (Object.hasOwn(e, t)) return !1;
|
|
8
8
|
return !0;
|
|
9
9
|
}
|
|
10
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
10
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/abort.js
|
|
11
11
|
function r(e) {
|
|
12
|
-
return e ?
|
|
12
|
+
return e ? AbortSignal.timeout(e) : void 0;
|
|
13
13
|
}
|
|
14
|
-
function i(
|
|
15
|
-
return typeof AbortSignal.timeout == "function" ? AbortSignal.timeout(e) : a(e);
|
|
16
|
-
}
|
|
17
|
-
function a(e) {
|
|
18
|
-
let t = new AbortController();
|
|
19
|
-
return setTimeout(() => {
|
|
20
|
-
t.abort(new DOMException("The operation was aborted due to timeout", "TimeoutError"));
|
|
21
|
-
}, e), t.signal;
|
|
22
|
-
}
|
|
23
|
-
function o(t) {
|
|
14
|
+
function i(t) {
|
|
24
15
|
let n = t.filter(e);
|
|
25
|
-
return n.length ?
|
|
16
|
+
return n.length ? a(n) : void 0;
|
|
26
17
|
}
|
|
27
|
-
function
|
|
28
|
-
return e.length === 1 ? e[0] : typeof AbortSignal.any == "function" ? AbortSignal.any(e) :
|
|
18
|
+
function a(e) {
|
|
19
|
+
return e.length === 1 ? e[0] : typeof AbortSignal.any == "function" ? AbortSignal.any(e) : o(e);
|
|
29
20
|
}
|
|
30
|
-
function
|
|
21
|
+
function o(e) {
|
|
31
22
|
let t = new AbortController();
|
|
32
23
|
for (let n of e) if (n.aborted) return t.abort(n.reason), t.signal;
|
|
33
24
|
for (let n of e) n.addEventListener("abort", () => t.abort(n.reason), {
|
|
@@ -36,11 +27,24 @@ function c(e) {
|
|
|
36
27
|
});
|
|
37
28
|
return t.signal;
|
|
38
29
|
}
|
|
39
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
40
|
-
function
|
|
30
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
|
|
31
|
+
function s(e, t = l()) {
|
|
32
|
+
return c(t - e);
|
|
33
|
+
}
|
|
34
|
+
function c(e) {
|
|
35
|
+
if (e < 1e3) return `${Math.round(e)} ms`;
|
|
36
|
+
if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
|
|
37
|
+
let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
|
|
38
|
+
return r === 0 ? n === 0 ? `${t} sec` : `${n}m${t}s` : r < 24 ? `${r}h${n}m` : r < 48 ? `${Math.round(r + n / 60)}h` : `${Math.floor(r / 24)} days`;
|
|
39
|
+
}
|
|
40
|
+
function l() {
|
|
41
|
+
return Date.now();
|
|
42
|
+
}
|
|
43
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/log/commonLogger.js
|
|
44
|
+
function u(e, t) {
|
|
41
45
|
let n = (n, [r, i]) => e({
|
|
42
46
|
...t?.(),
|
|
43
|
-
...
|
|
47
|
+
...d(r, i),
|
|
44
48
|
level: n
|
|
45
49
|
});
|
|
46
50
|
return {
|
|
@@ -48,23 +52,23 @@ function l(e, t) {
|
|
|
48
52
|
log: (...e) => n("log", e),
|
|
49
53
|
warn: (...e) => n("warn", e),
|
|
50
54
|
error: (...e) => n("error", e),
|
|
51
|
-
child: (n) =>
|
|
55
|
+
child: (n) => u(e, () => ({
|
|
52
56
|
...t?.(),
|
|
53
57
|
...n
|
|
54
58
|
}))
|
|
55
59
|
};
|
|
56
60
|
}
|
|
57
|
-
function
|
|
61
|
+
function d(e, t) {
|
|
58
62
|
return typeof e == "string" ? {
|
|
59
63
|
...t,
|
|
60
64
|
msg: e
|
|
61
65
|
} : e instanceof Error ? { err: e } : e;
|
|
62
66
|
}
|
|
63
|
-
var
|
|
67
|
+
var f = u(({ level: e, msg: t, err: n, ...r }) => {
|
|
64
68
|
let i = [];
|
|
65
69
|
t !== void 0 && i.push(t), n !== void 0 && i.push(n), Object.keys(r).length && i.push(r), console[e](...i);
|
|
66
|
-
}),
|
|
67
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
70
|
+
}), p = (...e) => void 0, m = Object.entries;
|
|
71
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
|
|
68
72
|
function ee(e, t, n = {}) {
|
|
69
73
|
if (n.mutate) {
|
|
70
74
|
for (let n of Object.keys(e)) t.includes(n) || delete e[n];
|
|
@@ -74,7 +78,7 @@ function ee(e, t, n = {}) {
|
|
|
74
78
|
for (let n of t) n in e && (r[n] = e[n]);
|
|
75
79
|
return r;
|
|
76
80
|
}
|
|
77
|
-
function
|
|
81
|
+
function h(e, t, n = {}) {
|
|
78
82
|
if (n.mutate) {
|
|
79
83
|
for (let n of t) delete e[n];
|
|
80
84
|
return e;
|
|
@@ -83,91 +87,110 @@ function m(e, t, n = {}) {
|
|
|
83
87
|
for (let n of Object.keys(e)) t.includes(n) || (r[n] = e[n]);
|
|
84
88
|
return r;
|
|
85
89
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
90
|
+
function g(e, t = {}) {
|
|
91
|
+
return y(e, (e, t) => !!t, t);
|
|
88
92
|
}
|
|
89
|
-
function
|
|
90
|
-
return
|
|
93
|
+
function _(e, t = {}) {
|
|
94
|
+
return y(e, (e, t) => t != null, t);
|
|
91
95
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
96
|
+
function v(e, t = {}) {
|
|
97
|
+
return y(e, (e, t) => t !== void 0, t);
|
|
94
98
|
}
|
|
95
|
-
function
|
|
99
|
+
function y(e, t, n = {}) {
|
|
96
100
|
if (n.mutate) {
|
|
97
|
-
for (let [n, r] of
|
|
101
|
+
for (let [n, r] of m(e)) t(n, r, e) || delete e[n];
|
|
98
102
|
return e;
|
|
99
103
|
}
|
|
100
104
|
let r = {};
|
|
101
|
-
for (let [n, i] of
|
|
105
|
+
for (let [n, i] of m(e)) t(n, i, e) && (r[n] = i);
|
|
102
106
|
return r;
|
|
103
107
|
}
|
|
104
|
-
function
|
|
108
|
+
function b(e, t) {
|
|
105
109
|
let n = {};
|
|
106
110
|
for (let [r, i] of Object.entries(e)) n[t(r, i, e)] = i;
|
|
107
111
|
return n;
|
|
108
112
|
}
|
|
109
|
-
function
|
|
110
|
-
for (let r of n) if (t(r)) for (let n of Object.keys(r)) n !== "__proto__" && n !== "constructor" && n !== "prototype" && (t(r[n]) ? (e[n] ||= {},
|
|
113
|
+
function x(e, ...n) {
|
|
114
|
+
for (let r of n) if (t(r)) for (let n of Object.keys(r)) n !== "__proto__" && n !== "constructor" && n !== "prototype" && (t(r[n]) ? (e[n] ||= {}, x(e[n], r[n])) : e[n] = r[n]);
|
|
111
115
|
return e;
|
|
112
116
|
}
|
|
113
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
114
|
-
function
|
|
115
|
-
return !
|
|
117
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/env.js
|
|
118
|
+
function S() {
|
|
119
|
+
return !C();
|
|
116
120
|
}
|
|
117
|
-
function
|
|
121
|
+
function C() {
|
|
118
122
|
return typeof window < "u" && !!window?.document;
|
|
119
123
|
}
|
|
120
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
|
|
125
|
+
function te(e, t, n) {
|
|
126
|
+
return e <= t ? t : e >= n ? n : e;
|
|
127
|
+
}
|
|
128
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/analytics/analytics.model.js
|
|
129
|
+
var ne = "identify";
|
|
130
|
+
function w(e) {
|
|
131
|
+
return e.length <= 255 ? e : Array.from(e).slice(0, 255).join("");
|
|
132
|
+
}
|
|
133
|
+
var T = [
|
|
134
|
+
"utm_source",
|
|
135
|
+
"utm_medium",
|
|
136
|
+
"utm_campaign",
|
|
137
|
+
"utm_content",
|
|
138
|
+
"utm_term",
|
|
139
|
+
"utm_id",
|
|
140
|
+
"utm_source_platform",
|
|
141
|
+
"utm_campaign_id",
|
|
142
|
+
"utm_creative_format",
|
|
143
|
+
"utm_marketing_tactic"
|
|
144
|
+
], re = /^\s*[{["\-\d]/;
|
|
145
|
+
function E(e, t) {
|
|
146
|
+
if (typeof e == "string" && e && re.test(e)) try {
|
|
124
147
|
return JSON.parse(e, t);
|
|
125
148
|
} catch {}
|
|
126
149
|
return e;
|
|
127
150
|
}
|
|
128
|
-
function
|
|
151
|
+
function ie(e, t) {
|
|
129
152
|
try {
|
|
130
153
|
return JSON.parse(e, t);
|
|
131
154
|
} catch {
|
|
132
|
-
throw new
|
|
155
|
+
throw new oe({ text: e });
|
|
133
156
|
}
|
|
134
157
|
}
|
|
135
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
136
|
-
function
|
|
158
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
|
|
159
|
+
function D(e, t, n = "...") {
|
|
137
160
|
if (!e || e.length <= t) return e;
|
|
138
161
|
if (t <= n.length) return n;
|
|
139
162
|
let r = Math.round((t - n.length) / 2), i = e.length - Math.floor((t - n.length) / 2);
|
|
140
163
|
return e.slice(0, r) + n + e.slice(i);
|
|
141
164
|
}
|
|
142
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
143
|
-
function
|
|
165
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
|
|
166
|
+
function O(e, t = Error, n) {
|
|
144
167
|
let r;
|
|
145
|
-
return r = e instanceof t ? e :
|
|
168
|
+
return r = e instanceof t ? e : ae(k(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
|
|
146
169
|
}
|
|
147
|
-
function
|
|
170
|
+
function k(e, t) {
|
|
148
171
|
let n;
|
|
149
|
-
return
|
|
172
|
+
return N(e) ? n = A(e) : (e = E(e), n = j(e) ? e.error : M(e) ? e : N(e) ? A(e) : {
|
|
150
173
|
name: "Error",
|
|
151
|
-
message:
|
|
174
|
+
message: B(e),
|
|
152
175
|
data: {}
|
|
153
176
|
}), Object.assign(n.data, t), n;
|
|
154
177
|
}
|
|
155
|
-
function
|
|
156
|
-
if (!(e instanceof Error) &&
|
|
178
|
+
function A(e) {
|
|
179
|
+
if (!(e instanceof Error) && M(e)) return e;
|
|
157
180
|
let t = {
|
|
158
181
|
name: e.name,
|
|
159
182
|
message: e.message,
|
|
160
183
|
data: { ...e.data }
|
|
161
184
|
};
|
|
162
|
-
return e.stack && (t.stack = e.stack), e.cause && (t.cause =
|
|
185
|
+
return e.stack && (t.stack = e.stack), e.cause && (t.cause = k(e.cause)), t;
|
|
163
186
|
}
|
|
164
|
-
function
|
|
187
|
+
function ae(e, t = Error) {
|
|
165
188
|
if (e instanceof t) return e;
|
|
166
189
|
let { name: n, cause: r } = e, i = new t(e.message, e.data, {
|
|
167
190
|
name: n,
|
|
168
191
|
cause: r
|
|
169
192
|
});
|
|
170
|
-
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof
|
|
193
|
+
return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof F || (Object.defineProperties(i, {
|
|
171
194
|
name: {
|
|
172
195
|
value: n,
|
|
173
196
|
configurable: !0,
|
|
@@ -191,31 +214,31 @@ function re(e, t = Error) {
|
|
|
191
214
|
writable: !0
|
|
192
215
|
})), i;
|
|
193
216
|
}
|
|
194
|
-
function
|
|
217
|
+
function j(e) {
|
|
195
218
|
try {
|
|
196
|
-
return
|
|
219
|
+
return M(e?.error);
|
|
197
220
|
} catch {
|
|
198
221
|
return !1;
|
|
199
222
|
}
|
|
200
223
|
}
|
|
201
|
-
function
|
|
224
|
+
function M(e) {
|
|
202
225
|
try {
|
|
203
226
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string" && typeof e.data == "object";
|
|
204
227
|
} catch {
|
|
205
228
|
return !1;
|
|
206
229
|
}
|
|
207
230
|
}
|
|
208
|
-
function
|
|
231
|
+
function N(e) {
|
|
209
232
|
try {
|
|
210
233
|
return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string";
|
|
211
234
|
} catch {
|
|
212
235
|
return !1;
|
|
213
236
|
}
|
|
214
237
|
}
|
|
215
|
-
function
|
|
216
|
-
return t ?
|
|
238
|
+
function P(e, t) {
|
|
239
|
+
return t ? O(e, void 0, t) : e;
|
|
217
240
|
}
|
|
218
|
-
var
|
|
241
|
+
var F = class e extends Error {
|
|
219
242
|
data;
|
|
220
243
|
cause;
|
|
221
244
|
static of(t) {
|
|
@@ -226,7 +249,7 @@ var M = class e extends Error {
|
|
|
226
249
|
}
|
|
227
250
|
constructor(e, t = {}, n = {}) {
|
|
228
251
|
super(e);
|
|
229
|
-
let { name: r =
|
|
252
|
+
let { name: r = S() ? this.constructor.name : "AppError", cause: i } = n;
|
|
230
253
|
Object.defineProperties(this, {
|
|
231
254
|
name: {
|
|
232
255
|
value: r,
|
|
@@ -240,7 +263,7 @@ var M = class e extends Error {
|
|
|
240
263
|
enumerable: !1
|
|
241
264
|
}
|
|
242
265
|
}), i ? Object.defineProperty(this, "cause", {
|
|
243
|
-
value:
|
|
266
|
+
value: k(i),
|
|
244
267
|
writable: !0,
|
|
245
268
|
configurable: !0,
|
|
246
269
|
enumerable: !0
|
|
@@ -250,43 +273,43 @@ var M = class e extends Error {
|
|
|
250
273
|
writable: !0
|
|
251
274
|
});
|
|
252
275
|
}
|
|
253
|
-
},
|
|
276
|
+
}, I = class extends F {
|
|
254
277
|
constructor(e, t, n) {
|
|
255
278
|
t.response && Object.defineProperty(t, "response", { enumerable: !1 }), super(e, t, {
|
|
256
279
|
...n,
|
|
257
280
|
name: "HttpRequestError"
|
|
258
281
|
});
|
|
259
282
|
}
|
|
260
|
-
},
|
|
283
|
+
}, L = class extends F {
|
|
261
284
|
constructor(e, t) {
|
|
262
285
|
super(e, t, { name: "AssertionError" });
|
|
263
286
|
}
|
|
264
|
-
},
|
|
287
|
+
}, oe = class extends F {
|
|
265
288
|
constructor(e) {
|
|
266
|
-
let t = ["Failed to parse", e.text &&
|
|
289
|
+
let t = ["Failed to parse", e.text && D(e.text, 200)].filter(Boolean).join(": ");
|
|
267
290
|
super(t, e, { name: "JsonParseError" });
|
|
268
291
|
}
|
|
269
|
-
},
|
|
292
|
+
}, se = class extends F {
|
|
270
293
|
constructor(e, t, n) {
|
|
271
294
|
super(e, t, {
|
|
272
295
|
...n,
|
|
273
296
|
name: "TimeoutError"
|
|
274
297
|
});
|
|
275
298
|
}
|
|
276
|
-
},
|
|
299
|
+
}, ce = class extends F {
|
|
277
300
|
constructor(e) {
|
|
278
301
|
super(e || "expected error was not thrown", {}, { name: "UnexpectedPassError" });
|
|
279
302
|
}
|
|
280
303
|
};
|
|
281
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
282
|
-
function
|
|
304
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
|
|
305
|
+
function R(e, t, n, r) {
|
|
283
306
|
try {
|
|
284
307
|
return JSON.stringify(e, t, n);
|
|
285
308
|
} catch {
|
|
286
|
-
return JSON.stringify(e,
|
|
309
|
+
return JSON.stringify(e, le(t, r), n);
|
|
287
310
|
}
|
|
288
311
|
}
|
|
289
|
-
function
|
|
312
|
+
function le(e, t) {
|
|
290
313
|
let n = [], r = [];
|
|
291
314
|
return t ??= (e, t) => n[0] === t ? "[Circular ~]" : "[Circular ~." + r.slice(0, n.indexOf(t)).join(".") + "]", function(i, a) {
|
|
292
315
|
if (n.length > 0) {
|
|
@@ -296,22 +319,22 @@ function ce(e, t) {
|
|
|
296
319
|
return e == null ? a : e.call(this, i, a);
|
|
297
320
|
};
|
|
298
321
|
}
|
|
299
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
300
|
-
var
|
|
301
|
-
function
|
|
322
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
|
|
323
|
+
var z = R;
|
|
324
|
+
function B(e, t = {}) {
|
|
302
325
|
if (e === void 0) return "undefined";
|
|
303
326
|
if (e === null) return "null";
|
|
304
327
|
if (typeof e == "function") return "function";
|
|
305
328
|
if (typeof e == "symbol") return e.toString();
|
|
306
329
|
let n;
|
|
307
|
-
if (e =
|
|
308
|
-
if (e instanceof Error ||
|
|
330
|
+
if (e = E(e), j(e)) return B(e.error, t);
|
|
331
|
+
if (e instanceof Error || N(e)) n = V(e, t);
|
|
309
332
|
else if (typeof e == "string") n = e.trim() || "empty_string";
|
|
310
333
|
else if (typeof e == "number") n = String(e);
|
|
311
334
|
else {
|
|
312
335
|
e instanceof Map ? e = Object.fromEntries(e) : e instanceof Set && (e = Array.from(e));
|
|
313
336
|
try {
|
|
314
|
-
let { stringifyFn: r =
|
|
337
|
+
let { stringifyFn: r = z } = t;
|
|
315
338
|
n = r(e, void 0, 2);
|
|
316
339
|
} catch {
|
|
317
340
|
n = String(e);
|
|
@@ -319,29 +342,41 @@ function F(e, t = {}) {
|
|
|
319
342
|
}
|
|
320
343
|
if (n === void 0) return "undefined";
|
|
321
344
|
let { maxLen: r = 1e4 } = t;
|
|
322
|
-
return r && n.length > r ?
|
|
345
|
+
return r && n.length > r ? D(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
|
|
323
346
|
}
|
|
324
|
-
function
|
|
347
|
+
function V(e, t) {
|
|
325
348
|
let { includeErrorCause: n = !0 } = t, r = [e.name, e.message].filter(Boolean).join(": ");
|
|
326
|
-
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData &&
|
|
349
|
+
if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && M(e) && Object.keys(e.data).length && (r += "\n" + B(e.data, t)), t.includeErrorStack && e.stack) {
|
|
327
350
|
let t = r.split("\n").length;
|
|
328
351
|
r = [r, ...e.stack.split("\n").slice(t)].join("\n");
|
|
329
352
|
}
|
|
330
|
-
return
|
|
353
|
+
return e instanceof AggregateError && e.errors.length && (r = [
|
|
331
354
|
r,
|
|
332
355
|
`${e.errors.length} error(s):`,
|
|
333
|
-
...e.errors.map((e, n) => `${n + 1}. ${
|
|
334
|
-
].join("\n")), e.cause && n && (r = r + "\nCaused by: " +
|
|
356
|
+
...e.errors.map((e, n) => `${n + 1}. ${B(e, t)}`)
|
|
357
|
+
].join("\n")), e.cause && n && (r = r + "\nCaused by: " + B(e.cause, t)), r;
|
|
335
358
|
}
|
|
336
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
337
|
-
function
|
|
338
|
-
if (!
|
|
359
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/error/assert.js
|
|
360
|
+
function H(e, t, n) {
|
|
361
|
+
if (!e) throw new L(t || "condition failed", { ...n });
|
|
339
362
|
}
|
|
340
|
-
function
|
|
363
|
+
function U(e, t = Error) {
|
|
364
|
+
if (!(e instanceof t)) throw new L(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
|
|
365
|
+
}
|
|
366
|
+
function W(e, t) {
|
|
341
367
|
if (!(e instanceof t)) throw e;
|
|
342
368
|
}
|
|
343
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
344
|
-
|
|
369
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/array/array.util.js
|
|
370
|
+
function ue(e, t) {
|
|
371
|
+
let n = {};
|
|
372
|
+
for (let r of e) {
|
|
373
|
+
let e = t(r);
|
|
374
|
+
e && (n[e[0]] = e[1]);
|
|
375
|
+
}
|
|
376
|
+
return n;
|
|
377
|
+
}
|
|
378
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
|
|
379
|
+
async function de(e, t) {
|
|
345
380
|
t?.aborted || await new Promise((n) => {
|
|
346
381
|
let r = setTimeout(i, e);
|
|
347
382
|
function i() {
|
|
@@ -350,59 +385,19 @@ async function R(e, t) {
|
|
|
350
385
|
t?.addEventListener("abort", i);
|
|
351
386
|
});
|
|
352
387
|
}
|
|
353
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
354
|
-
function
|
|
355
|
-
return B(t - e);
|
|
356
|
-
}
|
|
357
|
-
function B(e) {
|
|
358
|
-
if (e < 1e3) return `${Math.round(e)} ms`;
|
|
359
|
-
if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
|
|
360
|
-
let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
|
|
361
|
-
return r === 0 ? n === 0 ? `${t} sec` : `${n}m${t}s` : r < 24 ? `${r}h${n}m` : r < 48 ? `${Math.round(r + n / 60)}h` : `${Math.floor(r / 24)} days`;
|
|
362
|
-
}
|
|
363
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
|
|
364
|
-
function V(e, t, n) {
|
|
365
|
-
return e <= t ? t : e >= n ? n : e;
|
|
366
|
-
}
|
|
367
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/analytics/analytics.model.js
|
|
368
|
-
var H = "identify";
|
|
369
|
-
function U(e) {
|
|
370
|
-
return e.length <= 255 ? e : Array.from(e).slice(0, 255).join("");
|
|
371
|
-
}
|
|
372
|
-
var W = [
|
|
373
|
-
"utm_source",
|
|
374
|
-
"utm_medium",
|
|
375
|
-
"utm_campaign",
|
|
376
|
-
"utm_content",
|
|
377
|
-
"utm_term",
|
|
378
|
-
"utm_id",
|
|
379
|
-
"utm_source_platform",
|
|
380
|
-
"utm_campaign_id",
|
|
381
|
-
"utm_creative_format",
|
|
382
|
-
"utm_marketing_tactic"
|
|
383
|
-
];
|
|
384
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/array/array.util.js
|
|
385
|
-
function fe(e, t) {
|
|
386
|
-
let n = {};
|
|
387
|
-
for (let r of e) {
|
|
388
|
-
let e = t(r);
|
|
389
|
-
e && (n[e[0]] = e[1]);
|
|
390
|
-
}
|
|
391
|
-
return n;
|
|
392
|
-
}
|
|
393
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.98.0_undici@8.12.3/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
|
|
394
|
-
async function pe(e, t) {
|
|
388
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
|
|
389
|
+
async function fe(e, t) {
|
|
395
390
|
let n = new AbortController(), { signal: r } = n;
|
|
396
391
|
if (!t.timeout) return await e(r);
|
|
397
392
|
let { timeout: i, name: a = e.name || "pTimeout function", onTimeout: o } = t, s = t.fakeError || /* @__PURE__ */ Error("TimeoutError");
|
|
398
393
|
return await new Promise(async (c, l) => {
|
|
399
394
|
let u = setTimeout(() => {
|
|
400
|
-
let e = new
|
|
395
|
+
let e = new se(`"${a}" timed out after ${i} ms`, t.errorData);
|
|
401
396
|
if (e.stack = s.stack.replace("Error: TimeoutError", "TimeoutError: " + e.message), o) {
|
|
402
397
|
try {
|
|
403
398
|
c(o(e));
|
|
404
399
|
} catch (e) {
|
|
405
|
-
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(
|
|
400
|
+
e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(P(e, t.errorData));
|
|
406
401
|
}
|
|
407
402
|
n.abort(e);
|
|
408
403
|
} else l(e), n.abort(e);
|
|
@@ -416,8 +411,8 @@ async function pe(e, t) {
|
|
|
416
411
|
}
|
|
417
412
|
});
|
|
418
413
|
}
|
|
419
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
420
|
-
function
|
|
414
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
|
|
415
|
+
function pe(e, t) {
|
|
421
416
|
if (typeof e != "string") return null;
|
|
422
417
|
try {
|
|
423
418
|
return new URL(e, t || void 0);
|
|
@@ -425,21 +420,21 @@ function me(e, t) {
|
|
|
425
420
|
return null;
|
|
426
421
|
}
|
|
427
422
|
}
|
|
428
|
-
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.
|
|
429
|
-
var
|
|
423
|
+
// ../../node_modules/.pnpm/@naturalcycles+js-lib@15.106.0_undici@8.13.1/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
|
|
424
|
+
var me = [
|
|
430
425
|
"GET",
|
|
431
426
|
"POST",
|
|
432
427
|
"PUT",
|
|
433
428
|
"PATCH",
|
|
434
429
|
"DELETE",
|
|
435
|
-
"HEAD"
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
static
|
|
430
|
+
"HEAD",
|
|
431
|
+
"QUERY"
|
|
432
|
+
], G = 5, he = class e {
|
|
433
|
+
static VERSION = G;
|
|
434
|
+
static userAgent = /* @__PURE__ */ S() ? `fetcher/${G}` : void 0;
|
|
439
435
|
constructor(e = {}) {
|
|
440
|
-
if (typeof globalThis.fetch != "function") throw TypeError("globalThis.fetch is not available");
|
|
441
436
|
this.cfg = this.normalizeCfg(e);
|
|
442
|
-
for (let e of
|
|
437
|
+
for (let e of me) {
|
|
443
438
|
let t = e.toLowerCase();
|
|
444
439
|
this[`${t}Void`] = async (t, n) => await this.fetch({
|
|
445
440
|
url: t,
|
|
@@ -488,20 +483,23 @@ var he = [
|
|
|
488
483
|
put;
|
|
489
484
|
patch;
|
|
490
485
|
delete;
|
|
486
|
+
query;
|
|
491
487
|
getText;
|
|
492
488
|
postText;
|
|
493
489
|
putText;
|
|
494
490
|
patchText;
|
|
495
491
|
deleteText;
|
|
492
|
+
queryText;
|
|
496
493
|
getVoid;
|
|
497
494
|
postVoid;
|
|
498
495
|
putVoid;
|
|
499
496
|
patchVoid;
|
|
500
497
|
deleteVoid;
|
|
501
498
|
headVoid;
|
|
499
|
+
queryVoid;
|
|
502
500
|
async queryGraphQL(e) {
|
|
503
501
|
e = { ...e }, e.method ||= this.cfg.init.method;
|
|
504
|
-
let t =
|
|
502
|
+
let t = g({
|
|
505
503
|
query: e.query,
|
|
506
504
|
variables: e.variables
|
|
507
505
|
});
|
|
@@ -513,7 +511,7 @@ var he = [
|
|
|
513
511
|
if (n.err) throw n.err;
|
|
514
512
|
if (n.body.errors) {
|
|
515
513
|
let e = n.body.errors[0];
|
|
516
|
-
throw new
|
|
514
|
+
throw new I(e.message, {
|
|
517
515
|
...t,
|
|
518
516
|
errors: n.body.errors,
|
|
519
517
|
response: n.fetchResponse,
|
|
@@ -524,7 +522,7 @@ var he = [
|
|
|
524
522
|
requestSignature: n.signature,
|
|
525
523
|
requestName: n.req.requestName,
|
|
526
524
|
fetcherName: this.cfg.name,
|
|
527
|
-
requestDuration:
|
|
525
|
+
requestDuration: l() - n.req.started
|
|
528
526
|
});
|
|
529
527
|
}
|
|
530
528
|
let { data: r } = n.body;
|
|
@@ -556,12 +554,12 @@ var he = [
|
|
|
556
554
|
}
|
|
557
555
|
async expectError(e) {
|
|
558
556
|
let t = await this.doFetch(e);
|
|
559
|
-
if (!t.err) throw new
|
|
560
|
-
return
|
|
557
|
+
if (!t.err) throw new ce("Fetch was expected to error");
|
|
558
|
+
return U(t.err, I), t.err;
|
|
561
559
|
}
|
|
562
560
|
async tryFetch(e) {
|
|
563
561
|
let t = await this.doFetch(e);
|
|
564
|
-
return t.err ? (
|
|
562
|
+
return t.err ? (W(t.err, I), [t.err, null]) : [null, t.body];
|
|
565
563
|
}
|
|
566
564
|
async doFetch(t) {
|
|
567
565
|
let n = 0;
|
|
@@ -573,54 +571,54 @@ var he = [
|
|
|
573
571
|
}
|
|
574
572
|
n = this.initGeneration;
|
|
575
573
|
}
|
|
576
|
-
let
|
|
577
|
-
for (let e of this.cfg.hooks.beforeRequest || []) await e(
|
|
578
|
-
let
|
|
579
|
-
req:
|
|
574
|
+
let a = this.normalizeOptions(t), { logger: o } = this.cfg, { init: { method: s } } = a, c = a.timeoutSeconds ? a.timeoutSeconds * 1e3 : void 0;
|
|
575
|
+
for (let e of this.cfg.hooks.beforeRequest || []) await e(a);
|
|
576
|
+
let u = a.fullUrl.includes("://") ? new URL(a.fullUrl) : void 0, d = [s, u ? this.getShortUrl(u) : a.fullUrl].join(" "), f = {
|
|
577
|
+
req: a,
|
|
580
578
|
retryStatus: {
|
|
581
579
|
retryAttempt: 0,
|
|
582
580
|
retryStopped: !1,
|
|
583
|
-
retryTimeout:
|
|
581
|
+
retryTimeout: a.retry.timeout
|
|
584
582
|
},
|
|
585
|
-
signature:
|
|
583
|
+
signature: d
|
|
586
584
|
};
|
|
587
|
-
for (; !
|
|
588
|
-
if (
|
|
589
|
-
let { retryAttempt: e } =
|
|
590
|
-
|
|
585
|
+
for (; !f.retryStatus.retryStopped;) {
|
|
586
|
+
if (a.started = l(), f.body = void 0, a.init.signal = i([r(c), t.signal]), a.logRequest) {
|
|
587
|
+
let { retryAttempt: e } = f.retryStatus;
|
|
588
|
+
o.log([
|
|
591
589
|
" >>",
|
|
592
|
-
|
|
593
|
-
e && `try#${e + 1}/${
|
|
594
|
-
].filter(Boolean).join(" ")),
|
|
590
|
+
d,
|
|
591
|
+
e && `try#${e + 1}/${a.retry.count + 1}`
|
|
592
|
+
].filter(Boolean).join(" ")), a.logRequestBody && a.init.body && o.log({ body: a.init.body });
|
|
595
593
|
}
|
|
596
594
|
try {
|
|
597
|
-
|
|
595
|
+
f.fetchResponse = await (a.overrideFetchFn || e.callNativeFetch)(a.fullUrl, a.init, a.fetchFn), f.ok = f.fetchResponse.ok, f.err = void 0;
|
|
598
596
|
} catch (e) {
|
|
599
|
-
|
|
597
|
+
f.err = O(e), f.ok = !1, f.fetchResponse = void 0;
|
|
600
598
|
}
|
|
601
|
-
if (
|
|
602
|
-
await
|
|
599
|
+
if (f.statusFamily = this.getStatusFamily(f), f.statusCode = f.fetchResponse?.status, f.fetchResponse?.ok) try {
|
|
600
|
+
await fe(async () => await this.onOkResponse(f), {
|
|
603
601
|
timeout: c ?? 0,
|
|
604
602
|
name: "Fetcher.downloadBody"
|
|
605
603
|
});
|
|
606
604
|
} catch (e) {
|
|
607
|
-
|
|
605
|
+
f.err = O(e), f.ok = !1, await this.onNotOkResponse(f);
|
|
608
606
|
}
|
|
609
|
-
else await this.onNotOkResponse(
|
|
607
|
+
else await this.onNotOkResponse(f);
|
|
610
608
|
}
|
|
611
|
-
if (
|
|
612
|
-
|
|
613
|
-
for (let e of this.cfg.hooks.onError || []) await e(
|
|
609
|
+
if (f.err) {
|
|
610
|
+
P(f.err, a.errorData), a.onError?.(f.err);
|
|
611
|
+
for (let e of this.cfg.hooks.onError || []) await e(f.err);
|
|
614
612
|
}
|
|
615
|
-
for (let e of this.cfg.hooks.afterResponse || []) await e(
|
|
616
|
-
return
|
|
613
|
+
for (let e of this.cfg.hooks.afterResponse || []) await e(f);
|
|
614
|
+
return f.err && await this.detectStaleInit(t, f, n) ? await this.doFetch({
|
|
617
615
|
...t,
|
|
618
|
-
[
|
|
619
|
-
}) :
|
|
616
|
+
[K]: !0
|
|
617
|
+
}) : f;
|
|
620
618
|
}
|
|
621
619
|
async detectStaleInit(e, t, n) {
|
|
622
620
|
let { shouldReinit: r, init: i } = this.cfg.hooks;
|
|
623
|
-
return !r || !i || e[
|
|
621
|
+
return !r || !i || e[K] || !await r(t) ? !1 : (n === this.initGeneration && this.resetInit(), !0);
|
|
624
622
|
}
|
|
625
623
|
async runInitHooks() {
|
|
626
624
|
for (let e of this.cfg.hooks.init || []) await e(this.cfg);
|
|
@@ -630,14 +628,9 @@ var he = [
|
|
|
630
628
|
if (n === "json") {
|
|
631
629
|
if (e.fetchResponse.body) {
|
|
632
630
|
let n = await e.fetchResponse.text();
|
|
633
|
-
n ? (e.body = n, e.body =
|
|
631
|
+
n ? (e.body = n, e.body = ie(n, t.jsonReviver)) : e.body = {};
|
|
634
632
|
} else e.body = {};
|
|
635
|
-
} else
|
|
636
|
-
else if (n === "arrayBuffer") e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0);
|
|
637
|
-
else if (n === "bytes") e.body = e.fetchResponse.body ? new Uint8Array(await e.fetchResponse.arrayBuffer()) : /* @__PURE__ */ new Uint8Array();
|
|
638
|
-
else if (n === "blob") e.body = e.fetchResponse.body ? await e.fetchResponse.blob() : new Blob();
|
|
639
|
-
else if (n === "void") await e.fetchResponse.body?.cancel();
|
|
640
|
-
else if (n === "readableStream" && (e.body = e.fetchResponse.body, e.body === null)) throw Error("fetchResponse.body is null");
|
|
633
|
+
} else n === "text" ? e.body = e.fetchResponse.body ? await e.fetchResponse.text() : "" : n === "arrayBuffer" ? e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0) : n === "bytes" ? e.body = e.fetchResponse.body ? new Uint8Array(await e.fetchResponse.arrayBuffer()) : /* @__PURE__ */ new Uint8Array() : n === "blob" ? e.body = e.fetchResponse.body ? await e.fetchResponse.blob() : new Blob() : n === "void" ? await e.fetchResponse.body?.cancel() : n === "readableStream" && (e.body = e.fetchResponse.body, H(e.body !== null, "fetchResponse.body is null"));
|
|
641
634
|
if (e.retryStatus.retryStopped = !0, t.logResponse) {
|
|
642
635
|
let { retryAttempt: n } = e.retryStatus, { logger: r } = this.cfg;
|
|
643
636
|
r.log([
|
|
@@ -645,7 +638,7 @@ var he = [
|
|
|
645
638
|
e.fetchResponse.status,
|
|
646
639
|
e.signature,
|
|
647
640
|
n && `try#${n + 1}/${t.retry.count + 1}`,
|
|
648
|
-
|
|
641
|
+
s(e.req.started)
|
|
649
642
|
].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log({ body: e.body });
|
|
650
643
|
}
|
|
651
644
|
}
|
|
@@ -655,15 +648,15 @@ var he = [
|
|
|
655
648
|
async onNotOkResponse(e) {
|
|
656
649
|
let t;
|
|
657
650
|
if (!e.body && e.fetchResponse) try {
|
|
658
|
-
e.body =
|
|
651
|
+
e.body = E(await e.fetchResponse.text());
|
|
659
652
|
} catch {}
|
|
660
|
-
t = e.err ?
|
|
653
|
+
t = e.err ? A(e.err) : e.body ? k(e.body) : {
|
|
661
654
|
name: "Error",
|
|
662
655
|
message: "Fetch failed",
|
|
663
656
|
data: {}
|
|
664
657
|
};
|
|
665
658
|
let n = e.fetchResponse?.status || 0;
|
|
666
|
-
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new
|
|
659
|
+
e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new I([e.statusCode, e.signature].filter(Boolean).join(" "), _({
|
|
667
660
|
response: e.fetchResponse,
|
|
668
661
|
responseStatusCode: n,
|
|
669
662
|
requestUrl: e.req.fullUrl,
|
|
@@ -672,7 +665,7 @@ var he = [
|
|
|
672
665
|
requestSignature: e.signature,
|
|
673
666
|
requestName: e.req.requestName,
|
|
674
667
|
fetcherName: this.cfg.name,
|
|
675
|
-
requestDuration:
|
|
668
|
+
requestDuration: l() - e.req.started
|
|
676
669
|
}), { cause: t }), await this.processRetry(e);
|
|
677
670
|
}
|
|
678
671
|
async processRetry(e) {
|
|
@@ -686,13 +679,13 @@ var he = [
|
|
|
686
679
|
e.fetchResponse?.status || 0,
|
|
687
680
|
e.signature,
|
|
688
681
|
n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
|
|
689
|
-
|
|
682
|
+
s(e.req.started)
|
|
690
683
|
].filter(Boolean).join(" "),
|
|
691
684
|
err: e.err.cause || e.err
|
|
692
685
|
}), t.retryStopped) return;
|
|
693
686
|
t.retryAttempt++;
|
|
694
687
|
let a = this.getRetryTimeout(e);
|
|
695
|
-
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout =
|
|
688
|
+
a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = te(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${c(a)}`), await de(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0));
|
|
696
689
|
}
|
|
697
690
|
getRetryTimeout(e) {
|
|
698
691
|
let t = 0;
|
|
@@ -700,10 +693,10 @@ var he = [
|
|
|
700
693
|
let n = e.fetchResponse.headers.get("retry-after") ?? e.fetchResponse.headers.get("x-ratelimit-reset");
|
|
701
694
|
if (n) {
|
|
702
695
|
let e = Number(n);
|
|
703
|
-
if (e) t = e > 10 ** 9 ? e * 1e3 -
|
|
696
|
+
if (e) t = e > 10 ** 9 ? e * 1e3 - l() : e * 1e3;
|
|
704
697
|
else {
|
|
705
698
|
let e = new Date(n);
|
|
706
|
-
Number.isNaN(e.getTime()) || (t = e.getTime() -
|
|
699
|
+
Number.isNaN(e.getTime()) || (t = e.getTime() - l());
|
|
707
700
|
}
|
|
708
701
|
this.cfg.logger.log(`retry-after: ${n}`), t || this.cfg.logger.warn("retry-after could not be parsed");
|
|
709
702
|
}
|
|
@@ -736,7 +729,7 @@ var he = [
|
|
|
736
729
|
return this.cfg.logWithSearchParams || (n = n.split("?")[0]), !this.cfg.logWithBaseUrl && t && n.startsWith(t) && (n = n.slice(t.length)), n;
|
|
737
730
|
}
|
|
738
731
|
normalizeCfg(t) {
|
|
739
|
-
let { debug: n = !1, logger: r =
|
|
732
|
+
let { debug: n = !1, logger: r = f } = t, i = x({
|
|
740
733
|
baseUrl: "",
|
|
741
734
|
name: this.getFetcherName(t),
|
|
742
735
|
inputUrl: "",
|
|
@@ -753,12 +746,12 @@ var he = [
|
|
|
753
746
|
logRequestBody: n,
|
|
754
747
|
logResponse: n,
|
|
755
748
|
logResponseBody: n,
|
|
756
|
-
logWithBaseUrl:
|
|
749
|
+
logWithBaseUrl: S(),
|
|
757
750
|
logWithSearchParams: !0,
|
|
758
|
-
retry: { ...
|
|
751
|
+
retry: { ...ve },
|
|
759
752
|
init: {
|
|
760
753
|
method: t.method || "GET",
|
|
761
|
-
headers:
|
|
754
|
+
headers: _({
|
|
762
755
|
"user-agent": e.userAgent,
|
|
763
756
|
...t.headers
|
|
764
757
|
}),
|
|
@@ -770,7 +763,7 @@ var he = [
|
|
|
770
763
|
hooks: {},
|
|
771
764
|
throwHttpErrors: !0,
|
|
772
765
|
errorData: {}
|
|
773
|
-
},
|
|
766
|
+
}, h(t, [
|
|
774
767
|
"method",
|
|
775
768
|
"credentials",
|
|
776
769
|
"headers",
|
|
@@ -779,12 +772,12 @@ var he = [
|
|
|
779
772
|
"name",
|
|
780
773
|
"keepalive"
|
|
781
774
|
]));
|
|
782
|
-
return i.init.headers =
|
|
775
|
+
return i.init.headers = b(i.init.headers, (e) => e.toLowerCase()), i.baseUrl.endsWith("/") && (r.warn(`Fetcher: baseUrl should not end with slash: ${i.baseUrl}`), i.baseUrl = i.baseUrl.slice(0, -1)), i;
|
|
783
776
|
}
|
|
784
777
|
getFetcherName(e) {
|
|
785
778
|
let { name: t } = e;
|
|
786
779
|
if (!t && e.baseUrl) {
|
|
787
|
-
let n =
|
|
780
|
+
let n = pe(e.baseUrl);
|
|
788
781
|
n && (t = n.hostname);
|
|
789
782
|
}
|
|
790
783
|
return t;
|
|
@@ -809,8 +802,8 @@ var he = [
|
|
|
809
802
|
"fetchFn",
|
|
810
803
|
"overrideFetchFn"
|
|
811
804
|
]),
|
|
812
|
-
started:
|
|
813
|
-
...
|
|
805
|
+
started: l(),
|
|
806
|
+
...h(t, [
|
|
814
807
|
"method",
|
|
815
808
|
"headers",
|
|
816
809
|
"credentials"
|
|
@@ -819,9 +812,9 @@ var he = [
|
|
|
819
812
|
fullUrl: t.url || "",
|
|
820
813
|
retry: {
|
|
821
814
|
...this.cfg.retry,
|
|
822
|
-
...
|
|
815
|
+
...v(t.retry || {})
|
|
823
816
|
},
|
|
824
|
-
init:
|
|
817
|
+
init: x({
|
|
825
818
|
...this.cfg.init,
|
|
826
819
|
headers: {
|
|
827
820
|
...this.cfg.init.headers,
|
|
@@ -831,15 +824,15 @@ var he = [
|
|
|
831
824
|
credentials: t.credentials || this.cfg.init.credentials,
|
|
832
825
|
redirect: t.redirect || this.cfg.init.redirect || "follow",
|
|
833
826
|
keepalive: t.keepalive ?? this.cfg.init.keepalive
|
|
834
|
-
}, { headers:
|
|
827
|
+
}, { headers: b(t.headers || {}, (e) => e.toLowerCase()) })
|
|
835
828
|
};
|
|
836
|
-
|
|
829
|
+
_(n.init.headers, { mutate: !0 });
|
|
837
830
|
let r = t.baseUrl || this.cfg.baseUrl;
|
|
838
831
|
if (r) {
|
|
839
832
|
let { inputUrl: e } = n;
|
|
840
833
|
e.startsWith("/") && (this.cfg.logger.warn("Fetcher: url should not start with / when baseUrl is specified"), e = e.slice(1)), n.fullUrl = `${r}/${e}`;
|
|
841
834
|
}
|
|
842
|
-
let i =
|
|
835
|
+
let i = v({
|
|
843
836
|
...this.cfg.searchParams,
|
|
844
837
|
...t.searchParams
|
|
845
838
|
});
|
|
@@ -847,13 +840,13 @@ var he = [
|
|
|
847
840
|
let e = new URLSearchParams(i).toString();
|
|
848
841
|
n.fullUrl += (n.fullUrl.includes("?") ? "&" : "?") + e;
|
|
849
842
|
}
|
|
850
|
-
return t.json === void 0 ? t.text === void 0 ? t.form ? t.form instanceof URLSearchParams || t.form instanceof FormData ? n.init.body = t.form : (n.init.body = new URLSearchParams(t.form), n.init.headers["content-type"] ||= "application/x-www-form-urlencoded") : t.body !== void 0 && (n.init.body = t.body) : (n.init.body = t.text, n.init.headers["content-type"] ||= "text/plain") : (n.init.body = JSON.stringify(t.json), n.init.headers["content-type"] ||= "application/json"), n.init.headers.accept ||=
|
|
843
|
+
return t.json === void 0 ? t.text === void 0 ? t.form ? t.form instanceof URLSearchParams || t.form instanceof FormData ? n.init.body = t.form : (n.init.body = new URLSearchParams(t.form), n.init.headers["content-type"] ||= "application/x-www-form-urlencoded") : t.body !== void 0 && (n.init.body = t.body) : (n.init.body = t.text, n.init.headers["content-type"] ||= "text/plain") : (n.init.body = JSON.stringify(t.json), n.init.headers["content-type"] ||= "application/json"), n.init.headers.accept ||= _e[n.responseType], n;
|
|
851
844
|
}
|
|
852
845
|
};
|
|
853
|
-
function
|
|
854
|
-
return
|
|
846
|
+
function ge(e = {}) {
|
|
847
|
+
return he.create(e);
|
|
855
848
|
}
|
|
856
|
-
var
|
|
849
|
+
var K = Symbol("reinitAttempted"), _e = {
|
|
857
850
|
text: "text/plain",
|
|
858
851
|
json: "application/json",
|
|
859
852
|
void: "*/*",
|
|
@@ -861,23 +854,23 @@ var G = Symbol("reinitAttempted"), ve = {
|
|
|
861
854
|
arrayBuffer: "application/octet-stream",
|
|
862
855
|
bytes: "application/octet-stream",
|
|
863
856
|
blob: "application/octet-stream"
|
|
864
|
-
},
|
|
857
|
+
}, ve = {
|
|
865
858
|
count: 2,
|
|
866
859
|
timeout: 1e3,
|
|
867
860
|
timeoutMax: 3e4,
|
|
868
861
|
timeoutMultiplier: 2,
|
|
869
862
|
maxRetryAfter: 6e5
|
|
870
|
-
},
|
|
871
|
-
function
|
|
863
|
+
}, ye = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
864
|
+
function be(e = 21) {
|
|
872
865
|
let t = "", n = globalThis.crypto.getRandomValues(new Uint8Array(e));
|
|
873
|
-
for (; e--;) t +=
|
|
866
|
+
for (; e--;) t += ye[n[e] & 63];
|
|
874
867
|
return t;
|
|
875
868
|
}
|
|
876
|
-
var
|
|
877
|
-
function
|
|
878
|
-
return
|
|
869
|
+
var xe = (e) => globalThis.crypto.getRandomValues(new Uint8Array(e));
|
|
870
|
+
function Se(e, t = 21) {
|
|
871
|
+
return Ce(e, t, xe);
|
|
879
872
|
}
|
|
880
|
-
function
|
|
873
|
+
function Ce(e, t, n) {
|
|
881
874
|
let r = (2 << Math.log2(e.length - 1)) - 1, i = -~(1.6 * r * t / e.length);
|
|
882
875
|
return (a = t) => {
|
|
883
876
|
let o = "";
|
|
@@ -888,7 +881,7 @@ function we(e, t, n) {
|
|
|
888
881
|
};
|
|
889
882
|
}
|
|
890
883
|
// src/analytics/analyticsClient.ts
|
|
891
|
-
var
|
|
884
|
+
var we = 3800, Te = "utm_", Ee = [
|
|
892
885
|
"dclid",
|
|
893
886
|
"fbclid",
|
|
894
887
|
"gclid",
|
|
@@ -899,11 +892,11 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
899
892
|
"ttclid",
|
|
900
893
|
"twclid",
|
|
901
894
|
"wbraid"
|
|
902
|
-
],
|
|
895
|
+
], De = Se("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 16), Oe = class {
|
|
903
896
|
constructor(e) {
|
|
904
897
|
let t = e.localStorageKeyPrefix || "nca";
|
|
905
898
|
this.cfg = {
|
|
906
|
-
onError:
|
|
899
|
+
onError: p,
|
|
907
900
|
firstTouchUrl: "",
|
|
908
901
|
isEnabled: () => !0,
|
|
909
902
|
getCommonProps: () => ({}),
|
|
@@ -916,19 +909,19 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
916
909
|
persistQueue: !0,
|
|
917
910
|
maxPersistedAge: 864e5,
|
|
918
911
|
localStorageKeyPrefix: t,
|
|
919
|
-
logger:
|
|
912
|
+
logger: f,
|
|
920
913
|
debug: !1,
|
|
921
914
|
...e
|
|
922
|
-
}, this.identity = new q(this.cfg.identity), this.firstTouchFetcher =
|
|
915
|
+
}, this.identity = new q(this.cfg.identity), this.firstTouchFetcher = ge({
|
|
923
916
|
logger: this.cfg.logger,
|
|
924
917
|
retryPost: !0,
|
|
925
918
|
timeoutSeconds: 10
|
|
926
|
-
}),
|
|
919
|
+
}), S() || (this.restoreOrphanedQueues(), globalThis.addEventListener("pagehide", this.handlePageHide), document.addEventListener("visibilitychange", this.handleVisibilityChange));
|
|
927
920
|
}
|
|
928
921
|
cfg;
|
|
929
922
|
firstTouchFetcher;
|
|
930
923
|
identity;
|
|
931
|
-
tabId =
|
|
924
|
+
tabId = be(10);
|
|
932
925
|
queue = [];
|
|
933
926
|
flushTimer;
|
|
934
927
|
isFlushing = !1;
|
|
@@ -983,13 +976,13 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
983
976
|
identify(e) {
|
|
984
977
|
if (!this.canTrack()) return;
|
|
985
978
|
let t = this.identity.getDistinctId();
|
|
986
|
-
this.identity.identify(e), t !== e && (this.enqueue(
|
|
979
|
+
this.identity.identify(e), t !== e && (this.enqueue(ne, { anon_distinct_id: t }), this.flush(), this.sendFirstTouch());
|
|
987
980
|
}
|
|
988
981
|
enqueue(e, t, n) {
|
|
989
982
|
if (!this.canTrack()) return;
|
|
990
983
|
this.ensureAcquisitionProps();
|
|
991
984
|
let r = {
|
|
992
|
-
id:
|
|
985
|
+
id: De(),
|
|
993
986
|
name: e,
|
|
994
987
|
ts: n || Date.now(),
|
|
995
988
|
props: {
|
|
@@ -1002,13 +995,13 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1002
995
|
return this.cfg.debug && this.cfg.logger.log(`[analytics] ${r.name}`, { props: r.props }), this.queue.push(r), this.queue.length > this.cfg.maxQueueSize && (this.queue.shift(), this.cfg.logger.warn("[analytics] queue overflow, dropped the oldest event")), this.schedulePersistQueue(), this.queue.length >= this.cfg.maxBatchSize && !this.consecutiveFailures ? this.flush() : this.scheduleFlush(), r;
|
|
1003
996
|
}
|
|
1004
997
|
canTrack() {
|
|
1005
|
-
return !
|
|
998
|
+
return !S() && this.cfg.isEnabled();
|
|
1006
999
|
}
|
|
1007
1000
|
reset() {
|
|
1008
1001
|
this.clearPendingEvents(), this.identity.reset(), this.hasUpdatedAcquisitionProps = !1;
|
|
1009
1002
|
}
|
|
1010
1003
|
async flush() {
|
|
1011
|
-
if (!(
|
|
1004
|
+
if (!(S() || this.isFlushing)) {
|
|
1012
1005
|
this.isFlushing = !0, this.clearFlushTimer();
|
|
1013
1006
|
try {
|
|
1014
1007
|
for (; this.queue.length;) for (let e of this.prepareBatches()) {
|
|
@@ -1033,7 +1026,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1033
1026
|
}
|
|
1034
1027
|
}
|
|
1035
1028
|
destroy() {
|
|
1036
|
-
this.persistScheduledQueue(), this.clearFlushTimer(),
|
|
1029
|
+
this.persistScheduledQueue(), this.clearFlushTimer(), S() || (globalThis.removeEventListener("pagehide", this.handlePageHide), document.removeEventListener("visibilitychange", this.handleVisibilityChange));
|
|
1037
1030
|
}
|
|
1038
1031
|
ensureAcquisitionProps() {
|
|
1039
1032
|
this.hasUpdatedAcquisitionProps || (this.hasUpdatedAcquisitionProps = !0, this.identity.updateAcquisitionProps(), this.sendFirstTouch());
|
|
@@ -1050,11 +1043,11 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1050
1043
|
}, r = await this.firstTouchFetcher.doFetch({
|
|
1051
1044
|
url: e,
|
|
1052
1045
|
method: "POST",
|
|
1053
|
-
text:
|
|
1046
|
+
text: R(n),
|
|
1054
1047
|
responseType: "void"
|
|
1055
1048
|
});
|
|
1056
1049
|
if (r.err) try {
|
|
1057
|
-
this.cfg.onError(
|
|
1050
|
+
this.cfg.onError(P(r.err, { firstTouch: !0 }));
|
|
1058
1051
|
} catch (e) {
|
|
1059
1052
|
this.cfg.logger.warn("[analytics] onError hook threw", { err: e });
|
|
1060
1053
|
}
|
|
@@ -1068,7 +1061,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1068
1061
|
screen_width: globalThis.screen.width,
|
|
1069
1062
|
...this.identity.getAcquisitionProps(),
|
|
1070
1063
|
...J(t),
|
|
1071
|
-
...je(t,
|
|
1064
|
+
...je(t, Ee)
|
|
1072
1065
|
};
|
|
1073
1066
|
}
|
|
1074
1067
|
clearPendingEvents() {
|
|
@@ -1088,7 +1081,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1088
1081
|
}
|
|
1089
1082
|
this.cfg.logger.error(`[analytics] batch rejected with ${t.status}, dropping ${e.events.length} event(s)`);
|
|
1090
1083
|
try {
|
|
1091
|
-
this.cfg.onError(new
|
|
1084
|
+
this.cfg.onError(new F("batch dropped on a non-retryable status", {
|
|
1092
1085
|
status: t.status,
|
|
1093
1086
|
eventCount: e.events.length
|
|
1094
1087
|
}));
|
|
@@ -1109,7 +1102,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1109
1102
|
prepareBatches() {
|
|
1110
1103
|
let e = [], t, n = this.identity.getDistinctId();
|
|
1111
1104
|
for (let r of this.queue) {
|
|
1112
|
-
let i = Y(
|
|
1105
|
+
let i = Y(R(r)), a = t?.events.length === this.cfg.maxBatchSize, o = +!!t?.events.length, s = !!t && t.bodyBytes + o + i > this.cfg.maxBatchBytes;
|
|
1113
1106
|
t && (a || s) && (e.push(this.finalizeBatch(t)), t = void 0), t ? (t.events.push(r), t.bodyBytes += o + i) : t = this.createPendingBatch(n, r, i);
|
|
1114
1107
|
}
|
|
1115
1108
|
return t && e.push(this.finalizeBatch(t)), e;
|
|
@@ -1137,7 +1130,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1137
1130
|
};
|
|
1138
1131
|
return {
|
|
1139
1132
|
events: e.events,
|
|
1140
|
-
body:
|
|
1133
|
+
body: R(t)
|
|
1141
1134
|
};
|
|
1142
1135
|
}
|
|
1143
1136
|
restoreOrphanedQueues() {
|
|
@@ -1159,7 +1152,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1159
1152
|
} catch {}
|
|
1160
1153
|
}
|
|
1161
1154
|
scheduleFlush() {
|
|
1162
|
-
if (this.flushTimer ||
|
|
1155
|
+
if (this.flushTimer || S()) return;
|
|
1163
1156
|
let e = this.cfg.flushInterval;
|
|
1164
1157
|
this.consecutiveFailures && (e = Math.min(this.cfg.flushInterval * 2 ** this.consecutiveFailures, this.cfg.maxRetryBackoff), e = Math.max(e, this.retryAfter)), this.flushTimer = setTimeout(() => {
|
|
1165
1158
|
this.flushTimer = void 0, this.flush();
|
|
@@ -1182,7 +1175,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1182
1175
|
if (this.cfg.persistQueue) {
|
|
1183
1176
|
this.isQueuePersistScheduled = !1;
|
|
1184
1177
|
try {
|
|
1185
|
-
this.queue.length ? localStorage.setItem(this.queueKey,
|
|
1178
|
+
this.queue.length ? localStorage.setItem(this.queueKey, R(this.queue)) : localStorage.removeItem(this.queueKey);
|
|
1186
1179
|
} catch {}
|
|
1187
1180
|
}
|
|
1188
1181
|
}
|
|
@@ -1192,7 +1185,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1192
1185
|
}, q = class {
|
|
1193
1186
|
constructor(e) {
|
|
1194
1187
|
this.cfg = {
|
|
1195
|
-
onError:
|
|
1188
|
+
onError: p,
|
|
1196
1189
|
cookieDomain: "",
|
|
1197
1190
|
expireDays: 365,
|
|
1198
1191
|
secureCookie: !1,
|
|
@@ -1214,7 +1207,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1214
1207
|
return this.loadEntry()[e];
|
|
1215
1208
|
}
|
|
1216
1209
|
getAcquisitionProps() {
|
|
1217
|
-
let e = this.loadEntry(), t =
|
|
1210
|
+
let e = this.loadEntry(), t = y(e, (e) => String(e).startsWith(Te)), { firstTouch: n } = e;
|
|
1218
1211
|
return n && (t.initial_referrer = n.referrer), t;
|
|
1219
1212
|
}
|
|
1220
1213
|
getFirstTouchProps() {
|
|
@@ -1236,7 +1229,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1236
1229
|
});
|
|
1237
1230
|
}
|
|
1238
1231
|
updateAcquisitionProps() {
|
|
1239
|
-
if (
|
|
1232
|
+
if (S()) return;
|
|
1240
1233
|
let e = this.loadEntry(), t = new URL(globalThis.location.href);
|
|
1241
1234
|
Object.assign(e, J(t)), e.firstTouch ||= { referrer: ke() }, e.firstTouch.utms ||= Ae(t), this.saveEntry(e);
|
|
1242
1235
|
}
|
|
@@ -1265,7 +1258,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1265
1258
|
try {
|
|
1266
1259
|
let n = JSON.stringify(e);
|
|
1267
1260
|
if (t = n.length, this.cfg.persistence === "cookie") {
|
|
1268
|
-
if (t = this.cookieLength(e), t >
|
|
1261
|
+
if (t = this.cookieLength(e), t > we) {
|
|
1269
1262
|
this.reportError(new $("cookie exceeded the length limit", { bytes: t }));
|
|
1270
1263
|
return;
|
|
1271
1264
|
}
|
|
@@ -1277,7 +1270,7 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1277
1270
|
}));
|
|
1278
1271
|
} else localStorage.setItem(this.cfg.persistenceKey, n);
|
|
1279
1272
|
} catch (e) {
|
|
1280
|
-
this.reportError(
|
|
1273
|
+
this.reportError(P(e, { bytes: t }));
|
|
1281
1274
|
}
|
|
1282
1275
|
}
|
|
1283
1276
|
cookieLength(e) {
|
|
@@ -1291,21 +1284,21 @@ var Te = 3800, Ee = "utm_", De = [
|
|
|
1291
1284
|
};
|
|
1292
1285
|
function J(e) {
|
|
1293
1286
|
let t = {};
|
|
1294
|
-
for (let n of
|
|
1287
|
+
for (let n of T) {
|
|
1295
1288
|
let r = e.searchParams.get(n);
|
|
1296
|
-
r && (t[n] =
|
|
1289
|
+
r && (t[n] = w(r));
|
|
1297
1290
|
}
|
|
1298
1291
|
return t;
|
|
1299
1292
|
}
|
|
1300
1293
|
function ke() {
|
|
1301
|
-
return
|
|
1294
|
+
return w(document.referrer) || null;
|
|
1302
1295
|
}
|
|
1303
1296
|
function Ae(e) {
|
|
1304
|
-
let t =
|
|
1297
|
+
let t = ue(T, (t) => {
|
|
1305
1298
|
let n = e.searchParams.get(t);
|
|
1306
|
-
return [`initial_${t}`, n ?
|
|
1299
|
+
return [`initial_${t}`, n ? w(n) : null];
|
|
1307
1300
|
});
|
|
1308
|
-
if (!n(
|
|
1301
|
+
if (!n(_(t))) return t;
|
|
1309
1302
|
}
|
|
1310
1303
|
function je(e, t) {
|
|
1311
1304
|
return Object.fromEntries(t.flatMap((t) => {
|
|
@@ -1334,7 +1327,7 @@ function Q(e, t, n, r, i) {
|
|
|
1334
1327
|
let o = a.join("; ");
|
|
1335
1328
|
return document.cookie = o, o;
|
|
1336
1329
|
}
|
|
1337
|
-
var $ = class extends
|
|
1330
|
+
var $ = class extends F {
|
|
1338
1331
|
constructor(e, t) {
|
|
1339
1332
|
super(e, t, { name: "AnalyticsClientError" });
|
|
1340
1333
|
}
|