@montonio/montonio-js 1.1.6 → 1.1.7

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,36 +1,36 @@
1
- var Z;
1
+ var Q;
2
2
  (function(e) {
3
3
  e.MONTONIO_CHECKOUT_NOT_INITIALIZED = "MONTONIO_CHECKOUT_NOT_INITIALIZED", e.VALIDATION_ERROR = "VALIDATION_ERROR", e.CHECKOUT_OPTIONS_VALIDATION_ERROR = "CHECKOUT_OPTIONS_VALIDATION_ERROR", e.PAYMENT_FAILED = "PAYMENT_FAILED", e.FAILED_TO_FETCH_RETURN_URL = "FAILED_TO_FETCH_RETURN_URL";
4
- })(Z || (Z = {}));
5
- class Mt extends Error {
4
+ })(Q || (Q = {}));
5
+ class $t extends Error {
6
6
  constructor(t = "MontonioCheckout not initialized. Please call the .initialize() method of the MontonioCheckout class first.") {
7
- super(t), this.name = Z.MONTONIO_CHECKOUT_NOT_INITIALIZED;
7
+ super(t), this.name = Q.MONTONIO_CHECKOUT_NOT_INITIALIZED;
8
8
  }
9
9
  }
10
- class $t extends Error {
10
+ class Ft extends Error {
11
11
  constructor(t = "Validation failed. Check payment details and try again.") {
12
- super(t), this.displayedInPaymentComponent = !0, this.name = Z.VALIDATION_ERROR;
12
+ super(t), this.displayedInPaymentComponent = !0, this.name = Q.VALIDATION_ERROR;
13
13
  }
14
14
  }
15
- class dr extends Error {
15
+ class fr extends Error {
16
16
  constructor(t) {
17
- super(`Payment failed: ${t.errorCode}`), this.displayedInPaymentComponent = !0, this.name = Z.PAYMENT_FAILED, this.paymentFailedMessageData = t;
17
+ super(`Payment failed: ${t.errorCode}`), this.displayedInPaymentComponent = !0, this.name = Q.PAYMENT_FAILED, this.paymentFailedMessageData = t;
18
18
  }
19
19
  }
20
- class fr extends Error {
20
+ class hr extends Error {
21
21
  constructor({ attempts: t }) {
22
22
  super(`Payment was successful but we failed to fetch the return-url from our servers after ${t} retries.
23
- The customer should not try again! We will inform you about the payment being paid via webhook.`), this.name = Z.FAILED_TO_FETCH_RETURN_URL;
23
+ The customer should not try again! We will inform you about the payment being paid via webhook.`), this.name = Q.FAILED_TO_FETCH_RETURN_URL;
24
24
  }
25
25
  }
26
- class ht extends Error {
26
+ class pt extends Error {
27
27
  constructor(t) {
28
28
  const n = t.map((r, o) => ` ${o + 1}. ${r}`).join(`
29
29
  `);
30
30
  super(`Invalid CheckoutOptions provided:
31
31
  ${n}
32
32
 
33
- Please fix these validation errors and try again.`), this.name = Z.CHECKOUT_OPTIONS_VALIDATION_ERROR;
33
+ Please fix these validation errors and try again.`), this.name = Q.CHECKOUT_OPTIONS_VALIDATION_ERROR;
34
34
  }
35
35
  }
36
36
  var _;
@@ -62,12 +62,12 @@ class q {
62
62
  return r[n];
63
63
  }
64
64
  }
65
- class se {
65
+ class ie {
66
66
  constructor() {
67
67
  this.timeout = 3e4;
68
68
  }
69
69
  static get instance() {
70
- return se._instance || (se._instance = new se()), se._instance;
70
+ return ie._instance || (ie._instance = new ie()), ie._instance;
71
71
  }
72
72
  async get(t) {
73
73
  return this.request(t, "GET");
@@ -90,7 +90,7 @@ class se {
90
90
  try {
91
91
  const i = {
92
92
  Accept: "application/json",
93
- "X-Montonio-Js-Version": "1.1.6"
93
+ "X-Montonio-Js-Version": "1.1.7"
94
94
  };
95
95
  r && (i["Content-Type"] = "application/json");
96
96
  const c = {
@@ -112,124 +112,22 @@ class se {
112
112
  }
113
113
  }
114
114
  }
115
- class tn {
116
- constructor() {
117
- this.subscriptions = /* @__PURE__ */ new Map(), this.setupMessageListener();
118
- }
119
- /**
120
- * Subscribe to messages of a specific type from a specific source iframe.
121
- * @param messageType The message type to listen for.
122
- * @param handler Handler function to call when the message is received.
123
- * @param iframe Iframe object to listen to.
124
- * @returns Subscription ID that can be used to unsubscribe.
125
- */
126
- subscribe(t, n, r) {
127
- if (this.subscriptions.has(t))
128
- throw new Error(`Subscription for '${t}' already exists`);
129
- this.subscriptions.set(t, {
130
- handler: n,
131
- sources: [r]
132
- });
133
- }
134
- /**
135
- * Add an iframe to an existing subscription
136
- */
137
- addIframeToSubscription(t, n) {
138
- const r = this.subscriptions.get(t);
139
- if (!r)
140
- throw new Error(`Subscription for '${t}' not found`);
141
- r.sources.includes(n) || r.sources.push(n);
142
- }
143
- /**
144
- * Wait for a specific message type from a specific source Iframe
145
- * @param messageType The message type to wait for
146
- * @param iframe Iframe object to listen to
147
- * @param timeout Timeout in milliseconds
148
- * @returns Promise that resolves when the message is received or rejects on timeout
149
- */
150
- waitForMessage(t, n, r = 3e4) {
151
- return new Promise((o, s) => {
152
- const i = setTimeout(() => {
153
- this.removeIframeFromSubscription(t, n), s(new Error(`Message ${t} timeout after ${r}ms`));
154
- }, r);
155
- this.subscribe(t, (c) => {
156
- clearTimeout(i), this.removeIframeFromSubscription(t, n), o(c);
157
- }, n);
158
- });
159
- }
160
- /**
161
- * Post a message to a specific iframe window
162
- */
163
- postMessage(t, n, r = "*") {
164
- t.getContentWindow().postMessage(n, r);
165
- }
166
- /**
167
- * Clear all subscriptions
168
- */
169
- clearAllSubscriptions() {
170
- this.subscriptions.clear();
171
- }
172
- /**
173
- * Clear all subscriptions except the ones in the except array
174
- */
175
- clearSubscriptionsExcept(t) {
176
- for (const n of [...this.subscriptions.keys()])
177
- t.includes(n) || this.subscriptions.delete(n);
178
- }
179
- /**
180
- * Remove an iframe from a subscription's sources
181
- */
182
- removeIframeFromSubscription(t, n) {
183
- const r = this.subscriptions.get(t);
184
- if (!r)
185
- throw new Error(`Subscription for '${t}' not found`);
186
- r.sources = r.sources.filter((o) => o !== n), r.sources.length === 0 && this.subscriptions.delete(t);
187
- }
188
- /**
189
- * Set up the message listener for capturing all window messages
190
- */
191
- setupMessageListener() {
192
- window.addEventListener("message", (t) => {
193
- try {
194
- if (!t.data || typeof t.data != "object" || !t.data.name)
195
- return;
196
- const n = t.data;
197
- this.subscriptions.forEach((r, o) => {
198
- if (!(o !== n.name || !r.sources.some((i) => {
199
- try {
200
- return i.getContentWindow() === t.source;
201
- } catch (c) {
202
- return console.error("MONTONIO-JS: MessagingService: Failed to resolve contentWindow for source:", c), !1;
203
- }
204
- })))
205
- try {
206
- r.handler(n);
207
- } catch (i) {
208
- console.error("Error in message handler:", i);
209
- }
210
- });
211
- } catch (n) {
212
- console.error("Error processing iframe message:", n);
213
- }
214
- });
215
- }
216
- }
217
115
  const T = {
218
116
  log: "log",
219
117
  debug: "debug",
220
118
  info: "info",
221
119
  warn: "warn",
222
120
  error: "error"
223
- }, N = console, j = {};
121
+ }, k = console, j = {};
224
122
  Object.keys(T).forEach((e) => {
225
- j[e] = N[e];
123
+ j[e] = k[e];
226
124
  });
227
- const be = "Datadog Browser SDK:", y = {
228
- debug: j.debug.bind(N, be),
229
- log: j.log.bind(N, be),
230
- info: j.info.bind(N, be),
231
- warn: j.warn.bind(N, be),
232
- error: j.error.bind(N, be)
125
+ const ye = "Datadog Browser SDK:", y = {
126
+ debug: j.debug.bind(k, ye),
127
+ log: j.log.bind(k, ye),
128
+ info: j.info.bind(k, ye),
129
+ warn: j.warn.bind(k, ye),
130
+ error: j.error.bind(k, ye)
233
131
  }, St = "https://docs.datadoghq.com", pr = `${St}/real_user_monitoring/browser/troubleshooting`, _t = "More details:";
234
132
  function nn(e, t) {
235
133
  return (...n) => {
@@ -240,16 +138,16 @@ function nn(e, t) {
240
138
  }
241
139
  };
242
140
  }
243
- function Se(e) {
141
+ function _e(e) {
244
142
  return e !== 0 && Math.random() * 100 <= e;
245
143
  }
246
- function hr(e) {
247
- return mr(e) && e >= 0 && e <= 100;
248
- }
249
144
  function mr(e) {
145
+ return gr(e) && e >= 0 && e <= 100;
146
+ }
147
+ function gr(e) {
250
148
  return typeof e == "number";
251
149
  }
252
- const me = 1e3, B = 60 * me, rn = 60 * B, gr = 24 * rn, Er = 365 * gr;
150
+ const ge = 1e3, B = 60 * ge, rn = 60 * B, Er = 24 * rn, br = 365 * Er;
253
151
  function $() {
254
152
  return (/* @__PURE__ */ new Date()).getTime();
255
153
  }
@@ -259,19 +157,19 @@ function P() {
259
157
  function $e() {
260
158
  return performance.now();
261
159
  }
262
- function k() {
160
+ function N() {
263
161
  return { relative: $e(), timeStamp: P() };
264
162
  }
265
- function br() {
163
+ function yr() {
266
164
  return { relative: 0, timeStamp: sn() };
267
165
  }
268
166
  function on(e, t) {
269
167
  return t - e;
270
168
  }
271
- function yr(e, t) {
169
+ function Sr(e, t) {
272
170
  return e + t;
273
171
  }
274
- function Sr(e) {
172
+ function _r(e) {
275
173
  return e - sn();
276
174
  }
277
175
  let Qe;
@@ -279,11 +177,11 @@ function sn() {
279
177
  var e, t;
280
178
  return Qe === void 0 && (Qe = (t = (e = performance.timing) === null || e === void 0 ? void 0 : e.navigationStart) !== null && t !== void 0 ? t : performance.timeOrigin), Qe;
281
179
  }
282
- const ue = 1024, cn = 1024 * ue, _r = /[^\u0000-\u007F]/;
180
+ const le = 1024, cn = 1024 * le, Cr = /[^\u0000-\u007F]/;
283
181
  function an(e) {
284
- return _r.test(e) ? window.TextEncoder !== void 0 ? new TextEncoder().encode(e).length : new Blob([e]).size : e.length;
182
+ return Cr.test(e) ? window.TextEncoder !== void 0 ? new TextEncoder().encode(e).length : new Blob([e]).size : e.length;
285
183
  }
286
- function Or(e) {
184
+ function Tr(e) {
287
185
  return { ...e };
288
186
  }
289
187
  function un(e, t) {
@@ -304,20 +202,20 @@ function x() {
304
202
  let e = _dd_temp_;
305
203
  return delete Object.prototype._dd_temp_, typeof e != "object" && (typeof self == "object" ? e = self : typeof window == "object" ? e = window : e = {}), e;
306
204
  }
307
- const I = x(), Q = "WorkerGlobalScope" in I;
308
- function le(e, t) {
205
+ const I = x(), ee = "WorkerGlobalScope" in I;
206
+ function de(e, t) {
309
207
  const n = x();
310
208
  let r;
311
209
  return n.Zone && typeof n.Zone.__symbol__ == "function" && (r = e[n.Zone.__symbol__(t)]), r || (r = e[t]), r;
312
210
  }
313
211
  let Fe, ln = !1;
314
- function Tr(e) {
212
+ function vr(e) {
315
213
  Fe = e;
316
214
  }
317
- function Cr(e) {
215
+ function Or(e) {
318
216
  ln = e;
319
217
  }
320
- function vr(e, t, n) {
218
+ function wr(e, t, n) {
321
219
  const r = n.value;
322
220
  n.value = function(...o) {
323
221
  return (Fe ? b(r) : r).apply(this, o);
@@ -325,17 +223,17 @@ function vr(e, t, n) {
325
223
  }
326
224
  function b(e) {
327
225
  return function() {
328
- return de(e, this, arguments);
226
+ return fe(e, this, arguments);
329
227
  };
330
228
  }
331
- function de(e, t, n) {
229
+ function fe(e, t, n) {
332
230
  try {
333
231
  return e.apply(t, n);
334
232
  } catch (r) {
335
- Ot(r);
233
+ Ct(r);
336
234
  }
337
235
  }
338
- function Ot(e) {
236
+ function Ct(e) {
339
237
  if (mt(e), Fe)
340
238
  try {
341
239
  Fe(e);
@@ -346,19 +244,19 @@ function Ot(e) {
346
244
  function mt(...e) {
347
245
  ln && y.error("[MONITOR]", ...e);
348
246
  }
349
- function ve(e, t) {
350
- return le(x(), "setTimeout")(b(e), t);
247
+ function we(e, t) {
248
+ return de(x(), "setTimeout")(b(e), t);
351
249
  }
352
250
  function dn(e) {
353
- le(x(), "clearTimeout")(e);
251
+ de(x(), "clearTimeout")(e);
354
252
  }
355
253
  function Tt(e, t) {
356
- return le(x(), "setInterval")(b(e), t);
254
+ return de(x(), "setInterval")(b(e), t);
357
255
  }
358
256
  function fn(e) {
359
- le(x(), "clearInterval")(e);
257
+ de(x(), "clearInterval")(e);
360
258
  }
361
- function Ft(e) {
259
+ function Ht(e) {
362
260
  var t;
363
261
  const n = (t = I.queueMicrotask) === null || t === void 0 ? void 0 : t.bind(I);
364
262
  typeof n == "function" ? n(b(e)) : Promise.resolve().then(b(e));
@@ -382,13 +280,13 @@ class S {
382
280
  this.observers = this.observers.filter((n) => t !== n), !this.observers.length && this.onLastUnsubscribe && this.onLastUnsubscribe();
383
281
  }
384
282
  }
385
- function pn(...e) {
283
+ function hn(...e) {
386
284
  return new S((t) => {
387
285
  const n = e.map((r) => r.subscribe((o) => t.notify(o)));
388
286
  return () => n.forEach((r) => r.unsubscribe());
389
287
  });
390
288
  }
391
- class hn extends S {
289
+ class pn extends S {
392
290
  constructor(t) {
393
291
  super(), this.maxBufferSize = t, this.buffer = [];
394
292
  }
@@ -402,7 +300,7 @@ class hn extends S {
402
300
  n = !0, this.removeObserver(t);
403
301
  }
404
302
  };
405
- return Ft(() => {
303
+ return Ht(() => {
406
304
  for (const o of this.buffer) {
407
305
  if (n)
408
306
  return;
@@ -418,12 +316,12 @@ class hn extends S {
418
316
  * memory impact.
419
317
  */
420
318
  unbuffer() {
421
- Ft(() => {
319
+ Ht(() => {
422
320
  this.maxBufferSize = this.buffer.length = 0;
423
321
  });
424
322
  }
425
323
  }
426
- function wr(e, t, n) {
324
+ function Ar(e, t, n) {
427
325
  let r = !1, o, s;
428
326
  return {
429
327
  throttled: (...i) => {
@@ -431,7 +329,7 @@ function wr(e, t, n) {
431
329
  o = i;
432
330
  return;
433
331
  }
434
- e(...i), r = !0, s = ve(() => {
332
+ e(...i), r = !0, s = we(() => {
435
333
  o && e(...o), r = !1, o = void 0;
436
334
  }, t);
437
335
  },
@@ -449,7 +347,7 @@ function G(e) {
449
347
  ) : `10000000-1000-4000-8000-${1e11}`.replace(/[018]/g, G);
450
348
  }
451
349
  const He = /([\w-]+)\s*=\s*([^;]+)/g;
452
- function Ar(e, t) {
350
+ function Rr(e, t) {
453
351
  for (He.lastIndex = 0; ; ) {
454
352
  const n = He.exec(e);
455
353
  if (n) {
@@ -459,7 +357,7 @@ function Ar(e, t) {
459
357
  break;
460
358
  }
461
359
  }
462
- function Rr(e) {
360
+ function Ir(e) {
463
361
  const t = /* @__PURE__ */ new Map();
464
362
  for (He.lastIndex = 0; ; ) {
465
363
  const n = He.exec(e);
@@ -470,16 +368,16 @@ function Rr(e) {
470
368
  }
471
369
  return t;
472
370
  }
473
- function Ir(e, t, n = "") {
371
+ function xr(e, t, n = "") {
474
372
  const r = e.charCodeAt(t - 1), s = r >= 55296 && r <= 56319 ? t + 1 : t;
475
373
  return e.length <= s ? e : `${e.slice(0, s)}${n}`;
476
374
  }
477
- function xr() {
478
- return Lr() === 0;
479
- }
480
- let Re;
481
375
  function Lr() {
482
- return Re != null ? Re : Re = Nr();
376
+ return kr() === 0;
377
+ }
378
+ let Ie;
379
+ function kr() {
380
+ return Ie != null ? Ie : Ie = Nr();
483
381
  }
484
382
  function Nr(e = window) {
485
383
  var t;
@@ -491,11 +389,11 @@ function Nr(e = window) {
491
389
  ((t = e.navigator.vendor) === null || t === void 0 ? void 0 : t.indexOf("Apple")) === 0 || /safari/i.test(n) && !/chrome|android/i.test(n) ? 1 : 2
492
390
  );
493
391
  }
494
- function Ct(e) {
392
+ function vt(e) {
495
393
  return mn(e, location.href).href;
496
394
  }
497
395
  function mn(e, t) {
498
- const { URL: n } = kr();
396
+ const { URL: n } = Ur();
499
397
  try {
500
398
  return t !== void 0 ? new n(e, t) : new n(e);
501
399
  } catch (r) {
@@ -503,7 +401,7 @@ function mn(e, t) {
503
401
  }
504
402
  }
505
403
  let et;
506
- function kr() {
404
+ function Ur() {
507
405
  if (!et) {
508
406
  let e, t;
509
407
  try {
@@ -523,23 +421,23 @@ function We(e, t, n = 0, r) {
523
421
  const s = `expires=${o.toUTCString()}`, i = r && r.crossSite ? "none" : "strict", c = r && r.domain ? `;domain=${r.domain}` : "", a = r && r.secure ? ";secure" : "", u = r && r.partitioned ? ";partitioned" : "";
524
422
  document.cookie = `${e}=${t};${s};path=/;samesite=${i}${c}${a}${u}`;
525
423
  }
526
- function vt(e) {
527
- return Ar(document.cookie, e);
424
+ function Ot(e) {
425
+ return Rr(document.cookie, e);
528
426
  }
529
427
  let tt;
530
428
  function W(e) {
531
- return tt || (tt = Rr(document.cookie)), tt.get(e);
429
+ return tt || (tt = Ir(document.cookie)), tt.get(e);
532
430
  }
533
431
  function gn(e, t) {
534
432
  We(e, "", 0, t);
535
433
  }
536
- function Ur(e) {
434
+ function Pr(e) {
537
435
  if (document.cookie === void 0 || document.cookie === null)
538
436
  return !1;
539
437
  try {
540
438
  const t = `dd_cookie_test_${G()}`, n = "test";
541
439
  We(t, n, B, e);
542
- const r = vt(t) === n;
440
+ const r = Ot(t) === n;
543
441
  return gn(t, e), r;
544
442
  } catch (t) {
545
443
  return y.error(t), !1;
@@ -548,25 +446,25 @@ function Ur(e) {
548
446
  let nt;
549
447
  function En(e = location.hostname, t = document.referrer) {
550
448
  if (nt === void 0) {
551
- const n = Pr(e, t);
449
+ const n = Dr(e, t);
552
450
  if (n) {
553
451
  const r = `dd_site_test_${G()}`, o = "test", s = n.split(".");
554
452
  let i = s.pop();
555
- for (; s.length && !vt(r); )
556
- i = `${s.pop()}.${i}`, We(r, o, me, { domain: i });
453
+ for (; s.length && !Ot(r); )
454
+ i = `${s.pop()}.${i}`, We(r, o, ge, { domain: i });
557
455
  gn(r, { domain: i }), nt = i;
558
456
  }
559
457
  }
560
458
  return nt;
561
459
  }
562
- function Pr(e, t) {
460
+ function Dr(e, t) {
563
461
  try {
564
462
  return e || mn(t).hostname;
565
463
  } catch (n) {
566
464
  }
567
465
  }
568
466
  const H = "_dd_s";
569
- function Dr(e, t) {
467
+ function Mr(e, t) {
570
468
  for (let n = e.length - 1; n >= 0; n -= 1) {
571
469
  const r = e[n];
572
470
  if (t(r, n, e))
@@ -576,44 +474,44 @@ function Dr(e, t) {
576
474
  function Be(e) {
577
475
  return Object.values(e);
578
476
  }
579
- function Mr(e) {
477
+ function $r(e) {
580
478
  return Object.entries(e);
581
479
  }
582
- const wt = 4 * rn, bn = 15 * B, $r = Er, yn = "0", Oe = {
480
+ const wt = 4 * rn, bn = 15 * B, Fr = br, yn = "0", Te = {
583
481
  COOKIE: "cookie",
584
482
  LOCAL_STORAGE: "local-storage"
585
483
  }, Sn = /^([a-zA-Z]+)=([a-z0-9-]+)$/, At = "&";
586
- function Fr(e) {
484
+ function Hr(e) {
587
485
  return !!e && (e.indexOf(At) !== -1 || Sn.test(e));
588
486
  }
589
- const Hr = "1";
590
- function z(e, t) {
487
+ const Br = "1";
488
+ function V(e, t) {
591
489
  const n = {
592
- isExpired: Hr
490
+ isExpired: Br
593
491
  };
594
492
  return t.trackAnonymousUser && (e != null && e.anonymousId ? n.anonymousId = e == null ? void 0 : e.anonymousId : n.anonymousId = G()), n;
595
493
  }
596
- function ke(e) {
494
+ function Ue(e) {
597
495
  return qe(e);
598
496
  }
599
497
  function _n(e) {
600
- return !ke(e);
498
+ return !Ue(e);
601
499
  }
602
- function _e(e) {
603
- return e.isExpired !== void 0 || !Br(e);
500
+ function Ce(e) {
501
+ return e.isExpired !== void 0 || !Gr(e);
604
502
  }
605
- function Br(e) {
503
+ function Gr(e) {
606
504
  return (e.created === void 0 || $() - Number(e.created) < wt) && (e.expire === void 0 || $() < Number(e.expire));
607
505
  }
608
- function On(e) {
506
+ function Cn(e) {
609
507
  e.expire = String($() + bn);
610
508
  }
611
509
  function Tn(e) {
612
- return Mr(e).map(([t, n]) => t === "anonymousId" ? `aid=${n}` : `${t}=${n}`).join(At);
510
+ return $r(e).map(([t, n]) => t === "anonymousId" ? `aid=${n}` : `${t}=${n}`).join(At);
613
511
  }
614
512
  function Rt(e) {
615
513
  const t = {};
616
- return Fr(e) && e.split(At).forEach((n) => {
514
+ return Hr(e) && e.split(At).forEach((n) => {
617
515
  const r = Sn.exec(n);
618
516
  if (r !== null) {
619
517
  const [, o, s] = r;
@@ -621,38 +519,38 @@ function Rt(e) {
621
519
  }
622
520
  }), t;
623
521
  }
624
- const Gr = "_dd", Kr = "_dd_r", jr = "_dd_l", zr = "rum", Vr = "logs";
625
- function Yr(e) {
522
+ const Kr = "_dd", jr = "_dd_r", Vr = "_dd_l", Yr = "rum", zr = "logs";
523
+ function qr(e) {
626
524
  if (!W(H)) {
627
- const n = W(Gr), r = W(Kr), o = W(jr), s = {};
628
- n && (s.id = n), o && /^[01]$/.test(o) && (s[Vr] = o), r && /^[012]$/.test(r) && (s[zr] = r), _n(s) && (On(s), e.persistSession(s));
525
+ const n = W(Kr), r = W(jr), o = W(Vr), s = {};
526
+ n && (s.id = n), o && /^[01]$/.test(o) && (s[zr] = o), r && /^[012]$/.test(r) && (s[Yr] = r), _n(s) && (Cn(s), e.persistSession(s));
629
527
  }
630
528
  }
631
- function Ht(e) {
632
- const t = Wr(e);
633
- return t && Ur(t) ? { type: Oe.COOKIE, cookieOptions: t } : void 0;
529
+ function Bt(e) {
530
+ const t = Xr(e);
531
+ return t && Pr(t) ? { type: Te.COOKIE, cookieOptions: t } : void 0;
634
532
  }
635
- function qr(e, t) {
533
+ function Wr(e, t) {
636
534
  const n = {
637
535
  /**
638
536
  * Lock strategy allows mitigating issues due to concurrent access to cookie.
639
537
  * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
640
538
  */
641
- isLockEnabled: xr(),
642
- persistSession: (r) => Bt(t, e, r, bn),
643
- retrieveSession: Cn,
644
- expireSession: (r) => Bt(t, e, z(r, e), wt)
539
+ isLockEnabled: Lr(),
540
+ persistSession: (r) => Gt(t, e, r, bn),
541
+ retrieveSession: vn,
542
+ expireSession: (r) => Gt(t, e, V(r, e), wt)
645
543
  };
646
- return Yr(n), n;
544
+ return qr(n), n;
647
545
  }
648
- function Bt(e, t, n, r) {
649
- We(H, Tn(n), t.trackAnonymousUser ? $r : r, e);
546
+ function Gt(e, t, n, r) {
547
+ We(H, Tn(n), t.trackAnonymousUser ? Fr : r, e);
650
548
  }
651
- function Cn() {
652
- const e = vt(H);
549
+ function vn() {
550
+ const e = Ot(H);
653
551
  return Rt(e);
654
552
  }
655
- function Wr(e) {
553
+ function Xr(e) {
656
554
  const t = {};
657
555
  if (t.secure = !!e.useSecureSessionCookie || !!e.usePartitionedCrossSiteSessionCookie, t.crossSite = !!e.usePartitionedCrossSiteSessionCookie, t.partitioned = !!e.usePartitionedCrossSiteSessionCookie, e.trackSessionAcrossSubdomains) {
658
556
  const n = En();
@@ -663,150 +561,150 @@ function Wr(e) {
663
561
  return t;
664
562
  }
665
563
  const Jr = "_dd_test_";
666
- function Gt() {
564
+ function Kt() {
667
565
  try {
668
566
  const e = G(), t = `${Jr}${e}`;
669
567
  localStorage.setItem(t, e);
670
568
  const n = localStorage.getItem(t);
671
- return localStorage.removeItem(t), e === n ? { type: Oe.LOCAL_STORAGE } : void 0;
569
+ return localStorage.removeItem(t), e === n ? { type: Te.LOCAL_STORAGE } : void 0;
672
570
  } catch (e) {
673
571
  return;
674
572
  }
675
573
  }
676
- function Xr(e) {
574
+ function Zr(e) {
677
575
  return {
678
576
  isLockEnabled: !1,
679
- persistSession: vn,
680
- retrieveSession: Zr,
681
- expireSession: (t) => Qr(t, e)
577
+ persistSession: On,
578
+ retrieveSession: Qr,
579
+ expireSession: (t) => eo(t, e)
682
580
  };
683
581
  }
684
- function vn(e) {
582
+ function On(e) {
685
583
  localStorage.setItem(H, Tn(e));
686
584
  }
687
- function Zr() {
585
+ function Qr() {
688
586
  const e = localStorage.getItem(H);
689
587
  return Rt(e);
690
588
  }
691
- function Qr(e, t) {
692
- vn(z(e, t));
589
+ function eo(e, t) {
590
+ On(V(e, t));
693
591
  }
694
- const eo = 10, to = 100, no = me, wn = "--", An = [];
695
- let Ue;
696
- function V(e, t, n = 0) {
592
+ const to = 10, no = 100, ro = ge, wn = "--", An = [];
593
+ let Pe;
594
+ function Y(e, t, n = 0) {
697
595
  var r;
698
596
  const { isLockEnabled: o, persistSession: s, expireSession: i } = t, c = (f) => s({ ...f, lock: u }), a = () => {
699
- const { lock: f, ...p } = t.retrieveSession();
597
+ const { lock: f, ...h } = t.retrieveSession();
700
598
  return {
701
- session: p,
702
- lock: f && !oo(f) ? f : void 0
599
+ session: h,
600
+ lock: f && !so(f) ? f : void 0
703
601
  };
704
602
  };
705
- if (Ue || (Ue = e), e !== Ue) {
603
+ if (Pe || (Pe = e), e !== Pe) {
706
604
  An.push(e);
707
605
  return;
708
606
  }
709
- if (o && n >= to) {
710
- Kt(t);
607
+ if (o && n >= no) {
608
+ jt(t);
711
609
  return;
712
610
  }
713
611
  let u, d = a();
714
612
  if (o) {
715
613
  if (d.lock) {
716
- Ie(e, t, n);
614
+ xe(e, t, n);
717
615
  return;
718
616
  }
719
- if (u = ro(), c(d.session), d = a(), d.lock !== u) {
720
- Ie(e, t, n);
617
+ if (u = oo(), c(d.session), d = a(), d.lock !== u) {
618
+ xe(e, t, n);
721
619
  return;
722
620
  }
723
621
  }
724
622
  let l = e.process(d.session);
725
623
  if (o && (d = a(), d.lock !== u)) {
726
- Ie(e, t, n);
624
+ xe(e, t, n);
727
625
  return;
728
626
  }
729
- if (l && (_e(l) ? i(l) : (On(l), o ? c(l) : s(l))), o && !(l && _e(l))) {
627
+ if (l && (Ce(l) ? i(l) : (Cn(l), o ? c(l) : s(l))), o && !(l && Ce(l))) {
730
628
  if (d = a(), d.lock !== u) {
731
- Ie(e, t, n);
629
+ xe(e, t, n);
732
630
  return;
733
631
  }
734
632
  s(d.session), l = d.session;
735
633
  }
736
- (r = e.after) === null || r === void 0 || r.call(e, l || d.session), Kt(t);
634
+ (r = e.after) === null || r === void 0 || r.call(e, l || d.session), jt(t);
737
635
  }
738
- function Ie(e, t, n) {
739
- ve(() => {
740
- V(e, t, n + 1);
741
- }, eo);
636
+ function xe(e, t, n) {
637
+ we(() => {
638
+ Y(e, t, n + 1);
639
+ }, to);
742
640
  }
743
- function Kt(e) {
744
- Ue = void 0;
641
+ function jt(e) {
642
+ Pe = void 0;
745
643
  const t = An.shift();
746
- t && V(t, e);
644
+ t && Y(t, e);
747
645
  }
748
- function ro() {
646
+ function oo() {
749
647
  return G() + wn + P();
750
648
  }
751
- function oo(e) {
649
+ function so(e) {
752
650
  const [, t] = e.split(wn);
753
- return !t || on(Number(t), P()) > no;
651
+ return !t || on(Number(t), P()) > ro;
754
652
  }
755
- const jt = me;
756
- function so(e) {
653
+ const Vt = ge;
654
+ function io(e) {
757
655
  switch (e.sessionPersistence) {
758
- case Oe.COOKIE:
759
- return Ht(e);
760
- case Oe.LOCAL_STORAGE:
761
- return Gt();
656
+ case Te.COOKIE:
657
+ return Bt(e);
658
+ case Te.LOCAL_STORAGE:
659
+ return Kt();
762
660
  case void 0: {
763
- let t = Ht(e);
764
- return !t && e.allowFallbackToLocalStorage && (t = Gt()), t;
661
+ let t = Bt(e);
662
+ return !t && e.allowFallbackToLocalStorage && (t = Kt()), t;
765
663
  }
766
664
  default:
767
665
  y.error(`Invalid session persistence '${String(e.sessionPersistence)}'`);
768
666
  }
769
667
  }
770
- function io(e, t) {
771
- return e.type === Oe.COOKIE ? qr(t, e.cookieOptions) : Xr(t);
668
+ function co(e, t) {
669
+ return e.type === Te.COOKIE ? Wr(t, e.cookieOptions) : Zr(t);
772
670
  }
773
- function co(e, t, n, r, o = io(e, t)) {
774
- const s = new S(), i = new S(), c = new S(), a = Tt(p, jt);
671
+ function ao(e, t, n, r, o = co(e, t)) {
672
+ const s = new S(), i = new S(), c = new S(), a = Tt(h, Vt);
775
673
  let u;
776
- O();
777
- const { throttled: d, cancel: l } = wr(() => {
778
- V({
674
+ C();
675
+ const { throttled: d, cancel: l } = Ar(() => {
676
+ Y({
779
677
  process: (g) => {
780
- if (ke(g))
678
+ if (Ue(g))
781
679
  return;
782
680
  const L = m(g);
783
681
  return E(L), L;
784
682
  },
785
683
  after: (g) => {
786
- _n(g) && !M() && ur(g), u = g;
684
+ _n(g) && !M() && lr(g), u = g;
787
685
  }
788
686
  }, o);
789
- }, jt);
687
+ }, Vt);
790
688
  function f() {
791
- V({
689
+ Y({
792
690
  process: (g) => M() ? m(g) : void 0
793
691
  }, o);
794
692
  }
795
- function p() {
693
+ function h() {
796
694
  const g = o.retrieveSession();
797
- _e(g) ? V({
798
- process: (L) => _e(L) ? z(L, t) : void 0,
695
+ Ce(g) ? Y({
696
+ process: (L) => Ce(L) ? V(L, t) : void 0,
799
697
  after: m
800
698
  }, o) : m(g);
801
699
  }
802
700
  function m(g) {
803
- return _e(g) && (g = z(g, t)), M() && (oe(g) ? ar() : (c.notify({ previousState: u, newState: g }), u = g)), g;
701
+ return Ce(g) && (g = V(g, t)), M() && (se(g) ? ur() : (c.notify({ previousState: u, newState: g }), u = g)), g;
804
702
  }
805
- function O() {
806
- V({
703
+ function C() {
704
+ Y({
807
705
  process: (g) => {
808
- if (ke(g))
809
- return z(g, t);
706
+ if (Ue(g))
707
+ return V(g, t);
810
708
  },
811
709
  after: (g) => {
812
710
  u = g;
@@ -814,7 +712,7 @@ function co(e, t, n, r, o = io(e, t)) {
814
712
  }, o);
815
713
  }
816
714
  function E(g) {
817
- if (ke(g))
715
+ if (Ue(g))
818
716
  return !1;
819
717
  const L = r(g[n]);
820
718
  g[n] = L, delete g.isExpired, L !== yn && !g.id && (g.id = G(), g.created = String($()));
@@ -822,17 +720,17 @@ function co(e, t, n, r, o = io(e, t)) {
822
720
  function M() {
823
721
  return (u == null ? void 0 : u[n]) !== void 0;
824
722
  }
825
- function oe(g) {
723
+ function se(g) {
826
724
  return u.id !== g.id || u[n] !== g[n];
827
725
  }
828
- function ar() {
829
- u = z(u, t), i.notify();
726
+ function ur() {
727
+ u = V(u, t), i.notify();
830
728
  }
831
- function ur(g) {
729
+ function lr(g) {
832
730
  u = g, s.notify();
833
731
  }
834
- function lr(g) {
835
- V({
732
+ function dr(g) {
733
+ Y({
836
734
  process: (L) => ({ ...L, ...g }),
837
735
  after: m
838
736
  }, o);
@@ -844,21 +742,21 @@ function co(e, t, n, r, o = io(e, t)) {
844
742
  renewObservable: s,
845
743
  expireObservable: i,
846
744
  sessionStateUpdateObservable: c,
847
- restartSession: O,
745
+ restartSession: C,
848
746
  expire: () => {
849
- l(), o.expireSession(u), m(z(u, t));
747
+ l(), o.expireSession(u), m(V(u, t));
850
748
  },
851
749
  stop: () => {
852
750
  fn(a);
853
751
  },
854
- updateSessionState: lr
752
+ updateSessionState: dr
855
753
  };
856
754
  }
857
755
  const gt = {
858
756
  GRANTED: "granted",
859
757
  NOT_GRANTED: "not-granted"
860
758
  };
861
- function ao(e) {
759
+ function uo(e) {
862
760
  const t = new S();
863
761
  return {
864
762
  tryToInit(n) {
@@ -876,7 +774,7 @@ function ao(e) {
876
774
  function Rn(e) {
877
775
  return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
878
776
  }
879
- function uo(e, t, n = !1) {
777
+ function lo(e, t, n = !1) {
880
778
  return e.some((r) => {
881
779
  try {
882
780
  if (typeof r == "function")
@@ -891,62 +789,62 @@ function uo(e, t, n = !1) {
891
789
  return !1;
892
790
  });
893
791
  }
894
- const lo = ["chrome-extension://", "moz-extension://"];
895
- function zt(e) {
896
- return lo.some((t) => e.includes(t));
792
+ const fo = ["chrome-extension://", "moz-extension://"];
793
+ function Yt(e) {
794
+ return fo.some((t) => e.includes(t));
897
795
  }
898
- function fo(e, t = "") {
899
- if (zt(e))
796
+ function ho(e, t = "") {
797
+ if (Yt(e))
900
798
  return !1;
901
799
  const r = t.split(`
902
800
  `).filter((o) => {
903
801
  const s = o.trim();
904
802
  return s.length && /^at\s+|@/.test(s);
905
803
  })[1] || "";
906
- return zt(r);
804
+ return Yt(r);
907
805
  }
908
- const po = "Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.", ho = "SDK initialized on a non-allowed domain.";
909
- function mo(e, t, n = typeof location != "undefined" ? location.origin : "") {
806
+ const po = "Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.", mo = "SDK initialized on a non-allowed domain.";
807
+ function go(e, t, n = typeof location != "undefined" ? location.origin : "") {
910
808
  const r = e.allowedTrackingOrigins;
911
809
  if (!r)
912
- return fo(n, t) ? (y.error(po), !1) : !0;
913
- const o = uo(r, n);
914
- return o || y.error(ho), o;
810
+ return ho(n, t) ? (y.error(po), !1) : !0;
811
+ const o = lo(r, n);
812
+ return o || y.error(mo), o;
915
813
  }
916
- const go = "datad0g.com", Eo = "dd0g-gov.com", ie = "datadoghq.com", bo = "ddog-gov.com", yo = "pci.browser-intake-datadoghq.com", So = ["ddsource", "dd-api-key", "dd-request-id"];
917
- function Y(e, t, n) {
918
- const r = _o(e, t);
814
+ const Eo = "datad0g.com", bo = "dd0g-gov.com", ce = "datadoghq.com", yo = "ddog-gov.com", So = "pci.browser-intake-datadoghq.com", _o = ["ddsource", "dd-api-key", "dd-request-id"];
815
+ function z(e, t, n) {
816
+ const r = Co(e, t);
919
817
  return {
920
818
  build(o, s) {
921
- const i = To(e, t, o, s, n);
819
+ const i = vo(e, t, o, s, n);
922
820
  return r(i);
923
821
  },
924
822
  trackType: t
925
823
  };
926
824
  }
927
- function _o(e, t) {
825
+ function Co(e, t) {
928
826
  const n = `/api/v2/${t}`, r = e.proxy;
929
827
  if (typeof r == "string") {
930
- const s = Ct(r);
828
+ const s = vt(r);
931
829
  return (i) => `${s}?ddforward=${encodeURIComponent(`${n}?${i}`)}`;
932
830
  }
933
831
  if (typeof r == "function")
934
832
  return (s) => r({ path: n, parameters: s });
935
- const o = Oo(t, e);
833
+ const o = To(t, e);
936
834
  return (s) => `https://${o}${n}?${s}`;
937
835
  }
938
- function Oo(e, t) {
939
- const { site: n = ie, internalAnalyticsSubdomain: r } = t;
940
- if (e === "logs" && t.usePciIntake && n === ie)
941
- return yo;
942
- if (r && n === ie)
943
- return `${r}.${ie}`;
944
- if (n === Eo)
836
+ function To(e, t) {
837
+ const { site: n = ce, internalAnalyticsSubdomain: r } = t;
838
+ if (e === "logs" && t.usePciIntake && n === ce)
839
+ return So;
840
+ if (r && n === ce)
841
+ return `${r}.${ce}`;
842
+ if (n === bo)
945
843
  return `http-intake.logs.${n}`;
946
844
  const o = n.split("."), s = o.pop();
947
845
  return `browser-intake-${o.join("-")}.${s}`;
948
846
  }
949
- function To({ clientToken: e, internalAnalyticsSubdomain: t, source: n = "browser" }, r, o, { retry: s, encoding: i }, c = []) {
847
+ function vo({ clientToken: e, internalAnalyticsSubdomain: t, source: n = "browser" }, r, o, { retry: s, encoding: i }, c = []) {
950
848
  const a = [
951
849
  `ddsource=${n}`,
952
850
  `dd-api-key=${e}`,
@@ -956,55 +854,55 @@ function To({ clientToken: e, internalAnalyticsSubdomain: t, source: n = "browse
956
854
  ].concat(c);
957
855
  return i && a.push(`dd-evp-encoding=${i}`), r === "rum" && (a.push(`batch_time=${P()}`, `_dd.api=${o}`), s && a.push(`_dd.retry_count=${s.count}`, `_dd.retry_after=${s.lastFailureStatus}`)), t && a.reverse(), a.join("&");
958
856
  }
959
- function Co(e) {
960
- const t = e.site || ie, n = vo(e.source), r = wo({ ...e, site: t, source: n });
857
+ function Oo(e) {
858
+ const t = e.site || ce, n = wo(e.source), r = Ao({ ...e, site: t, source: n });
961
859
  return {
962
- replica: Ao({ ...e, site: t, source: n }),
860
+ replica: Ro({ ...e, site: t, source: n }),
963
861
  site: t,
964
862
  source: n,
965
863
  ...r
966
864
  };
967
865
  }
968
- function vo(e) {
866
+ function wo(e) {
969
867
  return e === "flutter" || e === "unity" ? e : "browser";
970
868
  }
971
- function wo(e) {
869
+ function Ao(e) {
972
870
  return {
973
- logsEndpointBuilder: Y(e, "logs"),
974
- rumEndpointBuilder: Y(e, "rum"),
975
- profilingEndpointBuilder: Y(e, "profile"),
976
- sessionReplayEndpointBuilder: Y(e, "replay"),
977
- exposuresEndpointBuilder: Y(e, "exposures")
871
+ logsEndpointBuilder: z(e, "logs"),
872
+ rumEndpointBuilder: z(e, "rum"),
873
+ profilingEndpointBuilder: z(e, "profile"),
874
+ sessionReplayEndpointBuilder: z(e, "replay"),
875
+ exposuresEndpointBuilder: z(e, "exposures")
978
876
  };
979
877
  }
980
- function Ao(e) {
878
+ function Ro(e) {
981
879
  if (!e.replica)
982
880
  return;
983
881
  const t = {
984
882
  ...e,
985
- site: ie,
883
+ site: ce,
986
884
  clientToken: e.replica.clientToken
987
885
  };
988
886
  return {
989
- logsEndpointBuilder: Y(t, "logs"),
990
- rumEndpointBuilder: Y(t, "rum", [
887
+ logsEndpointBuilder: z(t, "logs"),
888
+ rumEndpointBuilder: z(t, "rum", [
991
889
  `application.id=${e.replica.applicationId}`
992
890
  ])
993
891
  };
994
892
  }
995
- function Ro(e) {
996
- return So.every((t) => e.includes(t));
893
+ function Io(e) {
894
+ return _o.every((t) => e.includes(t));
997
895
  }
998
896
  function rt(e, t) {
999
897
  return e != null && typeof e != "string" ? (y.error(`${t} must be defined as a string`), !1) : !0;
1000
898
  }
1001
- function Io(e) {
899
+ function xo(e) {
1002
900
  return e && typeof e == "string" && !/(datadog|ddog|datad0g|dd0g)/.test(e) ? (y.error(`Site should be a valid Datadog site. ${_t} ${St}/getting_started/site/.`), !1) : !0;
1003
901
  }
1004
- function xe(e, t) {
1005
- return e !== void 0 && !hr(e) ? (y.error(`${t} Sample Rate should be a number between 0 and 100`), !1) : !0;
902
+ function Le(e, t) {
903
+ return e !== void 0 && !mr(e) ? (y.error(`${t} Sample Rate should be a number between 0 and 100`), !1) : !0;
1006
904
  }
1007
- function xo(e, t) {
905
+ function Lo(e, t) {
1008
906
  var n, r, o, s, i, c, a, u, d, l;
1009
907
  if (!e || !e.clientToken) {
1010
908
  y.error("Client Token is not configured, we will not send any data.");
@@ -1014,14 +912,14 @@ function xo(e, t) {
1014
912
  y.error("Allowed Tracking Origins must be an array");
1015
913
  return;
1016
914
  }
1017
- if (!(!Io(e.site) || !xe(e.sessionSampleRate, "Session") || !xe(e.telemetrySampleRate, "Telemetry") || !xe(e.telemetryConfigurationSampleRate, "Telemetry Configuration") || !xe(e.telemetryUsageSampleRate, "Telemetry Usage") || !rt(e.version, "Version") || !rt(e.env, "Env") || !rt(e.service, "Service") || !mo(e, t != null ? t : ""))) {
915
+ if (!(!xo(e.site) || !Le(e.sessionSampleRate, "Session") || !Le(e.telemetrySampleRate, "Telemetry") || !Le(e.telemetryConfigurationSampleRate, "Telemetry Configuration") || !Le(e.telemetryUsageSampleRate, "Telemetry Usage") || !rt(e.version, "Version") || !rt(e.env, "Env") || !rt(e.service, "Service") || !go(e, t != null ? t : ""))) {
1018
916
  if (e.trackingConsent !== void 0 && !un(gt, e.trackingConsent)) {
1019
917
  y.error('Tracking Consent should be either "granted" or "not-granted"');
1020
918
  return;
1021
919
  }
1022
920
  return {
1023
921
  beforeSend: e.beforeSend && nn(e.beforeSend, "beforeSend threw an error:"),
1024
- sessionStoreStrategyType: Q ? void 0 : so(e),
922
+ sessionStoreStrategyType: ee ? void 0 : io(e),
1025
923
  sessionSampleRate: (n = e.sessionSampleRate) !== null && n !== void 0 ? n : 100,
1026
924
  telemetrySampleRate: (r = e.telemetrySampleRate) !== null && r !== void 0 ? r : 20,
1027
925
  telemetryConfigurationSampleRate: (o = e.telemetryConfigurationSampleRate) !== null && o !== void 0 ? o : 5,
@@ -1039,30 +937,30 @@ function xo(e, t) {
1039
937
  * beacon payload max queue size implementation is 64kb
1040
938
  * ensure that we leave room for logs, rum and potential other users
1041
939
  */
1042
- batchBytesLimit: 16 * ue,
940
+ batchBytesLimit: 16 * le,
1043
941
  eventRateLimiterThreshold: 3e3,
1044
942
  maxTelemetryEventsPerPage: 15,
1045
943
  /**
1046
944
  * flush automatically, aim to be lower than ALB connection timeout
1047
945
  * to maximize connection reuse.
1048
946
  */
1049
- flushTimeout: 30 * me,
947
+ flushTimeout: 30 * ge,
1050
948
  /**
1051
949
  * Logs intake limit. When using the SDK in a Worker Environment, we
1052
950
  * limit the batch size to 1 to ensure it can be sent in a single event.
1053
951
  */
1054
- batchMessagesLimit: Q ? 1 : 50,
1055
- messageBytesLimit: 256 * ue,
952
+ batchMessagesLimit: ee ? 1 : 50,
953
+ messageBytesLimit: 256 * le,
1056
954
  /**
1057
955
  * The source of the SDK, used for support plugins purposes.
1058
956
  */
1059
957
  variant: e.variant,
1060
958
  sdkVersion: e.sdkVersion,
1061
- ...Co(e)
959
+ ...Oo(e)
1062
960
  };
1063
961
  }
1064
962
  }
1065
- function Lo(e) {
963
+ function ko(e) {
1066
964
  return {
1067
965
  session_sample_rate: e.sessionSampleRate,
1068
966
  telemetry_sample_rate: e.telemetrySampleRate,
@@ -1092,34 +990,34 @@ var Ge;
1092
990
  })(Ge || (Ge = {}));
1093
991
  const It = /* @__PURE__ */ new Set();
1094
992
  function No(e) {
1095
- Array.isArray(e) && ko(e.filter((t) => un(Ge, t)));
993
+ Array.isArray(e) && Uo(e.filter((t) => un(Ge, t)));
1096
994
  }
1097
- function ko(e) {
995
+ function Uo(e) {
1098
996
  e.forEach((t) => {
1099
997
  It.add(t);
1100
998
  });
1101
999
  }
1102
- function Uo(e) {
1000
+ function Po(e) {
1103
1001
  return It.has(e);
1104
1002
  }
1105
- function Po() {
1003
+ function Do() {
1106
1004
  return It;
1107
1005
  }
1108
- const fe = "?";
1109
- function ge(e) {
1006
+ const he = "?";
1007
+ function Ee(e) {
1110
1008
  var t, n;
1111
1009
  const r = [];
1112
1010
  let o = ot(e, "stack");
1113
1011
  const s = String(e);
1114
1012
  if (o && o.startsWith(s) && (o = o.slice(s.length)), o && o.split(`
1115
1013
  `).forEach((i) => {
1116
- const c = $o(i) || Ho(i) || Go(i) || zo(i);
1117
- c && (!c.func && c.line && (c.func = fe), r.push(c));
1118
- }), r.length > 0 && Wo() && e instanceof Error) {
1014
+ const c = Fo(i) || Bo(i) || Ko(i) || Yo(i);
1015
+ c && (!c.func && c.line && (c.func = he), r.push(c));
1016
+ }), r.length > 0 && Xo() && e instanceof Error) {
1119
1017
  const i = [];
1120
1018
  let c = e;
1121
1019
  for (; (c = Object.getPrototypeOf(c)) && xn(c); ) {
1122
- const a = ((t = c.constructor) === null || t === void 0 ? void 0 : t.name) || fe;
1020
+ const a = ((t = c.constructor) === null || t === void 0 ? void 0 : t.name) || he;
1123
1021
  i.push(a);
1124
1022
  }
1125
1023
  for (let a = i.length - 1; a >= 0 && ((n = r[0]) === null || n === void 0 ? void 0 : n.func) === i[a]; a--)
@@ -1131,54 +1029,54 @@ function ge(e) {
1131
1029
  stack: r
1132
1030
  };
1133
1031
  }
1134
- const In = "((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)", pe = "(?::(\\d+))", Do = new RegExp(`^\\s*at (.*?) ?\\(${In}${pe}?${pe}?\\)?\\s*$`, "i"), Mo = new RegExp(`\\((\\S*)${pe}${pe}\\)`);
1135
- function $o(e) {
1136
- const t = Do.exec(e);
1032
+ const In = "((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)", pe = "(?::(\\d+))", Mo = new RegExp(`^\\s*at (.*?) ?\\(${In}${pe}?${pe}?\\)?\\s*$`, "i"), $o = new RegExp(`\\((\\S*)${pe}${pe}\\)`);
1033
+ function Fo(e) {
1034
+ const t = Mo.exec(e);
1137
1035
  if (!t)
1138
1036
  return;
1139
- const n = t[2] && t[2].indexOf("native") === 0, r = t[2] && t[2].indexOf("eval") === 0, o = Mo.exec(t[2]);
1037
+ const n = t[2] && t[2].indexOf("native") === 0, r = t[2] && t[2].indexOf("eval") === 0, o = $o.exec(t[2]);
1140
1038
  return r && o && (t[2] = o[1], t[3] = o[2], t[4] = o[3]), {
1141
1039
  args: n ? [t[2]] : [],
1142
1040
  column: t[4] ? +t[4] : void 0,
1143
- func: t[1] || fe,
1041
+ func: t[1] || he,
1144
1042
  line: t[3] ? +t[3] : void 0,
1145
1043
  url: n ? void 0 : t[2]
1146
1044
  };
1147
1045
  }
1148
- const Fo = new RegExp(`^\\s*at ?${In}${pe}?${pe}??\\s*$`, "i");
1149
- function Ho(e) {
1150
- const t = Fo.exec(e);
1046
+ const Ho = new RegExp(`^\\s*at ?${In}${pe}?${pe}??\\s*$`, "i");
1047
+ function Bo(e) {
1048
+ const t = Ho.exec(e);
1151
1049
  if (t)
1152
1050
  return {
1153
1051
  args: [],
1154
1052
  column: t[3] ? +t[3] : void 0,
1155
- func: fe,
1053
+ func: he,
1156
1054
  line: t[2] ? +t[2] : void 0,
1157
1055
  url: t[1]
1158
1056
  };
1159
1057
  }
1160
- const Bo = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1161
- function Go(e) {
1162
- const t = Bo.exec(e);
1058
+ const Go = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1059
+ function Ko(e) {
1060
+ const t = Go.exec(e);
1163
1061
  if (t)
1164
1062
  return {
1165
1063
  args: [],
1166
1064
  column: t[4] ? +t[4] : void 0,
1167
- func: t[1] || fe,
1065
+ func: t[1] || he,
1168
1066
  line: +t[3],
1169
1067
  url: t[2]
1170
1068
  };
1171
1069
  }
1172
- const Ko = /^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i, jo = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
1173
- function zo(e) {
1174
- const t = Ko.exec(e);
1070
+ const jo = /^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i, Vo = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
1071
+ function Yo(e) {
1072
+ const t = jo.exec(e);
1175
1073
  if (!t)
1176
1074
  return;
1177
- const n = t[3] && t[3].indexOf(" > eval") > -1, r = jo.exec(t[3]);
1075
+ const n = t[3] && t[3].indexOf(" > eval") > -1, r = Vo.exec(t[3]);
1178
1076
  return n && r && (t[3] = r[1], t[4] = r[2], t[5] = void 0), {
1179
1077
  args: t[2] ? t[2].split(",") : [],
1180
1078
  column: t[5] ? +t[5] : void 0,
1181
- func: t[1] || fe,
1079
+ func: t[1] || he,
1182
1080
  line: t[4] ? +t[4] : void 0,
1183
1081
  url: t[3]
1184
1082
  };
@@ -1189,49 +1087,49 @@ function ot(e, t) {
1189
1087
  const n = e[t];
1190
1088
  return typeof n == "string" ? n : void 0;
1191
1089
  }
1192
- function Vo(e, t, n, r) {
1090
+ function zo(e, t, n, r) {
1193
1091
  if (t === void 0)
1194
1092
  return;
1195
- const { name: o, message: s } = qo(e);
1093
+ const { name: o, message: s } = Wo(e);
1196
1094
  return {
1197
1095
  name: o,
1198
1096
  message: s,
1199
1097
  stack: [{ url: t, column: r, line: n }]
1200
1098
  };
1201
1099
  }
1202
- const Yo = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;
1203
- function qo(e) {
1100
+ const qo = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;
1101
+ function Wo(e) {
1204
1102
  let t, n;
1205
- return {}.toString.call(e) === "[object String]" && ([, t, n] = Yo.exec(e)), { name: t, message: n };
1103
+ return {}.toString.call(e) === "[object String]" && ([, t, n] = qo.exec(e)), { name: t, message: n };
1206
1104
  }
1207
1105
  function xn(e) {
1208
1106
  return String(e.constructor).startsWith("class ");
1209
1107
  }
1210
- let Le;
1211
- function Wo() {
1212
- if (Le !== void 0)
1213
- return Le;
1108
+ let ke;
1109
+ function Xo() {
1110
+ if (ke !== void 0)
1111
+ return ke;
1214
1112
  class e extends Error {
1215
1113
  constructor() {
1216
1114
  super(), this.name = "Error";
1217
1115
  }
1218
1116
  }
1219
1117
  const [t, n] = [e, Error].map((r) => new r());
1220
- return Le = // If customError is not a class, it means that this was built with ES5 as target, converting the class to a normal object.
1118
+ return ke = // If customError is not a class, it means that this was built with ES5 as target, converting the class to a normal object.
1221
1119
  // Thus, error constructors will be reported on all browsers, which is the expected behavior.
1222
1120
  xn(Object.getPrototypeOf(t)) && // If the browser is correctly reporting the stacktrace, the normal error stacktrace should be the same as the custom error stacktrace
1223
- n.stack !== t.stack, Le;
1121
+ n.stack !== t.stack, ke;
1224
1122
  }
1225
- function Je(e) {
1123
+ function Xe(e) {
1226
1124
  const n = new Error(e);
1227
1125
  n.name = "HandlingStack";
1228
1126
  let r;
1229
- return de(() => {
1230
- const o = ge(n);
1231
- o.stack = o.stack.slice(2), r = Ee(o);
1127
+ return fe(() => {
1128
+ const o = Ee(n);
1129
+ o.stack = o.stack.slice(2), r = be(o);
1232
1130
  }), r;
1233
1131
  }
1234
- function Ee(e) {
1132
+ function be(e) {
1235
1133
  let t = Ln(e);
1236
1134
  return e.stack.forEach((n) => {
1237
1135
  const r = n.func === "?" ? "<anonymous>" : n.func, o = n.args && n.args.length > 0 ? `(${n.args.join(", ")})` : "", s = n.line ? `:${n.line}` : "", i = n.line && n.column ? `:${n.column}` : "";
@@ -1242,7 +1140,7 @@ function Ee(e) {
1242
1140
  function Ln(e) {
1243
1141
  return `${e.name || "Error"}: ${e.message}`;
1244
1142
  }
1245
- function J(e, t, n, { computeHandlingStack: r } = {}) {
1143
+ function X(e, t, n, { computeHandlingStack: r } = {}) {
1246
1144
  let o = e[t];
1247
1145
  if (typeof o != "function")
1248
1146
  if (t in e && t.startsWith("on"))
@@ -1255,18 +1153,18 @@ function J(e, t, n, { computeHandlingStack: r } = {}) {
1255
1153
  return o.apply(this, arguments);
1256
1154
  const c = Array.from(arguments);
1257
1155
  let a;
1258
- de(n, null, [
1156
+ fe(n, null, [
1259
1157
  {
1260
1158
  target: this,
1261
1159
  parameters: c,
1262
1160
  onPostCall: (d) => {
1263
1161
  a = d;
1264
1162
  },
1265
- handlingStack: r ? Je("instrumented method") : void 0
1163
+ handlingStack: r ? Xe("instrumented method") : void 0
1266
1164
  }
1267
1165
  ]);
1268
1166
  const u = o.apply(this, c);
1269
- return a && de(a, null, [u]), u;
1167
+ return a && fe(a, null, [u]), u;
1270
1168
  };
1271
1169
  return e[t] = i, {
1272
1170
  stop: () => {
@@ -1274,10 +1172,10 @@ function J(e, t, n, { computeHandlingStack: r } = {}) {
1274
1172
  }
1275
1173
  };
1276
1174
  }
1277
- function we(e, t, n) {
1175
+ function Ae(e, t, n) {
1278
1176
  if (typeof e != "object" || e === null)
1279
1177
  return JSON.stringify(e);
1280
- const r = ce(Object.prototype), o = ce(Array.prototype), s = ce(Object.getPrototypeOf(e)), i = ce(e);
1178
+ const r = ae(Object.prototype), o = ae(Array.prototype), s = ae(Object.getPrototypeOf(e)), i = ae(e);
1281
1179
  try {
1282
1180
  return JSON.stringify(e, t, n);
1283
1181
  } catch (c) {
@@ -1286,15 +1184,15 @@ function we(e, t, n) {
1286
1184
  r(), o(), s(), i();
1287
1185
  }
1288
1186
  }
1289
- function ce(e) {
1187
+ function ae(e) {
1290
1188
  const t = e, n = t.toJSON;
1291
1189
  return n ? (delete t.toJSON, () => {
1292
1190
  t.toJSON = n;
1293
1191
  }) : F;
1294
1192
  }
1295
- const Jo = 220 * ue, Xo = "$", Zo = 3;
1193
+ const Jo = 220 * le, Zo = "$", Qo = 3;
1296
1194
  function U(e, t = Jo) {
1297
- const n = ce(Object.prototype), r = ce(Array.prototype), o = [], s = /* @__PURE__ */ new WeakMap(), i = st(e, Xo, void 0, o, s), c = JSON.stringify(i);
1195
+ const n = ae(Object.prototype), r = ae(Array.prototype), o = [], s = /* @__PURE__ */ new WeakMap(), i = st(e, Zo, void 0, o, s), c = JSON.stringify(i);
1298
1196
  let a = c ? c.length : 0;
1299
1197
  if (a > t) {
1300
1198
  it(t, "discarded", e);
@@ -1316,7 +1214,7 @@ function U(e, t = Jo) {
1316
1214
  for (const l in u.source)
1317
1215
  if (Object.prototype.hasOwnProperty.call(u.source, l)) {
1318
1216
  const f = st(u.source[l], u.path, l, o, s);
1319
- if (f !== void 0 && (a += JSON.stringify(f).length + d + l.length + Zo, d = 1), a > t) {
1217
+ if (f !== void 0 && (a += JSON.stringify(f).length + d + l.length + Qo, d = 1), a > t) {
1320
1218
  it(t, "truncated", e);
1321
1219
  break;
1322
1220
  }
@@ -1326,9 +1224,9 @@ function U(e, t = Jo) {
1326
1224
  return n(), r(), i;
1327
1225
  }
1328
1226
  function st(e, t, n, r, o) {
1329
- const s = ts(e);
1227
+ const s = ns(e);
1330
1228
  if (!s || typeof s != "object")
1331
- return Qo(s);
1229
+ return es(s);
1332
1230
  const i = Et(s);
1333
1231
  if (i !== "[Object]" && i !== "[Array]" && i !== "[Error]")
1334
1232
  return i;
@@ -1338,13 +1236,13 @@ function st(e, t, n, r, o) {
1338
1236
  const a = n !== void 0 ? `${t}.${n}` : t, u = Array.isArray(s) ? [] : {};
1339
1237
  return o.set(c, a), r.push({ source: s, target: u, path: a }), u;
1340
1238
  }
1341
- function Qo(e) {
1239
+ function es(e) {
1342
1240
  return typeof e == "bigint" ? `[BigInt] ${e.toString()}` : typeof e == "function" ? `[Function] ${e.name || "unknown"}` : typeof e == "symbol" ? `[Symbol] ${e.description || e.toString()}` : e;
1343
1241
  }
1344
1242
  function Et(e) {
1345
1243
  try {
1346
1244
  if (e instanceof Event)
1347
- return es(e);
1245
+ return ts(e);
1348
1246
  if (e instanceof RegExp)
1349
1247
  return `[RegExp] ${e.toString()}`;
1350
1248
  const n = Object.prototype.toString.call(e).match(/\[object (.*)\]/);
@@ -1354,7 +1252,7 @@ function Et(e) {
1354
1252
  }
1355
1253
  return "[Unserializable]";
1356
1254
  }
1357
- function es(e) {
1255
+ function ts(e) {
1358
1256
  return {
1359
1257
  type: e.type,
1360
1258
  isTrusted: e.isTrusted,
@@ -1362,7 +1260,7 @@ function es(e) {
1362
1260
  target: e.target ? Et(e.target) : null
1363
1261
  };
1364
1262
  }
1365
- function ts(e) {
1263
+ function ns(e) {
1366
1264
  const t = e;
1367
1265
  if (t && typeof t.toJSON == "function")
1368
1266
  try {
@@ -1374,10 +1272,10 @@ function ts(e) {
1374
1272
  function it(e, t, n) {
1375
1273
  y.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`, n);
1376
1274
  }
1377
- const Nn = "No stack, consider using an instance of Error";
1275
+ const kn = "No stack, consider using an instance of Error";
1378
1276
  function xt({ stackTrace: e, originalError: t, handlingStack: n, componentStack: r, startClocks: o, nonErrorPrefix: s, useFallbackStack: i = !0, source: c, handling: a }) {
1379
- const u = ne(t);
1380
- return !e && u && (e = ge(t)), {
1277
+ const u = re(t);
1278
+ return !e && u && (e = Ee(t)), {
1381
1279
  startClocks: o,
1382
1280
  source: c,
1383
1281
  handling: a,
@@ -1385,40 +1283,40 @@ function xt({ stackTrace: e, originalError: t, handlingStack: n, componentStack:
1385
1283
  componentStack: r,
1386
1284
  originalError: t,
1387
1285
  type: e ? e.name : void 0,
1388
- message: ns(e, u, s, t),
1389
- stack: e ? Ee(e) : i ? Nn : void 0,
1390
- causes: u ? is(t, c) : void 0,
1391
- fingerprint: rs(t),
1392
- context: os(t)
1286
+ message: rs(e, u, s, t),
1287
+ stack: e ? be(e) : i ? kn : void 0,
1288
+ causes: u ? cs(t, c) : void 0,
1289
+ fingerprint: os(t),
1290
+ context: ss(t)
1393
1291
  };
1394
1292
  }
1395
- function ns(e, t, n, r) {
1396
- return e != null && e.message && (e != null && e.name) ? e.message : t ? "Empty message" : `${n} ${we(U(r))}`;
1397
- }
1398
- function rs(e) {
1399
- return ne(e) && "dd_fingerprint" in e ? String(e.dd_fingerprint) : void 0;
1293
+ function rs(e, t, n, r) {
1294
+ return e != null && e.message && (e != null && e.name) ? e.message : t ? "Empty message" : `${n} ${Ae(U(r))}`;
1400
1295
  }
1401
1296
  function os(e) {
1297
+ return re(e) && "dd_fingerprint" in e ? String(e.dd_fingerprint) : void 0;
1298
+ }
1299
+ function ss(e) {
1402
1300
  if (e !== null && typeof e == "object" && "dd_context" in e)
1403
1301
  return e.dd_context;
1404
1302
  }
1405
- function ss(e) {
1303
+ function is(e) {
1406
1304
  var t;
1407
1305
  return (t = /@ (.+)/.exec(e)) === null || t === void 0 ? void 0 : t[1];
1408
1306
  }
1409
- function ne(e) {
1307
+ function re(e) {
1410
1308
  return e instanceof Error || Object.prototype.toString.call(e) === "[object Error]";
1411
1309
  }
1412
- function is(e, t) {
1310
+ function cs(e, t) {
1413
1311
  let n = e;
1414
1312
  const r = [];
1415
- for (; ne(n == null ? void 0 : n.cause) && r.length < 10; ) {
1416
- const o = ge(n.cause);
1313
+ for (; re(n == null ? void 0 : n.cause) && r.length < 10; ) {
1314
+ const o = Ee(n.cause);
1417
1315
  r.push({
1418
1316
  message: n.cause.message,
1419
1317
  source: t,
1420
1318
  type: o == null ? void 0 : o.name,
1421
- stack: o && Ee(o)
1319
+ stack: o && be(o)
1422
1320
  }), n = n.cause;
1423
1321
  }
1424
1322
  return r.length ? r : void 0;
@@ -1432,36 +1330,36 @@ const A = {
1432
1330
  SOURCE: "source",
1433
1331
  REPORT: "report"
1434
1332
  };
1435
- function cs() {
1333
+ function as() {
1436
1334
  return new S((e) => {
1437
1335
  const t = (o, s) => {
1438
1336
  const i = xt({
1439
1337
  stackTrace: s,
1440
1338
  originalError: o,
1441
- startClocks: k(),
1339
+ startClocks: N(),
1442
1340
  nonErrorPrefix: "Uncaught",
1443
1341
  source: A.SOURCE,
1444
1342
  handling: "unhandled"
1445
1343
  });
1446
1344
  e.notify(i);
1447
- }, { stop: n } = as(t), { stop: r } = us(t);
1345
+ }, { stop: n } = us(t), { stop: r } = ls(t);
1448
1346
  return () => {
1449
1347
  n(), r();
1450
1348
  };
1451
1349
  });
1452
1350
  }
1453
- function as(e) {
1454
- return J(x(), "onerror", ({ parameters: [t, n, r, o, s] }) => {
1351
+ function us(e) {
1352
+ return X(x(), "onerror", ({ parameters: [t, n, r, o, s] }) => {
1455
1353
  let i;
1456
- ne(s) || (i = Vo(t, n, r, o)), e(s != null ? s : t, i);
1354
+ re(s) || (i = zo(t, n, r, o)), e(s != null ? s : t, i);
1457
1355
  });
1458
1356
  }
1459
- function us(e) {
1460
- return J(x(), "onunhandledrejection", ({ parameters: [t] }) => {
1357
+ function ls(e) {
1358
+ return X(x(), "onunhandledrejection", ({ parameters: [t] }) => {
1461
1359
  e(t.reason || "Empty reason");
1462
1360
  });
1463
1361
  }
1464
- function ls(e) {
1362
+ function ds(e) {
1465
1363
  const t = {
1466
1364
  version: "6.22.0",
1467
1365
  // This API method is intentionally not monitored, since the only thing executed is the
@@ -1474,29 +1372,29 @@ function ls(e) {
1474
1372
  };
1475
1373
  return Object.defineProperty(t, "_setDebug", {
1476
1374
  get() {
1477
- return Cr;
1375
+ return Or;
1478
1376
  },
1479
1377
  enumerable: !1
1480
1378
  }), t;
1481
1379
  }
1482
- function ds(e, t, n) {
1380
+ function fs(e, t, n) {
1483
1381
  const r = e[t];
1484
1382
  r && !r.q && r.version && y.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."), e[t] = n, r && r.q && r.q.forEach((o) => nn(o, "onReady callback threw an error:")());
1485
1383
  }
1486
- function kn(e, t) {
1384
+ function Nn(e, t) {
1487
1385
  t.silentMultipleInit || y.error(`${e} is already initialized.`);
1488
1386
  }
1489
- function re(e, t, n, r, o) {
1387
+ function oe(e, t, n, r, o) {
1490
1388
  return Lt(e, t, [n], r, o);
1491
1389
  }
1492
1390
  function Lt(e, t, n, r, { once: o, capture: s, passive: i } = {}) {
1493
1391
  const c = b((f) => {
1494
1392
  !f.isTrusted && !f.__ddIsTrusted && !e.allowUntrustedEvents || (o && l(), r(f));
1495
- }), a = i ? { capture: s, passive: i } : s, u = window.EventTarget && t instanceof EventTarget ? window.EventTarget.prototype : t, d = le(u, "addEventListener");
1393
+ }), a = i ? { capture: s, passive: i } : s, u = window.EventTarget && t instanceof EventTarget ? window.EventTarget.prototype : t, d = de(u, "addEventListener");
1496
1394
  n.forEach((f) => d.call(t, f, c, a));
1497
1395
  function l() {
1498
- const f = le(u, "removeEventListener");
1499
- n.forEach((p) => f.call(t, p, c, a));
1396
+ const f = de(u, "removeEventListener");
1397
+ n.forEach((h) => f.call(t, h, c, a));
1500
1398
  }
1501
1399
  return {
1502
1400
  stop: l
@@ -1507,17 +1405,17 @@ const Ke = {
1507
1405
  deprecation: "deprecation",
1508
1406
  cspViolation: "csp_violation"
1509
1407
  };
1510
- function fs(e, t) {
1408
+ function hs(e, t) {
1511
1409
  const n = [];
1512
- t.includes(Ke.cspViolation) && n.push(hs(e));
1410
+ t.includes(Ke.cspViolation) && n.push(ms(e));
1513
1411
  const r = t.filter((o) => o !== Ke.cspViolation);
1514
- return r.length && n.push(ps(r)), pn(...n);
1412
+ return r.length && n.push(ps(r)), hn(...n);
1515
1413
  }
1516
1414
  function ps(e) {
1517
1415
  return new S((t) => {
1518
1416
  if (!window.ReportingObserver)
1519
1417
  return;
1520
- const n = b((o, s) => o.forEach((i) => t.notify(ms(i)))), r = new window.ReportingObserver(n, {
1418
+ const n = b((o, s) => o.forEach((i) => t.notify(gs(i)))), r = new window.ReportingObserver(n, {
1521
1419
  types: e,
1522
1420
  buffered: !0
1523
1421
  });
@@ -1526,15 +1424,15 @@ function ps(e) {
1526
1424
  };
1527
1425
  });
1528
1426
  }
1529
- function hs(e) {
1427
+ function ms(e) {
1530
1428
  return new S((t) => {
1531
- const { stop: n } = re(e, document, "securitypolicyviolation", (r) => {
1532
- t.notify(gs(r));
1429
+ const { stop: n } = oe(e, document, "securitypolicyviolation", (r) => {
1430
+ t.notify(Es(r));
1533
1431
  });
1534
1432
  return n;
1535
1433
  });
1536
1434
  }
1537
- function ms(e) {
1435
+ function gs(e) {
1538
1436
  const { type: t, body: n } = e;
1539
1437
  return Un({
1540
1438
  type: n.id,
@@ -1543,7 +1441,7 @@ function ms(e) {
1543
1441
  stack: Pn(n.id, n.message, n.sourceFile, n.lineNumber, n.columnNumber)
1544
1442
  });
1545
1443
  }
1546
- function gs(e) {
1444
+ function Es(e) {
1547
1445
  const t = `'${e.blockedURI}' blocked by '${e.effectiveDirective}' directive`;
1548
1446
  return Un({
1549
1447
  type: e.effectiveDirective,
@@ -1552,19 +1450,19 @@ function gs(e) {
1552
1450
  csp: {
1553
1451
  disposition: e.disposition
1554
1452
  },
1555
- stack: Pn(e.effectiveDirective, e.originalPolicy ? `${t} of the policy "${Ir(e.originalPolicy, 100, "...")}"` : "no policy", e.sourceFile, e.lineNumber, e.columnNumber)
1453
+ stack: Pn(e.effectiveDirective, e.originalPolicy ? `${t} of the policy "${xr(e.originalPolicy, 100, "...")}"` : "no policy", e.sourceFile, e.lineNumber, e.columnNumber)
1556
1454
  });
1557
1455
  }
1558
1456
  function Un(e) {
1559
1457
  return {
1560
- startClocks: k(),
1458
+ startClocks: N(),
1561
1459
  source: A.REPORT,
1562
1460
  handling: "unhandled",
1563
1461
  ...e
1564
1462
  };
1565
1463
  }
1566
1464
  function Pn(e, t, n, r, o) {
1567
- return n ? Ee({
1465
+ return n ? be({
1568
1466
  name: e,
1569
1467
  message: t,
1570
1468
  stack: [
@@ -1577,22 +1475,22 @@ function Pn(e, t, n, r, o) {
1577
1475
  ]
1578
1476
  }) : void 0;
1579
1477
  }
1580
- const Es = 200;
1478
+ const bs = 200;
1581
1479
  function Dn(e) {
1582
1480
  const { env: t, service: n, version: r, datacenter: o, sdkVersion: s, variant: i } = e, c = [K("sdk_version", s != null ? s : "6.22.0")];
1583
1481
  return t && c.push(K("env", t)), n && c.push(K("service", n)), r && c.push(K("version", r)), o && c.push(K("datacenter", o)), i && c.push(K("variant", i)), c;
1584
1482
  }
1585
1483
  function K(e, t) {
1586
1484
  const n = t ? `${e}:${t}` : e;
1587
- return (n.length > Es || bs(n)) && y.warn(`Tag ${n} doesn't meet tag requirements and will be sanitized. ${_t} ${St}/getting_started/tagging/#defining-tags`), Mn(n);
1485
+ return (n.length > bs || ys(n)) && y.warn(`Tag ${n} doesn't meet tag requirements and will be sanitized. ${_t} ${St}/getting_started/tagging/#defining-tags`), Mn(n);
1588
1486
  }
1589
1487
  function Mn(e) {
1590
1488
  return e.replace(/,/g, "_");
1591
1489
  }
1592
- function bs(e) {
1593
- return ys() ? new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]", "u").test(e) : !1;
1490
+ function ys(e) {
1491
+ return Ss() ? new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]", "u").test(e) : !1;
1594
1492
  }
1595
- function ys() {
1493
+ function Ss() {
1596
1494
  try {
1597
1495
  return new RegExp("[\\p{Ll}]", "u"), !0;
1598
1496
  } catch (e) {
@@ -1603,7 +1501,7 @@ function $n(e, t) {
1603
1501
  const n = I.__ddBrowserSdkExtensionCallback;
1604
1502
  n && n({ type: e, payload: t });
1605
1503
  }
1606
- function je(e, t, n = Ss()) {
1504
+ function je(e, t, n = _s()) {
1607
1505
  if (t === void 0)
1608
1506
  return e;
1609
1507
  if (typeof t != "object" || t === null)
@@ -1637,13 +1535,13 @@ function je(e, t, n = Ss()) {
1637
1535
  function Fn(e) {
1638
1536
  return je(void 0, e);
1639
1537
  }
1640
- function ee(...e) {
1538
+ function te(...e) {
1641
1539
  let t;
1642
1540
  for (const n of e)
1643
1541
  n != null && (t = je(t, n));
1644
1542
  return t;
1645
1543
  }
1646
- function Ss() {
1544
+ function _s() {
1647
1545
  if (typeof WeakSet != "undefined") {
1648
1546
  const t = /* @__PURE__ */ new WeakSet();
1649
1547
  return {
@@ -1661,7 +1559,7 @@ function Ss() {
1661
1559
  }
1662
1560
  };
1663
1561
  }
1664
- function _s() {
1562
+ function Cs() {
1665
1563
  var e;
1666
1564
  const t = I.navigator;
1667
1565
  return {
@@ -1673,66 +1571,66 @@ function _s() {
1673
1571
  function Hn(e) {
1674
1572
  return e >= 500;
1675
1573
  }
1676
- function Os(e) {
1574
+ function Ts(e) {
1677
1575
  try {
1678
1576
  return e.clone();
1679
1577
  } catch (t) {
1680
1578
  return;
1681
1579
  }
1682
1580
  }
1683
- const Ts = 80 * ue, Cs = 32, Bn = 20 * cn, vs = B, Gn = me;
1581
+ const vs = 80 * le, Os = 32, Bn = 20 * cn, ws = B, Gn = ge;
1684
1582
  function Kn(e, t, n, r, o, s) {
1685
- t.transportStatus === 0 && t.queuedPayloads.size() === 0 && t.bandwidthMonitor.canHandle(e) ? zn(e, t, n, s, {
1686
- onSuccess: () => Vn(0, t, n, r, o, s),
1583
+ t.transportStatus === 0 && t.queuedPayloads.size() === 0 && t.bandwidthMonitor.canHandle(e) ? Vn(e, t, n, s, {
1584
+ onSuccess: () => Yn(0, t, n, r, o, s),
1687
1585
  onFailure: () => {
1688
1586
  t.queuedPayloads.enqueue(e) || s.notify({ type: "queue-full", bandwidth: t.bandwidthMonitor.stats(), payload: e }), jn(t, n, r, o, s);
1689
1587
  }
1690
1588
  }) : t.queuedPayloads.enqueue(e) || s.notify({ type: "queue-full", bandwidth: t.bandwidthMonitor.stats(), payload: e });
1691
1589
  }
1692
1590
  function jn(e, t, n, r, o) {
1693
- e.transportStatus === 2 && ve(() => {
1591
+ e.transportStatus === 2 && we(() => {
1694
1592
  const s = e.queuedPayloads.first();
1695
- zn(s, e, t, o, {
1593
+ Vn(s, e, t, o, {
1696
1594
  onSuccess: () => {
1697
- e.queuedPayloads.dequeue(), e.currentBackoffTime = Gn, Vn(1, e, t, n, r, o);
1595
+ e.queuedPayloads.dequeue(), e.currentBackoffTime = Gn, Yn(1, e, t, n, r, o);
1698
1596
  },
1699
1597
  onFailure: () => {
1700
- e.currentBackoffTime = Math.min(vs, e.currentBackoffTime * 2), jn(e, t, n, r, o);
1598
+ e.currentBackoffTime = Math.min(ws, e.currentBackoffTime * 2), jn(e, t, n, r, o);
1701
1599
  }
1702
1600
  });
1703
1601
  }, e.currentBackoffTime);
1704
1602
  }
1705
- function zn(e, t, n, r, { onSuccess: o, onFailure: s }) {
1603
+ function Vn(e, t, n, r, { onSuccess: o, onFailure: s }) {
1706
1604
  t.bandwidthMonitor.add(e), n(e, (i) => {
1707
- t.bandwidthMonitor.remove(e), ws(i) ? (t.transportStatus = t.bandwidthMonitor.ongoingRequestCount > 0 ? 1 : 2, e.retry = {
1605
+ t.bandwidthMonitor.remove(e), As(i) ? (t.transportStatus = t.bandwidthMonitor.ongoingRequestCount > 0 ? 1 : 2, e.retry = {
1708
1606
  count: e.retry ? e.retry.count + 1 : 1,
1709
1607
  lastFailureStatus: i.status
1710
1608
  }, r.notify({ type: "failure", bandwidth: t.bandwidthMonitor.stats(), payload: e }), s()) : (t.transportStatus = 0, r.notify({ type: "success", bandwidth: t.bandwidthMonitor.stats(), payload: e }), o());
1711
1609
  });
1712
1610
  }
1713
- function Vn(e, t, n, r, o, s) {
1611
+ function Yn(e, t, n, r, o, s) {
1714
1612
  e === 0 && t.queuedPayloads.isFull() && !t.queueFullReported && (o({
1715
1613
  message: `Reached max ${r} events size queued for upload: ${Bn / cn}MiB`,
1716
1614
  source: A.AGENT,
1717
- startClocks: k()
1615
+ startClocks: N()
1718
1616
  }), t.queueFullReported = !0);
1719
1617
  const i = t.queuedPayloads;
1720
- for (t.queuedPayloads = Yn(); i.size() > 0; )
1618
+ for (t.queuedPayloads = zn(); i.size() > 0; )
1721
1619
  Kn(i.dequeue(), t, n, r, o, s);
1722
1620
  }
1723
- function ws(e) {
1621
+ function As(e) {
1724
1622
  return e.type !== "opaque" && (e.status === 0 && !navigator.onLine || e.status === 408 || e.status === 429 || Hn(e.status));
1725
1623
  }
1726
- function As() {
1624
+ function Rs() {
1727
1625
  return {
1728
1626
  transportStatus: 0,
1729
1627
  currentBackoffTime: Gn,
1730
- bandwidthMonitor: Rs(),
1731
- queuedPayloads: Yn(),
1628
+ bandwidthMonitor: Is(),
1629
+ queuedPayloads: zn(),
1732
1630
  queueFullReported: !1
1733
1631
  };
1734
1632
  }
1735
- function Yn() {
1633
+ function zn() {
1736
1634
  const e = [];
1737
1635
  return {
1738
1636
  bytesCount: 0,
@@ -1754,12 +1652,12 @@ function Yn() {
1754
1652
  }
1755
1653
  };
1756
1654
  }
1757
- function Rs() {
1655
+ function Is() {
1758
1656
  return {
1759
1657
  ongoingRequestCount: 0,
1760
1658
  ongoingByteCount: 0,
1761
1659
  canHandle(e) {
1762
- return this.ongoingRequestCount === 0 || this.ongoingByteCount + e.bytesCount <= Ts && this.ongoingRequestCount < Cs;
1660
+ return this.ongoingRequestCount === 0 || this.ongoingByteCount + e.bytesCount <= vs && this.ongoingRequestCount < Os;
1763
1661
  },
1764
1662
  add(e) {
1765
1663
  this.ongoingRequestCount += 1, this.ongoingByteCount += e.bytesCount;
@@ -1776,12 +1674,12 @@ function Rs() {
1776
1674
  };
1777
1675
  }
1778
1676
  function qn(e, t, n) {
1779
- const r = new S(), o = As();
1677
+ const r = new S(), o = Rs();
1780
1678
  return {
1781
1679
  observable: r,
1782
1680
  send: (s) => {
1783
1681
  for (const i of e)
1784
- Kn(s, o, (c, a) => Ls(i, t, c, a), i.trackType, n, r);
1682
+ Kn(s, o, (c, a) => ks(i, t, c, a), i.trackType, n, r);
1785
1683
  },
1786
1684
  /**
1787
1685
  * Since fetch keepalive behaves like regular fetch on Firefox,
@@ -1789,26 +1687,26 @@ function qn(e, t, n) {
1789
1687
  */
1790
1688
  sendOnExit: (s) => {
1791
1689
  for (const i of e)
1792
- Is(i, t, s);
1690
+ xs(i, t, s);
1793
1691
  }
1794
1692
  };
1795
1693
  }
1796
- function Is(e, t, n) {
1694
+ function xs(e, t, n) {
1797
1695
  if (!!navigator.sendBeacon && n.bytesCount < t)
1798
1696
  try {
1799
1697
  const o = e.build("beacon", n);
1800
1698
  if (navigator.sendBeacon(o, n.data))
1801
1699
  return;
1802
1700
  } catch (o) {
1803
- xs(o);
1701
+ Ls(o);
1804
1702
  }
1805
1703
  bt(e, n);
1806
1704
  }
1807
- let Vt = !1;
1808
- function xs(e) {
1809
- Vt || (Vt = !0, Ot(e));
1705
+ let zt = !1;
1706
+ function Ls(e) {
1707
+ zt || (zt = !0, Ct(e));
1810
1708
  }
1811
- function Ls(e, t, n, r) {
1709
+ function ks(e, t, n, r) {
1812
1710
  if (Ns() && n.bytesCount < t) {
1813
1711
  const s = e.build("fetch-keepalive", n);
1814
1712
  fetch(s, { method: "POST", body: n.data, keepalive: !0, mode: "cors" }).then(b((i) => r == null ? void 0 : r({ status: i.status, type: i.type }))).catch(b(() => bt(e, n, r)));
@@ -1826,8 +1724,8 @@ function Ns() {
1826
1724
  return !1;
1827
1725
  }
1828
1726
  }
1829
- function Nt() {
1830
- const e = ks();
1727
+ function kt() {
1728
+ const e = Us();
1831
1729
  if (e)
1832
1730
  return {
1833
1731
  getCapabilities() {
@@ -1847,45 +1745,45 @@ function Nt() {
1847
1745
  }
1848
1746
  };
1849
1747
  }
1850
- function ze(e) {
1748
+ function Ve(e) {
1851
1749
  var t;
1852
1750
  e === void 0 && (e = (t = x().location) === null || t === void 0 ? void 0 : t.hostname);
1853
- const n = Nt();
1751
+ const n = kt();
1854
1752
  return !!n && n.getAllowedWebViewHosts().some((r) => e === r || e.endsWith(`.${r}`));
1855
1753
  }
1856
- function ks() {
1754
+ function Us() {
1857
1755
  return x().DatadogEventBridge;
1858
1756
  }
1859
- const Pe = {
1757
+ const De = {
1860
1758
  HIDDEN: "visibility_hidden",
1861
1759
  UNLOADING: "before_unload",
1862
1760
  PAGEHIDE: "page_hide",
1863
1761
  FROZEN: "page_frozen"
1864
1762
  };
1865
- function Us(e) {
1763
+ function Ps(e) {
1866
1764
  return new S((t) => {
1867
1765
  const { stop: n } = Lt(e, window, [
1868
1766
  "visibilitychange",
1869
1767
  "freeze"
1870
1768
  /* DOM_EVENT.FREEZE */
1871
1769
  ], (o) => {
1872
- o.type === "visibilitychange" && document.visibilityState === "hidden" ? t.notify({ reason: Pe.HIDDEN }) : o.type === "freeze" && t.notify({ reason: Pe.FROZEN });
1873
- }, { capture: !0 }), r = re(e, window, "beforeunload", () => {
1874
- t.notify({ reason: Pe.UNLOADING });
1770
+ o.type === "visibilitychange" && document.visibilityState === "hidden" ? t.notify({ reason: De.HIDDEN }) : o.type === "freeze" && t.notify({ reason: De.FROZEN });
1771
+ }, { capture: !0 }), r = oe(e, window, "beforeunload", () => {
1772
+ t.notify({ reason: De.UNLOADING });
1875
1773
  }).stop;
1876
1774
  return () => {
1877
1775
  n(), r();
1878
1776
  };
1879
1777
  });
1880
1778
  }
1881
- function Ps(e) {
1882
- return Be(Pe).includes(e);
1779
+ function Ds(e) {
1780
+ return Be(De).includes(e);
1883
1781
  }
1884
1782
  function Wn({ encoder: e, request: t, flushController: n, messageBytesLimit: r }) {
1885
1783
  let o = {};
1886
1784
  const s = n.flushObservable.subscribe((l) => d(l));
1887
- function i(l, f, p) {
1888
- n.notifyBeforeAddMessage(f), p !== void 0 ? (o[p] = l, n.notifyAfterAddMessage()) : e.write(e.isEmpty ? l : `
1785
+ function i(l, f, h) {
1786
+ n.notifyBeforeAddMessage(f), h !== void 0 ? (o[h] = l, n.notifyAfterAddMessage()) : e.write(e.isEmpty ? l : `
1889
1787
  ${l}`, (m) => {
1890
1788
  n.notifyAfterAddMessage(m - f);
1891
1789
  });
@@ -1896,30 +1794,30 @@ ${l}`, (m) => {
1896
1794
  function a(l) {
1897
1795
  const f = o[l];
1898
1796
  delete o[l];
1899
- const p = e.estimateEncodedBytesCount(f);
1900
- n.notifyAfterRemoveMessage(p);
1797
+ const h = e.estimateEncodedBytesCount(f);
1798
+ n.notifyAfterRemoveMessage(h);
1901
1799
  }
1902
1800
  function u(l, f) {
1903
- const p = we(l), m = e.estimateEncodedBytesCount(p);
1801
+ const h = Ae(l), m = e.estimateEncodedBytesCount(h);
1904
1802
  if (m >= r) {
1905
1803
  y.warn(`Discarded a message whose size was bigger than the maximum allowed size ${r}KB. ${_t} ${pr}/#technical-limitations`);
1906
1804
  return;
1907
1805
  }
1908
- c(f) && a(f), i(p, m, f);
1806
+ c(f) && a(f), i(h, m, f);
1909
1807
  }
1910
1808
  function d(l) {
1911
1809
  const f = Be(o).join(`
1912
1810
  `);
1913
1811
  o = {};
1914
- const p = Ps(l.reason), m = p ? t.sendOnExit : t.send;
1915
- if (p && // Note: checking that the encoder is async is not strictly needed, but it's an optimization:
1812
+ const h = Ds(l.reason), m = h ? t.sendOnExit : t.send;
1813
+ if (h && // Note: checking that the encoder is async is not strictly needed, but it's an optimization:
1916
1814
  // if the encoder is async we need to send two requests in some cases (one for encoded data
1917
1815
  // and the other for non-encoded data). But if it's not async, we don't have to worry about
1918
1816
  // it and always send a single request.
1919
1817
  e.isAsync) {
1920
- const O = e.finishSync();
1921
- O.outputBytesCount && m(Yt(O));
1922
- const E = [O.pendingData, f].filter(Boolean).join(`
1818
+ const C = e.finishSync();
1819
+ C.outputBytesCount && m(qt(C));
1820
+ const E = [C.pendingData, f].filter(Boolean).join(`
1923
1821
  `);
1924
1822
  E && m({
1925
1823
  data: E,
@@ -1927,8 +1825,8 @@ ${l}`, (m) => {
1927
1825
  });
1928
1826
  } else
1929
1827
  f && e.write(e.isEmpty ? f : `
1930
- ${f}`), e.finish((O) => {
1931
- m(Yt(O));
1828
+ ${f}`), e.finish((C) => {
1829
+ m(qt(C));
1932
1830
  });
1933
1831
  }
1934
1832
  return {
@@ -1938,7 +1836,7 @@ ${f}`), e.finish((O) => {
1938
1836
  stop: s.unsubscribe
1939
1837
  };
1940
1838
  }
1941
- function Yt(e) {
1839
+ function qt(e) {
1942
1840
  let t;
1943
1841
  return typeof e.output == "string" ? t = e.output : t = new Blob([e.output], {
1944
1842
  // This will set the 'Content-Type: text/plain' header. Reasoning:
@@ -1954,7 +1852,7 @@ function Yt(e) {
1954
1852
  encoding: e.encoding
1955
1853
  };
1956
1854
  }
1957
- function Jn({ messagesLimit: e, bytesLimit: t, durationLimit: n, pageMayExitObservable: r, sessionExpireObservable: o }) {
1855
+ function Xn({ messagesLimit: e, bytesLimit: t, durationLimit: n, pageMayExitObservable: r, sessionExpireObservable: o }) {
1958
1856
  const s = r.subscribe((m) => d(m.reason)), i = o.subscribe(() => d("session_expire")), c = new S(() => () => {
1959
1857
  s.unsubscribe(), i.unsubscribe();
1960
1858
  });
@@ -1962,20 +1860,20 @@ function Jn({ messagesLimit: e, bytesLimit: t, durationLimit: n, pageMayExitObse
1962
1860
  function d(m) {
1963
1861
  if (u === 0)
1964
1862
  return;
1965
- const O = u, E = a;
1966
- u = 0, a = 0, p(), c.notify({
1863
+ const C = u, E = a;
1864
+ u = 0, a = 0, h(), c.notify({
1967
1865
  reason: m,
1968
- messagesCount: O,
1866
+ messagesCount: C,
1969
1867
  bytesCount: E
1970
1868
  });
1971
1869
  }
1972
1870
  let l;
1973
1871
  function f() {
1974
- l === void 0 && (l = ve(() => {
1872
+ l === void 0 && (l = we(() => {
1975
1873
  d("duration_limit");
1976
1874
  }, n));
1977
1875
  }
1978
- function p() {
1876
+ function h() {
1979
1877
  dn(l), l = void 0;
1980
1878
  }
1981
1879
  return {
@@ -2018,12 +1916,12 @@ function Jn({ messagesLimit: e, bytesLimit: t, durationLimit: n, pageMayExitObse
2018
1916
  * `notifyAfterAddMessage`.
2019
1917
  */
2020
1918
  notifyAfterRemoveMessage(m) {
2021
- a -= m, u -= 1, u === 0 && p();
1919
+ a -= m, u -= 1, u === 0 && h();
2022
1920
  }
2023
1921
  };
2024
1922
  }
2025
- const he = "DISCARDED", te = "SKIPPED";
2026
- function Ds() {
1923
+ const me = "DISCARDED", ne = "SKIPPED";
1924
+ function Ms() {
2027
1925
  const e = {};
2028
1926
  return {
2029
1927
  register(t, n) {
@@ -2037,103 +1935,103 @@ function Ds() {
2037
1935
  const r = e[t] || [], o = [];
2038
1936
  for (const s of r) {
2039
1937
  const i = s(n);
2040
- if (i === he)
2041
- return he;
2042
- i !== te && o.push(i);
1938
+ if (i === me)
1939
+ return me;
1940
+ i !== ne && o.push(i);
2043
1941
  }
2044
- return ee(...o);
1942
+ return te(...o);
2045
1943
  }
2046
1944
  };
2047
1945
  }
2048
- const X = {
1946
+ const J = {
2049
1947
  LOG: "log",
2050
1948
  CONFIGURATION: "configuration",
2051
1949
  USAGE: "usage"
2052
- }, Ms = [
1950
+ }, $s = [
2053
1951
  "https://www.datadoghq-browser-agent.com",
2054
1952
  "https://www.datad0g-browser-agent.com",
2055
1953
  "https://d3uc069fcn7uxw.cloudfront.net",
2056
1954
  "https://d20xtzwzcl0ceb.cloudfront.net",
2057
1955
  "http://localhost",
2058
1956
  "<anonymous>"
2059
- ], $s = 1, Fs = [bo];
1957
+ ], Fs = 1, Hs = [yo];
2060
1958
  let ct;
2061
- function Ae() {
2062
- return ct || (ct = new hn(100)), ct;
1959
+ function Re() {
1960
+ return ct || (ct = new pn(100)), ct;
2063
1961
  }
2064
- function Hs(e, t, n, r, o, s) {
2065
- const i = new S(), { stop: c } = Gs(t, r, o, s, i), { enabled: a, metricsEnabled: u } = Bs(e, t, n, i);
1962
+ function Bs(e, t, n, r, o, s) {
1963
+ const i = new S(), { stop: c } = Ks(t, r, o, s, i), { enabled: a, metricsEnabled: u } = Gs(e, t, n, i);
2066
1964
  return {
2067
1965
  stop: c,
2068
1966
  enabled: a,
2069
1967
  metricsEnabled: u
2070
1968
  };
2071
1969
  }
2072
- function Bs(e, t, n, r, o = $s) {
2073
- const s = {}, i = !Fs.includes(t.site) && Se(t.telemetrySampleRate), c = {
2074
- [X.LOG]: i,
2075
- [X.CONFIGURATION]: i && Se(t.telemetryConfigurationSampleRate),
2076
- [X.USAGE]: i && Se(t.telemetryUsageSampleRate),
1970
+ function Gs(e, t, n, r, o = Fs) {
1971
+ const s = {}, i = !Hs.includes(t.site) && _e(t.telemetrySampleRate), c = {
1972
+ [J.LOG]: i,
1973
+ [J.CONFIGURATION]: i && _e(t.telemetryConfigurationSampleRate),
1974
+ [J.USAGE]: i && _e(t.telemetryUsageSampleRate),
2077
1975
  // not an actual "type" but using a single draw for all metrics
2078
- metric: i && Se(o)
2079
- }, a = Ks(), u = Ae();
1976
+ metric: i && _e(o)
1977
+ }, a = js(), u = Re();
2080
1978
  return u.subscribe(({ rawEvent: l, metricName: f }) => {
2081
1979
  if (f && !c.metric || !c[l.type])
2082
1980
  return;
2083
- const p = f || l.status || l.type;
2084
- let m = s[p];
2085
- if (m || (m = s[p] = /* @__PURE__ */ new Set()), m.size >= t.maxTelemetryEventsPerPage)
1981
+ const h = f || l.status || l.type;
1982
+ let m = s[h];
1983
+ if (m || (m = s[h] = /* @__PURE__ */ new Set()), m.size >= t.maxTelemetryEventsPerPage)
2086
1984
  return;
2087
- const O = we(l);
2088
- if (m.has(O))
1985
+ const C = Ae(l);
1986
+ if (m.has(C))
2089
1987
  return;
2090
1988
  const E = n.triggerHook(1, {
2091
- startTime: k().relative
1989
+ startTime: N().relative
2092
1990
  });
2093
- if (E === he)
1991
+ if (E === me)
2094
1992
  return;
2095
1993
  const M = d(E, e, l, a);
2096
- r.notify(M), $n("telemetry", M), m.add(O);
2097
- }), u.unbuffer(), Tr(zs), {
1994
+ r.notify(M), $n("telemetry", M), m.add(C);
1995
+ }), u.unbuffer(), vr(Ys), {
2098
1996
  enabled: i,
2099
1997
  metricsEnabled: c.metric
2100
1998
  };
2101
- function d(l, f, p, m) {
1999
+ function d(l, f, h, m) {
2102
2000
  const E = {
2103
2001
  type: "telemetry",
2104
- date: k().timeStamp,
2002
+ date: N().timeStamp,
2105
2003
  service: f,
2106
2004
  version: "6.22.0",
2107
2005
  source: "browser",
2108
2006
  _dd: {
2109
2007
  format_version: 2
2110
2008
  },
2111
- telemetry: ee(p, {
2009
+ telemetry: te(h, {
2112
2010
  runtime_env: m,
2113
- connectivity: _s(),
2011
+ connectivity: Cs(),
2114
2012
  sdk_setup: "npm"
2115
2013
  }),
2116
2014
  ddtags: Dn(t).join(","),
2117
- experimental_features: Array.from(Po())
2015
+ experimental_features: Array.from(Do())
2118
2016
  };
2119
- return ee(E, l);
2017
+ return te(E, l);
2120
2018
  }
2121
2019
  }
2122
- function Gs(e, t, n, r, o) {
2020
+ function Ks(e, t, n, r, o) {
2123
2021
  const s = [];
2124
- if (ze()) {
2125
- const i = Nt(), c = o.subscribe((a) => i.send("internal_telemetry", a));
2022
+ if (Ve()) {
2023
+ const i = kt(), c = o.subscribe((a) => i.send("internal_telemetry", a));
2126
2024
  s.push(c.unsubscribe);
2127
2025
  } else {
2128
2026
  const i = [e.rumEndpointBuilder];
2129
- e.replica && js(e) && i.push(e.replica.rumEndpointBuilder);
2027
+ e.replica && Vs(e) && i.push(e.replica.rumEndpointBuilder);
2130
2028
  const c = Wn({
2131
2029
  encoder: r(
2132
2030
  4
2133
2031
  /* DeflateEncoderStreamId.TELEMETRY */
2134
2032
  ),
2135
2033
  request: qn(i, e.batchBytesLimit, t),
2136
- flushController: Jn({
2034
+ flushController: Xn({
2137
2035
  messagesLimit: e.batchMessagesLimit,
2138
2036
  bytesLimit: e.batchBytesLimit,
2139
2037
  durationLimit: e.flushTimeout,
@@ -2152,106 +2050,106 @@ function Gs(e, t, n, r, o) {
2152
2050
  stop: () => s.forEach((i) => i())
2153
2051
  };
2154
2052
  }
2155
- function Ks() {
2053
+ function js() {
2156
2054
  var e;
2157
2055
  return {
2158
2056
  is_local_file: ((e = I.location) === null || e === void 0 ? void 0 : e.protocol) === "file:",
2159
- is_worker: Q
2057
+ is_worker: ee
2160
2058
  };
2161
2059
  }
2162
- function js(e) {
2163
- return e.site === go;
2060
+ function Vs(e) {
2061
+ return e.site === Eo;
2164
2062
  }
2165
- function kt(e, t) {
2166
- mt(T.debug, e, t), Ae().notify({
2063
+ function Nt(e, t) {
2064
+ mt(T.debug, e, t), Re().notify({
2167
2065
  rawEvent: {
2168
- type: X.LOG,
2066
+ type: J.LOG,
2169
2067
  message: e,
2170
2068
  status: "debug",
2171
2069
  ...t
2172
2070
  }
2173
2071
  });
2174
2072
  }
2175
- function zs(e, t) {
2176
- Ae().notify({
2073
+ function Ys(e, t) {
2074
+ Re().notify({
2177
2075
  rawEvent: {
2178
- type: X.LOG,
2076
+ type: J.LOG,
2179
2077
  status: "error",
2180
- ...qs(e),
2078
+ ...Ws(e),
2181
2079
  ...t
2182
2080
  }
2183
2081
  });
2184
2082
  }
2185
- function Vs(e) {
2186
- Ae().notify({
2083
+ function zs(e) {
2084
+ Re().notify({
2187
2085
  rawEvent: {
2188
- type: X.CONFIGURATION,
2086
+ type: J.CONFIGURATION,
2189
2087
  configuration: e
2190
2088
  }
2191
2089
  });
2192
2090
  }
2193
- function Ys(e) {
2194
- Ae().notify({
2091
+ function qs(e) {
2092
+ Re().notify({
2195
2093
  rawEvent: {
2196
- type: X.USAGE,
2094
+ type: J.USAGE,
2197
2095
  usage: e
2198
2096
  }
2199
2097
  });
2200
2098
  }
2201
- function qs(e) {
2202
- if (ne(e)) {
2203
- const t = ge(e);
2099
+ function Ws(e) {
2100
+ if (re(e)) {
2101
+ const t = Ee(e);
2204
2102
  return {
2205
2103
  error: {
2206
2104
  kind: t.name,
2207
- stack: Ee(Ws(t))
2105
+ stack: be(Xs(t))
2208
2106
  },
2209
2107
  message: t.message
2210
2108
  };
2211
2109
  }
2212
2110
  return {
2213
2111
  error: {
2214
- stack: Nn
2112
+ stack: kn
2215
2113
  },
2216
- message: `Uncaught ${we(e)}`
2114
+ message: `Uncaught ${Ae(e)}`
2217
2115
  };
2218
2116
  }
2219
- function Ws(e) {
2220
- return e.stack = e.stack.filter((t) => !t.url || Ms.some((n) => t.url.startsWith(n))), e;
2117
+ function Xs(e) {
2118
+ return e.stack = e.stack.filter((t) => !t.url || $s.some((n) => t.url.startsWith(n))), e;
2221
2119
  }
2222
2120
  function Js(e) {
2223
2121
  const t = /* @__PURE__ */ new Set();
2224
2122
  return e.forEach((n) => t.add(n)), Array.from(t);
2225
2123
  }
2226
- function Xn(e, t) {
2124
+ function Jn(e, t) {
2227
2125
  const n = e.indexOf(t);
2228
2126
  n >= 0 && e.splice(n, 1);
2229
2127
  }
2230
- const Ne = 1 / 0, Xs = B;
2231
- let ye = null;
2232
- const De = /* @__PURE__ */ new Set();
2233
- function Zs() {
2234
- De.forEach((e) => e());
2128
+ const Ne = 1 / 0, Zs = B;
2129
+ let Se = null;
2130
+ const Me = /* @__PURE__ */ new Set();
2131
+ function Qs() {
2132
+ Me.forEach((e) => e());
2235
2133
  }
2236
- function Qs({ expireDelay: e, maxEntries: t }) {
2134
+ function ei({ expireDelay: e, maxEntries: t }) {
2237
2135
  let n = [];
2238
- ye || (ye = Tt(() => Zs(), Xs));
2136
+ Se || (Se = Tt(() => Qs(), Zs));
2239
2137
  const r = () => {
2240
2138
  const d = $e() - e;
2241
2139
  for (; n.length > 0 && n[n.length - 1].endTime < d; )
2242
2140
  n.pop();
2243
2141
  };
2244
- De.add(r);
2142
+ Me.add(r);
2245
2143
  function o(d, l) {
2246
2144
  const f = {
2247
2145
  value: d,
2248
2146
  startTime: l,
2249
2147
  endTime: Ne,
2250
2148
  remove: () => {
2251
- Xn(n, f);
2149
+ Jn(n, f);
2252
2150
  },
2253
- close: (p) => {
2254
- f.endTime = p;
2151
+ close: (h) => {
2152
+ f.endTime = h;
2255
2153
  }
2256
2154
  };
2257
2155
  return t && n.length >= t && n.pop(), n.unshift(f), f;
@@ -2269,50 +2167,50 @@ function Qs({ expireDelay: e, maxEntries: t }) {
2269
2167
  l && l.endTime === Ne && l.close(d);
2270
2168
  }
2271
2169
  function c(d = Ne, l = 0) {
2272
- const f = yr(d, l);
2273
- return n.filter((p) => p.startTime <= f && d <= p.endTime).map((p) => p.value);
2170
+ const f = Sr(d, l);
2171
+ return n.filter((h) => h.startTime <= f && d <= h.endTime).map((h) => h.value);
2274
2172
  }
2275
2173
  function a() {
2276
2174
  n = [];
2277
2175
  }
2278
2176
  function u() {
2279
- De.delete(r), De.size === 0 && ye && (fn(ye), ye = null);
2177
+ Me.delete(r), Me.size === 0 && Se && (fn(Se), Se = null);
2280
2178
  }
2281
2179
  return { add: o, find: s, closeActive: i, findAll: c, reset: a, stop: u };
2282
2180
  }
2283
- const ei = "datadog-synthetics-public-id", ti = "datadog-synthetics-result-id", ni = "datadog-synthetics-injects-rum";
2181
+ const ti = "datadog-synthetics-public-id", ni = "datadog-synthetics-result-id", ri = "datadog-synthetics-injects-rum";
2284
2182
  function Zn() {
2285
- return Q ? !1 : !!(I._DATADOG_SYNTHETICS_INJECTS_RUM || W(ni));
2286
- }
2287
- function ri() {
2288
- const e = window._DATADOG_SYNTHETICS_PUBLIC_ID || W(ei);
2289
- return typeof e == "string" ? e : void 0;
2183
+ return ee ? !1 : !!(I._DATADOG_SYNTHETICS_INJECTS_RUM || W(ri));
2290
2184
  }
2291
2185
  function oi() {
2292
- const e = window._DATADOG_SYNTHETICS_RESULT_ID || W(ti);
2186
+ const e = window._DATADOG_SYNTHETICS_PUBLIC_ID || W(ti);
2293
2187
  return typeof e == "string" ? e : void 0;
2294
2188
  }
2295
2189
  function si() {
2296
- return !!(ri() && oi());
2190
+ const e = window._DATADOG_SYNTHETICS_RESULT_ID || W(ni);
2191
+ return typeof e == "string" ? e : void 0;
2297
2192
  }
2298
- const ii = B, ci = wt;
2299
- function ai(e, t, n, r) {
2300
- const o = new S(), s = new S(), i = co(e.sessionStoreStrategyType, e, t, n), c = Qs({
2301
- expireDelay: ci
2193
+ function ii() {
2194
+ return !!(oi() && si());
2195
+ }
2196
+ const ci = B, ai = wt;
2197
+ function ui(e, t, n, r) {
2198
+ const o = new S(), s = new S(), i = ao(e.sessionStoreStrategyType, e, t, n), c = ei({
2199
+ expireDelay: ai
2302
2200
  });
2303
2201
  if (i.renewObservable.subscribe(() => {
2304
2202
  c.add(a(), $e()), o.notify();
2305
2203
  }), i.expireObservable.subscribe(() => {
2306
2204
  s.notify(), c.closeActive($e());
2307
- }), i.expandOrRenewSession(), c.add(a(), br().relative), Uo(Ge.SHORT_SESSION_INVESTIGATION)) {
2205
+ }), i.expandOrRenewSession(), c.add(a(), yr().relative), Po(Ge.SHORT_SESSION_INVESTIGATION)) {
2308
2206
  const u = i.getSession();
2309
2207
  u && pi(e, u);
2310
2208
  }
2311
2209
  r.observable.subscribe(() => {
2312
2210
  r.isGranted() ? i.expandOrRenewSession() : i.expire();
2313
- }), ui(e, () => {
2211
+ }), li(e, () => {
2314
2212
  r.isGranted() && i.expandOrRenewSession();
2315
- }), li(e, () => i.expandSession()), di(e, () => i.restartSession());
2213
+ }), di(e, () => i.expandSession()), fi(e, () => i.restartSession());
2316
2214
  function a() {
2317
2215
  const u = i.getSession();
2318
2216
  return u ? {
@@ -2320,7 +2218,7 @@ function ai(e, t, n, r) {
2320
2218
  trackingType: u[t],
2321
2219
  isReplayForced: !!u.forcedReplay,
2322
2220
  anonymousId: u.anonymousId
2323
- } : (fi().catch(() => {
2221
+ } : (hi().catch(() => {
2324
2222
  }), {
2325
2223
  id: "invalid",
2326
2224
  trackingType: yn,
@@ -2337,7 +2235,7 @@ function ai(e, t, n, r) {
2337
2235
  updateSessionState: i.updateSessionState
2338
2236
  };
2339
2237
  }
2340
- function ui(e, t) {
2238
+ function li(e, t) {
2341
2239
  const { stop: n } = Lt(e, window, [
2342
2240
  "click",
2343
2241
  "touchstart",
@@ -2346,20 +2244,20 @@ function ui(e, t) {
2346
2244
  /* DOM_EVENT.SCROLL */
2347
2245
  ], t, { capture: !0, passive: !0 });
2348
2246
  }
2349
- function li(e, t) {
2247
+ function di(e, t) {
2350
2248
  const n = () => {
2351
2249
  document.visibilityState === "visible" && t();
2352
- }, { stop: r } = re(e, document, "visibilitychange", n);
2353
- Tt(n, ii);
2250
+ }, { stop: r } = oe(e, document, "visibilitychange", n);
2251
+ Tt(n, ci);
2354
2252
  }
2355
- function di(e, t) {
2356
- const { stop: n } = re(e, window, "resume", t, { capture: !0 });
2253
+ function fi(e, t) {
2254
+ const { stop: n } = oe(e, window, "resume", t, { capture: !0 });
2357
2255
  }
2358
- async function fi() {
2359
- const e = Cn();
2360
- kt("Unexpected session state", {
2256
+ async function hi() {
2257
+ const e = vn();
2258
+ Nt("Unexpected session state", {
2361
2259
  session: e,
2362
- isSyntheticsTest: si(),
2260
+ isSyntheticsTest: ii(),
2363
2261
  createdTimestamp: e == null ? void 0 : e.created,
2364
2262
  expireTimestamp: e == null ? void 0 : e.expire,
2365
2263
  cookie: await Qn(),
@@ -2369,9 +2267,9 @@ async function fi() {
2369
2267
  function pi(e, t) {
2370
2268
  if (!window.cookieStore || !t.created)
2371
2269
  return;
2372
- const n = Number(t.created), r = $(), { stop: o } = re(e, cookieStore, "change", s);
2270
+ const n = Number(t.created), r = $(), { stop: o } = oe(e, cookieStore, "change", s);
2373
2271
  function s(i) {
2374
- const c = Dr(i.changed, (u) => u.name === H);
2272
+ const c = Mr(i.changed, (u) => u.name === H);
2375
2273
  if (!c)
2376
2274
  return;
2377
2275
  const a = $() - n;
@@ -2383,14 +2281,14 @@ function pi(e, t) {
2383
2281
  o();
2384
2282
  const d = $() - r;
2385
2283
  Qn().then((l) => {
2386
- kt("Session cookie changed", {
2284
+ Nt("Session cookie changed", {
2387
2285
  time: d,
2388
2286
  session_age: a,
2389
2287
  old: t,
2390
2288
  new: u,
2391
2289
  cookie: l
2392
2290
  });
2393
- }).catch(Ot);
2291
+ }).catch(Ct);
2394
2292
  }
2395
2293
  }
2396
2294
  }
@@ -2431,7 +2329,7 @@ function er() {
2431
2329
  }
2432
2330
  };
2433
2331
  }
2434
- class hi {
2332
+ class mi {
2435
2333
  constructor() {
2436
2334
  this.callbacks = {};
2437
2335
  }
@@ -2447,11 +2345,11 @@ class hi {
2447
2345
  };
2448
2346
  }
2449
2347
  }
2450
- function mi(e, t, n) {
2348
+ function gi(e, t, n) {
2451
2349
  let r = 0, o = !1;
2452
2350
  return {
2453
2351
  isLimitReached() {
2454
- if (r === 0 && ve(() => {
2352
+ if (r === 0 && we(() => {
2455
2353
  r = 0;
2456
2354
  }, B), r += 1, r <= t || o)
2457
2355
  return o = !1, !1;
@@ -2461,7 +2359,7 @@ function mi(e, t, n) {
2461
2359
  n({
2462
2360
  message: `Reached max number of ${e}s by minute: ${t}`,
2463
2361
  source: A.AGENT,
2464
- startClocks: k()
2362
+ startClocks: N()
2465
2363
  });
2466
2364
  } finally {
2467
2365
  o = !1;
@@ -2473,67 +2371,67 @@ function mi(e, t, n) {
2473
2371
  }
2474
2372
  let at;
2475
2373
  const Ut = /* @__PURE__ */ new WeakMap();
2476
- function gi(e) {
2477
- return at || (at = Ei(e)), at;
2478
- }
2479
2374
  function Ei(e) {
2375
+ return at || (at = bi(e)), at;
2376
+ }
2377
+ function bi(e) {
2480
2378
  return new S((t) => {
2481
- const { stop: n } = J(XMLHttpRequest.prototype, "open", bi), { stop: r } = J(XMLHttpRequest.prototype, "send", (s) => {
2482
- yi(s, e, t);
2483
- }, { computeHandlingStack: !0 }), { stop: o } = J(XMLHttpRequest.prototype, "abort", Si);
2379
+ const { stop: n } = X(XMLHttpRequest.prototype, "open", yi), { stop: r } = X(XMLHttpRequest.prototype, "send", (s) => {
2380
+ Si(s, e, t);
2381
+ }, { computeHandlingStack: !0 }), { stop: o } = X(XMLHttpRequest.prototype, "abort", _i);
2484
2382
  return () => {
2485
2383
  n(), r(), o();
2486
2384
  };
2487
2385
  });
2488
2386
  }
2489
- function bi({ target: e, parameters: [t, n] }) {
2387
+ function yi({ target: e, parameters: [t, n] }) {
2490
2388
  Ut.set(e, {
2491
2389
  state: "open",
2492
2390
  method: String(t).toUpperCase(),
2493
- url: Ct(String(n))
2391
+ url: vt(String(n))
2494
2392
  });
2495
2393
  }
2496
- function yi({ target: e, parameters: [t], handlingStack: n }, r, o) {
2394
+ function Si({ target: e, parameters: [t], handlingStack: n }, r, o) {
2497
2395
  const s = Ut.get(e);
2498
2396
  if (!s)
2499
2397
  return;
2500
2398
  const i = s;
2501
- i.state = "start", i.startClocks = k(), i.isAborted = !1, i.xhr = e, i.handlingStack = n, i.body = t;
2399
+ i.state = "start", i.startClocks = N(), i.isAborted = !1, i.xhr = e, i.handlingStack = n, i.body = t;
2502
2400
  let c = !1;
2503
- const { stop: a } = J(e, "onreadystatechange", () => {
2401
+ const { stop: a } = X(e, "onreadystatechange", () => {
2504
2402
  e.readyState === XMLHttpRequest.DONE && u();
2505
2403
  }), u = () => {
2506
2404
  if (d(), a(), c)
2507
2405
  return;
2508
2406
  c = !0;
2509
2407
  const l = s;
2510
- l.state = "complete", l.duration = on(i.startClocks.timeStamp, P()), l.status = e.status, o.notify(Or(l));
2511
- }, { stop: d } = re(r, e, "loadend", u);
2408
+ l.state = "complete", l.duration = on(i.startClocks.timeStamp, P()), l.status = e.status, o.notify(Tr(l));
2409
+ }, { stop: d } = oe(r, e, "loadend", u);
2512
2410
  o.notify(i);
2513
2411
  }
2514
- function Si({ target: e }) {
2412
+ function _i({ target: e }) {
2515
2413
  const t = Ut.get(e);
2516
2414
  t && (t.isAborted = !0);
2517
2415
  }
2518
2416
  let ut;
2519
2417
  function tr() {
2520
- return ut || (ut = _i()), ut;
2418
+ return ut || (ut = Ci()), ut;
2521
2419
  }
2522
- function _i() {
2420
+ function Ci() {
2523
2421
  return new S((e) => {
2524
2422
  if (!I.fetch)
2525
2423
  return;
2526
- const { stop: t } = J(I, "fetch", (n) => Oi(n, e), {
2424
+ const { stop: t } = X(I, "fetch", (n) => Ti(n, e), {
2527
2425
  computeHandlingStack: !0
2528
2426
  });
2529
2427
  return t;
2530
2428
  });
2531
2429
  }
2532
- function Oi({ parameters: e, onPostCall: t, handlingStack: n }, r) {
2430
+ function Ti({ parameters: e, onPostCall: t, handlingStack: n }, r) {
2533
2431
  const [o, s] = e;
2534
2432
  let i = s && s.method;
2535
2433
  i === void 0 && o instanceof Request && (i = o.method);
2536
- const c = i !== void 0 ? String(i).toUpperCase() : "GET", a = o instanceof Request ? o.url : Ct(String(o)), u = k(), d = {
2434
+ const c = i !== void 0 ? String(i).toUpperCase() : "GET", a = o instanceof Request ? o.url : vt(String(o)), u = N(), d = {
2537
2435
  state: "start",
2538
2436
  init: s,
2539
2437
  input: o,
@@ -2542,9 +2440,9 @@ function Oi({ parameters: e, onPostCall: t, handlingStack: n }, r) {
2542
2440
  url: a,
2543
2441
  handlingStack: n
2544
2442
  };
2545
- r.notify(d), e[0] = d.input, e[1] = d.init, t((l) => Ti(r, l, d));
2443
+ r.notify(d), e[0] = d.input, e[1] = d.init, t((l) => vi(r, l, d));
2546
2444
  }
2547
- function Ti(e, t, n) {
2445
+ function vi(e, t, n) {
2548
2446
  const r = n;
2549
2447
  function o(s) {
2550
2448
  r.state = "resolve", Object.assign(r, s), e.notify(r);
@@ -2566,31 +2464,31 @@ function Ti(e, t, n) {
2566
2464
  }));
2567
2465
  }
2568
2466
  let lt = {};
2569
- function Ci(e) {
2570
- const t = e.map((n) => (lt[n] || (lt[n] = vi(n)), lt[n]));
2571
- return pn(...t);
2467
+ function Oi(e) {
2468
+ const t = e.map((n) => (lt[n] || (lt[n] = wi(n)), lt[n]));
2469
+ return hn(...t);
2572
2470
  }
2573
- function vi(e) {
2471
+ function wi(e) {
2574
2472
  return new S((t) => {
2575
- const n = N[e];
2576
- return N[e] = (...r) => {
2473
+ const n = k[e];
2474
+ return k[e] = (...r) => {
2577
2475
  n.apply(console, r);
2578
- const o = Je("console error");
2579
- de(() => {
2580
- t.notify(wi(r, e, o));
2476
+ const o = Xe("console error");
2477
+ fe(() => {
2478
+ t.notify(Ai(r, e, o));
2581
2479
  });
2582
2480
  }, () => {
2583
- N[e] = n;
2481
+ k[e] = n;
2584
2482
  };
2585
2483
  });
2586
2484
  }
2587
- function wi(e, t, n) {
2588
- const r = e.map((o) => Ai(o)).join(" ");
2485
+ function Ai(e, t, n) {
2486
+ const r = e.map((o) => Ri(o)).join(" ");
2589
2487
  if (t === T.error) {
2590
- const o = e.find(ne), s = xt({
2488
+ const o = e.find(re), s = xt({
2591
2489
  originalError: o,
2592
2490
  handlingStack: n,
2593
- startClocks: k(),
2491
+ startClocks: N(),
2594
2492
  source: A.CONSOLE,
2595
2493
  handling: "handled",
2596
2494
  nonErrorPrefix: "Provided",
@@ -2613,43 +2511,43 @@ function wi(e, t, n) {
2613
2511
  handlingStack: n
2614
2512
  };
2615
2513
  }
2616
- function Ai(e) {
2617
- return typeof e == "string" ? U(e) : ne(e) ? Ln(ge(e)) : we(U(e), void 0, 2);
2514
+ function Ri(e) {
2515
+ return typeof e == "string" ? U(e) : re(e) ? Ln(Ee(e)) : Ae(U(e), void 0, 2);
2618
2516
  }
2619
- const Ri = 500;
2620
- function Ii() {
2517
+ const Ii = 500;
2518
+ function xi() {
2621
2519
  const e = [];
2622
2520
  return {
2623
2521
  add: (o) => {
2624
- e.push(o) > Ri && e.splice(0, 1);
2522
+ e.push(o) > Ii && e.splice(0, 1);
2625
2523
  },
2626
2524
  remove: (o) => {
2627
- Xn(e, o);
2525
+ Jn(e, o);
2628
2526
  },
2629
2527
  drain: (o) => {
2630
2528
  e.forEach((s) => s(o)), e.length = 0;
2631
2529
  }
2632
2530
  };
2633
2531
  }
2634
- function xi(e) {
2532
+ function Li(e) {
2635
2533
  const t = Rn(e) === "object";
2636
2534
  return t || y.error("Unsupported context:", e), t;
2637
2535
  }
2638
2536
  function dt(e, t, n) {
2639
2537
  const r = { ...e };
2640
2538
  for (const [o, { required: s, type: i }] of Object.entries(t))
2641
- i === "string" && !qt(r[o]) && (r[o] = String(r[o])), s && qt(r[o]) && y.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);
2539
+ i === "string" && !Wt(r[o]) && (r[o] = String(r[o])), s && Wt(r[o]) && y.warn(`The property ${o} of ${n} is required; context will not be sent to the intake.`);
2642
2540
  return r;
2643
2541
  }
2644
- function qt(e) {
2542
+ function Wt(e) {
2645
2543
  return e == null || e === "";
2646
2544
  }
2647
- function Xe(e = "", { propertiesConfig: t = {} } = {}) {
2545
+ function Je(e = "", { propertiesConfig: t = {} } = {}) {
2648
2546
  let n = {};
2649
2547
  const r = new S(), o = {
2650
2548
  getContext: () => Fn(n),
2651
2549
  setContext: (s) => {
2652
- xi(s) ? n = U(dt(s, t, e)) : o.clearContext(), r.notify();
2550
+ Li(s) ? n = U(dt(s, t, e)) : o.clearContext(), r.notify();
2653
2551
  },
2654
2552
  setContextProperty: (s, i) => {
2655
2553
  n = U(dt({ ...n, [s]: i }, t, e)), r.notify();
@@ -2664,7 +2562,7 @@ function Xe(e = "", { propertiesConfig: t = {} } = {}) {
2664
2562
  };
2665
2563
  return o;
2666
2564
  }
2667
- function v(e, t, n, r) {
2565
+ function O(e, t, n, r) {
2668
2566
  return b((...o) => e()[t][n](...o));
2669
2567
  }
2670
2568
  function ft(e, t, n) {
@@ -2673,13 +2571,13 @@ function ft(e, t, n) {
2673
2571
  n.add((o) => o[t].setContext(r));
2674
2572
  });
2675
2573
  }
2676
- const Li = "_dd_c", Ni = [];
2574
+ const ki = "_dd_c", Ni = [];
2677
2575
  function Pt(e, t, n, r) {
2678
- const o = ki(n, r);
2679
- Ni.push(re(e, window, "storage", ({ key: u }) => {
2576
+ const o = Ui(n, r);
2577
+ Ni.push(oe(e, window, "storage", ({ key: u }) => {
2680
2578
  o === u && i();
2681
2579
  })), t.changeObservable.subscribe(c);
2682
- const s = ee(a(), t.getContext());
2580
+ const s = te(a(), t.getContext());
2683
2581
  qe(s) || t.setContext(s);
2684
2582
  function i() {
2685
2583
  t.setContext(a());
@@ -2692,10 +2590,10 @@ function Pt(e, t, n, r) {
2692
2590
  return u ? JSON.parse(u) : {};
2693
2591
  }
2694
2592
  }
2695
- function ki(e, t) {
2696
- return `${Li}_${e}_${t}`;
2593
+ function Ui(e, t) {
2594
+ return `${ki}_${e}_${t}`;
2697
2595
  }
2698
- function Ui(e, t, n) {
2596
+ function Pi(e, t, n) {
2699
2597
  const r = nr();
2700
2598
  return t.storeContextsAcrossPages && Pt(
2701
2599
  t,
@@ -2705,20 +2603,20 @@ function Ui(e, t, n) {
2705
2603
  /* CustomerDataType.Account */
2706
2604
  ), e.register(0, () => {
2707
2605
  const o = r.getContext();
2708
- return qe(o) || !o.id ? te : {
2606
+ return qe(o) || !o.id ? ne : {
2709
2607
  account: o
2710
2608
  };
2711
2609
  }), r;
2712
2610
  }
2713
2611
  function nr() {
2714
- return Xe("account", {
2612
+ return Je("account", {
2715
2613
  propertiesConfig: {
2716
2614
  id: { type: "string", required: !0 },
2717
2615
  name: { type: "string" }
2718
2616
  }
2719
2617
  });
2720
2618
  }
2721
- function Pi(e, t, n, r) {
2619
+ function Di(e, t, n, r) {
2722
2620
  const o = rr();
2723
2621
  return t.storeContextsAcrossPages && Pt(
2724
2622
  t,
@@ -2729,9 +2627,9 @@ function Pi(e, t, n, r) {
2729
2627
  ), e.register(0, () => o.getContext()), o;
2730
2628
  }
2731
2629
  function rr() {
2732
- return Xe("global context");
2630
+ return Je("global context");
2733
2631
  }
2734
- function Di(e, t, n, r) {
2632
+ function Mi(e, t, n, r) {
2735
2633
  const o = or();
2736
2634
  return t.storeContextsAcrossPages && Pt(
2737
2635
  t,
@@ -2741,7 +2639,7 @@ function Di(e, t, n, r) {
2741
2639
  /* CustomerDataType.User */
2742
2640
  ), e.register(0, ({ eventType: s, startTime: i }) => {
2743
2641
  const c = o.getContext(), a = n.findTrackedSession(i);
2744
- return a && a.anonymousId && !c.anonymous_id && t.trackAnonymousUser && (c.anonymous_id = a.anonymousId), qe(c) ? te : {
2642
+ return a && a.anonymousId && !c.anonymous_id && t.trackAnonymousUser && (c.anonymous_id = a.anonymousId), qe(c) ? ne : {
2745
2643
  type: s,
2746
2644
  usr: c
2747
2645
  };
@@ -2753,7 +2651,7 @@ function Di(e, t, n, r) {
2753
2651
  }), o;
2754
2652
  }
2755
2653
  function or() {
2756
- return Xe("user", {
2654
+ return Je("user", {
2757
2655
  propertiesConfig: {
2758
2656
  id: { type: "string" },
2759
2657
  name: { type: "string" },
@@ -2761,7 +2659,7 @@ function or() {
2761
2659
  }
2762
2660
  });
2763
2661
  }
2764
- const C = {
2662
+ const v = {
2765
2663
  userContext: "userContext",
2766
2664
  globalContext: "globalContext",
2767
2665
  accountContext: "accountContext"
@@ -2772,7 +2670,7 @@ const C = {
2772
2670
  removeContextProperty: "removeContextProperty",
2773
2671
  clearContext: "clearContext"
2774
2672
  };
2775
- function Mi(e, t, n) {
2673
+ function $i(e, t, n) {
2776
2674
  const r = e.getReader(), o = [];
2777
2675
  let s = 0;
2778
2676
  i();
@@ -2808,15 +2706,15 @@ function Mi(e, t, n) {
2808
2706
  t(void 0, a, u);
2809
2707
  }
2810
2708
  }
2811
- const Wt = {
2709
+ const Xt = {
2812
2710
  XHR: "xhr",
2813
2711
  FETCH: "fetch"
2814
2712
  }, yt = {
2815
- FETCH: Wt.FETCH,
2816
- XHR: Wt.XHR
2817
- }, $i = 500;
2818
- function Fi(e = cs) {
2819
- const t = new hn($i), n = e().subscribe((r) => {
2713
+ FETCH: Xt.FETCH,
2714
+ XHR: Xt.XHR
2715
+ }, Fi = 500;
2716
+ function Hi(e = as) {
2717
+ const t = new pn(Fi), n = e().subscribe((r) => {
2820
2718
  t.notify({
2821
2719
  type: 0,
2822
2720
  error: r
@@ -2829,11 +2727,11 @@ function Fi(e = cs) {
2829
2727
  }
2830
2728
  };
2831
2729
  }
2832
- function Ve(e, t, n) {
2730
+ function Ye(e, t, n) {
2833
2731
  const r = n.getHandler(), o = Array.isArray(r) ? r : [r];
2834
2732
  return Jt[e] >= Jt[n.getLevel()] && o.includes(t);
2835
2733
  }
2836
- const h = {
2734
+ const p = {
2837
2735
  ok: "ok",
2838
2736
  debug: "debug",
2839
2737
  info: "info",
@@ -2844,15 +2742,15 @@ const h = {
2844
2742
  alert: "alert",
2845
2743
  emerg: "emerg"
2846
2744
  }, Jt = {
2847
- [h.ok]: 0,
2848
- [h.debug]: 1,
2849
- [h.info]: 2,
2850
- [h.notice]: 4,
2851
- [h.warn]: 5,
2852
- [h.error]: 6,
2853
- [h.critical]: 7,
2854
- [h.alert]: 8,
2855
- [h.emerg]: 9
2745
+ [p.ok]: 0,
2746
+ [p.debug]: 1,
2747
+ [p.info]: 2,
2748
+ [p.notice]: 4,
2749
+ [p.warn]: 5,
2750
+ [p.error]: 6,
2751
+ [p.critical]: 7,
2752
+ [p.alert]: 8,
2753
+ [p.emerg]: 9
2856
2754
  };
2857
2755
  function Ze(e, {
2858
2756
  /**
@@ -2870,21 +2768,21 @@ function Ze(e, {
2870
2768
  handling: e.handling
2871
2769
  };
2872
2770
  }
2873
- var Hi = function(e, t, n, r) {
2771
+ var Bi = function(e, t, n, r) {
2874
2772
  var o = arguments.length, s = o < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, i;
2875
2773
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") s = Reflect.decorate(e, t, n, r);
2876
2774
  else for (var c = e.length - 1; c >= 0; c--) (i = e[c]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, n, s) : i(t, n)) || s);
2877
2775
  return o > 3 && s && Object.defineProperty(t, n, s), s;
2878
2776
  };
2879
- const Te = {
2777
+ const ve = {
2880
2778
  console: "console",
2881
2779
  http: "http"
2882
- }, Bi = Object.keys(h);
2780
+ }, Gi = Object.keys(p);
2883
2781
  class R {
2884
- constructor(t, n, r = Te.http, o = h.debug, s = {}) {
2885
- this.handleLogStrategy = t, this.handlerType = r, this.level = o, this.contextManager = Xe("logger"), this.tags = [], this.contextManager.setContext(s), n && this.contextManager.setContextProperty("logger", { name: n });
2782
+ constructor(t, n, r = ve.http, o = p.debug, s = {}) {
2783
+ this.handleLogStrategy = t, this.handlerType = r, this.level = o, this.contextManager = Je("logger"), this.tags = [], this.contextManager.setContext(s), n && this.contextManager.setContextProperty("logger", { name: n });
2886
2784
  }
2887
- logImplementation(t, n, r = h.info, o, s) {
2785
+ logImplementation(t, n, r = p.info, o, s) {
2888
2786
  const i = U(n);
2889
2787
  let c;
2890
2788
  if (o != null) {
@@ -2893,9 +2791,9 @@ class R {
2893
2791
  nonErrorPrefix: "Provided",
2894
2792
  source: A.LOGGER,
2895
2793
  handling: "handled",
2896
- startClocks: k()
2794
+ startClocks: N()
2897
2795
  });
2898
- c = ee({
2796
+ c = te({
2899
2797
  error: Ze(a, { includeMessage: !0 })
2900
2798
  }, a.context, i);
2901
2799
  } else
@@ -2906,9 +2804,9 @@ class R {
2906
2804
  status: r
2907
2805
  }, this, s);
2908
2806
  }
2909
- log(t, n, r = h.info, o) {
2807
+ log(t, n, r = p.info, o) {
2910
2808
  let s;
2911
- Ve(r, Te.http, this) && (s = Je("log")), this.logImplementation(t, n, r, o, s);
2809
+ Ye(r, ve.http, this) && (s = Xe("log")), this.logImplementation(t, n, r, o, s);
2912
2810
  }
2913
2811
  setContext(t) {
2914
2812
  this.contextManager.setContext(t);
@@ -2948,46 +2846,46 @@ class R {
2948
2846
  return this.level;
2949
2847
  }
2950
2848
  }
2951
- Hi([
2952
- vr
2849
+ Bi([
2850
+ wr
2953
2851
  ], R.prototype, "logImplementation", null);
2954
- R.prototype.ok = D(h.ok);
2955
- R.prototype.debug = D(h.debug);
2956
- R.prototype.info = D(h.info);
2957
- R.prototype.notice = D(h.notice);
2958
- R.prototype.warn = D(h.warn);
2959
- R.prototype.error = D(h.error);
2960
- R.prototype.critical = D(h.critical);
2961
- R.prototype.alert = D(h.alert);
2962
- R.prototype.emerg = D(h.emerg);
2852
+ R.prototype.ok = D(p.ok);
2853
+ R.prototype.debug = D(p.debug);
2854
+ R.prototype.info = D(p.info);
2855
+ R.prototype.notice = D(p.notice);
2856
+ R.prototype.warn = D(p.warn);
2857
+ R.prototype.error = D(p.error);
2858
+ R.prototype.critical = D(p.critical);
2859
+ R.prototype.alert = D(p.alert);
2860
+ R.prototype.emerg = D(p.emerg);
2963
2861
  function D(e) {
2964
2862
  return function(t, n, r) {
2965
2863
  let o;
2966
- Ve(e, Te.http, this) && (o = Je("log")), this.logImplementation(t, n, e, r, o);
2864
+ Ye(e, ve.http, this) && (o = Xe("log")), this.logImplementation(t, n, e, r, o);
2967
2865
  };
2968
2866
  }
2969
- function Xt() {
2970
- return Q ? {} : {
2867
+ function Zt() {
2868
+ return ee ? {} : {
2971
2869
  view: {
2972
2870
  referrer: document.referrer,
2973
2871
  url: window.location.href
2974
2872
  }
2975
2873
  };
2976
2874
  }
2977
- const Gi = 32 * ue;
2978
- function Ki(e, t) {
2875
+ const Ki = 32 * le;
2876
+ function ji(e, t) {
2979
2877
  e.usePciIntake === !0 && e.site && e.site !== "datadoghq.com" && y.warn("PCI compliance for Logs is only available for Datadog organizations in the US1 site. Default intake will be used.");
2980
- const n = xo(e, t), r = Zt(e.forwardConsoleLogs, Be(T), "Forward Console Logs"), o = Zt(e.forwardReports, Be(Ke), "Forward Reports");
2878
+ const n = Lo(e, t), r = Qt(e.forwardConsoleLogs, Be(T), "Forward Console Logs"), o = Qt(e.forwardReports, Be(Ke), "Forward Reports");
2981
2879
  if (!(!n || !r || !o))
2982
2880
  return e.forwardErrorsToLogs && !r.includes(T.error) && r.push(T.error), {
2983
2881
  forwardErrorsToLogs: e.forwardErrorsToLogs !== !1,
2984
2882
  forwardConsoleLogs: r,
2985
2883
  forwardReports: o,
2986
- requestErrorResponseLengthLimit: Gi,
2884
+ requestErrorResponseLengthLimit: Ki,
2987
2885
  ...n
2988
2886
  };
2989
2887
  }
2990
- function Zt(e, t, n) {
2888
+ function Qt(e, t, n) {
2991
2889
  if (e === void 0)
2992
2890
  return [];
2993
2891
  if (!(e === "all" || Array.isArray(e) && e.every((r) => t.includes(r)))) {
@@ -2996,8 +2894,8 @@ function Zt(e, t, n) {
2996
2894
  }
2997
2895
  return e === "all" ? t : Js(e);
2998
2896
  }
2999
- function ji(e) {
3000
- const t = Lo(e);
2897
+ function Vi(e) {
2898
+ const t = ko(e);
3001
2899
  return {
3002
2900
  forward_errors_to_logs: e.forwardErrorsToLogs,
3003
2901
  forward_console_logs: e.forwardConsoleLogs,
@@ -3006,13 +2904,13 @@ function ji(e) {
3006
2904
  ...t
3007
2905
  };
3008
2906
  }
3009
- function zi(e, t, n) {
3010
- const r = Ii(), o = rr();
3011
- ft(o, C.globalContext, r);
2907
+ function Yi(e, t, n) {
2908
+ const r = xi(), o = rr();
2909
+ ft(o, v.globalContext, r);
3012
2910
  const s = nr();
3013
- ft(s, C.accountContext, r);
2911
+ ft(s, v.accountContext, r);
3014
2912
  const i = or();
3015
- ft(i, C.userContext, r);
2913
+ ft(i, v.userContext, r);
3016
2914
  let c, a;
3017
2915
  const u = t.observable.subscribe(d);
3018
2916
  function d() {
@@ -3028,12 +2926,12 @@ function zi(e, t, n) {
3028
2926
  y.error("Missing configuration");
3029
2927
  return;
3030
2928
  }
3031
- if (No(l.enableExperimentalFeatures), ze() && (l = Vi(l)), c = l, Vs(ji(l)), a) {
3032
- kn("DD_LOGS", l);
2929
+ if (No(l.enableExperimentalFeatures), Ve() && (l = zi(l)), c = l, zs(Vi(l)), a) {
2930
+ Nn("DD_LOGS", l);
3033
2931
  return;
3034
2932
  }
3035
- const p = Ki(l, f);
3036
- p && (a = p, tr().subscribe(F), t.tryToInit(p.trackingConsent), d());
2933
+ const h = ji(l, f);
2934
+ h && (a = h, tr().subscribe(F), t.tryToInit(h.trackingConsent), d());
3037
2935
  },
3038
2936
  get initConfiguration() {
3039
2937
  return c;
@@ -3042,63 +2940,63 @@ function zi(e, t, n) {
3042
2940
  accountContext: s,
3043
2941
  userContext: i,
3044
2942
  getInternalContext: F,
3045
- handleLog(l, f, p, m = e(), O = P()) {
3046
- r.add((E) => E.handleLog(l, f, p, m, O));
2943
+ handleLog(l, f, h, m = e(), C = P()) {
2944
+ r.add((E) => E.handleLog(l, f, h, m, C));
3047
2945
  }
3048
2946
  };
3049
2947
  }
3050
- function Vi(e) {
2948
+ function zi(e) {
3051
2949
  return { ...e, clientToken: "empty" };
3052
2950
  }
3053
- function Yi(e) {
3054
- const t = ao(), n = Fi().observable;
3055
- let r = zi(Xt, t, (c, a) => {
3056
- const u = e(a, Xt, t, n);
3057
- return r = qi(c, u), u;
2951
+ function qi(e) {
2952
+ const t = uo(), n = Hi().observable;
2953
+ let r = Yi(Zt, t, (c, a) => {
2954
+ const u = e(a, Zt, t, n);
2955
+ return r = Wi(c, u), u;
3058
2956
  });
3059
2957
  const o = () => r, s = {}, i = new R((...c) => r.handleLog(...c));
3060
- return ls({
2958
+ return ds({
3061
2959
  logger: i,
3062
2960
  init: (c) => {
3063
2961
  const a = new Error().stack;
3064
- de(() => r.init(c, a));
2962
+ fe(() => r.init(c, a));
3065
2963
  },
3066
2964
  setTrackingConsent: b((c) => {
3067
- t.update(c), Ys({ feature: "set-tracking-consent", tracking_consent: c });
2965
+ t.update(c), qs({ feature: "set-tracking-consent", tracking_consent: c });
3068
2966
  }),
3069
- getGlobalContext: v(o, C.globalContext, w.getContext),
3070
- setGlobalContext: v(o, C.globalContext, w.setContext),
3071
- setGlobalContextProperty: v(o, C.globalContext, w.setContextProperty),
3072
- removeGlobalContextProperty: v(o, C.globalContext, w.removeContextProperty),
3073
- clearGlobalContext: v(o, C.globalContext, w.clearContext),
2967
+ getGlobalContext: O(o, v.globalContext, w.getContext),
2968
+ setGlobalContext: O(o, v.globalContext, w.setContext),
2969
+ setGlobalContextProperty: O(o, v.globalContext, w.setContextProperty),
2970
+ removeGlobalContextProperty: O(o, v.globalContext, w.removeContextProperty),
2971
+ clearGlobalContext: O(o, v.globalContext, w.clearContext),
3074
2972
  createLogger: b((c, a = {}) => (s[c] = new R((...u) => r.handleLog(...u), U(c), a.handler, a.level, U(a.context)), s[c])),
3075
2973
  getLogger: b((c) => s[c]),
3076
2974
  getInitConfiguration: b(() => Fn(r.initConfiguration)),
3077
2975
  getInternalContext: b((c) => r.getInternalContext(c)),
3078
- setUser: v(o, C.userContext, w.setContext),
3079
- getUser: v(o, C.userContext, w.getContext),
3080
- setUserProperty: v(o, C.userContext, w.setContextProperty),
3081
- removeUserProperty: v(o, C.userContext, w.removeContextProperty),
3082
- clearUser: v(o, C.userContext, w.clearContext),
3083
- setAccount: v(o, C.accountContext, w.setContext),
3084
- getAccount: v(o, C.accountContext, w.getContext),
3085
- setAccountProperty: v(o, C.accountContext, w.setContextProperty),
3086
- removeAccountProperty: v(o, C.accountContext, w.removeContextProperty),
3087
- clearAccount: v(o, C.accountContext, w.clearContext)
2976
+ setUser: O(o, v.userContext, w.setContext),
2977
+ getUser: O(o, v.userContext, w.getContext),
2978
+ setUserProperty: O(o, v.userContext, w.setContextProperty),
2979
+ removeUserProperty: O(o, v.userContext, w.removeContextProperty),
2980
+ clearUser: O(o, v.userContext, w.clearContext),
2981
+ setAccount: O(o, v.accountContext, w.setContext),
2982
+ getAccount: O(o, v.accountContext, w.getContext),
2983
+ setAccountProperty: O(o, v.accountContext, w.setContextProperty),
2984
+ removeAccountProperty: O(o, v.accountContext, w.removeContextProperty),
2985
+ clearAccount: O(o, v.accountContext, w.clearContext)
3088
2986
  });
3089
2987
  }
3090
- function qi(e, t) {
2988
+ function Wi(e, t) {
3091
2989
  return {
3092
2990
  init: (n) => {
3093
- kn("DD_LOGS", n);
2991
+ Nn("DD_LOGS", n);
3094
2992
  },
3095
2993
  initConfiguration: e,
3096
2994
  ...t
3097
2995
  };
3098
2996
  }
3099
- const Wi = "logs";
2997
+ const Xi = "logs";
3100
2998
  function Ji(e, t) {
3101
- const n = ai(e, Wi, (r) => sr(e, r), t);
2999
+ const n = ui(e, Xi, (r) => sr(e, r), t);
3102
3000
  return {
3103
3001
  findTrackedSession: (r, o = { returnInactive: !1 }) => {
3104
3002
  const s = n.findSession(r, o);
@@ -3110,7 +3008,7 @@ function Ji(e, t) {
3110
3008
  expireObservable: n.expireObservable
3111
3009
  };
3112
3010
  }
3113
- function Xi(e) {
3011
+ function Zi(e) {
3114
3012
  const n = sr(e) === "1" ? {} : void 0;
3115
3013
  return {
3116
3014
  findTrackedSession: () => n,
@@ -3118,39 +3016,39 @@ function Xi(e) {
3118
3016
  };
3119
3017
  }
3120
3018
  function sr(e, t) {
3121
- return Zi(t) ? t : Se(e.sessionSampleRate) ? "1" : "0";
3019
+ return Qi(t) ? t : _e(e.sessionSampleRate) ? "1" : "0";
3122
3020
  }
3123
- function Zi(e) {
3021
+ function Qi(e) {
3124
3022
  return e === "0" || e === "1";
3125
3023
  }
3126
- function Qi(e, t, n, r, o) {
3127
- const s = Bi.concat(["custom"]), i = {};
3024
+ function ec(e, t, n, r, o) {
3025
+ const s = Gi.concat(["custom"]), i = {};
3128
3026
  s.forEach((c) => {
3129
- i[c] = mi(c, e.eventRateLimiterThreshold, o);
3027
+ i[c] = gi(c, e.eventRateLimiterThreshold, o);
3130
3028
  }), t.subscribe(0, ({ rawLogsEvent: c, messageContext: a = void 0, savedCommonContext: u = void 0, domainContext: d, ddtags: l = [] }) => {
3131
- var f, p;
3132
- const m = Sr(c.date), O = u || r(), E = n.triggerHook(0, {
3029
+ var f, h;
3030
+ const m = _r(c.date), C = u || r(), E = n.triggerHook(0, {
3133
3031
  startTime: m
3134
3032
  });
3135
- if (E === he)
3033
+ if (E === me)
3136
3034
  return;
3137
- const M = Dn(e), oe = ee({
3138
- view: O.view
3035
+ const M = Dn(e), se = te({
3036
+ view: C.view
3139
3037
  }, E, c, a, {
3140
3038
  ddtags: M.concat(l).join(",")
3141
3039
  });
3142
- ((f = e.beforeSend) === null || f === void 0 ? void 0 : f.call(e, oe, d)) === !1 || oe.origin !== A.AGENT && ((p = i[oe.status]) !== null && p !== void 0 ? p : i.custom).isLimitReached() || t.notify(1, oe);
3040
+ ((f = e.beforeSend) === null || f === void 0 ? void 0 : f.call(e, se, d)) === !1 || se.origin !== A.AGENT && ((h = i[se.status]) !== null && h !== void 0 ? h : i.custom).isLimitReached() || t.notify(1, se);
3143
3041
  });
3144
3042
  }
3145
- const ec = {
3146
- [T.log]: h.info,
3147
- [T.debug]: h.debug,
3148
- [T.info]: h.info,
3149
- [T.warn]: h.warn,
3150
- [T.error]: h.error
3043
+ const tc = {
3044
+ [T.log]: p.info,
3045
+ [T.debug]: p.debug,
3046
+ [T.info]: p.info,
3047
+ [T.warn]: p.warn,
3048
+ [T.error]: p.error
3151
3049
  };
3152
- function tc(e, t) {
3153
- const n = Ci(e.forwardConsoleLogs).subscribe((r) => {
3050
+ function nc(e, t) {
3051
+ const n = Oi(e.forwardConsoleLogs).subscribe((r) => {
3154
3052
  var o;
3155
3053
  const s = {
3156
3054
  rawLogsEvent: {
@@ -3158,7 +3056,7 @@ function tc(e, t) {
3158
3056
  message: r.message,
3159
3057
  origin: A.CONSOLE,
3160
3058
  error: r.error && Ze(r.error),
3161
- status: ec[r.api]
3059
+ status: tc[r.api]
3162
3060
  },
3163
3061
  messageContext: (o = r.error) === null || o === void 0 ? void 0 : o.context,
3164
3062
  domainContext: {
@@ -3173,11 +3071,11 @@ function tc(e, t) {
3173
3071
  }
3174
3072
  };
3175
3073
  }
3176
- function nc(e, t) {
3177
- const n = fs(e, e.forwardReports).subscribe((r) => {
3074
+ function rc(e, t) {
3075
+ const n = hs(e, e.forwardReports).subscribe((r) => {
3178
3076
  let o = r.message, s;
3179
- const i = r.originalError.type === "deprecation" ? h.warn : h.error;
3180
- i === h.error ? s = Ze(r) : r.stack && (o += ` Found in ${ss(r.stack)}`), t.notify(0, {
3077
+ const i = r.originalError.type === "deprecation" ? p.warn : p.error;
3078
+ i === p.error ? s = Ze(r) : r.stack && (o += ` Found in ${is(r.stack)}`), t.notify(0, {
3181
3079
  rawLogsEvent: {
3182
3080
  date: P(),
3183
3081
  message: o,
@@ -3193,16 +3091,16 @@ function nc(e, t) {
3193
3091
  }
3194
3092
  };
3195
3093
  }
3196
- function rc(e, t) {
3094
+ function oc(e, t) {
3197
3095
  if (!e.forwardErrorsToLogs)
3198
3096
  return { stop: F };
3199
- const n = (Q ? new S() : gi(e)).subscribe((s) => {
3097
+ const n = (ee ? new S() : Ei(e)).subscribe((s) => {
3200
3098
  s.state === "complete" && o(yt.XHR, s);
3201
3099
  }), r = tr().subscribe((s) => {
3202
3100
  s.state === "resolve" && o(yt.FETCH, s);
3203
3101
  });
3204
3102
  function o(s, i) {
3205
- !Ro(i.url) && (cc(i) || Hn(i.status)) && ("xhr" in i ? oc(i.xhr, e, c) : i.response ? ic(i.response, e, c) : i.error && sc(i.error, e, c));
3103
+ !Io(i.url) && (ac(i) || Hn(i.status)) && ("xhr" in i ? sc(i.xhr, e, c) : i.response ? cc(i.response, e, c) : i.error && ic(i.error, e, c));
3206
3104
  function c(a) {
3207
3105
  const u = {
3208
3106
  isAborted: i.isAborted,
@@ -3210,7 +3108,7 @@ function rc(e, t) {
3210
3108
  };
3211
3109
  t.notify(0, {
3212
3110
  rawLogsEvent: {
3213
- message: `${ac(s)} error ${i.method} ${i.url}`,
3111
+ message: `${uc(s)} error ${i.method} ${i.url}`,
3214
3112
  date: i.startClocks.timeStamp,
3215
3113
  error: {
3216
3114
  stack: a || "Failed to load",
@@ -3223,7 +3121,7 @@ function rc(e, t) {
3223
3121
  status_code: i.status,
3224
3122
  url: i.url
3225
3123
  },
3226
- status: h.error,
3124
+ status: p.error,
3227
3125
  origin: A.NETWORK
3228
3126
  },
3229
3127
  domainContext: u
@@ -3236,29 +3134,29 @@ function rc(e, t) {
3236
3134
  }
3237
3135
  };
3238
3136
  }
3239
- function oc(e, t, n) {
3240
- typeof e.response == "string" ? n(Dt(e.response, t)) : n(e.response);
3241
- }
3242
3137
  function sc(e, t, n) {
3243
- n(Dt(Ee(ge(e)), t));
3138
+ typeof e.response == "string" ? n(Dt(e.response, t)) : n(e.response);
3244
3139
  }
3245
3140
  function ic(e, t, n) {
3246
- const r = Os(e);
3247
- !r || !r.body ? n() : window.TextDecoder ? uc(r.body, t.requestErrorResponseLengthLimit, (o, s) => {
3141
+ n(Dt(be(Ee(e)), t));
3142
+ }
3143
+ function cc(e, t, n) {
3144
+ const r = Ts(e);
3145
+ !r || !r.body ? n() : window.TextDecoder ? lc(r.body, t.requestErrorResponseLengthLimit, (o, s) => {
3248
3146
  n(o ? `Unable to retrieve response: ${o}` : s);
3249
3147
  }) : r.text().then(b((o) => n(Dt(o, t))), b((o) => n(`Unable to retrieve response: ${o}`)));
3250
3148
  }
3251
- function cc(e) {
3149
+ function ac(e) {
3252
3150
  return e.status === 0 && e.responseType !== "opaque";
3253
3151
  }
3254
3152
  function Dt(e, t) {
3255
3153
  return e.length > t.requestErrorResponseLengthLimit ? `${e.substring(0, t.requestErrorResponseLengthLimit)}...` : e;
3256
3154
  }
3257
- function ac(e) {
3155
+ function uc(e) {
3258
3156
  return yt.XHR === e ? "XHR" : "Fetch";
3259
3157
  }
3260
- function uc(e, t, n) {
3261
- Mi(e, (r, o, s) => {
3158
+ function lc(e, t, n) {
3159
+ $i(e, (r, o, s) => {
3262
3160
  if (r)
3263
3161
  n(r);
3264
3162
  else {
@@ -3269,7 +3167,7 @@ function uc(e, t, n) {
3269
3167
  bytesLimit: t
3270
3168
  });
3271
3169
  }
3272
- function lc(e, t, n) {
3170
+ function dc(e, t, n) {
3273
3171
  if (!e.forwardErrorsToLogs)
3274
3172
  return { stop: F };
3275
3173
  const r = n.subscribe((o) => {
@@ -3281,7 +3179,7 @@ function lc(e, t, n) {
3281
3179
  date: s.startClocks.timeStamp,
3282
3180
  error: Ze(s),
3283
3181
  origin: A.SOURCE,
3284
- status: h.error
3182
+ status: p.error
3285
3183
  },
3286
3184
  messageContext: s.context
3287
3185
  });
@@ -3293,11 +3191,11 @@ function lc(e, t, n) {
3293
3191
  }
3294
3192
  };
3295
3193
  }
3296
- const dc = hi;
3297
- function fc(e) {
3194
+ const fc = mi;
3195
+ function hc(e) {
3298
3196
  function t(n, r, o, s, i) {
3299
- const c = ee(r.getContext(), n.context);
3300
- if (Ve(n.status, Te.console, r) && hc(n, c), Ve(n.status, Te.http, r)) {
3197
+ const c = te(r.getContext(), n.context);
3198
+ if (Ye(n.status, ve.console, r) && mc(n, c), Ye(n.status, ve.http, r)) {
3301
3199
  const a = {
3302
3200
  rawLogsEvent: {
3303
3201
  date: i || P(),
@@ -3317,26 +3215,26 @@ function fc(e) {
3317
3215
  };
3318
3216
  }
3319
3217
  const pc = {
3320
- [h.ok]: T.debug,
3321
- [h.debug]: T.debug,
3322
- [h.info]: T.info,
3323
- [h.notice]: T.info,
3324
- [h.warn]: T.warn,
3325
- [h.error]: T.error,
3326
- [h.critical]: T.error,
3327
- [h.alert]: T.error,
3328
- [h.emerg]: T.error
3218
+ [p.ok]: T.debug,
3219
+ [p.debug]: T.debug,
3220
+ [p.info]: T.info,
3221
+ [p.notice]: T.info,
3222
+ [p.warn]: T.warn,
3223
+ [p.error]: T.error,
3224
+ [p.critical]: T.error,
3225
+ [p.alert]: T.error,
3226
+ [p.emerg]: T.error
3329
3227
  };
3330
- function hc({ status: e, message: t }, n) {
3331
- j[pc[e]].call(N, t, n);
3228
+ function mc({ status: e, message: t }, n) {
3229
+ j[pc[e]].call(k, t, n);
3332
3230
  }
3333
- function mc(e, t, n, r, o) {
3231
+ function gc(e, t, n, r, o) {
3334
3232
  const s = [e.logsEndpointBuilder];
3335
3233
  e.replica && s.push(e.replica.logsEndpointBuilder);
3336
3234
  const i = Wn({
3337
3235
  encoder: er(),
3338
3236
  request: qn(s, e.batchBytesLimit, n),
3339
- flushController: Jn({
3237
+ flushController: Xn({
3340
3238
  messagesLimit: e.batchMessagesLimit,
3341
3239
  bytesLimit: e.batchBytesLimit,
3342
3240
  durationLimit: e.flushTimeout,
@@ -3349,13 +3247,13 @@ function mc(e, t, n, r, o) {
3349
3247
  i.add(c);
3350
3248
  }), i;
3351
3249
  }
3352
- function gc(e) {
3353
- const t = Nt();
3250
+ function Ec(e) {
3251
+ const t = kt();
3354
3252
  e.subscribe(1, (n) => {
3355
3253
  t.send("log", n);
3356
3254
  });
3357
3255
  }
3358
- function Ec(e) {
3256
+ function bc(e) {
3359
3257
  return {
3360
3258
  get: (t) => {
3361
3259
  const n = e.findTrackedSession(t);
@@ -3366,24 +3264,24 @@ function Ec(e) {
3366
3264
  }
3367
3265
  };
3368
3266
  }
3369
- function bc(e) {
3267
+ function yc(e) {
3370
3268
  return (t) => {
3371
3269
  e.notify(0, {
3372
3270
  rawLogsEvent: {
3373
3271
  message: t.message,
3374
3272
  date: t.startClocks.timeStamp,
3375
3273
  origin: A.AGENT,
3376
- status: h.error
3274
+ status: p.error
3377
3275
  }
3378
- }), kt("Error reported to customer", { "error.message": t.message });
3276
+ }), Nt("Error reported to customer", { "error.message": t.message });
3379
3277
  };
3380
3278
  }
3381
- const yc = Ds;
3382
- function Sc(e) {
3279
+ const Sc = Ms;
3280
+ function _c(e) {
3383
3281
  const t = I;
3384
3282
  e.register(0, ({ startTime: o }) => {
3385
3283
  const s = n(o);
3386
- return s || te;
3284
+ return s || ne;
3387
3285
  }), e.register(1, ({ startTime: o }) => {
3388
3286
  var s, i;
3389
3287
  const c = n(o);
@@ -3391,7 +3289,7 @@ function Sc(e) {
3391
3289
  application: { id: c.application_id },
3392
3290
  view: { id: (s = c.view) === null || s === void 0 ? void 0 : s.id },
3393
3291
  action: { id: (i = c.user_action) === null || i === void 0 ? void 0 : i.id }
3394
- } : te;
3292
+ } : ne;
3395
3293
  });
3396
3294
  function n(o) {
3397
3295
  const i = Zn() ? t.DD_RUM_SYNTHETICS : t.DD_RUM, c = r(o, i);
@@ -3403,68 +3301,82 @@ function Sc(e) {
3403
3301
  return s.getInternalContext(o);
3404
3302
  }
3405
3303
  }
3406
- function _c(e, t, n) {
3304
+ function Cc(e, t, n) {
3407
3305
  e.register(0, ({ startTime: r }) => {
3408
3306
  const o = n.findTrackedSession(r);
3409
3307
  return n.findTrackedSession(r, { returnInactive: !0 }) ? {
3410
3308
  service: t.service,
3411
3309
  session_id: o ? o.id : void 0,
3412
3310
  session: o ? { id: o.id } : void 0
3413
- } : he;
3311
+ } : me;
3414
3312
  }), e.register(1, ({ startTime: r }) => {
3415
3313
  const o = n.findTrackedSession(r);
3416
- return !o || !o.id ? te : {
3314
+ return !o || !o.id ? ne : {
3417
3315
  session: { id: o.id }
3418
3316
  };
3419
3317
  });
3420
3318
  }
3421
- function Oc(e, t) {
3319
+ function Tc(e, t) {
3422
3320
  function n() {
3423
- return t.isGranted() ? te : he;
3321
+ return t.isGranted() ? ne : me;
3424
3322
  }
3425
3323
  e.register(0, n), e.register(1, n);
3426
3324
  }
3427
- const pt = "logs";
3428
- function Tc(e, t, n, r) {
3429
- const o = new dc(), s = yc(), i = [];
3325
+ const ht = "logs";
3326
+ function vc(e, t, n, r) {
3327
+ const o = new fc(), s = Sc(), i = [];
3430
3328
  o.subscribe(1, (E) => $n("logs", E));
3431
- const c = bc(o), a = Q ? new S() : Us(e), u = Hs("browser-logs-sdk", e, s, c, a, er);
3329
+ const c = yc(o), a = ee ? new S() : Ps(e), u = Bs("browser-logs-sdk", e, s, c, a, er);
3432
3330
  i.push(u.stop);
3433
- const d = e.sessionStoreStrategyType && !ze() && !Zn() ? Ji(e, n) : Xi(e);
3434
- Oc(s, n), _c(s, e, d);
3435
- const l = Ui(s, e, pt), f = Di(s, e, d, pt), p = Pi(s, e, pt);
3436
- Sc(s), rc(e, o), lc(e, o, r), r.unbuffer(), tc(e, o), nc(e, o);
3437
- const { handleLog: m } = fc(o);
3438
- if (Qi(e, o, s, t, c), ze())
3439
- gc(o);
3331
+ const d = e.sessionStoreStrategyType && !Ve() && !Zn() ? Ji(e, n) : Zi(e);
3332
+ Tc(s, n), Cc(s, e, d);
3333
+ const l = Pi(s, e, ht), f = Mi(s, e, d, ht), h = Di(s, e, ht);
3334
+ _c(s), oc(e, o), dc(e, o, r), r.unbuffer(), nc(e, o), rc(e, o);
3335
+ const { handleLog: m } = hc(o);
3336
+ if (ec(e, o, s, t, c), Ve())
3337
+ Ec(o);
3440
3338
  else {
3441
- const { stop: E } = mc(e, o, c, a, d);
3339
+ const { stop: E } = gc(e, o, c, a, d);
3442
3340
  i.push(() => E());
3443
3341
  }
3444
- const O = Ec(d);
3342
+ const C = bc(d);
3445
3343
  return {
3446
3344
  handleLog: m,
3447
- getInternalContext: O.get,
3345
+ getInternalContext: C.get,
3448
3346
  accountContext: l,
3449
- globalContext: p,
3347
+ globalContext: h,
3450
3348
  userContext: f,
3451
3349
  stop: () => {
3452
3350
  i.forEach((E) => E());
3453
3351
  }
3454
3352
  };
3455
3353
  }
3456
- const Me = Yi(Tc);
3457
- ds(x(), "DD_LOGS", Me);
3458
- var Ce;
3354
+ const Z = qi(vc);
3355
+ fs(x(), "DD_LOGS", Z);
3356
+ var Oe;
3459
3357
  (function(e) {
3460
3358
  e.DEVELOPMENT = "development", e.PRODUCTION = "production", e.SANDBOX = "sandbox", e.PRELIVE_SANDBOX = "prelive-sandbox", e.PRELIVE_PRODUCTION = "prelive-production";
3461
- })(Ce || (Ce = {}));
3462
- class ae {
3359
+ })(Oe || (Oe = {}));
3360
+ class Mt {
3361
+ constructor(t) {
3362
+ this.context = t, this.logPrefix = "MONTONIO-JS";
3363
+ }
3364
+ info(t, n) {
3365
+ console.log(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.info(t, { context: this.context, ...n });
3366
+ }
3367
+ warn(t, n) {
3368
+ console.warn(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.warn(t, { context: this.context, ...n });
3369
+ }
3370
+ error(t, n) {
3371
+ console.error(`${this.logPrefix}, ${this.context}: ${t}`, ...n ? [n] : []), Z.logger.error(t, { context: this.context, ...n });
3372
+ }
3373
+ }
3374
+ class ue {
3463
3375
  constructor() {
3464
- this.initialized = !1, this.configService = q.instance;
3376
+ this.initialized = !1, this.logger = new Mt("LoggingService"), this.configService = q.instance;
3465
3377
  }
3466
3378
  static get instance() {
3467
- return ae._instance || (ae._instance = new ae()), ae._instance;
3379
+ return ue._instance || (ue._instance = new ue()), ue._instance;
3468
3380
  }
3469
3381
  /**
3470
3382
  * Initialize Datadog logging with the given environment and session UUID
@@ -3475,32 +3387,134 @@ class ae {
3475
3387
  initialize(t, n) {
3476
3388
  if (this.initialized) {
3477
3389
  try {
3478
- Me.setGlobalContextProperty("sessionUuid", n), console.log("MONTONIO-JS: LoggingService: Session UUID updated:", n);
3390
+ Z.setGlobalContextProperty("sessionUuid", n), this.logger.info(`Updated sessionUuid to [${n}]`, { sessionUuid: n });
3479
3391
  } catch (r) {
3480
- console.error("MONTONIO-JS: LoggingService: Error updating sessionUuid:", r);
3392
+ this.logger.error(`Error updating sessionUuid to [${n}]`, { error: r });
3481
3393
  }
3482
3394
  return;
3483
3395
  }
3484
3396
  try {
3485
3397
  const r = this.configService.getConfig("datadogClientToken");
3486
- Me.init({
3398
+ Z.init({
3487
3399
  clientToken: r,
3488
3400
  site: "datadoghq.eu",
3489
- env: t === Ce.PRODUCTION ? "live-production" : "live-sandbox",
3490
- forwardErrorsToLogs: !0,
3401
+ env: t === Oe.PRODUCTION ? "live-production" : "live-sandbox",
3491
3402
  service: "montonio-js",
3492
- version: "1.1.6",
3403
+ version: "1.1.7",
3493
3404
  silentMultipleInit: !0,
3494
- forwardConsoleLogs: "all"
3495
- }), Me.setGlobalContext({
3405
+ forwardErrorsToLogs: !1,
3406
+ forwardConsoleLogs: []
3407
+ }), Z.setGlobalContext({
3496
3408
  sessionUuid: n
3497
- }), this.initialized = !0;
3409
+ }), this.logger.info(`Set sessionUuid to [${n}]`, { sessionUuid: n }), this.initialized = !0;
3498
3410
  } catch (r) {
3499
- console.error("MONTONIO-JS: LoggingService: Error initializing Datadog Logs:", r);
3411
+ console.error("Error initializing Datadog logs", r);
3500
3412
  }
3501
3413
  }
3502
3414
  }
3503
3415
  class ir {
3416
+ constructor() {
3417
+ this.logger = new Mt("MessagingService"), this.subscriptions = /* @__PURE__ */ new Map(), this.setupMessageListener();
3418
+ }
3419
+ /**
3420
+ * Subscribe to messages of a specific type from a specific source iframe.
3421
+ * @param messageType The message type to listen for.
3422
+ * @param handler Handler function to call when the message is received.
3423
+ * @param iframe Iframe object to listen to.
3424
+ * @returns Subscription ID that can be used to unsubscribe.
3425
+ */
3426
+ subscribe(t, n, r) {
3427
+ if (this.subscriptions.has(t))
3428
+ throw new Error(`Subscription for '${t}' already exists`);
3429
+ this.subscriptions.set(t, {
3430
+ handler: n,
3431
+ sources: [r]
3432
+ });
3433
+ }
3434
+ /**
3435
+ * Add an iframe to an existing subscription
3436
+ */
3437
+ addIframeToSubscription(t, n) {
3438
+ const r = this.subscriptions.get(t);
3439
+ if (!r)
3440
+ throw new Error(`Subscription for '${t}' not found`);
3441
+ r.sources.includes(n) || r.sources.push(n);
3442
+ }
3443
+ /**
3444
+ * Wait for a specific message type from a specific source Iframe
3445
+ * @param messageType The message type to wait for
3446
+ * @param iframe Iframe object to listen to
3447
+ * @param timeout Timeout in milliseconds
3448
+ * @returns Promise that resolves when the message is received or rejects on timeout
3449
+ */
3450
+ waitForMessage(t, n, r = 3e4) {
3451
+ return new Promise((o, s) => {
3452
+ const i = setTimeout(() => {
3453
+ this.removeIframeFromSubscription(t, n), s(new Error(`Message ${t} timeout after ${r}ms`));
3454
+ }, r);
3455
+ this.subscribe(t, (c) => {
3456
+ clearTimeout(i), this.removeIframeFromSubscription(t, n), o(c);
3457
+ }, n);
3458
+ });
3459
+ }
3460
+ /**
3461
+ * Post a message to a specific iframe window
3462
+ */
3463
+ postMessage(t, n, r = "*") {
3464
+ t.getContentWindow().postMessage(n, r);
3465
+ }
3466
+ /**
3467
+ * Clear all subscriptions
3468
+ */
3469
+ clearAllSubscriptions() {
3470
+ this.subscriptions.clear();
3471
+ }
3472
+ /**
3473
+ * Clear all subscriptions except the ones in the except array
3474
+ */
3475
+ clearSubscriptionsExcept(t) {
3476
+ for (const n of [...this.subscriptions.keys()])
3477
+ t.includes(n) || this.subscriptions.delete(n);
3478
+ }
3479
+ /**
3480
+ * Remove an iframe from a subscription's sources
3481
+ */
3482
+ removeIframeFromSubscription(t, n) {
3483
+ const r = this.subscriptions.get(t);
3484
+ if (!r)
3485
+ throw new Error(`Subscription for '${t}' not found`);
3486
+ r.sources = r.sources.filter((o) => o !== n), r.sources.length === 0 && this.subscriptions.delete(t);
3487
+ }
3488
+ /**
3489
+ * Set up the message listener for capturing all window messages
3490
+ */
3491
+ setupMessageListener() {
3492
+ window.addEventListener("message", (t) => {
3493
+ try {
3494
+ if (!t.data || typeof t.data != "object" || !t.data.name)
3495
+ return;
3496
+ const n = t.data;
3497
+ this.subscriptions.forEach((r, o) => {
3498
+ if (!(o !== n.name || !r.sources.some((i) => {
3499
+ try {
3500
+ return i.getContentWindow() === t.source;
3501
+ } catch (c) {
3502
+ return this.logger.error("Failed to resolve contentWindow for source", { error: c }), !1;
3503
+ }
3504
+ })))
3505
+ try {
3506
+ r.handler(n);
3507
+ } catch (i) {
3508
+ this.logger.error("Error in message handler", { error: i });
3509
+ }
3510
+ });
3511
+ } catch (n) {
3512
+ this.logger.error("Error processing iframe message", { error: n });
3513
+ }
3514
+ });
3515
+ }
3516
+ }
3517
+ class cr {
3504
3518
  constructor(t) {
3505
3519
  var n;
3506
3520
  this.defaultStyles = {
@@ -3508,7 +3522,7 @@ class ir {
3508
3522
  display: "block",
3509
3523
  width: "100%",
3510
3524
  height: "100%"
3511
- }, this.options = t, this.resizeOnHeightChange = (n = t.resizeOnHeightChange) !== null && n !== void 0 ? n : !0, this.element = document.createElement("iframe"), this.messagingService = new tn(), this.setupIframe();
3525
+ }, this.options = t, this.resizeOnHeightChange = (n = t.resizeOnHeightChange) !== null && n !== void 0 ? n : !0, this.element = document.createElement("iframe"), this.messagingService = new ir(), this.setupIframe();
3512
3526
  }
3513
3527
  mount() {
3514
3528
  return this.options.mountElement.appendChild(this.element), this.resizeOnHeightChange && this.startResizing(this.element), this.element;
@@ -3539,9 +3553,9 @@ class ir {
3539
3553
  Object.assign(this.element.style, o);
3540
3554
  }
3541
3555
  }
3542
- class cr {
3556
+ class ar {
3543
3557
  constructor() {
3544
- this.loaded = !1, this.mountElement = null, this._iframe = null, this.messagingService = new tn(), this.httpService = se.instance, this.configService = q.instance;
3558
+ this.loaded = !1, this.mountElement = null, this._iframe = null, this.messagingService = new ir(), this.httpService = ie.instance, this.configService = q.instance;
3545
3559
  }
3546
3560
  get iframe() {
3547
3561
  if (!this._iframe)
@@ -3555,7 +3569,7 @@ class cr {
3555
3569
  this.iframe && (this.iframe.unmount(), this.iframe = null);
3556
3570
  }
3557
3571
  }
3558
- function Cc(e) {
3572
+ function Oc(e) {
3559
3573
  if (typeof e == "string") {
3560
3574
  const t = document.querySelector(e);
3561
3575
  if (!t || !(t instanceof HTMLElement))
@@ -3564,47 +3578,47 @@ function Cc(e) {
3564
3578
  }
3565
3579
  return e;
3566
3580
  }
3567
- function vc() {
3581
+ function wc() {
3568
3582
  const e = document.body.style.overflow || null;
3569
3583
  return document.body.style.overflow = "hidden", { originalOverflow: e };
3570
3584
  }
3571
- function wc(e) {
3585
+ function Ac(e) {
3572
3586
  e ? document.body.style.overflow = e : document.body.style.removeProperty("overflow");
3573
3587
  }
3574
- var Qt;
3588
+ var en;
3575
3589
  (function(e) {
3576
3590
  e.SCROLL_INTO_VIEW = "scrollIntoView";
3577
- })(Qt || (Qt = {}));
3578
- var Ye;
3591
+ })(en || (en = {}));
3592
+ var ze;
3579
3593
  (function(e) {
3580
3594
  e.EN = "en", e.ET = "et", e.LT = "lt", e.LV = "lv", e.PL = "pl", e.RU = "ru", e.FI = "fi";
3581
- })(Ye || (Ye = {}));
3582
- var en;
3595
+ })(ze || (ze = {}));
3596
+ var tn;
3583
3597
  (function(e) {
3584
3598
  e.PENDING = "PENDING", e.AUTHORIZED = "AUTHORIZED", e.PAID = "PAID", e.PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED", e.REFUNDED = "REFUNDED", e.VOIDED = "VOIDED", e.ABANDONED = "ABANDONED";
3585
- })(en || (en = {}));
3586
- const Ac = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3587
- function Rc(e) {
3599
+ })(tn || (tn = {}));
3600
+ const Rc = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3601
+ function Ic(e) {
3588
3602
  const t = [];
3589
3603
  if (!e)
3590
- throw new ht(["CheckoutOptions object is required"]);
3591
- if (e.sessionUuid === void 0 || e.sessionUuid === null ? t.push("sessionUuid is required") : typeof e.sessionUuid != "string" ? t.push("sessionUuid must be a string") : Ac.test(e.sessionUuid) || t.push(`sessionUuid must be a valid UUID format. Received: '${e.sessionUuid}'`), e.onSuccess ? typeof e.onSuccess != "function" && t.push("onSuccess must be a function") : t.push("onSuccess callback is required"), e.onError ? typeof e.onError != "function" && t.push("onError must be a function") : t.push("onError callback is required"), e.locale !== void 0 && e.locale !== null) {
3592
- const n = Object.values(Ye);
3604
+ throw new pt(["CheckoutOptions object is required"]);
3605
+ if (e.sessionUuid === void 0 || e.sessionUuid === null ? t.push("sessionUuid is required") : typeof e.sessionUuid != "string" ? t.push("sessionUuid must be a string") : Rc.test(e.sessionUuid) || t.push(`sessionUuid must be a valid UUID format. Received: '${e.sessionUuid}'`), e.onSuccess ? typeof e.onSuccess != "function" && t.push("onSuccess must be a function") : t.push("onSuccess callback is required"), e.onError ? typeof e.onError != "function" && t.push("onError must be a function") : t.push("onError callback is required"), e.locale !== void 0 && e.locale !== null) {
3606
+ const n = Object.values(ze);
3593
3607
  n.includes(e.locale) || t.push(`locale must be one of: ${n.join(", ")}. Received: '${e.locale}'`);
3594
3608
  }
3595
- if (e.environment !== void 0 && e.environment !== null && (Object.values(Ce).includes(e.environment) || t.push(`environment must be one of: production, sandbox. Received: '${e.environment}'`)), t.length > 0)
3596
- throw new ht(t);
3609
+ if (e.environment !== void 0 && e.environment !== null && (Object.values(Oe).includes(e.environment) || t.push(`environment must be one of: production, sandbox. Received: '${e.environment}'`)), t.length > 0)
3610
+ throw new pt(t);
3597
3611
  }
3598
- function Ic(e) {
3612
+ function xc(e) {
3599
3613
  const t = [];
3600
3614
  if (e.locale !== void 0 && e.locale !== null) {
3601
- const n = Object.values(Ye);
3615
+ const n = Object.values(ze);
3602
3616
  n.includes(e.locale) || t.push(`locale must be one of: ${n.join(", ")}. Received: '${e.locale}'`);
3603
3617
  }
3604
3618
  if (t.length > 0)
3605
- throw new ht(t);
3619
+ throw new pt(t);
3606
3620
  }
3607
- class xc extends cr {
3621
+ class Lc extends ar {
3608
3622
  constructor(t) {
3609
3623
  super(), this.originalBodyOverflow = null, this.options = t, this.mountElement = t.mountElement || document.body;
3610
3624
  }
@@ -3619,8 +3633,8 @@ class xc extends cr {
3619
3633
  }
3620
3634
  if (!this.options.paymentAuthData.embeddedUrl)
3621
3635
  throw new Error("Embedded URL is not set in paymentAuthData");
3622
- const { originalOverflow: t } = vc();
3623
- this.originalBodyOverflow = t, this.iframe = new ir({
3636
+ const { originalOverflow: t } = wc();
3637
+ this.originalBodyOverflow = t, this.iframe = new cr({
3624
3638
  src: this.options.paymentAuthData.embeddedUrl,
3625
3639
  mountElement: this.mountElement,
3626
3640
  styles: {
@@ -3646,7 +3660,7 @@ class xc extends cr {
3646
3660
  * Clean up the payment auth component and restore body overflow
3647
3661
  */
3648
3662
  cleanup() {
3649
- this.loaded && wc(this.originalBodyOverflow), super.cleanup();
3663
+ this.loaded && Ac(this.originalBodyOverflow), super.cleanup();
3650
3664
  }
3651
3665
  /**
3652
3666
  * Handle redirect-based payment auth
@@ -3663,9 +3677,9 @@ class xc extends cr {
3663
3677
  throw document.body.appendChild(n), n.submit(), await new Promise((r) => setTimeout(r, 3e4)), new Error("Redirect timeout: Expected redirect to occur within 30 seconds");
3664
3678
  }
3665
3679
  }
3666
- class Lc extends cr {
3680
+ class kc extends ar {
3667
3681
  constructor(t) {
3668
- super(), this.isValid = !1, this.paymentAuth = null, this.options = t, this.environment = t.environment || Ce.PRODUCTION, ae.instance.initialize(this.environment, this.options.sessionUuid), console.log("MONTONIO-JS: MontonioCheckout: class created with options:", t), Rc(t);
3682
+ super(), this.isValid = !1, this.logger = new Mt("MontonioCheckout"), this.paymentAuth = null, this.options = t, this.environment = t.environment || Oe.PRODUCTION, ue.instance.initialize(this.environment, this.options.sessionUuid), this.logger.info("Checkout created", t), Ic(t);
3669
3683
  }
3670
3684
  /**
3671
3685
  * Mount the checkout to the DOM
@@ -3673,14 +3687,14 @@ class Lc extends cr {
3673
3687
  */
3674
3688
  async initialize(t) {
3675
3689
  try {
3676
- console.log("MONTONIO-JS: initialize: Initializing MontonioCheckout with mountTo:", t), this.mountElement = Cc(t);
3690
+ this.logger.info(`Mounting checkout to [${t}]`), this.mountElement = Oc(t);
3677
3691
  const n = await this.fetchSession();
3678
- return this.iframe = new ir({
3692
+ return this.iframe = new cr({
3679
3693
  src: n.url,
3680
3694
  mountElement: this.mountElement
3681
- }), this.iframe.mount(), await this.messagingService.waitForMessage(_.CHECKOUT_PAYMENT_COMPONENT_READY, this.iframe), this.setUpListeners(), this.loaded = !0, console.log("MONTONIO-JS: initialize: MontonioCheckout initialized successfully"), !0;
3695
+ }), this.iframe.mount(), await this.messagingService.waitForMessage(_.CHECKOUT_PAYMENT_COMPONENT_READY, this.iframe), this.setUpListeners(), this.loaded = !0, this.logger.info(`Successfully mounted checkout to [${t}]`), !0;
3682
3696
  } catch (n) {
3683
- throw console.error("MONTONIO-JS: initialize: Error initializing MontonioCheckout:", n), this.cleanup(), n;
3697
+ throw this.logger.error(`Error mounting checkout to [${t}]`, { error: n }), this.cleanup(), n;
3684
3698
  }
3685
3699
  }
3686
3700
  /**
@@ -3688,9 +3702,9 @@ class Lc extends cr {
3688
3702
  * @param options - Updatable options
3689
3703
  */
3690
3704
  updateOptions(t) {
3691
- if (console.log("MONTONIO-JS: updateOptions: Updating options to:", t), !this.loaded)
3692
- throw new Mt();
3693
- Ic(t), t.locale !== void 0 && (this.options.locale = t.locale, this.messagingService.postMessage(this.iframe, {
3705
+ if (this.logger.info("Updating checkout options", t), !this.loaded)
3706
+ throw new $t();
3707
+ xc(t), t.locale !== void 0 && (this.options.locale = t.locale, this.messagingService.postMessage(this.iframe, {
3694
3708
  name: _.CHECKOUT_CHANGE_LOCALE,
3695
3709
  payload: { locale: t.locale }
3696
3710
  }));
@@ -3699,10 +3713,10 @@ class Lc extends cr {
3699
3713
  * Check the validity of the payment form. Throws an error if the payment form is invalid.
3700
3714
  */
3701
3715
  validateOrReject() {
3702
- if (console.log("MONTONIO-JS: validateOrReject: Called validateOrReject, isValid:", this.isValid), !this.isValid)
3716
+ if (!this.isValid)
3703
3717
  throw this.messagingService.postMessage(this.iframe, {
3704
3718
  name: _.CHECKOUT_VALIDATE_FIELDS
3705
- }), new $t();
3719
+ }), new Ft();
3706
3720
  }
3707
3721
  /**
3708
3722
  * Submit the payment. Call this after creating the Order with the Montonio backend API.
@@ -3710,7 +3724,7 @@ class Lc extends cr {
3710
3724
  */
3711
3725
  submitPayment() {
3712
3726
  if (!this.loaded)
3713
- throw new Mt();
3727
+ throw new $t();
3714
3728
  this.messagingService.postMessage(this.iframe, {
3715
3729
  name: _.CHECKOUT_SUBMIT_PAYMENT
3716
3730
  });
@@ -3720,13 +3734,13 @@ class Lc extends cr {
3720
3734
  */
3721
3735
  async fetchSession() {
3722
3736
  const n = `${this.configService.getConfig("stargateUrl", this.environment)}/api/sessions/${this.options.sessionUuid}/gateway-url${this.options.locale ? `?preferredLocale=${this.options.locale}` : ""}`;
3723
- return console.log("MONTONIO-JS: fetchSession: Fetching iframe URL from:", n), await this.httpService.get(n);
3737
+ return this.logger.info(`Fetching iframe URL from [${n}]`), await this.httpService.get(n);
3724
3738
  }
3725
3739
  /**
3726
3740
  * Set up global listeners for payment completion, failure, payment auth, and validation.
3727
3741
  */
3728
3742
  setUpListeners() {
3729
- console.log("MONTONIO-JS: setUpListeners: Setting up listeners"), this.setUpFormChangeListener(), this.setUpPaymentCompletedListener(), this.setUpPaymentFailedListener(), this.setUpValidationListener(), this.setUpActionRequiredListener(), this.setUpPaymentAuthListener(), this.setUpRedirectListener();
3743
+ this.logger.info("setUpListeners: Setting up listeners"), this.setUpFormChangeListener(), this.setUpPaymentCompletedListener(), this.setUpPaymentFailedListener(), this.setUpValidationListener(), this.setUpActionRequiredListener(), this.setUpPaymentAuthListener(), this.setUpRedirectListener();
3730
3744
  }
3731
3745
  setUpRedirectListener() {
3732
3746
  this.messagingService.subscribe(_.CHECKOUT_REDIRECT, (t) => {
@@ -3754,7 +3768,7 @@ class Lc extends cr {
3754
3768
  */
3755
3769
  setUpPaymentCompletedListener() {
3756
3770
  this.messagingService.subscribe(_.CHECKOUT_PAYMENT_COMPLETED, async (t) => {
3757
- console.log("MONTONIO-JS: CHECKOUT_PAYMENT_COMPLETED (from main iframe)", t), this.cleanupPaymentAuth();
3771
+ this.logger.info("Checkout payment completed", t), this.cleanupPaymentAuth();
3758
3772
  try {
3759
3773
  const n = await this.getPaymentResult(t.payload.paymentIntentUuid);
3760
3774
  this.handlePaymentSuccess(n);
@@ -3768,10 +3782,10 @@ class Lc extends cr {
3768
3782
  */
3769
3783
  setUpPaymentFailedListener() {
3770
3784
  this.messagingService.subscribe(_.CHECKOUT_PAYMENT_FAILED, (t) => {
3771
- console.error("MONTONIO-JS: CHECKOUT_PAYMENT_FAILED (from main iframe)", t), this.cleanupPaymentAuth(), this.messagingService.postMessage(this.iframe, {
3785
+ this.logger.warn("Checkout payment failed", t), this.cleanupPaymentAuth(), this.messagingService.postMessage(this.iframe, {
3772
3786
  name: _.CHECKOUT_SEND_PAYMENT_FAILED_DATA,
3773
3787
  payload: t.payload
3774
- }), this.handlePaymentError(new dr(t.payload));
3788
+ }), this.handlePaymentError(new fr(t.payload));
3775
3789
  }, this.iframe);
3776
3790
  }
3777
3791
  /**
@@ -3779,7 +3793,7 @@ class Lc extends cr {
3779
3793
  */
3780
3794
  setUpValidationListener() {
3781
3795
  this.messagingService.subscribe(_.CHECKOUT_VALIDATE_FIELDS_RESULT, (t) => {
3782
- console.log("MONTONIO-JS: CHECKOUT_VALIDATE_FIELDS_RESULT", t), t.payload.isValid || this.handlePaymentError(new $t());
3796
+ this.logger.info("Checkout validate fields result", t), t.payload.isValid || this.handlePaymentError(new Ft());
3783
3797
  }, this.iframe);
3784
3798
  }
3785
3799
  /**
@@ -3788,7 +3802,7 @@ class Lc extends cr {
3788
3802
  setUpPaymentAuthListener() {
3789
3803
  this.messagingService.subscribe(_.CHECKOUT_START_PAYMENT_AUTH, async (t) => {
3790
3804
  try {
3791
- console.log("MONTONIO-JS: PAYMENT_AUTH_STARTED", t), this.paymentAuth = new xc({
3805
+ this.logger.info("Payment auth started", t), this.paymentAuth = new Lc({
3792
3806
  paymentAuthData: t.payload.paymentAuthData
3793
3807
  }), await this.paymentAuth.initialize();
3794
3808
  const n = this.paymentAuth.iframe;
@@ -3807,7 +3821,7 @@ class Lc extends cr {
3807
3821
  let i = 0;
3808
3822
  for (; i < o; ) {
3809
3823
  try {
3810
- console.log("MONTONIO-JS: getPaymentResult: Fetching return URL from:", r);
3824
+ this.logger.info(`Fetching return URL from [${r}]`);
3811
3825
  const c = await this.httpService.get(r);
3812
3826
  if (i++, c != null && c.merchantReturnUrl)
3813
3827
  return {
@@ -3816,11 +3830,11 @@ class Lc extends cr {
3816
3830
  paymentStatus: c.paymentStatus
3817
3831
  };
3818
3832
  } catch (c) {
3819
- console.error("MONTONIO-JS: getPaymentResult: Error fetching return URL:", c);
3833
+ this.logger.error(`Error fetching return URL from [${r}]`, { error: c });
3820
3834
  }
3821
3835
  i < o && await new Promise((c) => setTimeout(c, s));
3822
3836
  }
3823
- throw new fr({ attempts: i });
3837
+ throw new hr({ attempts: i });
3824
3838
  }
3825
3839
  /**
3826
3840
  * Destroy the PaymentAuth component and remove it from success/failure subscriptions
@@ -3832,27 +3846,27 @@ class Lc extends cr {
3832
3846
  * Handle payment success - calls the onSuccess callback
3833
3847
  */
3834
3848
  handlePaymentSuccess(t) {
3835
- this.options.onSuccess(t), console.log("MONTONIO-JS: handlePaymentSuccess: onSuccess callback called with result:", t);
3849
+ this.options.onSuccess(t), this.logger.info("Triggered onSuccess callback", t);
3836
3850
  }
3837
3851
  /**
3838
3852
  * Handle payment error - calls the onError callback
3839
3853
  */
3840
3854
  handlePaymentError(t) {
3841
- this.options.onError(t), console.error("MONTONIO-JS: handlePaymentError: onError callback called with error:", t);
3855
+ this.options.onError(t), this.logger.warn("Triggered onError callback", { error: t });
3842
3856
  }
3843
3857
  /**
3844
3858
  * Handle action required - calls the optional onActionRequired callback
3845
3859
  */
3846
3860
  handleActionRequired(t) {
3847
- this.options.onActionRequired && (this.options.onActionRequired(t), console.log("MONTONIO-JS: handleActionRequired: onActionRequired callback called with payload:", t));
3861
+ this.options.onActionRequired && (this.options.onActionRequired(t), this.logger.info("Triggered onActionRequired callback", t));
3848
3862
  }
3849
3863
  }
3850
3864
  export {
3851
- Qt as ActionRequiredActionEnum,
3852
- Ce as Environment,
3853
- Z as ErrorEnum,
3854
- Ye as LocaleEnum,
3865
+ en as ActionRequiredActionEnum,
3866
+ Oe as Environment,
3867
+ Q as ErrorEnum,
3868
+ ze as LocaleEnum,
3855
3869
  _ as MessageTypeEnum,
3856
- Lc as MontonioCheckout
3870
+ kc as MontonioCheckout
3857
3871
  };
3858
3872
  //# sourceMappingURL=montonio.es.js.map