@naturalcycles/internal-web-lib 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/is.util.js
1
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/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;
@@ -8,7 +8,7 @@ function n(e) {
8
8
  return !0;
9
9
  }
10
10
  //#endregion
11
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/abort.js
11
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/abort.js
12
12
  function r(e) {
13
13
  return e ? i(e) : void 0;
14
14
  }
@@ -38,11 +38,37 @@ function c(e) {
38
38
  return t.signal;
39
39
  }
40
40
  //#endregion
41
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/types.js
42
- var l = (...e) => void 0, u = Object.entries;
41
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/log/commonLogger.js
42
+ function l(e, t) {
43
+ let n = (n, [r, i]) => e({
44
+ ...t?.(),
45
+ ...u(r, i),
46
+ level: n
47
+ });
48
+ return {
49
+ debug: (...e) => n("debug", e),
50
+ log: (...e) => n("log", e),
51
+ warn: (...e) => n("warn", e),
52
+ error: (...e) => n("error", e),
53
+ child: (n) => l(e, () => ({
54
+ ...t?.(),
55
+ ...n
56
+ }))
57
+ };
58
+ }
59
+ function u(e, t) {
60
+ return typeof e == "string" ? {
61
+ ...t,
62
+ msg: e
63
+ } : e instanceof Error ? { err: e } : e;
64
+ }
65
+ var d = l(({ level: e, msg: t, err: n, ...r }) => {
66
+ let i = [];
67
+ t !== void 0 && i.push(t), n !== void 0 && i.push(n), Object.keys(r).length && i.push(r), console[e](...i);
68
+ }), f = (...e) => void 0, p = Object.entries;
43
69
  //#endregion
