@naturalcycles/internal-web-lib 1.3.0 → 1.5.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.
@@ -9,7 +9,7 @@ function t() {
9
9
  return e();
10
10
  }
11
11
  //#endregion
12
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/is.util.js
12
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/is.util.js
13
13
  var n = (e) => !!e;
14
14
  function r(e) {
15
15
  return typeof e == "object" && !!e && !Array.isArray(e) || !1;
@@ -25,7 +25,7 @@ function i(e) {
25
25
  return !1;
26
26
  }
27
27
  //#endregion
28
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/abort.js
28
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/abort.js
29
29
  function a(e) {
30
30
  return e ? o(e) : void 0;
31
31
  }
@@ -54,8 +54,36 @@ function u(e) {
54
54
  });
55
55
  return t.signal;
56
56
  }
57
- var d = new class {
58
- logger = console;
57
+ //#endregion
58
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/log/commonLogger.js
59
+ function d(e, t) {
60
+ let n = (n, [r, i]) => e({
61
+ ...t?.(),
62
+ ...ee(r, i),
63
+ level: n
64
+ });
65
+ return {
66
+ debug: (...e) => n("debug", e),
67
+ log: (...e) => n("log", e),
68
+ warn: (...e) => n("warn", e),
69
+ error: (...e) => n("error", e),
70
+ child: (n) => d(e, () => ({
71
+ ...t?.(),
72
+ ...n
73
+ }))
74
+ };
75
+ }
76
+ function ee(e, t) {
77
+ return typeof e == "string" ? {
78
+ ...t,
79
+ msg: e
80
+ } : e instanceof Error ? { err: e } : e;
81
+ }
82
+ var f = d(({ level: e, msg: t, err: n, ...r }) => {
83
+ let i = [];
84
+ t !== void 0 && i.push(t), n !== void 0 && i.push(n), Object.keys(r).length && i.push(r), console[e](...i);
85
+ }), p = new class {
86
+ logger = f;
59
87
  pendingOps = /* @__PURE__ */ new Set();
60
88
  onErrorHooks = [];
61
89
  runInBackground(e) {
@@ -81,12 +109,15 @@ var d = new class {
81
109
  this.pendingOps.clear(), this.onErrorHooks = [];
82
110
  }
83
111
  fireOnErrorHooks(e) {
84
- this.onErrorHooks.length ? this.onErrorHooks.forEach((t) => t(e)) : this.logger.error("AsyncManager unhandled rejection:", e);
112
+ this.onErrorHooks.length ? this.onErrorHooks.forEach((t) => t(e)) : this.logger.error({
113
+ msg: "AsyncManager unhandled rejection",
114
+ err: e
115
+ });
85
116
  }
86
- }(), f = d.runInBackground.bind(d), ee = (...e) => void 0, p = Object.entries;
117
+ }(), m = p.runInBackground.bind(p), te = (...e) => void 0, h = Object.entries;
87
118
  //#endregion
88
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
89
- function te(e, t, n = {}) {
119
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/object/object.util.js
120
+ function g(e, t, n = {}) {
90
121
  if (n.mutate) {
91
122
  for (let n of Object.keys(e)) t.includes(n) || delete e[n];
92
123
  return e;
@@ -95,7 +126,7 @@ function te(e, t, n = {}) {
95
126
  for (let n of t) n in e && (r[n] = e[n]);
96
127
  return r;
97
128
  }
98
- function m(e, t, n = {}) {
129
+ function _(e, t, n = {}) {
99
130
  if (n.mutate) {
100
131
  for (let n of t) delete e[n];
101
132
  return e;
@@ -105,97 +136,101 @@ function m(e, t, n = {}) {
105
136
  return r;
106
137
  }
107
138
  function ne(e, t = {}) {
108
- return _(e, (e, t) => !!t, t);
139
+ return b(e, (e, t) => !!t, t);
109
140
  }
110
- function h(e, t = {}) {
111
- return _(e, (e, t) => t != null, t);
141
+ function v(e, t = {}) {
142
+ return b(e, (e, t) => t != null, t);
112
143
  }
113
- function g(e, t = {}) {
114
- return _(e, (e, t) => t !== void 0, t);
144
+ function y(e, t = {}) {
145
+ return b(e, (e, t) => t !== void 0, t);
115
146
  }
116
- function _(e, t, n = {}) {
147
+ function b(e, t, n = {}) {
117
148
  if (n.mutate) {
118
- for (let [n, r] of p(e)) t(n, r, e) || delete e[n];
149
+ for (let [n, r] of h(e)) t(n, r, e) || delete e[n];
119
150
  return e;
120
151
  }
121
152
  let r = {};
122
- for (let [n, i] of p(e)) t(n, i, e) && (r[n] = i);
153
+ for (let [n, i] of h(e)) t(n, i, e) && (r[n] = i);
123
154
  return r;
124
155
  }
125
- function v(e, t) {
156
+ function x(e, t) {
126
157
  let n = {};
127
158
  for (let [r, i] of Object.entries(e)) n[t(r, i, e)] = i;
128
159
  return n;
129
160
  }
130
161
  function re(e, t = {}) {
131
- return _(e, (e, t) => !i(t), t);
162
+ return b(e, (e, t) => !i(t), t);
132
163
  }
133
- function y(e, ...t) {
134
- for (let n of t) if (r(n)) for (let t of Object.keys(n)) t !== "__proto__" && t !== "constructor" && t !== "prototype" && (r(n[t]) ? (e[t] ||= {}, y(e[t], n[t])) : e[t] = n[t]);
164
+ function S(e, ...t) {
165
+ for (let n of t) if (r(n)) for (let t of Object.keys(n)) t !== "__proto__" && t !== "constructor" && t !== "prototype" && (r(n[t]) ? (e[t] ||= {}, S(e[t], n[t])) : e[t] = n[t]);
135
166
  return e;
136
167
  }
137
168
  //#endregion
138
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/env.js
139
- function b() {
140
- return !x();
169
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/env.js
170
+ function C() {
171
+ return !ie();
141
172
  }
142
- function x() {
173
+ function ie() {
143
174
  return typeof window < "u" && !!window?.document;
144
175
  }
145
176
  //#endregion
146
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
147
- var S = /^\s*[{["\-\d]/;
148
- function C(e, t) {
149
- if (typeof e == "string" && e && S.test(e)) try {
177
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/json.util.js
178
+ var ae = /^\s*[{["\-\d]/;
179
+ function w(e, t) {
180
+ if (typeof e == "string" && e && ae.test(e)) try {
150
181
  return JSON.parse(e, t);
151
182
  } catch {}
152
183
  return e;
153
184
  }
154
- function ie(e, t) {
185
+ function oe(e, t) {
155
186
  try {
156
187
  return JSON.parse(e, t);
157
188
  } catch {
158
- throw new F({ text: e });
189
+ throw new le({ text: e });
159
190
  }
160
191
  }
161
192
  //#endregion
162
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
163
- function w(e, t, n = "...") {
193
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/string.util.js
194
+ function T(e, t, n = "...") {
164
195
  if (!e || e.length <= t) return e;
165
196
  if (t <= n.length) return n;
166
197
  let r = Math.round((t - n.length) / 2), i = e.length - Math.floor((t - n.length) / 2);
167
198
  return e.slice(0, r) + n + e.slice(i);
168
199
  }
200
+ function E(e, t) {
201
+ let n = e.indexOf(t);
202
+ return e.slice(0, n === -1 ? void 0 : n);
203
+ }
169
204
  //#endregion
170
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
171
- function T(e, t = Error, n) {
205
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/error.util.js
206
+ function D(e, t = Error, n) {
172
207
  let r;
173
- return r = e instanceof t ? e : O(E(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
208
+ return r = e instanceof t ? e : se(O(e), t), n && (r.data ||= {}, Object.assign(r.data, n)), r;
174
209
  }
175
- function E(e, t) {
210
+ function O(e, t) {
176
211
  let n;
177
- return j(e) ? n = D(e) : (e = C(e), n = k(e) ? e.error : A(e) ? e : j(e) ? D(e) : {
212
+ return M(e) ? n = k(e) : (e = w(e), n = A(e) ? e.error : j(e) ? e : M(e) ? k(e) : {
178
213
  name: "Error",
179
214
  message: H(e),
180
215
  data: {}
181
216
  }), Object.assign(n.data, t), n;
182
217
  }
183
- function D(e) {
184
- if (!(e instanceof Error) && A(e)) return e;
218
+ function k(e) {
219
+ if (!(e instanceof Error) && j(e)) return e;
185
220
  let t = {
186
221
  name: e.name,
187
222
  message: e.message,
188
223
  data: { ...e.data }
189
224
  };
190
- return e.stack && (t.stack = e.stack), e.cause && (t.cause = E(e.cause)), t;
225
+ return e.stack && (t.stack = e.stack), e.cause && (t.cause = O(e.cause)), t;
191
226
  }
192
- function O(e, t = Error) {
227
+ function se(e, t = Error) {
193
228
  if (e instanceof t) return e;
194
229
  let { name: n, cause: r } = e, i = new t(e.message, e.data, {
195
230
  name: n,
196
231
  cause: r
197
232
  });
198
- return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof N || (Object.defineProperties(i, {
233
+ return e.stack && Object.defineProperty(i, "stack", { value: e.stack }), i instanceof P || (Object.defineProperties(i, {
199
234
  name: {
200
235
  value: n,
201
236
  configurable: !0,
@@ -219,31 +254,31 @@ function O(e, t = Error) {
219
254
  writable: !0
220
255
  })), i;
221
256
  }
222
- function k(e) {
257
+ function A(e) {
223
258
  try {
224
- return A(e?.error);
259
+ return j(e?.error);
225
260
  } catch {
226
261
  return !1;
227
262
  }
228
263
  }
229
- function A(e) {
264
+ function j(e) {
230
265
  try {
231
266
  return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string" && typeof e.data == "object";
232
267
  } catch {
233
268
  return !1;
234
269
  }
235
270
  }
236
- function j(e) {
271
+ function M(e) {
237
272
  try {
238
273
  return !!e && typeof e == "object" && typeof e.name == "string" && typeof e.message == "string";
239
274
  } catch {
240
275
  return !1;
241
276
  }
242
277
  }
243
- function M(e, t) {
244
- return t ? T(e, void 0, t) : e;
278
+ function N(e, t) {
279
+ return t ? D(e, void 0, t) : e;
245
280
  }
246
- var N = class e extends Error {
281
+ var P = class e extends Error {
247
282
  data;
248
283
  cause;
249
284
  static of(t) {
@@ -254,7 +289,7 @@ var N = class e extends Error {
254
289
  }
255
290
  constructor(e, t = {}, n = {}) {
256
291
  super(e);
257
- let { name: r = b() ? this.constructor.name : "AppError", cause: i } = n;
292
+ let { name: r = C() ? this.constructor.name : "AppError", cause: i } = n;
258
293
  Object.defineProperties(this, {
259
294
  name: {
260
295
  value: r,
@@ -268,7 +303,7 @@ var N = class e extends Error {
268
303
  enumerable: !1
269
304
  }
270
305
  }), i ? Object.defineProperty(this, "cause", {
271
- value: E(i),
306
+ value: O(i),
272
307
  writable: !0,
273
308
  configurable: !0,
274
309
  enumerable: !0
@@ -278,36 +313,36 @@ var N = class e extends Error {
278
313
  writable: !0
279
314
  });
280
315
  }
281
- }, P = class extends N {
316
+ }, F = class extends P {
282
317
  constructor(e, t, n) {
283
318
  t.response && Object.defineProperty(t, "response", { enumerable: !1 }), super(e, t, {
284
319
  ...n,
285
320
  name: "HttpRequestError"
286
321
  });
287
322
  }
288
- }, ae = class extends N {
323
+ }, ce = class extends P {
289
324
  constructor(e, t) {
290
325
  super(e, t, { name: "AssertionError" });
291
326
  }
292
- }, F = class extends N {
327
+ }, le = class extends P {
293
328
  constructor(e) {
294
- let t = ["Failed to parse", e.text && w(e.text, 200)].filter(Boolean).join(": ");
329
+ let t = ["Failed to parse", e.text && T(e.text, 200)].filter(Boolean).join(": ");
295
330
  super(t, e, { name: "JsonParseError" });
296
331
  }
297
- }, I = class extends N {
332
+ }, I = class extends P {
298
333
  constructor(e, t, n) {
299
334
  super(e, t, {
300
335
  ...n,
301
336
  name: "TimeoutError"
302
337
  });
303
338
  }
304
- }, L = class extends N {
339
+ }, L = class extends P {
305
340
  constructor(e) {
306
341
  super(e || "expected error was not thrown", {}, { name: "UnexpectedPassError" });
307
342
  }
308
343
  };
309
344
  //#endregion
310
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
345
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/safeJsonStringify.js
311
346
  function R(e, t, n, r) {
312
347
  try {
313
348
  return JSON.stringify(e, t, n);
@@ -326,7 +361,7 @@ function z(e, t) {
326
361
  };
327
362
  }
328
363
  //#endregion
329
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
364
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/stringify.js
330
365
  var B = typeof globalThis.AggregateError == "function", V = R;
331
366
  function H(e, t = {}) {
332
367
  if (e === void 0) return "undefined";
@@ -334,8 +369,8 @@ function H(e, t = {}) {
334
369
  if (typeof e == "function") return "function";
335
370
  if (typeof e == "symbol") return e.toString();
336
371
  let n;
337
- if (e = C(e), k(e)) return H(e.error, t);
338
- if (e instanceof Error || j(e)) n = U(e, t);
372
+ if (e = w(e), A(e)) return H(e.error, t);
373
+ if (e instanceof Error || M(e)) n = U(e, t);
339
374
  else if (typeof e == "string") n = e.trim() || "empty_string";
340
375
  else if (typeof e == "number") n = String(e);
341
376
  else {
@@ -349,11 +384,11 @@ function H(e, t = {}) {
349
384
  }
350
385
  if (n === void 0) return "undefined";
351
386
  let { maxLen: r = 1e4 } = t;
352
- return r && n.length > r ? w(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
387
+ return r && n.length > r ? T(n, r, `\n... ${Math.ceil(n.length / 1024)} Kb message truncated ...\n`) : n;
353
388
  }
354
389
  function U(e, t) {
355
390
  let { includeErrorCause: n = !0 } = t, r = [e.name, e.message].filter(Boolean).join(": ");
356
- if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && A(e) && Object.keys(e.data).length && (r += "\n" + H(e.data, t)), t.includeErrorStack && e.stack) {
391
+ if (typeof e.code == "string" && (r += `\ncode: ${e.code}`), t.includeErrorData && j(e) && Object.keys(e.data).length && (r += "\n" + H(e.data, t)), t.includeErrorStack && e.stack) {
357
392
  let t = r.split("\n").length;
358
393
  r = [r, ...e.stack.split("\n").slice(t)].join("\n");
359
394
  }
@@ -364,16 +399,16 @@ function U(e, t) {
364
399
  ].join("\n")), e.cause && n && (r = r + "\nCaused by: " + H(e.cause, t)), r;
365
400
  }
366
401
  //#endregion
367
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/assert.js
402
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/error/assert.js
368
403
  function W(e, t = Error) {
369
- if (!(e instanceof t)) throw new ae(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
404
+ if (!(e instanceof t)) throw new ce(`Expected to be instanceof ${t.name}, actual typeof: ${typeof e}`);
370
405
  }
371
- function G(e, t) {
406
+ function ue(e, t) {
372
407
  if (!(e instanceof t)) throw e;
373
408
  }
374
409
  //#endregion
375
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
376
- async function K(e, t) {
410
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pDelay.js
411
+ async function de(e, t) {
377
412
  t?.aborted || await new Promise((n) => {
378
413
  let r = setTimeout(i, e);
379
414
  function i() {
@@ -383,24 +418,24 @@ async function K(e, t) {
383
418
  });
384
419
  }
385
420
  //#endregion
386
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
387
- function q(e, t = Date.now()) {
388
- return J(t - e);
421
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/datetime/time.util.js
422
+ function G(e, t = Date.now()) {
423
+ return K(t - e);
389
424
  }
390
- function J(e) {
425
+ function K(e) {
391
426
  if (e < 1e3) return `${Math.round(e)} ms`;
392
427
  if (e < 1e4) return `${(e / 1e3).toFixed(2)} sec`;
393
428
  let t = Math.floor(e / 1e3) % 60, n = Math.floor(e / 6e4) % 60, r = Math.floor(e / 36e5);
394
429
  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`;
395
430
  }
396
431
  //#endregion
397
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
398
- function oe(e, t, n) {
432
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/number/number.util.js
433
+ function fe(e, t, n) {
399
434
  return e <= t ? t : e >= n ? n : e;
400
435
  }
401
436
  //#endregion
402
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
403
- async function se(e, t) {
437
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/promise/pTimeout.js
438
+ async function pe(e, t) {
404
439
  let n = new AbortController(), { signal: r } = n;
405
440
  if (!t.timeout) return await e(r);
406
441
  let { timeout: i, name: a = e.name || "pTimeout function", onTimeout: o } = t, s = t.fakeError || /* @__PURE__ */ Error("TimeoutError");
@@ -411,12 +446,10 @@ async function se(e, t) {
411
446
  try {
412
447
  c(o(e));
413
448
  } catch (e) {
414
- e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(M(e, t.errorData));
449
+ e.stack = s.stack.replace("Error: TimeoutError", e.name + ": " + e.message), l(N(e, t.errorData));
415
450
  }
416
451
  n.abort(e);
417
- return;
418
- }
419
- l(e), n.abort(e);
452
+ } else l(e), n.abort(e);
420
453
  }, i);
421
454
  try {
422
455
  c(await e(r));
@@ -428,8 +461,8 @@ async function se(e, t) {
428
461
  });
429
462
  }
430
463
  //#endregion
431
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
432
- function ce(e, t) {
464
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/string/url.util.js
465
+ function me(e, t) {
433
466
  if (typeof e != "string") return null;
434
467
  try {
435
468
  return new URL(e, t || void 0);
@@ -438,21 +471,21 @@ function ce(e, t) {
438
471
  }
439
472
  }
440
473
  //#endregion
441
- //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.90.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
442
- var le = [
474
+ //#region ../../node_modules/.pnpm/@naturalcycles+js-lib@15.93.0_undici@8.11.2/node_modules/@naturalcycles/js-lib/dist/http/http.model.js
475
+ var he = [
443
476
  "GET",
444
477
  "POST",
445
478
  "PUT",
446
479
  "PATCH",
447
480
  "DELETE",
448
481
  "HEAD"
449
- ], ue = class e {
482
+ ], ge = class e {
450
483
  static VERSION = 5;
451
- static userAgent = b() ? `fetcher/${this.VERSION}` : void 0;
484
+ static userAgent = C() ? `fetcher/${this.VERSION}` : void 0;
452
485
  constructor(e = {}) {
453
486
  if (typeof globalThis.fetch != "function") throw TypeError("globalThis.fetch is not available");
454
487
  this.cfg = this.normalizeCfg(e);
455
- for (let e of le) {
488
+ for (let e of he) {
456
489
  let t = e.toLowerCase();
457
490
  this[`${t}Void`] = async (t, n) => await this.fetch({
458
491
  url: t,
@@ -526,7 +559,7 @@ var le = [
526
559
  if (n.err) throw n.err;
527
560
  if (n.body.errors) {
528
561
  let e = n.body.errors[0];
529
- throw new P(e.message, {
562
+ throw new F(e.message, {
530
563
  ...t,
531
564
  errors: n.body.errors,
532
565
  response: n.fetchResponse,
@@ -570,11 +603,11 @@ var le = [
570
603
  async expectError(e) {
571
604
  let t = await this.doFetch(e);
572
605
  if (!t.err) throw new L("Fetch was expected to error");
573
- return W(t.err, P), t.err;
606
+ return W(t.err, F), t.err;
574
607
  }
575
608
  async tryFetch(e) {
576
609
  let t = await this.doFetch(e);
577
- return t.err ? (G(t.err, P), [t.err, null]) : [null, t.body];
610
+ return t.err ? (ue(t.err, F), [t.err, null]) : [null, t.body];
578
611
  }
579
612
  async doFetch(t) {
580
613
  let n = 0;
@@ -604,36 +637,36 @@ var le = [
604
637
  " >>",
605
638
  u,
606
639
  e && `try#${e + 1}/${r.retry.count + 1}`
607
- ].filter(Boolean).join(" ")), r.logRequestBody && r.init.body && i.log(r.init.body);
640
+ ].filter(Boolean).join(" ")), r.logRequestBody && r.init.body && i.log({ body: r.init.body });
608
641
  }
609
642
  try {
610
643
  d.fetchResponse = await (r.overrideFetchFn || e.callNativeFetch)(r.fullUrl, r.init, r.fetchFn), d.ok = d.fetchResponse.ok, d.err = void 0;
611
644
  } catch (e) {
612
- d.err = T(e), d.ok = !1, d.fetchResponse = void 0;
645
+ d.err = D(e), d.ok = !1, d.fetchResponse = void 0;
613
646
  }
614
647
  if (d.statusFamily = this.getStatusFamily(d), d.statusCode = d.fetchResponse?.status, d.fetchResponse?.ok) try {
615
- await se(async () => await this.onOkResponse(d), {
648
+ await pe(async () => await this.onOkResponse(d), {
616
649
  timeout: s ?? 0,
617
650
  name: "Fetcher.downloadBody"
618
651
  });
619
652
  } catch (e) {
620
- d.err = T(e), d.ok = !1, await this.onNotOkResponse(d);
653
+ d.err = D(e), d.ok = !1, await this.onNotOkResponse(d);
621
654
  }
622
655
  else await this.onNotOkResponse(d);
623
656
  }
624
657
  if (d.err) {
625
- M(d.err, r.errorData), r.onError?.(d.err);
658
+ N(d.err, r.errorData), r.onError?.(d.err);
626
659
  for (let e of this.cfg.hooks.onError || []) await e(d.err);
627
660
  }
628
661
  for (let e of this.cfg.hooks.afterResponse || []) await e(d);
629
662
  return d.err && await this.detectStaleInit(t, d, n) ? await this.doFetch({
630
663
  ...t,
631
- [Y]: !0
664
+ [q]: !0
632
665
  }) : d;
633
666
  }
634
667
  async detectStaleInit(e, t, n) {
635
668
  let { shouldReinit: r, init: i } = this.cfg.hooks;
636
- return !r || !i || e[Y] || !await r(t) ? !1 : (n === this.initGeneration && this.resetInit(), !0);
669
+ return !r || !i || e[q] || !await r(t) ? !1 : (n === this.initGeneration && this.resetInit(), !0);
637
670
  }
638
671
  async runInitHooks() {
639
672
  for (let e of this.cfg.hooks.init || []) await e(this.cfg);
@@ -643,7 +676,7 @@ var le = [
643
676
  if (n === "json") {
644
677
  if (e.fetchResponse.body) {
645
678
  let n = await e.fetchResponse.text();
646
- n ? (e.body = n, e.body = ie(n, t.jsonReviver)) : e.body = {};
679
+ n ? (e.body = n, e.body = oe(n, t.jsonReviver)) : e.body = {};
647
680
  } else e.body = {};
648
681
  } else if (n === "text") e.body = e.fetchResponse.body ? await e.fetchResponse.text() : "";
649
682
  else if (n === "arrayBuffer") e.body = e.fetchResponse.body ? await e.fetchResponse.arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0);
@@ -658,8 +691,8 @@ var le = [
658
691
  e.fetchResponse.status,
659
692
  e.signature,
660
693
  n && `try#${n + 1}/${t.retry.count + 1}`,
661
- q(e.req.started)
662
- ].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log(e.body);
694
+ G(e.req.started)
695
+ ].filter(Boolean).join(" ")), t.logResponseBody && e.body !== void 0 && r.log({ body: e.body });
663
696
  }
664
697
  }
665
698
  static async callNativeFetch(e, t, n) {
@@ -668,15 +701,15 @@ var le = [
668
701
  async onNotOkResponse(e) {
669
702
  let t;
670
703
  if (!e.body && e.fetchResponse) try {
671
- e.body = C(await e.fetchResponse.text());
704
+ e.body = w(await e.fetchResponse.text());
672
705
  } catch {}
673
- t = e.err ? D(e.err) : e.body ? E(e.body) : {
706
+ t = e.err ? k(e.err) : e.body ? O(e.body) : {
674
707
  name: "Error",
675
708
  message: "Fetch failed",
676
709
  data: {}
677
710
  };
678
711
  let n = e.fetchResponse?.status || 0;
679
- e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new P([e.statusCode, e.signature].filter(Boolean).join(" "), h({
712
+ e.statusFamily === 2 && (e.statusFamily = void 0, e.statusCode = void 0, n = 0), e.err = new F([e.statusCode, e.signature].filter(Boolean).join(" "), v({
680
713
  response: e.fetchResponse,
681
714
  responseStatusCode: n,
682
715
  requestUrl: e.req.fullUrl,
@@ -693,20 +726,19 @@ var le = [
693
726
  this.shouldRetry(e) || (t.retryStopped = !0);
694
727
  for (let t of this.cfg.hooks.beforeRetry || []) await t(e);
695
728
  let { count: n, timeoutMultiplier: r, timeoutMax: i } = e.req.retry;
696
- if (t.retryAttempt >= n && (t.retryStopped = !0), e.err && (!t.retryStopped || e.req.logResponse) && this.cfg.logger.error([
697
- " <<",
698
- e.fetchResponse?.status || 0,
699
- e.signature,
700
- n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
701
- q(e.req.started)
702
- ].filter(Boolean).join(" ") + "\n", H(e.err.cause || e.err)), t.retryStopped) return;
729
+ if (t.retryAttempt >= n && (t.retryStopped = !0), e.err && (!t.retryStopped || e.req.logResponse) && this.cfg.logger.error({
730
+ msg: [
731
+ " <<",
732
+ e.fetchResponse?.status || 0,
733
+ e.signature,
734
+ n && (t.retryAttempt || !t.retryStopped) && `try#${t.retryAttempt + 1}/${n + 1}`,
735
+ G(e.req.started)
736
+ ].filter(Boolean).join(" "),
737
+ err: e.err.cause || e.err
738
+ }), t.retryStopped) return;
703
739
  t.retryAttempt++;
704
740
  let a = this.getRetryTimeout(e);
705
- if (a === null) {
706
- this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0;
707
- return;
708
- }
709
- t.retryTimeout = oe(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${J(a)}`), await K(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0);
741
+ a === null ? (this.cfg.logger.warn(`${e.signature} server-indicated delay exceeds maxRetryAfter, will not retry`), t.retryStopped = !0) : (t.retryTimeout = fe(t.retryTimeout * r, 0, i), e.req.debug && this.cfg.logger.log(` .. ${e.signature} waiting ${K(a)}`), await de(a, e.req.signal), e.req.signal?.aborted && (t.retryStopped = !0));
710
742
  }
711
743
  getRetryTimeout(e) {
712
744
  let t = 0;
@@ -750,9 +782,9 @@ var le = [
750
782
  return this.cfg.logWithSearchParams || (n = n.split("?")[0]), !this.cfg.logWithBaseUrl && t && n.startsWith(t) && (n = n.slice(t.length)), n;
751
783
  }
752
784
  normalizeCfg(t) {
753
- let { debug: n = !1, logger: r = console } = t;
785
+ let { debug: n = !1, logger: r = f } = t;
754
786
  t.baseUrl?.endsWith("/") && (r.warn(`Fetcher: baseUrl should not end with slash: ${t.baseUrl}`), t.baseUrl = t.baseUrl.slice(0, t.baseUrl.length - 1));
755
- let i = y({
787
+ let i = S({
756
788
  baseUrl: "",
757
789
  name: this.getFetcherName(t),
758
790
  inputUrl: "",
@@ -769,12 +801,12 @@ var le = [
769
801
  logRequestBody: n,
770
802
  logResponse: n,
771
803
  logResponseBody: n,
772
- logWithBaseUrl: b(),
804
+ logWithBaseUrl: C(),
773
805
  logWithSearchParams: !0,
774
- retry: { ...pe },
806
+ retry: { ...ye },
775
807
  init: {
776
808
  method: t.method || "GET",
777
- headers: h({
809
+ headers: v({
778
810
  "user-agent": e.userAgent,
779
811
  ...t.headers
780
812
  }),
@@ -786,7 +818,7 @@ var le = [
786
818
  hooks: {},
787
819
  throwHttpErrors: !0,
788
820
  errorData: {}
789
- }, m(t, [
821
+ }, _(t, [
790
822
  "method",
791
823
  "credentials",
792
824
  "headers",
@@ -795,19 +827,19 @@ var le = [
795
827
  "name",
796
828
  "keepalive"
797
829
  ]));
798
- return i.init.headers = v(i.init.headers, (e) => e.toLowerCase()), i;
830
+ return i.init.headers = x(i.init.headers, (e) => e.toLowerCase()), i;
799
831
  }
800
832
  getFetcherName(e) {
801
833
  let { name: t } = e;
802
834
  if (!t && e.baseUrl) {
803
- let n = ce(e.baseUrl);
835
+ let n = me(e.baseUrl);
804
836
  n && (t = n.hostname);
805
837
  }
806
838
  return t;
807
839
  }
808
840
  normalizeOptions(t) {
809
841
  let n = {
810
- ...te(this.cfg, [
842
+ ...g(this.cfg, [
811
843
  "timeoutSeconds",
812
844
  "retryPost",
813
845
  "retry3xx",
@@ -826,7 +858,7 @@ var le = [
826
858
  "overrideFetchFn"
827
859
  ]),
828
860
  started: Date.now(),
829
- ...m(t, [
861
+ ..._(t, [
830
862
  "method",
831
863
  "headers",
832
864
  "credentials"
@@ -835,9 +867,9 @@ var le = [
835
867
  fullUrl: t.url || "",
836
868
  retry: {
837
869
  ...this.cfg.retry,
838
- ...g(t.retry || {})
870
+ ...y(t.retry || {})
839
871
  },
840
- init: y({
872
+ init: S({
841
873
  ...this.cfg.init,
842
874
  headers: {
843
875
  ...this.cfg.init.headers,
@@ -847,15 +879,15 @@ var le = [
847
879
  credentials: t.credentials || this.cfg.init.credentials,
848
880
  redirect: t.redirect || this.cfg.init.redirect || "follow",
849
881
  keepalive: t.keepalive ?? this.cfg.init.keepalive
850
- }, { headers: v(t.headers || {}, (e) => e.toLowerCase()) })
882
+ }, { headers: x(t.headers || {}, (e) => e.toLowerCase()) })
851
883
  };
852
- h(n.init.headers, { mutate: !0 });
884
+ v(n.init.headers, { mutate: !0 });
853
885
  let r = t.baseUrl || this.cfg.baseUrl;
854
886
  if (r) {
855
887
  let { inputUrl: e } = n;
856
888
  e.startsWith("/") && (this.cfg.logger.warn("Fetcher: url should not start with / when baseUrl is specified"), e = e.slice(1)), n.fullUrl = `${r}/${e}`;
857
889
  }
858
- let i = g({
890
+ let i = y({
859
891
  ...this.cfg.searchParams,
860
892
  ...t.searchParams
861
893
  });
@@ -863,13 +895,13 @@ var le = [
863
895
  let e = new URLSearchParams(i).toString();
864
896
  n.fullUrl += (n.fullUrl.includes("?") ? "&" : "?") + e;
865
897
  }
866
- 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 ||= fe[n.responseType], n;
898
+ 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;
867
899
  }
868
900
  };
869
- function de(e = {}) {
870
- return ue.create(e);
901
+ function _e(e = {}) {
902
+ return ge.create(e);
871
903
  }
872
- var Y = Symbol("reinitAttempted"), fe = {
904
+ var q = Symbol("reinitAttempted"), ve = {
873
905
  text: "text/plain",
874
906
  json: "application/json",
875
907
  void: "*/*",
@@ -877,56 +909,87 @@ var Y = Symbol("reinitAttempted"), fe = {
877
909
  arrayBuffer: "application/octet-stream",
878
910
  bytes: "application/octet-stream",
879
911
  blob: "application/octet-stream"
880
- }, pe = {
912
+ }, ye = {
881
913
  count: 2,
882
914
  timeout: 1e3,
883
915
  timeoutMax: 3e4,
884
916
  timeoutMultiplier: 2,
885
917
  maxRetryAfter: 6e5
886
- }, me = {
918
+ }, be = {
887
919
  "https://www.naturalcycles.com/": [
888
- "shop",
889
- "research-library",
890
- "plan-pregnancy",
891
- "postpartum",
892
- "cyclematters/period-calculator",
893
- "cyclematters/search",
894
- "cyclematters/perimenopause-quiz"
920
+ {
921
+ pathIncludes: "shop",
922
+ conversionScrubber: (e) => J(e, "/shop")
923
+ },
924
+ {
925
+ pathIncludes: "research-library",
926
+ conversionScrubber: (e) => J(e, "/research-library")
927
+ },
928
+ { pathIncludes: "plan-pregnancy" },
929
+ { pathIncludes: "postpartum" },
930
+ {
931
+ pathIncludes: "cyclematters/period-calculator",
932
+ conversionScrubber: (e) => E(e, "/period-calculator")
933
+ },
934
+ {
935
+ pathIncludes: "cyclematters/search",
936
+ conversionScrubber: (e) => J(e, "/cyclematters/search")
937
+ },
938
+ {
939
+ pathIncludes: "cyclematters/perimenopause-quiz",
940
+ conversionScrubber: (e) => E(e, "/perimenopause-quiz")
941
+ }
895
942
  ],
896
943
  "https://www.naturalcycles.me/": [],
897
- "https://signup.naturalcycles.com/": ["account", "onboarding"],
944
+ "https://signup.naturalcycles.com/": [{ pathIncludes: "account" }, {
945
+ pathIncludes: "onboarding",
946
+ conversionScrubber: (e) => J(e, "/onboarding")
947
+ }],
898
948
  "https://se.naturalcycles.com/": [],
899
949
  "https://br.naturalcycles.com/": [],
900
950
  "https://uk.naturalcycles.com/": []
901
- }, he = {
951
+ };
952
+ function J(e, t) {
953
+ let n = e.indexOf(t);
954
+ return n === -1 ? null : e.slice(0, n + t.length);
955
+ }
956
+ var xe = {
902
957
  "http://localhost:8000": "https://www.naturalcycles.com/",
903
958
  "http://localhost:8001": "https://www.naturalcycles.me/",
904
959
  "http://localhost:4200": "https://signup.naturalcycles.com/"
905
- }, ge = [
960
+ }, Se = [
906
961
  "https://www.naturalcycles.com/",
907
962
  "https://www.naturalcycles.me/",
908
963
  "https://signup.naturalcycles.com/",
909
964
  "https://se.naturalcycles.com/",
910
965
  "https://br.naturalcycles.com/",
911
966
  "https://uk.naturalcycles.com/"
912
- ], X;
967
+ ], Y;
913
968
  (function(e) {
914
969
  e.flow = "flow", e.code = "code", e.refId = "refId", e.referral = "referral", e.ignoreConfirmation = "ignoreConfirmation", e.ic = "ic", e.measuringDevice = "measuringDevice", e.irclickid = "irclickid", e.fg = "fg", e.sfg = "sfg", e.sq = "sq", e.cbo = "cbo", e.ip = "ip", e.ipv = "ipv", e.appleAuth = "appleAuth", e.googleAuth = "googleAuth", e.od = "od", e.pl = "pl", e.ScCid = "ScCid", e.fbclid = "fbclid", e.ttclid = "ttclid", e.rdt_cid = "rdt_cid", e.epik = "epik", e.adid = "adid", e.wcf = "wcf", e.we = "we", e.werr = "werr", e.wdpm = "wdpm", e.wsc = "wsc", e.ral = "ral";
915
- })(X ||= {});
916
- var _e = [
917
- X.ScCid,
918
- X.irclickid,
919
- X.fbclid,
920
- X.ttclid,
921
- X.rdt_cid,
922
- X.epik
970
+ })(Y ||= {});
971
+ var Ce = [
972
+ Y.ScCid,
973
+ Y.irclickid,
974
+ Y.fbclid,
975
+ Y.ttclid,
976
+ Y.rdt_cid,
977
+ Y.epik
923
978
  ];
924
- X.flow, X.code, X.ignoreConfirmation, X.ic, X.fg, X.sfg, X.sq, X.cbo, X.ip, X.ipv, X.od, X.pl, X.wcf, X.we, X.wdpm, X.wsc, X.ral;
925
- var Z;
979
+ Y.flow, Y.code, Y.ignoreConfirmation, Y.ic, Y.fg, Y.sfg, Y.sq, Y.cbo, Y.ip, Y.ipv, Y.od, Y.pl, Y.wcf, Y.we, Y.wdpm, Y.wsc, Y.ral;
980
+ var X;
926
981
  (function(e) {
927
982
  e[e.OURA = 1] = "OURA", e[e.APPLE_WATCH = 2] = "APPLE_WATCH", e[e.META_LANDING_PAGE = 3] = "META_LANDING_PAGE", e[e.PAYMENT_REDIRECT_FROM_APP = 4] = "PAYMENT_REDIRECT_FROM_APP", e[e.B1 = 5] = "B1", e[e.EMAIL_VERIFICATION_REDIRECT = 6] = "EMAIL_VERIFICATION_REDIRECT", e[e.WHOOP = 7] = "WHOOP";
928
- })(Z ||= {});
929
- var Q = new class {
983
+ })(X ||= {});
984
+ var Z = new class {
985
+ scrubPathname(e, t) {
986
+ let n = Se.find((t) => t === `${e}/`) || xe[e];
987
+ if (!n) return null;
988
+ let r = t;
989
+ for (let e of be[n]) if (r.includes(e.pathIncludes) && (r = e.conversionScrubber?.(r) ?? null, r === null)) return null;
990
+ return r;
991
+ }
992
+ }(), Q = new class {
930
993
  getAllCookies() {
931
994
  let e = {}, t = document.cookie.split("; ");
932
995
  for (let n of t) {
@@ -964,7 +1027,7 @@ var Q = new class {
964
1027
  function $(e) {
965
1028
  if (e) return e.startsWith("fb.") ? e : `fb.1.${Date.now()}.${e}`;
966
1029
  }
967
- function ve(e) {
1030
+ function we(e) {
968
1031
  if (!e) return;
969
1032
  e = e.split("?")[0], e.includes("__DOT__") && (e = e.replaceAll("__DOT__", ".")), e = e.split("%")[0], e = e.split("&")[0];
970
1033
  let t = e.split("."), n = t.lastIndexOf("fb");
@@ -972,13 +1035,13 @@ function ve(e) {
972
1035
  }
973
1036
  //#endregion
974
1037
  //#region src/conversion/conversionClient.ts
975
- var ye = 30, be = 200, xe = 20, Se = class {
1038
+ var Te = 30, Ee = 200, De = 20, Oe = class {
976
1039
  constructor(e) {
977
1040
  this.cfg = {
978
1041
  ...e,
979
1042
  enabled: e.enabled ?? !0,
980
- onError: e.onError ?? ee
981
- }, this.fetcher = de({ baseUrl: e.url });
1043
+ onError: e.onError ?? te
1044
+ }, this.fetcher = _e({ baseUrl: e.url });
982
1045
  }
983
1046
  cfg;
984
1047
  fetcher;
@@ -988,24 +1051,23 @@ var ye = 30, be = 200, xe = 20, Se = class {
988
1051
  this.cfg.enabled && this.tryOrReport(() => this.captureClickIds(), void 0);
989
1052
  }
990
1053
  pageView(e, t = {}) {
991
- if (!this.cfg.enabled) return;
992
- let n = this.getAllowedPathname(e.pathname);
993
- n !== null && f(this.send("p", {
1054
+ if (!this.cfg.enabled || !this.hasMarketingConsent(e)) return;
1055
+ let n = Z.scrubPathname(globalThis.location.origin, e.pathname);
1056
+ n !== null && m(this.send("p", {
994
1057
  ...e,
995
1058
  pathname: n
996
1059
  }, t));
997
1060
  }
998
1061
  purchase(e, t = {}) {
999
- if (!this.cfg.enabled) return;
1000
- let n = this.getAllowedPathname(e.pathname);
1001
- n !== null && f(this.send("purchase", {
1062
+ if (!this.cfg.enabled || !this.hasMarketingConsent(e)) return;
1063
+ let n = Z.scrubPathname(globalThis.location.origin, e.pathname);
1064
+ n !== null && m(this.send("purchase", {
1002
1065
  ...e,
1003
1066
  pathname: n
1004
1067
  }, t));
1005
1068
  }
1006
- getAllowedPathname(e) {
1007
- let { href: t, origin: n } = globalThis.location, r = ge.find((e) => t.startsWith(e)) || he[n];
1008
- return r ? me[r].some((t) => e.includes(t)) ? null : e : null;
1069
+ hasMarketingConsent(e) {
1070
+ return (e.marketingConsent ?? e.marketingCookie) === !0;
1009
1071
  }
1010
1072
  async send(e, t, n) {
1011
1073
  try {
@@ -1022,32 +1084,32 @@ var ye = 30, be = 200, xe = 20, Se = class {
1022
1084
  });
1023
1085
  r.err && this.cfg.onError(r.err);
1024
1086
  } catch (e) {
1025
- this.cfg.onError(T(e));
1087
+ this.cfg.onError(D(e));
1026
1088
  }
1027
1089
  }
1028
1090
  getHeaders(e) {
1029
1091
  let t = String(this.cfg.clientId);
1030
1092
  return e.marketingConsent ? this.tryOrReport(() => (this.cfg.enabled && this.storeClickIds(), re({
1031
1093
  clientId: t,
1032
- fbc: Q.getCookie("_fbc") || $(Q.getCookie(X.fbclid)),
1094
+ fbc: Q.getCookie("_fbc") || $(Q.getCookie(Y.fbclid)),
1033
1095
  fbp: Q.getCookie("_fbp"),
1034
- scCid: Q.getCookie(X.ScCid),
1035
- ttclid: Q.getCookie(X.ttclid),
1036
- rdtCid: Q.getCookie(X.rdt_cid),
1037
- epik: Q.getCookie("_epik") || Q.getCookie(X.epik),
1096
+ scCid: Q.getCookie(Y.ScCid),
1097
+ ttclid: Q.getCookie(Y.ttclid),
1098
+ rdtCid: Q.getCookie(Y.rdt_cid),
1099
+ epik: Q.getCookie("_epik") || Q.getCookie(Y.epik),
1038
1100
  uuid_c1: Q.getCookie("_scid") || Q.getCookie("uuid_c1")
1039
1101
  })), { clientId: t }) : { clientId: t };
1040
1102
  }
1041
1103
  storeClickIds() {
1042
1104
  this.captureClickIds();
1043
- for (let [e, t] of Object.entries(this.pendingClickIds)) Q.setCookie(e, t, ye, this.cfg.cookieDomain);
1105
+ for (let [e, t] of Object.entries(this.pendingClickIds)) Q.setCookie(e, t, Te, this.cfg.cookieDomain);
1044
1106
  this.pendingClickIds = {};
1045
1107
  }
1046
1108
  tryOrReport(e, t) {
1047
1109
  try {
1048
1110
  return e();
1049
1111
  } catch (e) {
1050
- return this.cfg.onError(T(e)), t;
1112
+ return this.cfg.onError(D(e)), t;
1051
1113
  }
1052
1114
  }
1053
1115
  captureClickIds() {
@@ -1055,19 +1117,19 @@ var ye = 30, be = 200, xe = 20, Se = class {
1055
1117
  if (e === this.lastCapturedHref) return;
1056
1118
  this.lastCapturedHref = e;
1057
1119
  let n = new URLSearchParams(t);
1058
- for (let e of _e) {
1120
+ for (let e of Ce) {
1059
1121
  let t = n.get(e) || n.get(e.toLowerCase());
1060
1122
  if (!t) continue;
1061
- let r = e === X.fbclid ? this.toFbc(t) : t.slice(0, be);
1123
+ let r = e === Y.fbclid ? this.toFbc(t) : t.slice(0, Ee);
1062
1124
  r && (this.pendingClickIds[e] = r);
1063
1125
  }
1064
1126
  }
1065
1127
  toFbc(e) {
1066
- let t = ve(e);
1067
- if (!(!t || t.length < xe) && !(this.pendingClickIds[X.fbclid] || Q.getCookie(X.fbclid))?.endsWith(`.${t}`)) return $(t);
1128
+ let t = we(e);
1129
+ if (!(!t || t.length < De) && !(this.pendingClickIds[Y.fbclid] || Q.getCookie(Y.fbclid))?.endsWith(`.${t}`)) return $(t);
1068
1130
  }
1069
1131
  };
1070
1132
  //#endregion
1071
- export { Se as ConversionClient, t as generateConversionEventId };
1133
+ export { Oe as ConversionClient, t as generateConversionEventId };
1072
1134
 
1073
1135
  //# sourceMappingURL=conversionClient.js.map