44
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
45
- function d(e, t, n = {}) {
70
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
71
+ function ee(e, t, n = {}) {
46
72
  if (n.mutate) {
47
73
  for (let n of Object.keys(e)) t.includes(n) || delete e[n];
48
74
  return e;
@@ -51,7 +77,7 @@ function d(e, t, n = {}) {
51
77
  for (let n of t) n in e && (r[n] = e[n]);
52
78
  return r;
53
79
  }
54
- function f(e, t, n = {}) {
80
+ function m(e, t, n = {}) {
55
81
  if (n.mutate) {
56
82
  for (let n of t) delete e[n];
57
83
  return e;
@@ -60,95 +86,95 @@ function f(e, t, n = {}) {
60
86
  for (let n of Object.keys(e)) t.includes(n) || (r[n] = e[n]);
61
87
  return r;
62
88
  }
63
- function ee(e, t = {}) {
64
- return h(e, (e, t) => !!t, t);
89
+ function te(e, t = {}) {
90
+ return _(e, (e, t) => !!t, t);
65
91
  }
66
- function p(e, t = {}) {
67
- return h(e, (e, t) => t != null, t);
92
+ function h(e, t = {}) {
93
+ return _(e, (e, t) => t != null, t);
68
94
  }
69
- function m(e, t = {}) {
70
- return h(e, (e, t) => t !== void 0, t);
95
+ function g(e, t = {}) {
96
+ return _(e, (e, t) => t !== void 0, t);
71
97
  }
72
- function h(e, t, n = {}) {
98
+ function _(e, t, n = {}) {
73
99
  if (n.mutate) {
74
- for (let [n, r] of u(e)) t(n, r, e) || delete e[n];
100
+ for (let [n, r] of p(e)) t(n, r, e) || delete e[n];
75
101
  return e;
76
102
  }
77
103
  let r = {};
78
- for (let [n, i] of u(e)) t(n, i, e) && (r[n] = i);
104
+ for (let [n, i] of p(e)) t(n, i, e) && (r[n] = i);
79
105
  return r;
80
106
  }
81
- function g(e, t) {
107
+ function v(e, t) {
82
108
  let n = {};
83
109
  for (let [r, i] of Object.entries(e)) n[t(r, i, e)] = i;
84
110
  return n;
85
111
  }
86
- function _(e, ...n) {
87
- 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] ||= {}, _(e[n], r[n])) : e[n] = r[n]);
112
+ function y(e, ...n) {
113
+ 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] ||= {}, y(e[n], r[n])) : e[n] = r[n]);
88
114
  return e;
89
115
  }
90
116
  //#endregion
91
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/env.js
92
- function v() {
93
- return !y();
117
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/env.js
118
+ function b() {
119
+ return !x();
94
120
  }
95
- function y() {
121
+ function x() {
96
122
  return typeof window < "u" && !!window?.document;
97
123
  }
98
124
  //#endregion
99
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
100
- var te = /^\s*[{["\-\d]/;
101
- function b(e, t) {
102
- if (typeof e == "string" && e && te.test(e)) try {
125
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
126
+ var S = /^\s*[{["\-\d]/;
127
+ function C(e, t) {
128
+ if (typeof e == "string" && e && S.test(e)) try {
103
129
  return JSON.parse(e, t);
104
130
  } catch {}
105
131
  return e;
106
132
  }
107
- function x(e, t) {
133
+ function ne(e, t) {
108
134
  try {
109
135
  return JSON.parse(e, t);
110
136
  } catch {
111
- throw new ne({ text: e });
137
+ throw new ae({ text: e });
112
138
  }
113
139
  }
114
140
  //#endregion
115
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
116
- function S(e, t, n = "...") {
141
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
142
+ function w(e, t, n = "...") {
117
143
  if (!e || e.length <= t) return e;
118
144
  if (t <= n.length) return n;
119
145
  let r = Math.round((t - n.length) / 2), i = e.length - Math.floor((t - n.length) / 2);
120
146
  return e.slice(0, r) + n + e.slice(i);
121
147
  }
122
148
  //#endregion
123
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
124
- function C(e, t = Error, n) {
149
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
150
+ function T(e, t = Error, n) {
125
151
  let r;
126
- return r = e instanceof t ? e : E(w(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
152
+ return r = e instanceof t ? e : re(E(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
127
153
  }
128
- function w(e, t) {
154
+ function E(e, t) {
129
155
  let n;
130
- return k(e) ? n = T(e) : (e = b(e), n = D(e) ? e.error : O(e) ? e : k(e) ? T(e) : {
156
+ return A(e) ? n = D(e) : (e = C(e), n = O(e) ? e.error : k(e) ? e : A(e) ? D(e) : {
131
157
  name: "Error",
132
158
  message: F(e),
133
159
  data: {}
134
160
  }), Object.assign(n.data, t), n;
135
161
  }
136
- function T(e) {
137
- if (!(e instanceof Error) && O(e)) return e;
162
+ function D(e) {
163
+ if (!(e instanceof Error) && k(e)) return e;
138
164
  let t = {
139
165
  name: e.name,
140
166
  message: e.message,
141
167
  data: { ...e.data }
142
168
  };
143
- return e.stack && (t.stack = e.stack), e.cause && (t.cause = w(e.cause)), t;
169
+ return e.stack && (t.stack = e.stack), e.cause && (t.cause = E(e.cause)), t;
144
170
  }
145
- function E(e, t = Error) {
171
+ function re(e, t = Error) {
146
172
  if (e instanceof t) return e;
147
173
  let { name: n, cause: r } = e, i = new t(e.message, e.data, {
148
174
  name: n,
149
175
  cause: r
150
176
  });
151
- return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof j || (Object.defineProperties(i, {
177
+ return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof M || (Object.defineProperties(i, {
152
178
  name: {
153
179
  value: n,
154
180
  configurable: !0,
@@ -172,31 +198,31 @@ function E(e, t = Error) {
172
198
  writable: !0
173
199
  })), i;
174
200
  }
175
- function D(e) {
201
+ function O(e) {
176
202
  try {
177
- return O(e?.error);
203
+ return k(e?.error);
178
204
  } catch {
179
205
  return !1;
180
206
  }
181
207
  }
182
- function O(e) {
208
+ function k(e) {
183
209
  try {
184
210
  return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string" && typeof e.data == "object";
185
211
  } catch {
186
212
  return !1;
187
213
  }
188
214
  }
189
- function k(e) {
215
+ function A(e) {
190
216
  try {
191
217
  return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string";
192
218
  } catch {
193
219
  return !1;
194
220
  }
195
221
  }
196
- function A(e, t) {
197
- return t ? C(e, void 0, t) : e;
222
+ function j(e, t) {
223
+ return t ? T(e, void 0, t) : e;
198
224
  }
199
- var j = class e extends Error {
225
+ var M = class e extends Error {
200
226
  data;
201
227
  cause;
202
228
  static of(t) {
@@ -207,7 +233,7 @@ var j = class e extends Error {
207
233
  }
208
234
  constructor(e, t = {}, n = {}) {
209
235
  super(e);
210
- let { name: r = v() ? this.constructor.name : "AppError", cause: i } = n;
236
+ let { name: r = b() ? this.constructor.name : "AppError", cause: i } = n;
211
237
  Object.defineProperties(this, {
212
238
  name: {
213
239
  value: r,
@@ -221,7 +247,7 @@ var j = class e extends Error {
221
247
  enumerable: !1
222
248
  }
223
249
  }), i ? Object.defineProperty(this, "cause", {
224
- value: w(i),
250
+ value: E(i),
225
251
  writable: !0,
226
252
  configurable: !0,
227
253
  enumerable: !0
@@ -231,44 +257,44 @@ var j = class e extends Error {
231
257
  writable: !0
232
258
  });
233
259
  }
234
- }, M = class extends j {
260
+ }, N = class extends M {
235
261
  constructor(e, t, n) {
236
262
  t.response && Object.defineProperty(t, "response", { enumerable: !1 }), super(e, t, {
237
263
  ...n,
238
264
  name: "HttpRequestError"
239
265
  });
240
266
  }
241
- }, N = class extends j {
267
+ }, ie = class extends M {
242
268
  constructor(e, t) {
243
269
  super(e, t, { name: "AssertionError" });
244
270
  }
245
- }, ne = class extends j {
271
+ }, ae = class extends M {
246
272
  constructor(e) {
247
- let t = ["Failed to parse", e.text && S(e.text, 200)].filter(Boolean).join(": ");
273
+ let t = ["Failed to parse", e.text && w(e.text, 200)].filter(Boolean).join(": ");
248
274
  super(t, e, { name: "JsonParseError" });
249
275
  }
250
- }, re = class extends j {
276
+ }, oe = class extends M {
251
277
  constructor(e, t, n) {
252
278
  super(e, t, {
253
279
  ...n,
254
280
  name: "TimeoutError"
255
281
  });
256
282
  }
257
- }, ie = class extends j {
283
+ }, se = class extends M {
258
284
  constructor(e) {
259
285
  super(e || "expected error was not thrown", {}, { name: "UnexpectedPassError" });
260
286
  }
261
287
  };
262
288
  //#endregion
263
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
289
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
264
290
  function P(e, t, n, r) {
265
291
  try {
266
292
  return JSON.stringify(e, t, n);
267
293
  } catch {
268
- return JSON.stringify(e, ae(t, r), n);
294
+ return JSON.stringify(e, ce(t, r), n);
269
295
  }
270
296
  }
271
- function ae(e, t) {
297
+ function ce(e, t) {
272
298
  let n = [], r = [];
273
299
  return t ??= (e, t) => n[0] === t ? "[Circular ~]" : "[Circular ~." + r.slice(0, n.indexOf(t)).join(".") + "]", function(i, a) {
274
300
  if (n.length > 0) {
@@ -279,22 +305,22 @@ function ae(e, t) {
279
305
  };
280
306
  }
281
307
  //#endregion
282
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
283
- var oe = typeof globalThis.AggregateError == "function", se = P;
308
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
309
+ var le = typeof globalThis.AggregateError == "function", ue = P;
284
310
  function F(e, t = {}) {
285
311
  if (e === void 0) return "undefined";
286
312
  if (e === null) return "null";
287
313
  if (typeof e == "function") return "function";
288
314
  if (typeof e == "symbol") return e.toString();
289
315
  let n;
290
- if (e = b(e), D(e)) return F(e.error, t);
291
- if (e instanceof Error || k(e)) n = ce(e, t);
316
+ if (e = C(e), O(e)) return F(e.error, t);
317
+ if (e instanceof Error || A(e)) n = de(e, t);
292
318
  else if (typeof e == "string") n = e.trim() || "empty_string";
293
319
  else if (typeof e == "number") n = String(e);
294
320
  else {
295
321
  e instanceof Map ? e = Object.fromEntries(e) : e instanceof Set && (e = Array.from(e));
296
322
  try {
297
- let { stringifyFn: r = se } = t;
323
+ let { stringifyFn: r = ue } = t;
298
324
  n = r(e, void 0, 2);
299
325
  } catch {
300
326
  n = String(e);
@@ -302,31 +328,31 @@ function F(e, t = {}) {
302
328
  }
303
329
  if (n === void 0) return "undefined";
304
330
  let { maxLen: r = 1e4 } = t;
305
- return r && n.length > r ? S(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
331
+ return r && n.length > r ? w(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
306
332
  }
307
- function ce(e, t) {
333
+ function de(e, t) {
308
334
  let { includeErrorCause: n = !0 } = t, r = [e.name, e.message].filter(Boolean).join(": ");
309
- if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && O(e) && Object.keys(e.data).length && (r += "\n" + F(e.data, t)), t.includeErrorStack && e.stack) {
335
+ if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && k(e) && Object.keys(e.data).length && (r += "\n" + F(e.data, t)), t.includeErrorStack && e.stack) {
310
336
  let t = r.split("\n").length;
311
337
  r = [r, ...e.stack.split("\n").slice(t)].join("\n");
312
338
  }
313
- return oe && e instanceof AggregateError && e.errors.length && (r = [
339
+ return le && e instanceof AggregateError && e.errors.length && (r = [
314
340
  r,
315
341
  `${e.errors.length} error(s):`,
316
342
  ...e.errors.map((e, n) => `${n + 1}. ${F(e, t)}`)
317
343
  ].join("\n")), e.cause && n && (r = r + "\nCaused by: " + F(e.cause, t)), r;
318
344
  }
319
345
  //#endregion
320
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/assert.js
321
- function le(e, t = Error) {
322
- if (!(e instanceof t)) throw new N(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
346
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/assert.js
347
+ function I(e, t = Error) {
348
+ if (!(e instanceof t)) throw new ie(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
323
349
  }
324
- function I(e, t) {
350
+ function L(e, t) {
325
351
  if (!(e instanceof t)) throw e;
326
352
  }
327
353
  //#endregion
328
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
329
- async function L(e, t) {
354
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
355
+ async function R(e, t) {
330
356
  t?.aborted || await new Promise((n) => {
331
357
  let r = setTimeout(i, e);
332
358
  function i() {
@@ -336,28 +362,28 @@ async function L(e, t) {
336
362
  });
337
363
  }
338
364
  //#endregion
339
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
340
- function R(e, t = Date.now()) {
341
- return z(t - e);
365
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
366
+ function z(e, t = Date.now()) {
367
+ return B(t - e);
342
368
  }
343
- function z(e) {
369
+ function B(e) {
344
370
  if (e < 1e3) return `${Math.round(e)} ms`;
345
371
  if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
346
372
  let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
347
373
  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`;
348
374
  }
349
375
  //#endregion
350
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
351
- function B(e, t, n) {
376
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
377
+ function V(e, t, n) {
352
378
  return e <= t ? t : e >= n ? n : e;
353
379
  }
354
380
  //#endregion
355
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/analytics/analytics.model.js
356
- var V = "identify";
357
- function H(e) {
381
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/analytics/analytics.model.js
382
+ var H = "identify";
383
+ function U(e) {
358
384
  return e.length <= 255 ? e : Array.from(e).slice(0, 255).join("");
359
385
  }
360
- var U = [
386
+ var W = [
361
387
  "utm_source",
362
388
  "utm_medium",
363
389
  "utm_campaign",
@@ -370,8 +396,8 @@ var U = [
370
396
  "utm_marketing_tactic"
371
397
  ];
372
398
  //#endregion
373
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/array/array.util.js
374
- function W(e, t) {
399
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/array/array.util.js
400
+ function fe(e, t) {
375
401
  let n = {};
376
402
  for (let r of e) {
377
403
  let e = t(r);
@@ -380,24 +406,22 @@ function W(e, t) {
380
406
  return n;
381
407
  }
382
408
  //#endregion
383
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
384
- async function ue(e, t) {
409
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
410
+ async function pe(e, t) {
385
411
  let n = new AbortController(), { signal: r } = n;
386
412
  if (!t.timeout) return await e(r);
387
413
  let { timeout: i, name: a = e.name || "pTimeout function", onTimeout: o } = t, s = t.fakeError || /* @__PURE__ */ Error("TimeoutError");
388
414
  return await new Promise(async (c, l) => {
389
415
  let u = setTimeout(() => {
390
- let e = new re(`"${a}" timed out after ${i} ms`, t.errorData);
416
+ let e = new oe(`"${a}" timed out after ${i} ms`, t.errorData);
391
417
  if (e.stack = s.stack.replace("Error: TimeoutError", "TimeoutError: " + e.message), o) {
392
418
  try {
393
419
  c(o(e));
394
420
  } catch (e) {
395
- e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(A(e, t.errorData));
421
+ e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(j(e, t.errorData));
396
422
  }
397
423
  n.abort(e);
398
- return;
399
- }
400
- l(e), n.abort(e);
424
+ } else l(e), n.abort(e);
401
425
  }, i);
402
426
  try {
403
427
  c(await e(r));
@@ -409,8 +433,8 @@ async function ue(e, t) {
409
433
  });
410
434
  }
411
435
  //#endregion
412
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
413
- function de(e, t) {
436
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
437
+ function me(e, t) {
414
438
  if (typeof e != "string") return null;
415
439
  try {
416
440
  return new URL(e, t || void 0);
@@ -419,21 +443,21 @@ function de(e, t) {
419
443
  }
420
444
  }
421
445
  //#endregion
422
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
423
- var fe = [
446
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
447
+ var he = [
424
448
  "GET",
425
449
  "POST",
426
450
  "PUT",
427
451
  "PATCH",
428
452
  "DELETE",
429
453
  "HEAD"
430
- ], pe = class e {
454
+ ], ge = class e {
431
455
  static VERSION = 5;
432
- static userAgent = v() ? `fetcher/${this.VERSION}` : void 0;
456
+ static userAgent = b() ? `fetcher/${this.VERSION}` : void 0;
433
457
  constructor(e = {}) {
434
458
  if (typeof globalThis.fetch != "function") throw TypeError("globalThis.fetch is not available");
435
459
  this.cfg = this.normalizeCfg(e);
436
- for (let e of fe) {
460
+ for (let e of he) {
437
461
  let t = e.toLowerCase();
438
462
  this[`${t}Void`] = async (t, n) => await this.fetch({
439
463
  url: t,
@@ -495,7 +519,7 @@ var fe = [
495
519
  headVoid;
496
520
  async queryGraphQL(e) {
497
521
  e = { ...e }, e.method ||= this.cfg.init.method;
498
- let t = ee({
522
+ let t = te({
499
523
  query: e.query,
500
524
  variables: e.variables
501
525
  });
@@ -507,7 +531,7 @@ var fe = [
507
531
  if (n.err) throw n.err;
508
532
  if (n.body.errors) {
509
533
  let e = n.body.errors[0];
510
- throw new M(e.message, {
534
+ throw new N(e.message, {
511
535
  ...t,
512
536
  errors: n.body.errors,
513
537
  response: n.fetchResponse,
@@ -550,12 +574,12 @@ var fe = [
550
574
  }
551
575
  async expectError(e) {
552
576
  let t = await this.doFetch(e);
553
- if (!t.err) throw new ie("Fetch was expected to error");
554
- return le(t.err, M), t.err;
577
+ if (!t.err) throw new se("Fetch was expected to error");
578
+ return I(t.err, N), t.err;
555
579
  }
556
580
  async tryFetch(e) {
557
581
  let t = await this.doFetch(e);
558
- return t.err ? (I(t.err, M), [t.err, null]) : [null, t.body];
582
+ return t.err ? (L(t.err, N), [t.err, null]) : [null, t.body];
559
583
  }
560
584
  async doFetch(t) {
561
585
  let n = 0;
@@ -585,25 +609,25 @@ var fe = [
585
609
  " >>",
586
610
  u,
587
611
  e && `try#${e + 1}/${i.retry.count + 1}`
588
- ].filter(Boolean).join(" ")), i.logRequestBody && i.init.body && a.log(i.init.body);
612
+ ].filter(Boolean).join(" ")), i.logRequestBody && i.init.body && a.log({ body: i.init.body });
589
613
  }
590
614
  try {
591
615
  d.fetchResponse = await (i.overrideFetchFn || e.callNativeFetch)(i.fullUrl, i.init, i.fetchFn), d.ok = d.fetchResponse.ok, d.err = void 0;
592
616
  } catch (e) {
593
- d.err = C(e), d.ok = !1, d.fetchResponse = void 0;
617
+ d.err = T(e), d.ok = !1, d.fetchResponse = void 0;
594
618
  }
595
619
  if (d.statusFamily = this.getStatusFamily(d), d.statusCode = d.fetchResponse?.status, d.fetchResponse?.ok) try {
596
- await ue(async () => await this.onOkResponse(d), {
620
+ await pe(async () => await this.onOkResponse(d), {
597
621
  timeout: c ?? 0,
598
622
  name: "Fetcher.downloadBody"
599
623
  });
600
624
  } catch (e) {
601
- d.err = C(e), d.ok = !1, await this.onNotOkResponse(d);
625
+ d.err = T(e), d.ok = !1, await this.onNotOkResponse(d);
602
626
  }
603
627
  else await this.onNotOkResponse(d);
604
628
  }
605
629
  if (d.err) {
606
- A(d.err, i.errorData), i.onError?.(d.err);
630
+ j(d.err, i.errorData), i.onError?.(d.err);
607
631
  for (let e of this.cfg.hooks.onError || []) await e(d.err);
608
632
  }
609
633
  for (let e of this.cfg.hooks.afterResponse || []) await e(d);
@@ -624,7 +648,7 @@ var fe = [
624
648
  if (n === "json") {
625
649
  if (e.fetchResponse.body) {
626
650
  let n = await e.fetchResponse.text();
627
- n ? (e.body = n, e.body = x(n, t.jsonReviver)) : e.body = {};
651
+ n ? (e.body = n, e.body = ne(n, t.jsonReviver)) : e.body = {};
628
652
  } else e.body = {};
629
653
  } else if (n === "text") e.body = e.fetchResponse.body ? await e.fetchResponse.text() : "";
630
654
  else if (n === "arrayBuffer") e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0);
@@ -639,8 +663,8 @@ var fe = [
639
663
  e.fetchResponse.status,
640
664
  e.signature,
641
665
  n && `try#${n + 1}/${t.retry.count + 1}`,
642
- R(e.req.started)
643
- ].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log(e.body);
666
+ z(e.req.started)
667
+ ].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log({ body: e.body });
644
668
  }
645
669
  }
646
670
  static async callNativeFetch(e, t, n) {
@@ -649,15 +673,15 @@ var fe = [
649
673
  async onNotOkResponse(e) {
650
674
  let t;
651
675
  if (!e.body && e.fetchResponse) try {
652
- e.body = b(await e.fetchResponse.text());
676
+ e.body = C(await e.fetchResponse.text());
653
677
  } catch {}
654
- t = e.err ? T(e.err) : e.body ? w(e.body) : {
678
+ t = e.err ? D(e.err) : e.body ? E(e.body) : {
655
679
  name: "Error",
656
680
  message: "Fetch failed",
657
681
  data: {}
658
682
  };
659
683
  let n = e.fetchResponse?.status || 0;
660
- e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new M([e.statusCode, e.signature].filter(Boolean).join(" "), p({
684
+ e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new N([e.statusCode, e.signature].filter(Boolean).join(" "), h({
661
685
  response: e.fetchResponse,
662
686
  responseStatusCode: n,
663
687
  requestUrl: e.req.fullUrl,
@@ -674,20 +698,19 @@ var fe = [
674
698
  this.shouldRetry(e) || (t.retryStopped = !0);
675
699
  for (let t of this.cfg.hooks.beforeRetry || []) await t(e);
676
700
  let { count: n, timeoutMultiplier: r, timeoutMax: i } = e.req.retry;
677
- if (t.retryAttempt >= n && (t.retryStopped = !0), e.err && (!t.retryStopped || e.req.logResponse) && this.cfg.logger.error([
678
- " <<",
679
- e.fetchResponse?.status || 0,
680
- e.signature,
681
- n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
682
- R(e.req.started)
683
- ].filter(Boolean).join(" ") + "\n", F(e.err.cause || e.err)), t.retryStopped) return;
701
+ if (t.retryAttempt >= n && (t.retryStopped = !0), e.err && (!t.retryStopped || e.req.logResponse) && this.cfg.logger.error({
702
+ msg: [
703
+ " <<",
704
+ e.fetchResponse?.status || 0,
705
+ e.signature,
706
+ n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
707
+ z(e.req.started)
708
+ ].filter(Boolean).join(" "),
709
+ err: e.err.cause || e.err
710
+ }), t.retryStopped) return;
684
711
  t.retryAttempt++;
685
712
  let a = this.getRetryTimeout(e);
686
- if (a === null) {
687
- this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0;
688
- return;
689
- }
690
- t.retryTimeout = B(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${z(a)}`), await L(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0);
713
+ a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = V(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${B(a)}`), await R(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0));
691
714
  }
692
715
  getRetryTimeout(e) {
693
716
  let t = 0;
@@ -731,9 +754,9 @@ var fe = [
731
754
  return this.cfg.logWithSearchParams || (n = n.split("?")[0]), !this.cfg.logWithBaseUrl && t && n.startsWith(t) && (n = n.slice(t.length)), n;
732
755
  }
733
756
  normalizeCfg(t) {
734
- let { debug: n = !1, logger: r = console } = t;
757
+ let { debug: n = !1, logger: r = d } = t;
735
758
  t.baseUrl?.endsWith("/") && (r.warn(`Fetcher: baseUrl should not end with slash: ${t.baseUrl}`), t.baseUrl = t.baseUrl.slice(0, t.baseUrl.length - 1));
736
- let i = _({
759
+ let i = y({
737
760
  baseUrl: "",
738
761
  name: this.getFetcherName(t),
739
762
  inputUrl: "",
@@ -750,12 +773,12 @@ var fe = [
750
773
  logRequestBody: n,
751
774
  logResponse: n,
752
775
  logResponseBody: n,
753
- logWithBaseUrl: v(),
776
+ logWithBaseUrl: b(),
754
777
  logWithSearchParams: !0,
755
- retry: { ...ge },
778
+ retry: { ...ye },
756
779
  init: {
757
780
  method: t.method || "GET",
758
- headers: p({
781
+ headers: h({
759
782
  "user-agent": e.userAgent,
760
783
  ...t.headers
761
784
  }),
@@ -767,7 +790,7 @@ var fe = [
767
790
  hooks: {},
768
791
  throwHttpErrors: !0,
769
792
  errorData: {}
770
- }, f(t, [
793
+ }, m(t, [
771
794
  "method",
772
795
  "credentials",
773
796
  "headers",
@@ -776,19 +799,19 @@ var fe = [
776
799
  "name",
777
800
  "keepalive"
778
801
  ]));
779
- return i.init.headers = g(i.init.headers, (e) => e.toLowerCase()), i;
802
+ return i.init.headers = v(i.init.headers, (e) => e.toLowerCase()), i;
780
803
  }
781
804
  getFetcherName(e) {
782
805
  let { name: t } = e;
783
806
  if (!t && e.baseUrl) {
784
- let n = de(e.baseUrl);
807
+ let n = me(e.baseUrl);
785
808
  n && (t = n.hostname);
786
809
  }
787
810
  return t;
788
811
  }
789
812
  normalizeOptions(t) {
790
813
  let n = {
791
- ...d(this.cfg, [
814
+ ...ee(this.cfg, [
792
815
  "timeoutSeconds",
793
816
  "retryPost",
794
817
  "retry3xx",
@@ -807,7 +830,7 @@ var fe = [
807
830
  "overrideFetchFn"
808
831
  ]),
809
832
  started: Date.now(),
810
- ...f(t, [
833
+ ...m(t, [
811
834
  "method",
812
835
  "headers",
813
836
  "credentials"
@@ -816,9 +839,9 @@ var fe = [
816
839
  fullUrl: t.url || "",
817
840
  retry: {
818
841
  ...this.cfg.retry,
819
- ...m(t.retry || {})
842
+ ...g(t.retry || {})
820
843
  },
821
- init: _({
844
+ init: y({
822
845
  ...this.cfg.init,
823
846
  headers: {
824
847
  ...this.cfg.init.headers,
@@ -828,15 +851,15 @@ var fe = [
828
851
  credentials: t.credentials || this.cfg.init.credentials,
829
852
  redirect: t.redirect || this.cfg.init.redirect || "follow",
830
853
  keepalive: t.keepalive ?? this.cfg.init.keepalive
831
- }, { headers: g(t.headers || {}, (e) => e.toLowerCase()) })
854
+ }, { headers: v(t.headers || {}, (e) => e.toLowerCase()) })
832
855
  };
833
- p(n.init.headers, { mutate: !0 });
856
+ h(n.init.headers, { mutate: !0 });
834
857
  let r = t.baseUrl || this.cfg.baseUrl;
835
858
  if (r) {
836
859
  let { inputUrl: e } = n;
837
860
  e.startsWith("/") && (this.cfg.logger.warn("Fetcher: url should not start with / when baseUrl is specified"), e = e.slice(1)), n.fullUrl = `${r}/${e}`;
838
861
  }
839
- let i = m({
862
+ let i = g({
840
863
  ...this.cfg.searchParams,
841
864
  ...t.searchParams
842
865
  });
@@ -844,13 +867,13 @@ var fe = [
844
867
  let e = new URLSearchParams(i).toString();
845
868
  n.fullUrl += (n.fullUrl.includes("?") ? "&" : "?") + e;
846
869
  }
847
- 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 ||= he[n.responseType], n;
870
+ 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 ||= ve[n.responseType], n;
848
871
  }
849
872
  };
850
- function me(e = {}) {
851
- return pe.create(e);
873
+ function _e(e = {}) {
874
+ return ge.create(e);
852
875
  }
853
- var G = Symbol("reinitAttempted"), he = {
876
+ var G = Symbol("reinitAttempted"), ve = {
854
877
  text: "text/plain",
855
878
  json: "application/json",
856
879
  void: "*/*",
@@ -858,23 +881,23 @@ var G = Symbol("reinitAttempted"), he = {
858
881
  arrayBuffer: "application/octet-stream",
859
882
  bytes: "application/octet-stream",
860
883
  blob: "application/octet-stream"
861
- }, ge = {
884
+ }, ye = {
862
885
  count: 2,
863
886
  timeout: 1e3,
864
887
  timeoutMax: 3e4,
865
888
  timeoutMultiplier: 2,
866
889
  maxRetryAfter: 6e5
867
- }, _e = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
868
- function ve(e = 21) {
890
+ }, be = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
891
+ function xe(e = 21) {
869
892
  let t = "", n = globalThis.crypto.getRandomValues(new Uint8Array(e));
870
- for (; e--;) t += _e[n[e] & 63];
893
+ for (; e--;) t += be[n[e] & 63];
871
894
  return t;
872
895
  }
873
- var ye = (e) => globalThis.crypto.getRandomValues(new Uint8Array(e));
874
- function be(e, t = 21) {
875
- return xe(e, t, ye);
896
+ var Se = (e) => globalThis.crypto.getRandomValues(new Uint8Array(e));
897
+ function Ce(e, t = 21) {
898
+ return we(e, t, Se);
876
899
  }
877
- function xe(e, t, n) {
900
+ function we(e, t, n) {
878
901
  let r = (2 << Math.log2(e.length - 1)) - 1, i = -~(1.6 * r * t / e.length);
879
902
  return (a = t) => {
880
903
  let o = "";
@@ -886,7 +909,7 @@ function xe(e, t, n) {
886
909
  }
887
910
  //#endregion
888
911
  //#region src/analytics/analyticsClient.ts
889
- var Se = 3800, Ce = "utm_", we = [
912
+ var Te = 3800, Ee = "utm_", De = [
890
913
  "dclid",
891
914
  "fbclid",
892
915
  "gclid",
@@ -897,11 +920,11 @@ var Se = 3800, Ce = "utm_", we = [
897
920
  "ttclid",
898
921
  "twclid",
899
922
  "wbraid"
900
- ], Te = be("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 16), Ee = class {
923
+ ], K = Ce("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 16), Oe = class {
901
924
  constructor(e) {
902
925
  let t = e.localStorageKeyPrefix || "nca";
903
926
  this.cfg = {
904
- onError: l,
927
+ onError: f,
905
928
  firstTouchUrl: "",
906
929
  isEnabled: () => !0,
907
930
  getCommonProps: () => ({}),
@@ -914,19 +937,19 @@ var Se = 3800, Ce = "utm_", we = [
914
937
  persistQueue: !0,
915
938
  maxPersistedAge: 864e5,
916
939
  localStorageKeyPrefix: t,
917
- logger: console,
940
+ logger: d,
918
941
  debug: !1,
919
942
  ...e
920
- }, this.identity = new K(this.cfg.identity), this.firstTouchFetcher = me({
943
+ }, this.identity = new q(this.cfg.identity), this.firstTouchFetcher = _e({
921
944
  logger: this.cfg.logger,
922
945
  retryPost: !0,
923
946
  timeoutSeconds: 10
924
- }), !v() && (this.restoreOrphanedQueues(), globalThis.addEventListener("pagehide", this.handlePageHide), document.addEventListener("visibilitychange", this.handleVisibilityChange));
947
+ }), !b() && (this.restoreOrphanedQueues(), globalThis.addEventListener("pagehide", this.handlePageHide), document.addEventListener("visibilitychange", this.handleVisibilityChange));
925
948
  }
926
949
  cfg;
927
950
  firstTouchFetcher;
928
951
  identity;
929
- tabId = ve(10);
952
+ tabId = xe(10);
930
953
  queue = [];
931
954
  flushTimer;
932
955
  isFlushing = !1;
@@ -957,7 +980,7 @@ var Se = 3800, Ce = "utm_", we = [
957
980
  e && this.notifyEventListeners(e);
958
981
  }
959
982
  } catch (e) {
960
- this.cfg.logger.warn("[analytics] could not replay a stubbed call", e);
983
+ this.cfg.logger.warn("[analytics] could not replay a stubbed call", { err: e });
961
984
  }
962
985
  e.q.length = 0;
963
986
  }
@@ -974,19 +997,19 @@ var Se = 3800, Ce = "utm_", we = [
974
997
  for (let e of this.eventListeners) try {
975
998
  e(n, t);
976
999
  } catch (e) {
977
- this.cfg.logger.warn("[analytics] onEvent listener threw", e);
1000
+ this.cfg.logger.warn("[analytics] onEvent listener threw", { err: e });
978
1001
  }
979
1002
  }
980
1003
  identify(e) {
981
1004
  if (!this.canTrack()) return;
982
1005
  let t = this.identity.getDistinctId();
983
- this.identity.identify(e), t !== e && (this.enqueue(V, { anon_distinct_id: t }), this.flush(), this.sendFirstTouch());
1006
+ this.identity.identify(e), t !== e && (this.enqueue(H, { anon_distinct_id: t }), this.flush(), this.sendFirstTouch());
984
1007
  }
985
1008
  enqueue(e, t, n) {
986
1009
  if (!this.canTrack()) return;
987
1010
  this.ensureAcquisitionProps();
988
1011
  let r = {
989
- id: Te(),
1012
+ id: K(),
990
1013
  name: e,
991
1014
  ts: n || Date.now(),
992
1015
  props: {
@@ -996,16 +1019,16 @@ var Se = 3800, Ce = "utm_", we = [
996
1019
  },
997
1020
  userId: this.identity.getDistinctId()
998
1021
  };
999
- return this.cfg.debug && this.cfg.logger.log(`[analytics] ${r.name}`, 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.persistQueue(), this.queue.length >= this.cfg.maxBatchSize && !this.consecutiveFailures ? this.flush() : this.scheduleFlush(), r;
1022
+ 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.persistQueue(), this.queue.length >= this.cfg.maxBatchSize && !this.consecutiveFailures ? this.flush() : this.scheduleFlush(), r;
1000
1023
  }
1001
1024
  canTrack() {
1002
- return !v() && this.cfg.isEnabled();
1025
+ return !b() && this.cfg.isEnabled();
1003
1026
  }
1004
1027
  reset() {
1005
1028
  this.clearPendingEvents(), this.identity.reset(), this.hasUpdatedAcquisitionProps = !1;
1006
1029
  }
1007
1030
  async flush() {
1008
- if (!(v() || this.isFlushing)) {
1031
+ if (!(b() || this.isFlushing)) {
1009
1032
  this.isFlushing = !0, this.clearFlushTimer();
1010
1033
  try {
1011
1034
  for (; this.queue.length;) for (let e of this.prepareBatches()) {
@@ -1024,13 +1047,13 @@ var Se = 3800, Ce = "utm_", we = [
1024
1047
  if (this.queue.length) {
1025
1048
  this.clearFlushTimer();
1026
1049
  for (let e of this.prepareBatches()) this.postBatch(e, !0).catch((e) => {
1027
- this.cfg.logger.warn("[analytics] lifecycle batch failed to send; retained for retry", e);
1050
+ this.cfg.logger.warn("[analytics] lifecycle batch failed to send; retained for retry", { err: e });
1028
1051
  });
1029
1052
  this.scheduleFlush();
1030
1053
  }
1031
1054
  }
1032
1055
  destroy() {
1033
- this.clearFlushTimer(), !v() && (globalThis.removeEventListener("pagehide", this.handlePageHide), document.removeEventListener("visibilitychange", this.handleVisibilityChange));
1056
+ this.clearFlushTimer(), !b() && (globalThis.removeEventListener("pagehide", this.handlePageHide), document.removeEventListener("visibilitychange", this.handleVisibilityChange));
1034
1057
  }
1035
1058
  ensureAcquisitionProps() {
1036
1059
  this.hasUpdatedAcquisitionProps || (this.hasUpdatedAcquisitionProps = !0, this.identity.updateAcquisitionProps(), this.sendFirstTouch());
@@ -1051,9 +1074,9 @@ var Se = 3800, Ce = "utm_", we = [
1051
1074
  responseType: "void"
1052
1075
  });
1053
1076
  if (r.err) try {
1054
- this.cfg.onError(A(r.err, { firstTouch: !0 }));
1077
+ this.cfg.onError(j(r.err, { firstTouch: !0 }));
1055
1078
  } catch (e) {
1056
- this.cfg.logger.warn("[analytics] onError hook threw", e);
1079
+ this.cfg.logger.warn("[analytics] onError hook threw", { err: e });
1057
1080
  }
1058
1081
  }
1059
1082
  getDefaultProps() {
@@ -1064,8 +1087,8 @@ var Se = 3800, Ce = "utm_", we = [
1064
1087
  screen_height: globalThis.screen.height,
1065
1088
  screen_width: globalThis.screen.width,
1066
1089
  ...this.identity.getAcquisitionProps(),
1067
- ...q(t),
1068
- ...J(t, we)
1090
+ ...J(t),
1091
+ ...je(t, De)
1069
1092
  };
1070
1093
  }
1071
1094
  clearPendingEvents() {
@@ -1076,7 +1099,7 @@ var Se = 3800, Ce = "utm_", we = [
1076
1099
  try {
1077
1100
  t = await this.postBatch(e, !1, AbortSignal.timeout?.(this.cfg.requestTimeout));
1078
1101
  } catch (e) {
1079
- return this.cfg.logger.warn("[analytics] batch failed to send, will retry", e), "retry";
1102
+ return this.cfg.logger.warn("[analytics] batch failed to send, will retry", { err: e }), "retry";
1080
1103
  }
1081
1104
  if (t.ok) return "ok";
1082
1105
  if (t.status === 429 || t.status >= 500) {
@@ -1085,12 +1108,12 @@ var Se = 3800, Ce = "utm_", we = [
1085
1108
  }
1086
1109
  this.cfg.logger.error(`[analytics] batch rejected with ${t.status}, dropping ${e.events.length} event(s)`);
1087
1110
  try {
1088
- this.cfg.onError(new j("batch dropped on a non-retryable status", {
1111
+ this.cfg.onError(new M("batch dropped on a non-retryable status", {
1089
1112
  status: t.status,
1090
1113
  eventCount: e.events.length
1091
1114
  }));
1092
1115
  } catch (e) {
1093
- this.cfg.logger.warn("[analytics] onError hook threw", e);
1116
+ this.cfg.logger.warn("[analytics] onError hook threw", { err: e });
1094
1117
  }
1095
1118
  return "drop";
1096
1119
  }
@@ -1158,7 +1181,7 @@ var Se = 3800, Ce = "utm_", we = [
1158
1181
  } catch {}
1159
1182
  }
1160
1183
  scheduleFlush() {
1161
- if (this.flushTimer || v()) return;
1184
+ if (this.flushTimer || b()) return;
1162
1185
  let e = this.cfg.flushInterval;
1163
1186
  this.consecutiveFailures && (e = Math.min(this.cfg.flushInterval * 2 ** this.consecutiveFailures, this.cfg.maxRetryBackoff), e = Math.max(e, this.retryAfter)), this.flushTimer = setTimeout(() => {
1164
1187
  this.flushTimer = void 0, this.flush();
@@ -1179,10 +1202,10 @@ var Se = 3800, Ce = "utm_", we = [
1179
1202
  get queueKey() {
1180
1203
  return `${this.cfg.localStorageKeyPrefix}.q.${this.tabId}`;
1181
1204
  }
1182
- }, K = class {
1205
+ }, q = class {
1183
1206
  constructor(e) {
1184
1207
  this.cfg = {
1185
- onError: l,
1208
+ onError: f,
1186
1209
  cookieDomain: "",
1187
1210
  expireDays: 365,
1188
1211
  secureCookie: !1,
@@ -1203,7 +1226,7 @@ var Se = 3800, Ce = "utm_", we = [
1203
1226
  return this.loadEntry()[e];
1204
1227
  }
1205
1228
  getAcquisitionProps() {
1206
- let e = this.loadEntry(), t = h(e, (e) => String(e).startsWith(Ce)), { firstTouch: n } = e;
1229
+ let e = this.loadEntry(), t = _(e, (e) => String(e).startsWith(Ee)), { firstTouch: n } = e;
1207
1230
  return n && (t.initial_referrer = n.referrer), t;
1208
1231
  }
1209
1232
  getFirstTouchProps() {
@@ -1225,9 +1248,9 @@ var Se = 3800, Ce = "utm_", we = [
1225
1248
  });
1226
1249
  }
1227
1250
  updateAcquisitionProps() {
1228
- if (v()) return;
1251
+ if (b()) return;
1229
1252
  let e = this.loadEntry(), t = new URL(globalThis.location.href);
1230
- Object.assign(e, q(t)), e.firstTouch ||= { referrer: De() }, e.firstTouch.utms ||= Oe(t), this.saveEntry(e);
1253
+ Object.assign(e, J(t)), e.firstTouch ||= { referrer: ke() }, e.firstTouch.utms ||= Ae(t), this.saveEntry(e);
1231
1254
  }
1232
1255
  ensureIdentity() {
1233
1256
  let e = this.loadEntry();
@@ -1254,7 +1277,7 @@ var Se = 3800, Ce = "utm_", we = [
1254
1277
  try {
1255
1278
  let n = JSON.stringify(e);
1256
1279
  if (t = n.length, this.cfg.persistence === "cookie") {
1257
- if (t = this.cookieLength(e), t > Se) {
1280
+ if (t = this.cookieLength(e), t > Te) {
1258
1281
  this.reportError(new $("cookie exceeded the length limit", { bytes: t }));
1259
1282
  return;
1260
1283
  }
@@ -1266,7 +1289,7 @@ var Se = 3800, Ce = "utm_", we = [
1266
1289
  }));
1267
1290
  } else localStorage.setItem(this.cfg.persistenceKey, n);
1268
1291
  } catch (e) {
1269
- this.reportError(A(e, { bytes: t }));
1292
+ this.reportError(j(e, { bytes: t }));
1270
1293
  }
1271
1294
  }
1272
1295
  cookieLength(e) {
@@ -1278,33 +1301,33 @@ var Se = 3800, Ce = "utm_", we = [
1278
1301
  } catch {}
1279
1302
  }
1280
1303
  };
1281
- function q(e) {
1304
+ function J(e) {
1282
1305
  let t = {};
1283
- for (let n of U) {
1306
+ for (let n of W) {
1284
1307
  let r = e.searchParams.get(n);
1285
- r && (t[n] = H(r));
1308
+ r && (t[n] = U(r));
1286
1309
  }
1287
1310
  return t;
1288
1311
  }
1289
- function De() {
1290
- return H(document.referrer) || null;
1312
+ function ke() {
1313
+ return U(document.referrer) || null;
1291
1314
  }
1292
- function Oe(e) {
1293
- let t = W(U, (t) => {
1315
+ function Ae(e) {
1316
+ let t = fe(W, (t) => {
1294
1317
  let n = e.searchParams.get(t);
1295
- return [`initial_${t}`, n ? H(n) : null];
1318
+ return [`initial_${t}`, n ? U(n) : null];
1296
1319
  });
1297
- if (!n(p(t))) return t;
1320
+ if (!n(h(t))) return t;
1298
1321
  }
1299
- function J(e, t) {
1322
+ function je(e, t) {
1300
1323
  return Object.fromEntries(t.flatMap((t) => {
1301
1324
  let n = e.searchParams.get(t);
1302
1325
  return n ? [[t, n]] : [];
1303
1326
  }));
1304
1327
  }
1305
- var ke = new TextEncoder();
1328
+ var Me = new TextEncoder();
1306
1329
  function Y(e) {
1307
- return ke.encode(e).byteLength;
1330
+ return Me.encode(e).byteLength;
1308
1331
  }
1309
1332
  function X(e) {
1310
1333
  return e ? Z(e)[0] ?? null : null;
@@ -1323,12 +1346,12 @@ function Q(e, t, n, r, i) {
1323
1346
  let o = a.join("; ");
1324
1347
  return document.cookie = o, o;
1325
1348
  }
1326
- var $ = class extends j {
1349
+ var $ = class extends M {
1327
1350
  constructor(e, t) {
1328
1351
  super(e, t, { name: "AnalyticsClientError" });
1329
1352
  }
1330
1353
  };
1331
1354
  //#endregion
1332
- export { Ee as AnalyticsClient, $ as AnalyticsClientError, K as AnalyticsIdentity, X as getCookie, Q as setCookie };
1355
+ export { Oe as AnalyticsClient, $ as AnalyticsClientError, q as AnalyticsIdentity, X as getCookie, Q as setCookie };
1333
1356
 
1334
1357
  //# sourceMappingURL=analyticsClient.js.map