moonshot-rails 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -109,7 +109,7 @@ function d(e, t) {
109
109
  }(e);
110
110
  }
111
111
 
112
- function h(e) {
112
+ function f(e) {
113
113
  var t = function() {
114
114
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
115
115
  if (Reflect.construct.sham) return !1;
@@ -131,7 +131,7 @@ function h(e) {
131
131
  };
132
132
  }
133
133
 
134
- function f(e, t) {
134
+ function h(e, t) {
135
135
  return function(e) {
136
136
  if (Array.isArray(e)) return e;
137
137
  }(e) || function(e, t) {
@@ -227,125 +227,133 @@ function v(e, t) {
227
227
 
228
228
  var m = {
229
229
  DEBUG: !1,
230
- LIB_VERSION: "1.96.1"
231
- }, y = Array.isArray, b = Object.prototype, k = b.hasOwnProperty, w = b.toString, S = y || function(e) {
232
- return "[object Array]" === w.call(e);
230
+ LIB_VERSION: "1.111.0"
231
+ }, y = Array.isArray, b = Object.prototype, w = b.hasOwnProperty, k = b.toString, S = y || function(e) {
232
+ return "[object Array]" === k.call(e);
233
233
  }, F = function(e) {
234
- return "[object Uint8Array]" === w.call(e);
235
- }, P = function(e) {
234
+ return "[object Uint8Array]" === k.call(e);
235
+ }, R = function(e) {
236
236
  return "function" == typeof e;
237
- }, I = function(e) {
237
+ }, P = function(e) {
238
238
  return e === Object(e) && !S(e);
239
239
  }, x = function(e) {
240
- if (I(e)) {
241
- for (var t in e) if (k.call(e, t)) return !1;
242
- return !0;
243
- }
244
- return !1;
245
- }, R = function(e) {
246
240
  return void 0 === e;
247
241
  }, E = function(e) {
248
- return "[object String]" == w.call(e);
249
- }, C = function(e) {
242
+ return "[object String]" == k.call(e);
243
+ }, I = function(e) {
250
244
  return null === e;
251
- }, O = function(e) {
252
- return "[object Number]" == w.call(e);
245
+ }, C = function(e) {
246
+ return x(e) || I(e);
247
+ }, T = function(e) {
248
+ return "[object Number]" == k.call(e);
253
249
  }, $ = function(e) {
254
- return "[object Boolean]" === w.call(e);
255
- }, M = Array.prototype, T = M.forEach, A = M.indexOf, D = "undefined" != typeof window ? window : void 0, q = null == D ? void 0 : D.navigator, B = null == D ? void 0 : D.document, N = null == q ? void 0 : q.userAgent, L = null != D ? D : {}, j = "[PostHog.js]", H = {
250
+ return "[object Boolean]" === k.call(e);
251
+ }, O = function(e) {
252
+ return e instanceof FormData;
253
+ }, A = "undefined" != typeof window ? window : void 0, q = "undefined" != typeof globalThis ? globalThis : A, M = Array.prototype, D = M.forEach, N = M.indexOf, L = null == q ? void 0 : q.navigator, B = null == q ? void 0 : q.document, j = null == q ? void 0 : q.location, H = null == q ? void 0 : q.fetch, U = null == q ? void 0 : q.XMLHttpRequest, V = null == L ? void 0 : L.userAgent, W = null != A ? A : {}, z = "[PostHog.js]", G = {
256
254
  _log: function(e) {
257
- if (D && (m.DEBUG || L.POSTHOG_DEBUG) && !R(D.console) && D.console) {
258
- for (var t = ("__rrweb_original__" in D.console[e] ? D.console[e].__rrweb_original__ : D.console[e]), n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) r[i - 1] = arguments[i];
259
- t.apply(void 0, [ j ].concat(r));
255
+ if (A && (m.DEBUG || W.POSTHOG_DEBUG) && !x(A.console) && A.console) {
256
+ for (var t = ("__rrweb_original__" in A.console[e] ? A.console[e].__rrweb_original__ : A.console[e]), n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++) r[i - 1] = arguments[i];
257
+ t.apply(void 0, [ z ].concat(r));
260
258
  }
261
259
  },
262
260
  info: function() {
263
261
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
264
- H._log.apply(H, [ "log" ].concat(t));
262
+ G._log.apply(G, [ "log" ].concat(t));
265
263
  },
266
264
  warn: function() {
267
265
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
268
- H._log.apply(H, [ "warn" ].concat(t));
266
+ G._log.apply(G, [ "warn" ].concat(t));
269
267
  },
270
268
  error: function() {
271
269
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
272
- H._log.apply(H, [ "error" ].concat(t));
270
+ G._log.apply(G, [ "error" ].concat(t));
273
271
  },
274
272
  critical: function() {
275
273
  for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r];
276
- (e = console).error.apply(e, [ j ].concat(n));
274
+ (e = console).error.apply(e, [ z ].concat(n));
277
275
  },
278
276
  uninitializedWarning: function(e) {
279
- H.error("You must initialize PostHog before calling ".concat(e));
277
+ G.error("You must initialize PostHog before calling ".concat(e));
280
278
  }
281
- }, V = {}, U = function(e) {
279
+ }, Q = {}, Y = function(e) {
282
280
  return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
283
281
  };
284
282
 
285
- function W(e, t, n) {
286
- if (S(e)) if (T && e.forEach === T) e.forEach(t, n); else if ("length" in e && e.length === +e.length) for (var r = 0, i = e.length; r < i; r++) if (r in e && t.call(n, e[r], r) === V) return;
283
+ function J(e, t, n) {
284
+ if (S(e)) if (D && e.forEach === D) e.forEach(t, n); else if ("length" in e && e.length === +e.length) for (var r = 0, i = e.length; r < i; r++) if (r in e && t.call(n, e[r], r) === Q) return;
287
285
  }
288
286
 
289
- function G(e, t, n) {
290
- if (!C(e) && !R(e)) {
291
- if (S(e)) return W(e, t, n);
292
- for (var r in e) if (k.call(e, r) && t.call(n, e[r], r) === V) return;
287
+ function K(e, t, n) {
288
+ if (!C(e)) {
289
+ if (S(e)) return J(e, t, n);
290
+ if (O(e)) {
291
+ var r, i = v(e.entries());
292
+ try {
293
+ for (i.s(); !(r = i.n()).done; ) {
294
+ var o = r.value;
295
+ if (t.call(n, o[1], o[0]) === Q) return;
296
+ }
297
+ } catch (e) {
298
+ i.e(e);
299
+ } finally {
300
+ i.f();
301
+ }
302
+ } else for (var s in e) if (w.call(e, s) && t.call(n, e[s], s) === Q) return;
293
303
  }
294
304
  }
295
305
 
296
- var z = function(e) {
306
+ var X = function(e) {
297
307
  for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) n[r - 1] = arguments[r];
298
- return W(n, (function(t) {
308
+ return J(n, (function(t) {
299
309
  for (var n in t) void 0 !== t[n] && (e[n] = t[n]);
300
310
  })), e;
301
311
  };
302
312
 
303
- function Y(e, t) {
313
+ function Z(e, t) {
304
314
  return -1 !== e.indexOf(t);
305
315
  }
306
316
 
307
- function Q(e) {
317
+ function ee(e) {
308
318
  for (var t = Object.keys(e), n = t.length, r = new Array(n); n--; ) r[n] = [ t[n], e[t[n]] ];
309
319
  return r;
310
320
  }
311
321
 
312
- var J = function() {
322
+ var te = function() {
313
323
  return Date.now = Date.now || function() {
314
324
  return +new Date;
315
325
  }, Date.now();
316
- }, X = function(e) {
326
+ }, ne = function(e) {
317
327
  try {
318
328
  return e();
319
329
  } catch (e) {
320
330
  return;
321
331
  }
322
- }, K = function(e) {
332
+ }, re = function(e) {
323
333
  return function() {
324
334
  try {
325
335
  for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r];
326
336
  return e.apply(this, n);
327
337
  } catch (e) {
328
- H.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),
329
- H.critical(e);
338
+ G.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),
339
+ G.critical(e);
330
340
  }
331
341
  };
332
- }, Z = function(e) {
342
+ }, ie = function(e) {
333
343
  var t = {};
334
- return G(e, (function(e, n) {
344
+ return K(e, (function(e, n) {
335
345
  E(e) && e.length > 0 && (t[n] = e);
336
346
  })), t;
337
347
  };
338
348
 
339
- var ee = [ "$performance_raw" ];
340
-
341
- function te(e, t) {
342
- return n = e, r = function(e, n) {
343
- return n && ee.indexOf(n) > -1 ? e : E(e) && !C(t) ? e.slice(0, t) : e;
349
+ function oe(e, t) {
350
+ return n = e, r = function(e) {
351
+ return E(e) && !I(t) ? e.slice(0, t) : e;
344
352
  }, i = new Set, function e(t, n) {
345
353
  return t !== Object(t) ? r ? r(t, n) : t : i.has(t) ? void 0 : (i.add(t), S(t) ? (o = [],
346
- W(t, (function(t) {
354
+ J(t, (function(t) {
347
355
  o.push(e(t));
348
- }))) : (o = {}, G(t, (function(t, n) {
356
+ }))) : (o = {}, K(t, (function(t, n) {
349
357
  i.has(t) || (o[n] = e(t, n));
350
358
  }))), o);
351
359
  var o;
@@ -353,10 +361,10 @@ function te(e, t) {
353
361
  var n, r, i;
354
362
  }
355
363
 
356
- function ne(e) {
364
+ function se(e) {
357
365
  var t, n, r, i, o, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", a = 0, u = 0, l = "", c = [];
358
366
  if (!e) return e;
359
- e = re(e);
367
+ e = ae(e);
360
368
  do {
361
369
  t = (o = e.charCodeAt(a++) << 16 | e.charCodeAt(a++) << 8 | e.charCodeAt(a++)) >> 18 & 63,
362
370
  n = o >> 12 & 63, r = o >> 6 & 63, i = 63 & o, c[u++] = s.charAt(t) + s.charAt(n) + s.charAt(r) + s.charAt(i);
@@ -372,16 +380,16 @@ function ne(e) {
372
380
  return l;
373
381
  }
374
382
 
375
- var re = function(e) {
383
+ var ae = function(e) {
376
384
  var t, n, r, i, o = "";
377
385
  for (t = n = 0, r = (e = (e + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n")).length,
378
386
  i = 0; i < r; i++) {
379
387
  var s = e.charCodeAt(i), a = null;
380
388
  s < 128 ? n++ : a = s > 127 && s < 2048 ? String.fromCharCode(s >> 6 | 192, 63 & s | 128) : String.fromCharCode(s >> 12 | 224, s >> 6 & 63 | 128, 63 & s | 128),
381
- C(a) || (n > t && (o += e.substring(t, n)), o += a, t = n = i + 1);
389
+ I(a) || (n > t && (o += e.substring(t, n)), o += a, t = n = i + 1);
382
390
  }
383
391
  return n > t && (o += e.substring(t, e.length)), o;
384
- }, ie = function() {
392
+ }, ue = function() {
385
393
  function e(t) {
386
394
  return t && (t.preventDefault = e.preventDefault, t.stopPropagation = e.stopPropagation),
387
395
  t;
@@ -395,19 +403,19 @@ var re = function(e) {
395
403
  var s = "on" + n, a = t[s];
396
404
  t[s] = function(t, n, r) {
397
405
  return function(i) {
398
- if (i = i || e(null == D ? void 0 : D.event)) {
406
+ if (i = i || e(null == A ? void 0 : A.event)) {
399
407
  var o, s = !0;
400
- P(r) && (o = r(i));
408
+ R(r) && (o = r(i));
401
409
  var a = n.call(t, i);
402
410
  return !1 !== o && !1 !== a || (s = !1), s;
403
411
  }
404
412
  };
405
413
  }(t, r, a);
406
- } else H.error("No valid element provided to register_event");
414
+ } else G.error("No valid element provided to register_event");
407
415
  };
408
416
  }();
409
417
 
410
- function oe(e, t) {
418
+ function le(e, t) {
411
419
  var n = function() {
412
420
  if (!B) return t("document not found");
413
421
  var n = B.createElement("script");
@@ -422,11 +430,11 @@ function oe(e, t) {
422
430
  null != B && B.body ? n() : null == B || B.addEventListener("DOMContentLoaded", n);
423
431
  }
424
432
 
425
- function se(e) {
426
- return e ? U(e).split(/\s+/) : [];
433
+ function ce(e) {
434
+ return e ? Y(e).split(/\s+/) : [];
427
435
  }
428
436
 
429
- function ae(e) {
437
+ function de(e) {
430
438
  var t = "";
431
439
  switch (n(e.className)) {
432
440
  case "string":
@@ -440,40 +448,142 @@ function ae(e) {
440
448
  default:
441
449
  t = "";
442
450
  }
443
- return se(t);
451
+ return ce(t);
452
+ }
453
+
454
+ function fe(e) {
455
+ return C(e) ? null : Y(e).split(/(\s+)/).filter(Se).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255);
444
456
  }
445
457
 
446
- function ue(e) {
458
+ function he(e) {
447
459
  var t = "";
448
- return pe(e) && !_e(e) && e.childNodes && e.childNodes.length && G(e.childNodes, (function(e) {
449
- de(e) && e.textContent && (t += U(e.textContent).split(/(\s+)/).filter(ge).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255));
450
- })), U(t);
460
+ return we(e) && !ke(e) && e.childNodes && e.childNodes.length && K(e.childNodes, (function(e) {
461
+ var n;
462
+ ge(e) && e.textContent && (t += null !== (n = fe(e.textContent)) && void 0 !== n ? n : "");
463
+ })), Y(t);
451
464
  }
452
465
 
453
- function le(e) {
466
+ function pe(e) {
454
467
  return !!e && 1 === e.nodeType;
455
468
  }
456
469
 
457
- function ce(e, t) {
470
+ function _e(e, t) {
458
471
  return !!e && !!e.tagName && e.tagName.toLowerCase() === t.toLowerCase();
459
472
  }
460
473
 
461
- function de(e) {
474
+ function ge(e) {
462
475
  return !!e && 3 === e.nodeType;
463
476
  }
464
477
 
465
- function he(e) {
478
+ function ve(e) {
466
479
  return !!e && 11 === e.nodeType;
467
480
  }
468
481
 
469
- var fe = [ "a", "button", "form", "input", "select", "textarea", "label" ];
482
+ var me = [ "a", "button", "form", "input", "select", "textarea", "label" ];
470
483
 
471
- function pe(e) {
472
- for (var t = e; t.parentNode && !ce(t, "body"); t = t.parentNode) {
473
- var n = ae(t);
474
- if (Y(n, "ph-sensitive") || Y(n, "ph-no-capture")) return !1;
484
+ function ye(e) {
485
+ var t = e.parentNode;
486
+ return !(!t || !pe(t)) && t;
487
+ }
488
+
489
+ function be(e, t) {
490
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0, i = arguments.length > 3 ? arguments[3] : void 0, o = arguments.length > 4 ? arguments[4] : void 0;
491
+ if (!A || !e || _e(e, "html") || !pe(e)) return !1;
492
+ if (null != r && r.url_allowlist) {
493
+ var s = A.location.href, a = r.url_allowlist;
494
+ if (a && !a.some((function(e) {
495
+ return s.match(e);
496
+ }))) return !1;
497
+ }
498
+ if (null != r && r.dom_event_allowlist) {
499
+ var u = r.dom_event_allowlist;
500
+ if (u && !u.some((function(e) {
501
+ return t.type === e;
502
+ }))) return !1;
503
+ }
504
+ for (var l = !1, c = [ e ], d = !0, f = e; f.parentNode && !_e(f, "body"); ) if (ve(f.parentNode)) c.push(f.parentNode.host),
505
+ f = f.parentNode.host; else {
506
+ if (!(d = ye(f))) break;
507
+ if (i || me.indexOf(d.tagName.toLowerCase()) > -1) l = !0; else {
508
+ var h = A.getComputedStyle(d);
509
+ h && "pointer" === h.getPropertyValue("cursor") && (l = !0);
510
+ }
511
+ c.push(d), f = d;
512
+ }
513
+ if (!function(e, t) {
514
+ var r = null == t ? void 0 : t.element_allowlist;
515
+ if (x(r)) return !0;
516
+ var i, o = v(e);
517
+ try {
518
+ var s = function() {
519
+ var e = i.value;
520
+ if (r.some((function(t) {
521
+ return e.tagName.toLowerCase() === t;
522
+ }))) return {
523
+ v: !0
524
+ };
525
+ };
526
+ for (o.s(); !(i = o.n()).done; ) {
527
+ var a = s();
528
+ if ("object" === n(a)) return a.v;
529
+ }
530
+ } catch (e) {
531
+ o.e(e);
532
+ } finally {
533
+ o.f();
534
+ }
535
+ return !1;
536
+ }(c, r)) return !1;
537
+ if (!function(e, t) {
538
+ var r = null == t ? void 0 : t.css_selector_allowlist;
539
+ if (x(r)) return !0;
540
+ var i, o = v(e);
541
+ try {
542
+ var s = function() {
543
+ var e = i.value;
544
+ if (r.some((function(t) {
545
+ return e.matches(t);
546
+ }))) return {
547
+ v: !0
548
+ };
549
+ };
550
+ for (o.s(); !(i = o.n()).done; ) {
551
+ var a = s();
552
+ if ("object" === n(a)) return a.v;
553
+ }
554
+ } catch (e) {
555
+ o.e(e);
556
+ } finally {
557
+ o.f();
558
+ }
559
+ return !1;
560
+ }(c, r)) return !1;
561
+ var p = A.getComputedStyle(e);
562
+ if (p && "pointer" === p.getPropertyValue("cursor") && "click" === t.type) return !0;
563
+ var _ = e.tagName.toLowerCase();
564
+ switch (_) {
565
+ case "html":
566
+ return !1;
567
+
568
+ case "form":
569
+ return (o || [ "submit" ]).indexOf(t.type) >= 0;
570
+
571
+ case "input":
572
+ case "select":
573
+ case "textarea":
574
+ return (o || [ "change", "click" ]).indexOf(t.type) >= 0;
575
+
576
+ default:
577
+ return l ? (o || [ "click" ]).indexOf(t.type) >= 0 : (o || [ "click" ]).indexOf(t.type) >= 0 && (me.indexOf(_) > -1 || "true" === e.getAttribute("contenteditable"));
475
578
  }
476
- if (Y(ae(e), "ph-include")) return !0;
579
+ }
580
+
581
+ function we(e) {
582
+ for (var t = e; t.parentNode && !_e(t, "body"); t = t.parentNode) {
583
+ var n = de(t);
584
+ if (Z(n, "ph-sensitive") || Z(n, "ph-no-capture")) return !1;
585
+ }
586
+ if (Z(de(e), "ph-include")) return !0;
477
587
  var r = e.type || "";
478
588
  if (E(r)) switch (r.toLowerCase()) {
479
589
  case "hidden":
@@ -487,39 +597,39 @@ function pe(e) {
487
597
  return !0;
488
598
  }
489
599
 
490
- function _e(e) {
491
- return !!(ce(e, "input") && ![ "button", "checkbox", "submit", "reset" ].includes(e.type) || ce(e, "select") || ce(e, "textarea") || "true" === e.getAttribute("contenteditable"));
600
+ function ke(e) {
601
+ return !!(_e(e, "input") && ![ "button", "checkbox", "submit", "reset" ].includes(e.type) || _e(e, "select") || _e(e, "textarea") || "true" === e.getAttribute("contenteditable"));
492
602
  }
493
603
 
494
- function ge(e) {
495
- if (C(e) || R(e)) return !1;
604
+ function Se(e) {
605
+ if (C(e)) return !1;
496
606
  if (E(e)) {
497
- e = U(e);
607
+ e = Y(e);
498
608
  if (/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e || "").replace(/[- ]/g, ""))) return !1;
499
609
  if (/(^\d{3}-?\d{2}-?\d{4}$)/.test(e)) return !1;
500
610
  }
501
611
  return !0;
502
612
  }
503
613
 
504
- function ve(e) {
505
- var t = ue(e);
506
- return ge(t = "".concat(t, " ").concat(me(e)).trim()) ? t : "";
614
+ function Fe(e) {
615
+ var t = he(e);
616
+ return Se(t = "".concat(t, " ").concat(Re(e)).trim()) ? t : "";
507
617
  }
508
618
 
509
- function me(e) {
619
+ function Re(e) {
510
620
  var t = "";
511
- return e && e.childNodes && e.childNodes.length && G(e.childNodes, (function(e) {
621
+ return e && e.childNodes && e.childNodes.length && K(e.childNodes, (function(e) {
512
622
  var n;
513
623
  if (e && "span" === (null === (n = e.tagName) || void 0 === n ? void 0 : n.toLowerCase())) try {
514
- var r = ue(e);
515
- t = "".concat(t, " ").concat(r).trim(), e.childNodes && e.childNodes.length && (t = "".concat(t, " ").concat(me(e)).trim());
624
+ var r = he(e);
625
+ t = "".concat(t, " ").concat(r).trim(), e.childNodes && e.childNodes.length && (t = "".concat(t, " ").concat(Re(e)).trim());
516
626
  } catch (e) {
517
- H.error(e);
627
+ G.error(e);
518
628
  }
519
629
  })), t;
520
630
  }
521
631
 
522
- function ye(e) {
632
+ function Pe(e) {
523
633
  return function(e) {
524
634
  var n = e.map((function(e) {
525
635
  var n, r, i = "";
@@ -547,14 +657,14 @@ function ye(e) {
547
657
  } : {}), e.attr_id ? {
548
658
  attr_id: e.attr_id
549
659
  } : {}), e.attributes), l = {};
550
- return Q(u).sort((function(e, t) {
551
- var n = f(e, 1)[0], r = f(t, 1)[0];
660
+ return ee(u).sort((function(e, t) {
661
+ var n = h(e, 1)[0], r = h(t, 1)[0];
552
662
  return n.localeCompare(r);
553
663
  })).forEach((function(e) {
554
- var t = f(e, 2), n = t[0], r = t[1];
555
- return l[be(n.toString())] = be(r.toString());
556
- })), i += ":", i += Q(u).map((function(e) {
557
- var t = f(e, 2), n = t[0], r = t[1];
664
+ var t = h(e, 2), n = t[0], r = t[1];
665
+ return l[xe(n.toString())] = xe(r.toString());
666
+ })), i += ":", i += ee(u).map((function(e) {
667
+ var t = h(e, 2), n = t[0], r = t[1];
558
668
  return "".concat(n, '="').concat(r, '"');
559
669
  })).join("");
560
670
  }));
@@ -565,32 +675,32 @@ function ye(e) {
565
675
  text: null === (t = e.$el_text) || void 0 === t ? void 0 : t.slice(0, 400),
566
676
  tag_name: e.tag_name,
567
677
  href: null === (n = e.attr__href) || void 0 === n ? void 0 : n.slice(0, 2048),
568
- attr_class: ke(e),
678
+ attr_class: Ee(e),
569
679
  attr_id: e.attr__id,
570
680
  nth_child: e.nth_child,
571
681
  nth_of_type: e.nth_of_type,
572
682
  attributes: {}
573
683
  };
574
- return Q(e).filter((function(e) {
575
- return 0 === f(e, 1)[0].indexOf("attr__");
684
+ return ee(e).filter((function(e) {
685
+ return 0 === h(e, 1)[0].indexOf("attr__");
576
686
  })).forEach((function(e) {
577
- var t = f(e, 2), n = t[0], i = t[1];
687
+ var t = h(e, 2), n = t[0], i = t[1];
578
688
  return r.attributes[n] = i;
579
689
  })), r;
580
690
  }));
581
691
  }(e));
582
692
  }
583
693
 
584
- function be(e) {
694
+ function xe(e) {
585
695
  return e.replace(/"|\\"/g, '\\"');
586
696
  }
587
697
 
588
- function ke(e) {
698
+ function Ee(e) {
589
699
  var t = e.attr__class;
590
- return t ? S(t) ? t : se(t) : void 0;
700
+ return t ? S(t) ? t : ce(t) : void 0;
591
701
  }
592
702
 
593
- var we = function() {
703
+ var Ie = function() {
594
704
  function e(t) {
595
705
  r(this, e), this.clicks = [], this.enabled = t;
596
706
  }
@@ -613,18 +723,18 @@ var we = function() {
613
723
  return !1;
614
724
  }
615
725
  } ]), e;
616
- }(), Se = "$people_distinct_id", Fe = "__alias", Pe = "__timers", Ie = "$autocapture_disabled_server_side", xe = "$session_recording_enabled_server_side", Re = "$console_log_recording_enabled_server_side", Ee = "$session_recording_recorder_version_server_side", Ce = "$session_recording_network_payload_capture", Oe = "$sesid", $e = "$session_is_sampled", Me = "$enabled_feature_flags", Te = "$early_access_features", Ae = "$stored_person_properties", De = "$stored_group_properties", qe = "$surveys", Be = "$flag_call_reported", Ne = "$user_state", Le = "$posthog_quota_limited", je = "$client_session_props", He = [ Se, Fe, "__cmpns", Pe, xe, Oe, Me, Ne, Le, Te, De, Ae, qe, Be, je ];
726
+ }(), Ce = "$people_distinct_id", Te = "__alias", $e = "__timers", Oe = "$autocapture_disabled_server_side", Ae = "$session_recording_enabled_server_side", qe = "$console_log_recording_enabled_server_side", Me = "$session_recording_recorder_version_server_side", De = "$session_recording_network_payload_capture", Ne = "$session_recording_canvas_recording", Le = "$sesid", Be = "$session_is_sampled", je = "$enabled_feature_flags", He = "$early_access_features", Ue = "$stored_person_properties", Ve = "$stored_group_properties", We = "$surveys", ze = "$flag_call_reported", Ge = "$user_state", Qe = "$posthog_quota_limited", Ye = "$client_session_props", Je = [ Ce, Te, "__cmpns", $e, Ae, Le, je, Ge, Qe, He, Ve, Ue, We, ze, Ye ], Ke = "$copy_autocapture";
617
727
 
618
- function Ve(e, t) {
728
+ function Xe(e, t) {
619
729
  return t.length > e ? t.slice(0, e) + "..." : t;
620
730
  }
621
731
 
622
- var Ue = {
732
+ var Ze = {
623
733
  _initializedTokens: [],
624
734
  _isDisabledServerSide: null,
625
735
  _isAutocaptureEnabled: !1,
626
736
  _setIsAutocaptureEnabled: function(e) {
627
- var t, n = C(this._isDisabledServerSide) ? !(null === (t = e.persistence) || void 0 === t || !t.props[Ie]) : this._isDisabledServerSide, r = !!e.config.autocapture;
737
+ var t, n = I(this._isDisabledServerSide) ? !(null === (t = e.persistence) || void 0 === t || !t.props[Oe]) : this._isDisabledServerSide, r = !!e.config.autocapture;
628
738
  this._isAutocaptureEnabled = r && !n;
629
739
  },
630
740
  _previousElementSibling: function(e) {
@@ -632,16 +742,16 @@ var Ue = {
632
742
  var t = e;
633
743
  do {
634
744
  t = t.previousSibling;
635
- } while (t && !le(t));
745
+ } while (t && !pe(t));
636
746
  return t;
637
747
  },
638
748
  _getAugmentPropertiesFromElement: function(e) {
639
- if (!pe(e)) return {};
749
+ if (!we(e)) return {};
640
750
  var t = {};
641
- return G(e.attributes, (function(e) {
751
+ return K(e.attributes, (function(e) {
642
752
  if (0 === e.name.indexOf("data-ph-capture-attribute")) {
643
753
  var n = e.name.replace("data-ph-capture-attribute-", ""), r = e.value;
644
- n && r && ge(r) && (t[n] = r);
754
+ n && r && Se(r) && (t[n] = r);
645
755
  }
646
756
  })), t;
647
757
  },
@@ -649,18 +759,18 @@ var Ue = {
649
759
  var r, i = e.tagName.toLowerCase(), o = {
650
760
  tag_name: i
651
761
  };
652
- fe.indexOf(i) > -1 && !n && ("a" === i.toLowerCase() || "button" === i.toLowerCase() ? o.$el_text = Ve(1024, ve(e)) : o.$el_text = Ve(1024, ue(e)));
653
- var s = ae(e);
762
+ me.indexOf(i) > -1 && !n && ("a" === i.toLowerCase() || "button" === i.toLowerCase() ? o.$el_text = Xe(1024, Fe(e)) : o.$el_text = Xe(1024, he(e)));
763
+ var s = de(e);
654
764
  s.length > 0 && (o.classes = s.filter((function(e) {
655
765
  return "" !== e;
656
766
  })));
657
767
  var a = null === (r = this.config) || void 0 === r ? void 0 : r.element_attribute_ignorelist;
658
- G(e.attributes, (function(n) {
768
+ K(e.attributes, (function(n) {
659
769
  var r;
660
- if ((!_e(e) || -1 !== [ "name", "id", "class" ].indexOf(n.name)) && ((null == a || !a.includes(n.name)) && !t && ge(n.value) && (r = n.name,
770
+ if ((!ke(e) || -1 !== [ "name", "id", "class" ].indexOf(n.name)) && ((null == a || !a.includes(n.name)) && !t && Se(n.value) && (r = n.name,
661
771
  !E(r) || "_ngcontent" !== r.substring(0, 10) && "_nghost" !== r.substring(0, 7)))) {
662
772
  var i = n.value;
663
- "class" === n.name && (i = se(i).join(" ")), o["attr__" + n.name] = Ve(1024, i);
773
+ "class" === n.name && (i = ce(i).join(" ")), o["attr__" + n.name] = Xe(1024, i);
664
774
  }
665
775
  }));
666
776
  for (var u = 1, l = 1, c = e; c = this._previousElementSibling(c); ) u++, c.tagName === e.tagName && l++;
@@ -674,115 +784,71 @@ var Ue = {
674
784
  },
675
785
  _extractCustomPropertyValue: function(e) {
676
786
  var t = [];
677
- return G(null == B ? void 0 : B.querySelectorAll(e.css_selector), (function(e) {
787
+ return K(null == B ? void 0 : B.querySelectorAll(e.css_selector), (function(e) {
678
788
  var n;
679
789
  [ "input", "select" ].indexOf(e.tagName.toLowerCase()) > -1 ? n = e.value : e.textContent && (n = e.textContent),
680
- ge(n) && t.push(n);
790
+ Se(n) && t.push(n);
681
791
  })), t.join(", ");
682
792
  },
683
793
  _getCustomProperties: function(e) {
684
794
  var t = this, n = {};
685
- return G(this._customProperties, (function(r) {
686
- G(r.event_selectors, (function(i) {
687
- G(null == B ? void 0 : B.querySelectorAll(i), (function(i) {
688
- Y(e, i) && pe(i) && (n[r.name] = t._extractCustomPropertyValue(r));
795
+ return K(this._customProperties, (function(r) {
796
+ K(r.event_selectors, (function(i) {
797
+ K(null == B ? void 0 : B.querySelectorAll(i), (function(i) {
798
+ Z(e, i) && we(i) && (n[r.name] = t._extractCustomPropertyValue(r));
689
799
  }));
690
800
  }));
691
801
  })), n;
692
802
  },
693
803
  _getEventTarget: function(e) {
694
- return R(e.target) ? e.srcElement || null : null !== (t = e.target) && void 0 !== t && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
804
+ return x(e.target) ? e.srcElement || null : null !== (t = e.target) && void 0 !== t && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;
695
805
  var t;
696
806
  },
697
807
  _captureEvent: function(e, t) {
698
- var n, r = this, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "$autocapture", o = this._getEventTarget(e);
699
- (de(o) && (o = o.parentNode || null), "$autocapture" === i && "click" === e.type && e instanceof MouseEvent) && (null !== (n = this.rageclicks) && void 0 !== n && n.isRageClick(e.clientX, e.clientY, (new Date).getTime()) && this._captureEvent(e, t, "$rageclick"));
700
- if (o && function(e, t) {
701
- var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
702
- if (!D || !e || ce(e, "html") || !le(e)) return !1;
703
- if (null != n && n.url_allowlist) {
704
- var r = D.location.href, i = n.url_allowlist;
705
- if (i && !i.some((function(e) {
706
- return r.match(e);
707
- }))) return !1;
708
- }
709
- if (null != n && n.dom_event_allowlist) {
710
- var o = n.dom_event_allowlist;
711
- if (o && !o.some((function(e) {
712
- return t.type === e;
713
- }))) return !1;
714
- }
715
- if (null != n && n.element_allowlist) {
716
- var s = n.element_allowlist;
717
- if (s && !s.some((function(t) {
718
- return e.tagName.toLowerCase() === t;
719
- }))) return !1;
720
- }
721
- if (null != n && n.css_selector_allowlist) {
722
- var a = n.css_selector_allowlist;
723
- if (a && !a.some((function(t) {
724
- return e.matches(t);
725
- }))) return !1;
726
- }
727
- for (var u = !1, l = [ e ], c = !0, d = e; d.parentNode && !ce(d, "body"); ) if (he(d.parentNode)) l.push(d.parentNode.host),
728
- d = d.parentNode.host; else {
729
- if (!(c = d.parentNode || !1)) break;
730
- if (fe.indexOf(c.tagName.toLowerCase()) > -1) u = !0; else {
731
- var h = D.getComputedStyle(c);
732
- h && "pointer" === h.getPropertyValue("cursor") && (u = !0);
733
- }
734
- l.push(c), d = c;
735
- }
736
- var f = D.getComputedStyle(e);
737
- if (f && "pointer" === f.getPropertyValue("cursor") && "click" === t.type) return !0;
738
- var p = e.tagName.toLowerCase();
739
- switch (p) {
740
- case "html":
741
- return !1;
742
-
743
- case "form":
744
- return "submit" === t.type;
745
-
746
- case "input":
747
- case "select":
748
- case "textarea":
749
- return "change" === t.type || "click" === t.type;
750
-
751
- default:
752
- return u ? "click" === t.type : "click" === t.type && (fe.indexOf(p) > -1 || "true" === e.getAttribute("contenteditable"));
753
- }
754
- }(o, e, this.config)) {
755
- for (var s, a, u = [ o ], l = o; l.parentNode && !ce(l, "body"); ) he(l.parentNode) ? (u.push(l.parentNode.host),
756
- l = l.parentNode.host) : (u.push(l.parentNode), l = l.parentNode);
757
- var c, d = [], h = {}, f = !1;
758
- if (G(u, (function(e) {
759
- var n = pe(e);
760
- "a" === e.tagName.toLowerCase() && (c = e.getAttribute("href"), c = n && ge(c) && c),
761
- Y(ae(e), "ph-no-capture") && (f = !0), d.push(r._getPropertiesFromElement(e, t.config.mask_all_element_attributes, t.config.mask_all_text));
808
+ var n, r = this, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "$autocapture", o = arguments.length > 3 ? arguments[3] : void 0, s = this._getEventTarget(e);
809
+ (ge(s) && (s = s.parentNode || null), "$autocapture" === i && "click" === e.type && e instanceof MouseEvent) && (null !== (n = this.rageclicks) && void 0 !== n && n.isRageClick(e.clientX, e.clientY, (new Date).getTime()) && this._captureEvent(e, t, "$rageclick"));
810
+ var a = i === Ke;
811
+ if (s && be(s, e, this.config, a, a ? [ "copy", "cut" ] : void 0)) {
812
+ for (var u, l, c = [ s ], d = s; d.parentNode && !_e(d, "body"); ) ve(d.parentNode) ? (c.push(d.parentNode.host),
813
+ d = d.parentNode.host) : (c.push(d.parentNode), d = d.parentNode);
814
+ var f, h = [], p = {}, _ = !1;
815
+ if (K(c, (function(e) {
816
+ var n = we(e);
817
+ "a" === e.tagName.toLowerCase() && (f = e.getAttribute("href"), f = n && Se(f) && f),
818
+ Z(de(e), "ph-no-capture") && (_ = !0), h.push(r._getPropertiesFromElement(e, t.config.mask_all_element_attributes, t.config.mask_all_text));
762
819
  var i = r._getAugmentPropertiesFromElement(e);
763
- z(h, i);
764
- })), t.config.mask_all_text || ("a" === o.tagName.toLowerCase() || "button" === o.tagName.toLowerCase() ? d[0].$el_text = ve(o) : d[0].$el_text = ue(o)),
765
- c && (d[0].attr__href = c), f) return !1;
766
- var p = z(this._getDefaultProperties(e.type), t.elementsChainAsString ? {
767
- $elements_chain: ye(d)
820
+ X(p, i);
821
+ })), t.config.mask_all_text || ("a" === s.tagName.toLowerCase() || "button" === s.tagName.toLowerCase() ? h[0].$el_text = Fe(s) : h[0].$el_text = he(s)),
822
+ f && (h[0].attr__href = f), _) return !1;
823
+ var g = X(this._getDefaultProperties(e.type), t.elementsChainAsString ? {
824
+ $elements_chain: Pe(h)
768
825
  } : {
769
- $elements: d
770
- }, null !== (s = d[0]) && void 0 !== s && s.$el_text ? {
771
- $el_text: null === (a = d[0]) || void 0 === a ? void 0 : a.$el_text
772
- } : {}, this._getCustomProperties(u), h);
773
- return t.capture(i, p), !0;
826
+ $elements: h
827
+ }, null !== (u = h[0]) && void 0 !== u && u.$el_text ? {
828
+ $el_text: null === (l = h[0]) || void 0 === l ? void 0 : l.$el_text
829
+ } : {}, this._getCustomProperties(c), p, o || {});
830
+ if (i === Ke) {
831
+ var v, m = fe(null == A || null === (v = A.getSelection()) || void 0 === v ? void 0 : v.toString()), y = e.type || "clipboard";
832
+ if (!m) return !1;
833
+ g.$selected_content = m, g.$copy_type = y;
834
+ }
835
+ return t.capture(i, g), !0;
774
836
  }
775
837
  },
776
838
  _navigate: function(e) {
777
- D && (D.location.href = e);
839
+ A && (A.location.href = e);
778
840
  },
779
841
  _addDomEventHandlers: function(e) {
780
842
  var t = this;
781
- if (D && B) {
843
+ if (A && B) {
782
844
  var n = function(n) {
783
- n = n || (null == D ? void 0 : D.event), t._captureEvent(n, e);
845
+ n = n || (null == A ? void 0 : A.event), t._captureEvent(n, e);
846
+ }, r = function(n) {
847
+ n = n || (null == A ? void 0 : A.event), t._captureEvent(n, e, Ke);
784
848
  };
785
- ie(B, "submit", n, !1, !0), ie(B, "change", n, !1, !0), ie(B, "click", n, !1, !0);
849
+ ue(B, "submit", n, !1, !0), ue(B, "change", n, !1, !0), ue(B, "click", n, !1, !0),
850
+ P(e.config.autocapture) && e.config.autocapture.capture_copied_text && (ue(B, "copy", r, !1, !0),
851
+ ue(B, "cut", r, !1, !0));
786
852
  }
787
853
  },
788
854
  _customProperties: [],
@@ -792,37 +858,37 @@ var Ue = {
792
858
  var t;
793
859
  $(e.__autocapture) || (this.config = e.__autocapture), null !== (t = this.config) && void 0 !== t && t.url_allowlist && (this.config.url_allowlist = this.config.url_allowlist.map((function(e) {
794
860
  return new RegExp(e);
795
- }))), this.rageclicks = new we(e.config.rageclick);
861
+ }))), this.rageclicks = new Ie(e.config.rageclick);
796
862
  },
797
863
  afterDecideResponse: function(e, t) {
798
864
  var n = t.config.token;
799
- this._initializedTokens.indexOf(n) > -1 ? H.info('autocapture already initialized for token "' + n + '"') : (t.persistence && t.persistence.register(s({}, Ie, !!e.autocapture_opt_out)),
865
+ this._initializedTokens.indexOf(n) > -1 ? G.info('autocapture already initialized for token "' + n + '"') : (t.persistence && t.persistence.register(s({}, Oe, !!e.autocapture_opt_out)),
800
866
  this._isDisabledServerSide = !!e.autocapture_opt_out, this._setIsAutocaptureEnabled(t),
801
867
  this._initializedTokens.push(n), e && e.config && e.config.enable_collect_everything && this._isAutocaptureEnabled ? (e.custom_properties && (this._customProperties = e.custom_properties),
802
868
  this._addDomEventHandlers(t)) : t.__autocapture = !1);
803
869
  },
804
870
  enabledForProject: function(e, t, n) {
805
871
  if (!e) return !0;
806
- t = R(t) ? 10 : t, n = R(n) ? 10 : n;
872
+ t = x(t) ? 10 : t, n = x(n) ? 10 : n;
807
873
  for (var r = 0, i = 0; i < e.length; i++) r += e.charCodeAt(i);
808
874
  return r % t < n;
809
875
  },
810
876
  isBrowserSupported: function() {
811
- return P(null == B ? void 0 : B.querySelectorAll);
877
+ return R(null == B ? void 0 : B.querySelectorAll);
812
878
  }
813
879
  };
814
880
 
815
881
  !function(e) {
816
- for (var t in e) P(e[t]) && (e[t] = e[t].bind(e));
817
- }(Ue), function(e) {
818
- for (var t in e) P(e[t]) && (e[t] = K(e[t]));
819
- }(Ue);
882
+ for (var t in e) R(e[t]) && (e[t] = e[t].bind(e));
883
+ }(Ze), function(e) {
884
+ for (var t in e) R(e[t]) && (e[t] = re(e[t]));
885
+ }(Ze);
820
886
 
821
- var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature_flag_payloads", Ye = function(e) {
822
- var t, n = {}, r = v(Q(e || {}));
887
+ var et = "$active_feature_flags", tt = "$override_feature_flags", nt = "$feature_flag_payloads", rt = function(e) {
888
+ var t, n = {}, r = v(ee(e || {}));
823
889
  try {
824
890
  for (r.s(); !(t = r.n()).done; ) {
825
- var i = f(t.value, 2), o = i[0], s = i[1];
891
+ var i = h(t.value, 2), o = i[0], s = i[1];
826
892
  s && (n[o] = s);
827
893
  }
828
894
  } catch (e) {
@@ -831,7 +897,7 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
831
897
  r.f();
832
898
  }
833
899
  return n;
834
- }, Qe = function() {
900
+ }, it = function() {
835
901
  function e(t) {
836
902
  r(this, e), this.instance = t, this._override_warning = !1, this.featureFlagEventHandlers = [],
837
903
  this.reloadFeatureFlagsQueued = !1, this.reloadFeatureFlagsInAction = !1;
@@ -844,10 +910,10 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
844
910
  }, {
845
911
  key: "getFlagVariants",
846
912
  value: function() {
847
- var e = this.instance.get_property(Me), t = this.instance.get_property(Ge);
913
+ var e = this.instance.get_property(je), t = this.instance.get_property(tt);
848
914
  if (!t) return e || {};
849
- for (var n = z({}, e), r = Object.keys(t), i = 0; i < r.length; i++) !1 === t[r[i]] ? delete n[r[i]] : n[r[i]] = t[r[i]];
850
- return this._override_warning || (H.warn(" Overriding feature flags!", {
915
+ for (var n = X({}, e), r = Object.keys(t), i = 0; i < r.length; i++) !1 === t[r[i]] ? delete n[r[i]] : n[r[i]] = t[r[i]];
916
+ return this._override_warning || (G.warn(" Overriding feature flags!", {
851
917
  enabledFlags: e,
852
918
  overriddenFlags: t,
853
919
  finalFlags: n
@@ -856,7 +922,7 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
856
922
  }, {
857
923
  key: "getFlagPayloads",
858
924
  value: function() {
859
- return this.instance.get_property(ze) || {};
925
+ return this.instance.get_property(nt) || {};
860
926
  }
861
927
  }, {
862
928
  key: "reloadFeatureFlags",
@@ -893,7 +959,7 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
893
959
  var e = this;
894
960
  if (!this.instance.config.advanced_disable_feature_flags) {
895
961
  this.setReloadingPaused(!0);
896
- var t = this.instance.config.token, n = this.instance.get_property(Ae), r = this.instance.get_property(De), i = ne(JSON.stringify({
962
+ var t = this.instance.config.token, n = this.instance.get_property(Ue), r = this.instance.get_property(Ve), i = se(JSON.stringify({
897
963
  token: t,
898
964
  distinct_id: this.instance.get_distinct_id(),
899
965
  groups: this.instance.getGroups(),
@@ -902,7 +968,7 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
902
968
  group_properties: r,
903
969
  disable_flags: this.instance.config.advanced_disable_feature_flags || void 0
904
970
  }));
905
- this.instance._send_request(this.instance.config.api_host + "/decide/?v=3", {
971
+ this.instance._send_request(this.instance.requestRouter.endpointFor("api", "/decide/?v=3"), {
906
972
  data: i
907
973
  }, {
908
974
  method: "POST"
@@ -917,16 +983,16 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
917
983
  value: function(e) {
918
984
  var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
919
985
  if (this.instance.decideEndpointWasHit || this.getFlags() && this.getFlags().length > 0) {
920
- var n, r = this.getFlagVariants()[e], i = "".concat(r), o = this.instance.get_property(Be) || {};
986
+ var n, r = this.getFlagVariants()[e], i = "".concat(r), o = this.instance.get_property(ze) || {};
921
987
  if (t.send_event || !("send_event" in t)) if (!(e in o) || !o[e].includes(i)) S(o[e]) ? o[e].push(i) : o[e] = [ i ],
922
- null === (n = this.instance.persistence) || void 0 === n || n.register(s({}, Be, o)),
988
+ null === (n = this.instance.persistence) || void 0 === n || n.register(s({}, ze, o)),
923
989
  this.instance.capture("$feature_flag_called", {
924
990
  $feature_flag: e,
925
991
  $feature_flag_response: r
926
992
  });
927
993
  return r;
928
994
  }
929
- H.warn('getFeatureFlag for key "' + e + "\" failed. Feature flags didn't load in time.");
995
+ G.warn('getFeatureFlag for key "' + e + "\" failed. Feature flags didn't load in time.");
930
996
  }
931
997
  }, {
932
998
  key: "getFeatureFlagPayload",
@@ -938,7 +1004,7 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
938
1004
  value: function(e) {
939
1005
  var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
940
1006
  if (this.instance.decideEndpointWasHit || this.getFlags() && this.getFlags().length > 0) return !!this.getFeatureFlag(e, t);
941
- H.warn('isFeatureEnabled for key "' + e + "\" failed. Feature flags didn't load in time.");
1007
+ G.warn('isFeatureEnabled for key "' + e + "\" failed. Feature flags didn't load in time.");
942
1008
  }
943
1009
  }, {
944
1010
  key: "addFeatureFlagsHandler",
@@ -963,11 +1029,11 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
963
1029
  if (o) if (S(o)) {
964
1030
  var u, l = {};
965
1031
  if (o) for (var c = 0; c < o.length; c++) l[o[c]] = !0;
966
- n && n.register((s(u = {}, We, o), s(u, Me, l), u));
1032
+ n && n.register((s(u = {}, et, o), s(u, je, l), u));
967
1033
  } else {
968
- var d, h = o, f = a;
969
- e.errorsWhileComputingFlags && (h = t(t({}, r), h), f = t(t({}, i), f)), n && n.register((s(d = {}, We, Object.keys(Ye(h))),
970
- s(d, Me, h || {}), s(d, ze, f || {}), d));
1034
+ var d, f = o, h = a;
1035
+ e.errorsWhileComputingFlags && (f = t(t({}, r), f), h = t(t({}, i), h)), n && n.register((s(d = {}, et, Object.keys(rt(f))),
1036
+ s(d, je, f || {}), s(d, nt, h || {}), d));
971
1037
  }
972
1038
  }(e, this.instance.persistence, n, r), this._fireFeatureFlagsCallbacks();
973
1039
  }
@@ -975,11 +1041,11 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
975
1041
  }, {
976
1042
  key: "override",
977
1043
  value: function(e) {
978
- if (!this.instance.__loaded || !this.instance.persistence) return H.uninitializedWarning("posthog.feature_flags.override");
979
- if (this._override_warning = !1, !1 === e) this.instance.persistence.unregister(Ge); else if (S(e)) {
1044
+ if (!this.instance.__loaded || !this.instance.persistence) return G.uninitializedWarning("posthog.feature_flags.override");
1045
+ if (this._override_warning = !1, !1 === e) this.instance.persistence.unregister(tt); else if (S(e)) {
980
1046
  for (var t = {}, n = 0; n < e.length; n++) t[e[n]] = !0;
981
- this.instance.persistence.register(s({}, Ge, t));
982
- } else this.instance.persistence.register(s({}, Ge, e));
1047
+ this.instance.persistence.register(s({}, tt, t));
1048
+ } else this.instance.persistence.register(s({}, tt, e));
983
1049
  }
984
1050
  }, {
985
1051
  key: "onFeatureFlags",
@@ -1003,19 +1069,19 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
1003
1069
  $set: o
1004
1070
  }), this.setPersonPropertiesForFlags(o, !1);
1005
1071
  var a = t(t({}, this.getFlagVariants()), {}, s({}, e, n));
1006
- null === (r = this.instance.persistence) || void 0 === r || r.register((s(i = {}, We, Object.keys(Ye(a))),
1007
- s(i, Me, a), i)), this._fireFeatureFlagsCallbacks();
1072
+ null === (r = this.instance.persistence) || void 0 === r || r.register((s(i = {}, et, Object.keys(rt(a))),
1073
+ s(i, je, a), i)), this._fireFeatureFlagsCallbacks();
1008
1074
  }
1009
1075
  }, {
1010
1076
  key: "getEarlyAccessFeatures",
1011
1077
  value: function(e) {
1012
- var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(Te);
1078
+ var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(He);
1013
1079
  if (r && !n) return e(r);
1014
- this.instance._send_request("".concat(this.instance.config.api_host, "/api/early_access_features/?token=").concat(this.instance.config.token), {}, {
1080
+ this.instance._send_request(this.instance.requestRouter.endpointFor("api", "/api/early_access_features/?token=".concat(this.instance.config.token)), {}, {
1015
1081
  method: "GET"
1016
1082
  }, (function(n) {
1017
1083
  var r, i = n.earlyAccessFeatures;
1018
- return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, Te, i)),
1084
+ return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, He, i)),
1019
1085
  e(i);
1020
1086
  }));
1021
1087
  }
@@ -1045,29 +1111,29 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
1045
1111
  }, {
1046
1112
  key: "setPersonPropertiesForFlags",
1047
1113
  value: function(e) {
1048
- var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.instance.get_property(Ae) || {};
1049
- this.instance.register(s({}, Ae, t(t({}, r), e))), n && this.instance.reloadFeatureFlags();
1114
+ var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.instance.get_property(Ue) || {};
1115
+ this.instance.register(s({}, Ue, t(t({}, r), e))), n && this.instance.reloadFeatureFlags();
1050
1116
  }
1051
1117
  }, {
1052
1118
  key: "resetPersonPropertiesForFlags",
1053
1119
  value: function() {
1054
- this.instance.unregister(Ae);
1120
+ this.instance.unregister(Ue);
1055
1121
  }
1056
1122
  }, {
1057
1123
  key: "setGroupPropertiesForFlags",
1058
1124
  value: function(e) {
1059
- var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.instance.get_property(De) || {};
1125
+ var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.instance.get_property(Ve) || {};
1060
1126
  0 !== Object.keys(r).length && Object.keys(r).forEach((function(n) {
1061
1127
  r[n] = t(t({}, r[n]), e[n]), delete e[n];
1062
- })), this.instance.register(s({}, De, t(t({}, r), e))), n && this.instance.reloadFeatureFlags();
1128
+ })), this.instance.register(s({}, Ve, t(t({}, r), e))), n && this.instance.reloadFeatureFlags();
1063
1129
  }
1064
1130
  }, {
1065
1131
  key: "resetGroupPropertiesForFlags",
1066
1132
  value: function(e) {
1067
1133
  if (e) {
1068
- var n = this.instance.get_property(De) || {};
1069
- this.instance.register(s({}, De, t(t({}, n), {}, s({}, e, {}))));
1070
- } else this.instance.unregister(De);
1134
+ var n = this.instance.get_property(Ve) || {};
1135
+ this.instance.register(s({}, Ve, t(t({}, n), {}, s({}, e, {}))));
1136
+ } else this.instance.unregister(Ve);
1071
1137
  }
1072
1138
  } ]), e;
1073
1139
  }();
@@ -1075,17 +1141,17 @@ var We = "$active_feature_flags", Ge = "$override_feature_flags", ze = "$feature
1075
1141
  Math.trunc || (Math.trunc = function(e) {
1076
1142
  return e < 0 ? Math.ceil(e) : Math.floor(e);
1077
1143
  }), Number.isInteger || (Number.isInteger = function(e) {
1078
- return O(e) && isFinite(e) && Math.floor(e) === e;
1144
+ return T(e) && isFinite(e) && Math.floor(e) === e;
1079
1145
  });
1080
1146
 
1081
- var Je = "0123456789abcdef", Xe = function() {
1147
+ var ot = "0123456789abcdef", st = function() {
1082
1148
  function e(t) {
1083
1149
  if (r(this, e), this.bytes = t, 16 !== t.length) throw new TypeError("not 128-bit length");
1084
1150
  }
1085
1151
  return o(e, [ {
1086
1152
  key: "toString",
1087
1153
  value: function() {
1088
- for (var e = "", t = 0; t < this.bytes.length; t++) e = e + Je.charAt(this.bytes[t] >>> 4) + Je.charAt(15 & this.bytes[t]),
1154
+ for (var e = "", t = 0; t < this.bytes.length; t++) e = e + ot.charAt(this.bytes[t] >>> 4) + ot.charAt(15 & this.bytes[t]),
1089
1155
  3 !== t && 5 !== t && 7 !== t && 9 !== t || (e += "-");
1090
1156
  if (36 !== e.length) throw new Error("Invalid UUIDv7 was generated");
1091
1157
  return e;
@@ -1120,18 +1186,18 @@ var Je = "0123456789abcdef", Xe = function() {
1120
1186
  o[13] = i >>> 16, o[14] = i >>> 8, o[15] = i, new e(o);
1121
1187
  }
1122
1188
  } ]), e;
1123
- }(), Ke = function() {
1189
+ }(), at = function() {
1124
1190
  function e() {
1125
- r(this, e), s(this, "timestamp", 0), s(this, "counter", 0), s(this, "random", new tt);
1191
+ r(this, e), s(this, "timestamp", 0), s(this, "counter", 0), s(this, "random", new ct);
1126
1192
  }
1127
1193
  return o(e, [ {
1128
1194
  key: "generate",
1129
1195
  value: function() {
1130
1196
  var e = this.generateOrAbort();
1131
- if (R(e)) {
1197
+ if (x(e)) {
1132
1198
  this.timestamp = 0;
1133
1199
  var t = this.generateOrAbort();
1134
- if (R(t)) throw new Error("Could not generate UUID after timestamp reset");
1200
+ if (x(t)) throw new Error("Could not generate UUID after timestamp reset");
1135
1201
  return t;
1136
1202
  }
1137
1203
  return e;
@@ -1144,7 +1210,7 @@ var Je = "0123456789abcdef", Xe = function() {
1144
1210
  if (!(e + 1e4 > this.timestamp)) return;
1145
1211
  this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
1146
1212
  }
1147
- return Xe.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());
1213
+ return st.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());
1148
1214
  }
1149
1215
  }, {
1150
1216
  key: "resetCounter",
@@ -1152,66 +1218,66 @@ var Je = "0123456789abcdef", Xe = function() {
1152
1218
  this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
1153
1219
  }
1154
1220
  } ]), e;
1155
- }(), Ze = function(e) {
1221
+ }(), ut = function(e) {
1156
1222
  if ("undefined" != typeof UUIDV7_DENY_WEAK_RNG && UUIDV7_DENY_WEAK_RNG) throw new Error("no cryptographically strong RNG available");
1157
1223
  for (var t = 0; t < e.length; t++) e[t] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());
1158
1224
  return e;
1159
1225
  };
1160
1226
 
1161
- D && !R(D.crypto) && crypto.getRandomValues && (Ze = function(e) {
1227
+ A && !x(A.crypto) && crypto.getRandomValues && (ut = function(e) {
1162
1228
  return crypto.getRandomValues(e);
1163
1229
  });
1164
1230
 
1165
- var et, tt = function() {
1231
+ var lt, ct = function() {
1166
1232
  function e() {
1167
1233
  r(this, e), s(this, "buffer", new Uint32Array(8)), s(this, "cursor", 1 / 0);
1168
1234
  }
1169
1235
  return o(e, [ {
1170
1236
  key: "nextUint32",
1171
1237
  value: function() {
1172
- return this.cursor >= this.buffer.length && (Ze(this.buffer), this.cursor = 0),
1238
+ return this.cursor >= this.buffer.length && (ut(this.buffer), this.cursor = 0),
1173
1239
  this.buffer[this.cursor++];
1174
1240
  }
1175
1241
  } ]), e;
1176
- }(), nt = function() {
1177
- return rt().toString();
1178
- }, rt = function() {
1179
- return (et || (et = new Ke)).generate();
1180
- }, it = "Thu, 01 Jan 1970 00:00:00 GMT", ot = "";
1181
-
1182
- var st = /[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i, at = function(e) {
1183
- var t = e.match(st);
1184
- return t ? t[0] : "";
1185
- };
1242
+ }(), dt = function() {
1243
+ return ft().toString();
1244
+ }, ft = function() {
1245
+ return (lt || (lt = new at)).generate();
1246
+ }, ht = "Thu, 01 Jan 1970 00:00:00 GMT", pt = "";
1247
+
1248
+ var _t = /[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;
1186
1249
 
1187
- function ut(e, t) {
1250
+ function gt(e, t) {
1188
1251
  if (t) {
1189
1252
  var n = function(e) {
1190
1253
  var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : B;
1191
- if (ot) return ot;
1254
+ if (pt) return pt;
1192
1255
  if (!t) return "";
1193
1256
  if ([ "localhost", "127.0.0.1" ].includes(e)) return "";
1194
- for (var n = e.split("."), r = Math.min(n.length, 8), i = "dmn_chk_" + nt(), o = new RegExp("(^|;)\\s*" + i + "=1"); !ot && r--; ) {
1257
+ for (var n = e.split("."), r = Math.min(n.length, 8), i = "dmn_chk_" + dt(), o = new RegExp("(^|;)\\s*" + i + "=1"); !pt && r--; ) {
1195
1258
  var s = n.slice(r).join("."), a = i + "=1;domain=." + s;
1196
- t.cookie = a, o.test(t.cookie) && (t.cookie = a + ";expires=" + it, ot = s);
1259
+ t.cookie = a, o.test(t.cookie) && (t.cookie = a + ";expires=" + ht, pt = s);
1197
1260
  }
1198
- return ot;
1261
+ return pt;
1199
1262
  }(e);
1200
1263
  if (!n) {
1201
- var r = at(e);
1202
- r !== n && H.info("Warning: cookie subdomain discovery mismatch", r, n), n = r;
1264
+ var r = function(e) {
1265
+ var t = e.match(_t);
1266
+ return t ? t[0] : "";
1267
+ }(e);
1268
+ r !== n && G.info("Warning: cookie subdomain discovery mismatch", r, n), n = r;
1203
1269
  }
1204
1270
  return n ? "; domain=." + n : "";
1205
1271
  }
1206
1272
  return "";
1207
1273
  }
1208
1274
 
1209
- var lt = {
1275
+ var vt, mt = {
1210
1276
  is_supported: function() {
1211
1277
  return !!B;
1212
1278
  },
1213
1279
  error: function(e) {
1214
- H.error("cookieStore error: " + e);
1280
+ G.error("cookieStore error: " + e);
1215
1281
  },
1216
1282
  get: function(e) {
1217
1283
  if (B) {
@@ -1229,20 +1295,20 @@ var lt = {
1229
1295
  parse: function(e) {
1230
1296
  var t;
1231
1297
  try {
1232
- t = JSON.parse(lt.get(e)) || {};
1298
+ t = JSON.parse(mt.get(e)) || {};
1233
1299
  } catch (e) {}
1234
1300
  return t;
1235
1301
  },
1236
1302
  set: function(e, t, n, r, i) {
1237
1303
  if (B) try {
1238
- var o = "", s = "", a = ut(B.location.hostname, r);
1304
+ var o = "", s = "", a = gt(B.location.hostname, r);
1239
1305
  if (n) {
1240
1306
  var u = new Date;
1241
1307
  u.setTime(u.getTime() + 24 * n * 60 * 60 * 1e3), o = "; expires=" + u.toUTCString();
1242
1308
  }
1243
1309
  i && (s = "; secure");
1244
1310
  var l = e + "=" + encodeURIComponent(JSON.stringify(t)) + o + "; SameSite=Lax; path=/" + a + s;
1245
- return l.length > 3686.4 && H.warn("cookieStore warning: large cookie, len=" + l.length),
1311
+ return l.length > 3686.4 && G.warn("cookieStore warning: large cookie, len=" + l.length),
1246
1312
  B.cookie = l, l;
1247
1313
  } catch (e) {
1248
1314
  return;
@@ -1250,150 +1316,150 @@ var lt = {
1250
1316
  },
1251
1317
  remove: function(e, t) {
1252
1318
  try {
1253
- lt.set(e, "", -1, t);
1319
+ mt.set(e, "", -1, t);
1254
1320
  } catch (e) {
1255
1321
  return;
1256
1322
  }
1257
1323
  }
1258
- }, ct = null, dt = {
1324
+ }, yt = null, bt = {
1259
1325
  is_supported: function() {
1260
- if (!C(ct)) return ct;
1326
+ if (!I(yt)) return yt;
1261
1327
  var e = !0;
1262
- if (R(D)) e = !1; else try {
1328
+ if (x(A)) e = !1; else try {
1263
1329
  var t = "__mplssupport__";
1264
- dt.set(t, "xyz"), '"xyz"' !== dt.get(t) && (e = !1), dt.remove(t);
1330
+ bt.set(t, "xyz"), '"xyz"' !== bt.get(t) && (e = !1), bt.remove(t);
1265
1331
  } catch (t) {
1266
1332
  e = !1;
1267
1333
  }
1268
- return e || H.error("localStorage unsupported; falling back to cookie store"), ct = e,
1334
+ return e || G.error("localStorage unsupported; falling back to cookie store"), yt = e,
1269
1335
  e;
1270
1336
  },
1271
1337
  error: function(e) {
1272
- H.error("localStorage error: " + e);
1338
+ G.error("localStorage error: " + e);
1273
1339
  },
1274
1340
  get: function(e) {
1275
1341
  try {
1276
- return null == D ? void 0 : D.localStorage.getItem(e);
1342
+ return null == A ? void 0 : A.localStorage.getItem(e);
1277
1343
  } catch (e) {
1278
- dt.error(e);
1344
+ bt.error(e);
1279
1345
  }
1280
1346
  return null;
1281
1347
  },
1282
1348
  parse: function(e) {
1283
1349
  try {
1284
- return JSON.parse(dt.get(e)) || {};
1350
+ return JSON.parse(bt.get(e)) || {};
1285
1351
  } catch (e) {}
1286
1352
  return null;
1287
1353
  },
1288
1354
  set: function(e, t) {
1289
1355
  try {
1290
- null == D || D.localStorage.setItem(e, JSON.stringify(t));
1356
+ null == A || A.localStorage.setItem(e, JSON.stringify(t));
1291
1357
  } catch (e) {
1292
- dt.error(e);
1358
+ bt.error(e);
1293
1359
  }
1294
1360
  },
1295
1361
  remove: function(e) {
1296
1362
  try {
1297
- null == D || D.localStorage.removeItem(e);
1363
+ null == A || A.localStorage.removeItem(e);
1298
1364
  } catch (e) {
1299
- dt.error(e);
1365
+ bt.error(e);
1300
1366
  }
1301
1367
  }
1302
- }, ht = [ "distinct_id", Oe, $e ], ft = t(t({}, dt), {}, {
1368
+ }, wt = [ "distinct_id", Le, Be ], kt = t(t({}, bt), {}, {
1303
1369
  parse: function(e) {
1304
1370
  try {
1305
1371
  var t = {};
1306
1372
  try {
1307
- t = lt.parse(e) || {};
1373
+ t = mt.parse(e) || {};
1308
1374
  } catch (e) {}
1309
- var n = z(t, JSON.parse(dt.get(e) || "{}"));
1310
- return dt.set(e, n), n;
1375
+ var n = X(t, JSON.parse(bt.get(e) || "{}"));
1376
+ return bt.set(e, n), n;
1311
1377
  } catch (e) {}
1312
1378
  return null;
1313
1379
  },
1314
1380
  set: function(e, t, n, r, i) {
1315
1381
  try {
1316
- dt.set(e, t);
1382
+ bt.set(e, t);
1317
1383
  var o = {};
1318
- ht.forEach((function(e) {
1384
+ wt.forEach((function(e) {
1319
1385
  t[e] && (o[e] = t[e]);
1320
- })), Object.keys(o).length && lt.set(e, o, n, r, i);
1386
+ })), Object.keys(o).length && mt.set(e, o, n, r, i);
1321
1387
  } catch (e) {
1322
- dt.error(e);
1388
+ bt.error(e);
1323
1389
  }
1324
1390
  },
1325
1391
  remove: function(e, t) {
1326
1392
  try {
1327
- null == D || D.localStorage.removeItem(e), lt.remove(e, t);
1393
+ null == A || A.localStorage.removeItem(e), mt.remove(e, t);
1328
1394
  } catch (e) {
1329
- dt.error(e);
1395
+ bt.error(e);
1330
1396
  }
1331
1397
  }
1332
- }), pt = {}, _t = {
1398
+ }), St = {}, Ft = {
1333
1399
  is_supported: function() {
1334
1400
  return !0;
1335
1401
  },
1336
1402
  error: function(e) {
1337
- H.error("memoryStorage error: " + e);
1403
+ G.error("memoryStorage error: " + e);
1338
1404
  },
1339
1405
  get: function(e) {
1340
- return pt[e] || null;
1406
+ return St[e] || null;
1341
1407
  },
1342
1408
  parse: function(e) {
1343
- return pt[e] || null;
1409
+ return St[e] || null;
1344
1410
  },
1345
1411
  set: function(e, t) {
1346
- pt[e] = t;
1412
+ St[e] = t;
1347
1413
  },
1348
1414
  remove: function(e) {
1349
- delete pt[e];
1415
+ delete St[e];
1350
1416
  }
1351
- }, gt = null, vt = {
1417
+ }, Rt = null, Pt = {
1352
1418
  is_supported: function() {
1353
- if (!C(gt)) return gt;
1354
- if (gt = !0, R(D)) gt = !1; else try {
1419
+ if (!I(Rt)) return Rt;
1420
+ if (Rt = !0, x(A)) Rt = !1; else try {
1355
1421
  var e = "__support__";
1356
- vt.set(e, "xyz"), '"xyz"' !== vt.get(e) && (gt = !1), vt.remove(e);
1422
+ Pt.set(e, "xyz"), '"xyz"' !== Pt.get(e) && (Rt = !1), Pt.remove(e);
1357
1423
  } catch (e) {
1358
- gt = !1;
1424
+ Rt = !1;
1359
1425
  }
1360
- return gt;
1426
+ return Rt;
1361
1427
  },
1362
1428
  error: function(e) {
1363
- H.error("sessionStorage error: ", e);
1429
+ G.error("sessionStorage error: ", e);
1364
1430
  },
1365
1431
  get: function(e) {
1366
1432
  try {
1367
- return null == D ? void 0 : D.sessionStorage.getItem(e);
1433
+ return null == A ? void 0 : A.sessionStorage.getItem(e);
1368
1434
  } catch (e) {
1369
- vt.error(e);
1435
+ Pt.error(e);
1370
1436
  }
1371
1437
  return null;
1372
1438
  },
1373
1439
  parse: function(e) {
1374
1440
  try {
1375
- return JSON.parse(vt.get(e)) || null;
1441
+ return JSON.parse(Pt.get(e)) || null;
1376
1442
  } catch (e) {}
1377
1443
  return null;
1378
1444
  },
1379
1445
  set: function(e, t) {
1380
1446
  try {
1381
- null == D || D.sessionStorage.setItem(e, JSON.stringify(t));
1447
+ null == A || A.sessionStorage.setItem(e, JSON.stringify(t));
1382
1448
  } catch (e) {
1383
- vt.error(e);
1449
+ Pt.error(e);
1384
1450
  }
1385
1451
  },
1386
1452
  remove: function(e) {
1387
1453
  try {
1388
- null == D || D.sessionStorage.removeItem(e);
1454
+ null == A || A.sessionStorage.removeItem(e);
1389
1455
  } catch (e) {
1390
- vt.error(e);
1456
+ Pt.error(e);
1391
1457
  }
1392
1458
  }
1393
- }, mt = [ "localhost", "127.0.0.1" ], yt = function(e) {
1459
+ }, xt = [ "localhost", "127.0.0.1" ], Et = !(!U || !("withCredentials" in new U)) || !!H, It = function(e) {
1394
1460
  var t = null == B ? void 0 : B.createElement("a");
1395
- return R(t) ? null : (t.href = e, t);
1396
- }, bt = function(e, t) {
1461
+ return x(t) ? null : (t.href = e, t);
1462
+ }, Ct = function(e, t) {
1397
1463
  return !!function(e) {
1398
1464
  try {
1399
1465
  new RegExp(e);
@@ -1402,7 +1468,14 @@ var lt = {
1402
1468
  }
1403
1469
  return !0;
1404
1470
  }(t) && new RegExp(t).test(e);
1405
- }, kt = function(e, t) {
1471
+ }, Tt = function(e) {
1472
+ var t, n, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "&", i = [];
1473
+ return K(e, (function(e, r) {
1474
+ x(e) || x(r) || "undefined" === r || (t = encodeURIComponent(function(e) {
1475
+ return e instanceof File;
1476
+ }(e) ? e.name : e.toString()), n = encodeURIComponent(r), i[i.length] = n + "=" + t);
1477
+ })), i.join(r);
1478
+ }, $t = function(e, t) {
1406
1479
  for (var n, r = ((e.split("#")[0] || "").split("?")[1] || "").split("&"), i = 0; i < r.length; i++) {
1407
1480
  var o = r[i].split("=");
1408
1481
  if (o[0] === t) {
@@ -1415,63 +1488,102 @@ var lt = {
1415
1488
  try {
1416
1489
  s = decodeURIComponent(s);
1417
1490
  } catch (e) {
1418
- H.error("Skipping decoding for malformed query param: " + s);
1491
+ G.error("Skipping decoding for malformed query param: " + s);
1419
1492
  }
1420
1493
  return s.replace(/\+/g, " ");
1421
- }, wt = function(e, t) {
1494
+ }, Ot = function(e, t) {
1422
1495
  var n = e.match(new RegExp(t + "=([^&]*)"));
1423
1496
  return n ? n[1] : null;
1497
+ }, At = "Mobile", qt = "iOS", Mt = "Android", Dt = "Tablet", Nt = Mt + " " + Dt, Lt = "iPad", Bt = "Apple", jt = Bt + " Watch", Ht = "Safari", Ut = "BlackBerry", Vt = "Samsung", Wt = Vt + "Browser", zt = Vt + " Internet", Gt = "Chrome", Qt = Gt + " OS", Yt = Gt + " " + qt, Jt = "Internet Explorer", Kt = Jt + " " + At, Xt = "Opera", Zt = Xt + " Mini", en = "Edge", tn = "Microsoft " + en, nn = "Firefox", rn = nn + " " + qt, on = "Nintendo", sn = "PlayStation", an = "Xbox", un = Mt + " " + At, ln = At + " " + Ht, cn = "Windows", dn = cn + " Phone", fn = "Nokia", hn = "Ouya", pn = "Generic", _n = pn + " " + At.toLowerCase(), gn = pn + " " + Dt.toLowerCase(), vn = "Konqueror", mn = "(\\d+(\\.\\d+)?)", yn = new RegExp("Version/" + mn), bn = new RegExp(an, "i"), wn = new RegExp(sn + " \\w+", "i"), kn = new RegExp(on + " \\w+", "i"), Sn = new RegExp(Ut + "|PlayBook|BB10", "i"), Fn = {
1498
+ "NT3.51": "NT 3.11",
1499
+ "NT4.0": "NT 4.0",
1500
+ "5.0": "2000",
1501
+ 5.1: "XP",
1502
+ 5.2: "XP",
1503
+ "6.0": "Vista",
1504
+ 6.1: "7",
1505
+ 6.2: "8",
1506
+ 6.3: "8.1",
1507
+ 6.4: "10",
1508
+ "10.0": "10"
1424
1509
  };
1425
1510
 
1426
- var St = {
1511
+ var Rn = function(e, t) {
1512
+ return t && Z(t, Bt) || function(e) {
1513
+ return Z(e, Ht) && !Z(e, Gt) && !Z(e, Mt);
1514
+ }(e);
1515
+ }, Pn = function(e, t, n) {
1516
+ return n ? Xt : (t = t || "", Z(e, " OPR/") && Z(e, "Mini") ? Zt : Z(e, " OPR/") ? Xt : Sn.test(e) ? Ut : Z(e, "IE" + At) || Z(e, "WPDesktop") ? Kt : Z(e, Wt) ? zt : Z(e, en) || Z(e, "Edg/") ? tn : Z(e, "FBIOS") ? "Facebook " + At : Z(e, Gt) ? Gt : Z(e, "CriOS") ? Yt : Z(e, "UCWEB") || Z(e, "UCBrowser") ? "UC Browser" : Z(e, "FxiOS") ? rn : Z(e, Mt) ? un : Z(e.toLowerCase(), vn.toLowerCase()) ? vn : Rn(e, t) ? Z(e, At) ? ln : Ht : Z(e, nn) ? nn : Z(e, "MSIE") || Z(e, "Trident/") ? Jt : Z(e, "Gecko") ? nn : "");
1517
+ }, xn = (s(vt = {}, Kt, [ new RegExp("rv:" + mn) ]), s(vt, tn, [ new RegExp(en + "?\\/" + mn) ]),
1518
+ s(vt, Gt, [ new RegExp(Gt + "/" + mn) ]), s(vt, Yt, [ new RegExp("CriOS\\/" + mn) ]),
1519
+ s(vt, "UC Browser", [ new RegExp("(UCBrowser|UCWEB)\\/" + mn) ]), s(vt, Ht, [ yn ]),
1520
+ s(vt, ln, [ yn ]), s(vt, Xt, [ new RegExp("(Opera|OPR)\\/" + mn) ]), s(vt, nn, [ new RegExp(nn + "\\/" + mn) ]),
1521
+ s(vt, rn, [ new RegExp("FxiOS\\/" + mn) ]), s(vt, vn, [ new RegExp("Konqueror[:/]?" + mn, "i") ]),
1522
+ s(vt, Ut, [ new RegExp(Ut + " " + mn), yn ]), s(vt, un, [ new RegExp("android\\s" + mn) ]),
1523
+ s(vt, zt, [ new RegExp(Wt + "\\/" + mn) ]), s(vt, Jt, [ new RegExp("(rv:|MSIE )" + mn) ]),
1524
+ s(vt, "Mozilla", [ new RegExp("rv:" + mn) ]), vt), En = [ [ new RegExp(an + "; " + an + " (.*?)[);]", "i"), function(e) {
1525
+ return [ an, e && e[1] || "" ];
1526
+ } ], [ new RegExp(on, "i"), [ on, "" ] ], [ new RegExp(sn, "i"), [ sn, "" ] ], [ Sn, [ Ut, "" ] ], [ new RegExp(cn, "i"), function(e, t) {
1527
+ if (/Phone/.test(t) || /WPDesktop/.test(t)) return [ dn, "" ];
1528
+ if (new RegExp(At).test(t) && !/IEMobile\b/.test(t)) return [ cn + " " + At, "" ];
1529
+ var n = /Windows NT ([0-9.]+)/i.exec(t);
1530
+ if (n && n[1]) {
1531
+ var r = n[1], i = Fn[r] || "";
1532
+ return /arm/i.test(t) && (i = "RT"), [ cn, i ];
1533
+ }
1534
+ return [ cn, "" ];
1535
+ } ], [ /((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/, function(e) {
1536
+ if (e && e[3]) {
1537
+ var t = [ e[3], e[4], e[5] || "0" ];
1538
+ return [ qt, t.join(".") ];
1539
+ }
1540
+ return [ qt, "" ];
1541
+ } ], [ /(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i, function(e) {
1542
+ var t = "";
1543
+ return e && e.length >= 3 && (t = x(e[2]) ? e[3] : e[2]), [ "watchOS", t ];
1544
+ } ], [ new RegExp("(" + Mt + " (\\d+)\\.(\\d+)\\.?(\\d+)?|" + Mt + ")", "i"), function(e) {
1545
+ if (e && e[2]) {
1546
+ var t = [ e[2], e[3], e[4] || "0" ];
1547
+ return [ Mt, t.join(".") ];
1548
+ }
1549
+ return [ Mt, "" ];
1550
+ } ], [ /Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i, function(e) {
1551
+ var t = [ "Mac OS X", "" ];
1552
+ if (e && e[1]) {
1553
+ var n = [ e[1], e[2], e[3] || "0" ];
1554
+ t[1] = n.join(".");
1555
+ }
1556
+ return t;
1557
+ } ], [ /Mac/i, [ "Mac OS X", "" ] ], [ /CrOS/, [ Qt, "" ] ], [ /Linux|debian/i, [ "Linux", "" ] ] ], In = function(e) {
1558
+ return kn.test(e) ? on : wn.test(e) ? sn : bn.test(e) ? an : new RegExp(hn, "i").test(e) ? hn : new RegExp("(" + dn + "|WPDesktop)", "i").test(e) ? dn : /iPad/.test(e) ? Lt : /iPod/.test(e) ? "iPod Touch" : /iPhone/.test(e) ? "iPhone" : /(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e) ? jt : Sn.test(e) ? Ut : /(kobo)\s(ereader|touch)/i.test(e) ? "Kobo" : new RegExp(fn, "i").test(e) ? fn : /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e) || /(kf[a-z]+)( bui|\)).+silk\//i.test(e) ? "Kindle Fire" : /(Android|ZTE)/i.test(e) ? !new RegExp(At).test(e) || /(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e) ? /pixel[\daxl ]{1,6}/i.test(e) && !/pixel c/i.test(e) || /(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e) || /lmy47v/i.test(e) && !/QTAQZ3/i.test(e) ? Mt : Nt : Mt : new RegExp("(pda|" + At + ")", "i").test(e) ? _n : new RegExp(Dt, "i").test(e) && !new RegExp(Dt + " pc", "i").test(e) ? gn : "";
1559
+ }, Cn = "https?://(.*)", Tn = {
1427
1560
  campaignParams: function(e) {
1428
1561
  var t = [ "utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gclid", "gad_source", "gbraid", "wbraid", "fbclid", "msclkid" ].concat(e || []), n = {};
1429
- return G(t, (function(e) {
1430
- var t = B ? kt(B.URL, e) : "";
1562
+ return K(t, (function(e) {
1563
+ var t = B ? $t(B.URL, e) : "";
1431
1564
  t.length && (n[e] = t);
1432
1565
  })), n;
1433
1566
  },
1434
1567
  searchEngine: function() {
1435
1568
  var e = null == B ? void 0 : B.referrer;
1436
- return e ? 0 === e.search("https?://(.*)google.([^/?]*)") ? "google" : 0 === e.search("https?://(.*)bing.com") ? "bing" : 0 === e.search("https?://(.*)yahoo.com") ? "yahoo" : 0 === e.search("https?://(.*)duckduckgo.com") ? "duckduckgo" : null : null;
1569
+ return e ? 0 === e.search(Cn + "google.([^/?]*)") ? "google" : 0 === e.search(Cn + "bing.com") ? "bing" : 0 === e.search(Cn + "yahoo.com") ? "yahoo" : 0 === e.search(Cn + "duckduckgo.com") ? "duckduckgo" : null : null;
1437
1570
  },
1438
1571
  searchInfo: function() {
1439
- var e = St.searchEngine(), t = "yahoo" != e ? "q" : "p", n = {};
1440
- if (!C(e)) {
1572
+ var e = Tn.searchEngine(), t = "yahoo" != e ? "q" : "p", n = {};
1573
+ if (!I(e)) {
1441
1574
  n.$search_engine = e;
1442
- var r = B ? kt(B.referrer, t) : "";
1575
+ var r = B ? $t(B.referrer, t) : "";
1443
1576
  r.length && (n.ph_keyword = r);
1444
1577
  }
1445
1578
  return n;
1446
1579
  },
1447
- browser: function(e, t, n) {
1448
- return t = t || "", n || Y(e, " OPR/") ? Y(e, "Mini") ? "Opera Mini" : "Opera" : /(BlackBerry|PlayBook|BB10)/i.test(e) ? "BlackBerry" : Y(e, "IEMobile") || Y(e, "WPDesktop") ? "Internet Explorer Mobile" : Y(e, "SamsungBrowser/") ? "Samsung Internet" : Y(e, "Edge") || Y(e, "Edg/") ? "Microsoft Edge" : Y(e, "FBIOS") ? "Facebook Mobile" : Y(e, "Chrome") ? "Chrome" : Y(e, "CriOS") ? "Chrome iOS" : Y(e, "UCWEB") || Y(e, "UCBrowser") ? "UC Browser" : Y(e, "FxiOS") ? "Firefox iOS" : Y(t, "Apple") || function(e) {
1449
- return Y(e, "Safari") && !Y(e, "Chrome") && !Y(e, "Android");
1450
- }(e) ? Y(e, "Mobile") ? "Mobile Safari" : "Safari" : Y(e, "Android") ? "Android Mobile" : Y(e, "Konqueror") || Y(e, "konqueror") ? "Konqueror" : Y(e, "Firefox") ? "Firefox" : Y(e, "MSIE") || Y(e, "Trident/") ? "Internet Explorer" : Y(e, "Gecko") ? "Mozilla" : "";
1451
- },
1580
+ browser: Pn,
1452
1581
  browserVersion: function(e, t, n) {
1453
- var r = {
1454
- "Internet Explorer Mobile": [ /rv:(\d+(\.\d+)?)/ ],
1455
- "Microsoft Edge": [ /Edge?\/(\d+(\.\d+)?)/ ],
1456
- Chrome: [ /Chrome\/(\d+(\.\d+)?)/ ],
1457
- "Chrome iOS": [ /CriOS\/(\d+(\.\d+)?)/ ],
1458
- "UC Browser": [ /(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/ ],
1459
- Safari: [ /Version\/(\d+(\.\d+)?)/ ],
1460
- "Mobile Safari": [ /Version\/(\d+(\.\d+)?)/ ],
1461
- Opera: [ /(Opera|OPR)\/(\d+(\.\d+)?)/ ],
1462
- Firefox: [ /Firefox\/(\d+(\.\d+)?)/ ],
1463
- "Firefox iOS": [ /FxiOS\/(\d+(\.\d+)?)/ ],
1464
- Konqueror: [ /Konqueror[:/]?(\d+(\.\d+)?)/i ],
1465
- BlackBerry: [ /BlackBerry (\d+(\.\d+)?)/, /Version\/(\d+(\.\d+)?)/ ],
1466
- "Android Mobile": [ /android\s(\d+(\.\d+)?)/ ],
1467
- "Samsung Internet": [ /SamsungBrowser\/(\d+(\.\d+)?)/ ],
1468
- "Internet Explorer": [ /(rv:|MSIE )(\d+(\.\d+)?)/ ],
1469
- Mozilla: [ /rv:(\d+(\.\d+)?)/ ]
1470
- }[St.browser(e, t, n)];
1471
- if (R(r)) return null;
1472
- for (var i = 0; i < r.length; i++) {
1473
- var o = r[i], s = e.match(o);
1474
- if (s) return parseFloat(s[s.length - 2]);
1582
+ var r = Pn(e, t, n), i = xn[r];
1583
+ if (x(i)) return null;
1584
+ for (var o = 0; o < i.length; o++) {
1585
+ var s = i[o], a = e.match(s);
1586
+ if (a) return parseFloat(a[a.length - 2]);
1475
1587
  }
1476
1588
  return null;
1477
1589
  },
@@ -1479,137 +1591,86 @@ var St = {
1479
1591
  return navigator.language || navigator.userLanguage;
1480
1592
  },
1481
1593
  os: function(e) {
1482
- if (/Windows/i.test(e)) {
1483
- if (/Phone/.test(e) || /WPDesktop/.test(e)) return {
1484
- os_name: "Windows Phone",
1485
- os_version: ""
1486
- };
1487
- var t = /Windows NT ([0-9.]+)/i.exec(e);
1488
- return t && t[1] ? {
1489
- os_name: "Windows",
1490
- os_version: t[1]
1491
- } : {
1492
- os_name: "Windows",
1493
- os_version: ""
1494
- };
1495
- }
1496
- if (/(iPhone|iPad|iPod)/.test(e)) {
1497
- var n = /OS (\d+)_(\d+)_?(\d+)?/i.exec(e);
1498
- return n && n[1] ? {
1499
- os_name: "iOS",
1500
- os_version: [ n[1], n[2], n[3] || "0" ].join(".")
1501
- } : {
1502
- os_name: "iOS",
1503
- os_version: ""
1504
- };
1505
- }
1506
- if (/Android/.test(e)) {
1507
- var r = /Android (\d+)\.(\d+)\.?(\d+)?/i.exec(e);
1508
- return r && r[1] ? {
1509
- os_name: "Android",
1510
- os_version: [ r[1], r[2], r[3] || "0" ].join(".")
1511
- } : {
1512
- os_name: "Android",
1513
- os_version: ""
1514
- };
1515
- }
1516
- if (/(BlackBerry|PlayBook|BB10)/i.test(e)) return {
1517
- os_name: "BlackBerry",
1518
- os_version: ""
1519
- };
1520
- if (/Mac/i.test(e)) {
1521
- var i = /Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(e);
1522
- return i && i[1] ? {
1523
- os_name: "Mac OS X",
1524
- os_version: [ i[1], i[2], i[3] || "0" ].join(".")
1525
- } : {
1526
- os_name: "Mac OS X",
1527
- os_version: ""
1528
- };
1594
+ for (var t = 0; t < En.length; t++) {
1595
+ var n = h(En[t], 2), r = n[0], i = n[1], o = r.exec(e), s = o && (R(i) ? i(o, e) : i);
1596
+ if (s) return s;
1529
1597
  }
1530
- return /Linux/.test(e) ? {
1531
- os_name: "Linux",
1532
- os_version: ""
1533
- } : /CrOS/.test(e) ? {
1534
- os_name: "Chrome OS",
1535
- os_version: ""
1536
- } : {
1537
- os_name: "",
1538
- os_version: ""
1539
- };
1540
- },
1541
- device: function(e) {
1542
- return /Windows Phone/i.test(e) || /WPDesktop/.test(e) ? "Windows Phone" : /iPad/.test(e) ? "iPad" : /iPod/.test(e) ? "iPod Touch" : /iPhone/.test(e) ? "iPhone" : /(BlackBerry|PlayBook|BB10)/i.test(e) ? "BlackBerry" : /Android/.test(e) && !/Mobile/.test(e) ? "Android Tablet" : /Android/.test(e) ? "Android" : "";
1598
+ return [ "", "" ];
1543
1599
  },
1600
+ device: In,
1544
1601
  deviceType: function(e) {
1545
- var t = this.device(e);
1546
- return "iPad" === t || "Android Tablet" === t ? "Tablet" : t ? "Mobile" : "Desktop";
1602
+ var t = In(e);
1603
+ return t === Lt || t === Nt || "Kobo" === t || "Kindle Fire" === t || t === gn ? Dt : t === on || t === an || t === sn || t === hn ? "Console" : t === jt ? "Wearable" : t ? At : "Desktop";
1547
1604
  },
1548
1605
  referrer: function() {
1549
1606
  return (null == B ? void 0 : B.referrer) || "$direct";
1550
1607
  },
1551
1608
  referringDomain: function() {
1552
1609
  var e;
1553
- return null != B && B.referrer && (null === (e = yt(B.referrer)) || void 0 === e ? void 0 : e.host) || "$direct";
1610
+ return null != B && B.referrer && (null === (e = It(B.referrer)) || void 0 === e ? void 0 : e.host) || "$direct";
1554
1611
  },
1555
1612
  properties: function() {
1556
- if (!N) return {};
1557
- var e = St.os(N), t = e.os_name, n = e.os_version;
1558
- return z(Z({
1613
+ if (!V) return {};
1614
+ var e = h(Tn.os(V), 2), t = e[0], n = e[1];
1615
+ return X(ie({
1559
1616
  $os: t,
1560
1617
  $os_version: n,
1561
- $browser: St.browser(N, navigator.vendor, L.opera),
1562
- $device: St.device(N),
1563
- $device_type: St.deviceType(N)
1618
+ $browser: Tn.browser(V, navigator.vendor, W.opera),
1619
+ $device: Tn.device(V),
1620
+ $device_type: Tn.deviceType(V)
1564
1621
  }), {
1565
- $current_url: null == D ? void 0 : D.location.href,
1566
- $host: null == D ? void 0 : D.location.host,
1567
- $pathname: null == D ? void 0 : D.location.pathname,
1568
- $raw_user_agent: N.length > 1e3 ? N.substring(0, 997) + "..." : N,
1569
- $browser_version: St.browserVersion(N, navigator.vendor, L.opera),
1570
- $browser_language: St.browserLanguage(),
1571
- $screen_height: null == D ? void 0 : D.screen.height,
1572
- $screen_width: null == D ? void 0 : D.screen.width,
1573
- $viewport_height: null == D ? void 0 : D.innerHeight,
1574
- $viewport_width: null == D ? void 0 : D.innerWidth,
1622
+ $current_url: null == j ? void 0 : j.href,
1623
+ $host: null == j ? void 0 : j.host,
1624
+ $pathname: null == j ? void 0 : j.pathname,
1625
+ $raw_user_agent: V.length > 1e3 ? V.substring(0, 997) + "..." : V,
1626
+ $browser_version: Tn.browserVersion(V, navigator.vendor, W.opera),
1627
+ $browser_language: Tn.browserLanguage(),
1628
+ $screen_height: null == A ? void 0 : A.screen.height,
1629
+ $screen_width: null == A ? void 0 : A.screen.width,
1630
+ $viewport_height: null == A ? void 0 : A.innerHeight,
1631
+ $viewport_width: null == A ? void 0 : A.innerWidth,
1575
1632
  $lib: "web",
1576
1633
  $lib_version: m.LIB_VERSION,
1577
1634
  $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
1578
- $time: J() / 1e3
1635
+ $time: te() / 1e3
1579
1636
  });
1580
1637
  },
1581
1638
  people_properties: function() {
1582
- if (!N) return {};
1583
- var e = St.os(N), t = e.os_name, n = e.os_version;
1584
- return z(Z({
1639
+ if (!V) return {};
1640
+ var e = h(Tn.os(V), 2), t = e[0], n = e[1];
1641
+ return X(ie({
1585
1642
  $os: t,
1586
1643
  $os_version: n,
1587
- $browser: St.browser(N, navigator.vendor, L.opera)
1644
+ $browser: Tn.browser(V, navigator.vendor, W.opera)
1588
1645
  }), {
1589
- $browser_version: St.browserVersion(N, navigator.vendor, L.opera)
1646
+ $browser_version: Tn.browserVersion(V, navigator.vendor, W.opera)
1590
1647
  });
1591
1648
  }
1592
- }, Ft = [ "cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory" ], Pt = function() {
1649
+ }, $n = [ "cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory" ], On = function() {
1593
1650
  function e(t) {
1594
- r(this, e);
1595
- var n = "";
1596
- t.token && (n = t.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")),
1597
- this.props = {}, this.campaign_params_saved = !1, this.custom_campaign_params = t.custom_campaign_params || [],
1598
- t.persistence_name ? this.name = "ph_" + t.persistence_name : this.name = "ph_" + n + "_posthog",
1599
- -1 === Ft.indexOf(t.persistence.toLowerCase()) && (H.critical("Unknown persistence type " + t.persistence + "; falling back to localStorage+cookie"),
1600
- t.persistence = "localStorage+cookie");
1601
- var i = t.persistence.toLowerCase();
1602
- "localstorage" === i && dt.is_supported() ? this.storage = dt : "localstorage+cookie" === i && ft.is_supported() ? this.storage = ft : "sessionstorage" === i && vt.is_supported() ? this.storage = vt : "memory" === i ? this.storage = _t : "cookie" === i ? this.storage = lt : ft.is_supported() ? this.storage = ft : this.storage = lt,
1603
- this.user_state = "anonymous", this.load(), this.update_config(t), this.save();
1651
+ r(this, e), this.config = t, this.props = {}, this.campaign_params_saved = !1, this.name = function(e) {
1652
+ var t = "";
1653
+ return e.token && (t = e.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")),
1654
+ e.persistence_name ? "ph_" + e.persistence_name : "ph_" + t + "_posthog";
1655
+ }(t), this.storage = this.buildStorage(t), this.load(), this.update_config(t, t),
1656
+ this.save();
1604
1657
  }
1605
1658
  return o(e, [ {
1659
+ key: "buildStorage",
1660
+ value: function(e) {
1661
+ -1 === $n.indexOf(e.persistence.toLowerCase()) && (G.critical("Unknown persistence type " + e.persistence + "; falling back to localStorage+cookie"),
1662
+ e.persistence = "localStorage+cookie");
1663
+ var t = e.persistence.toLowerCase();
1664
+ return "localstorage" === t && bt.is_supported() ? bt : "localstorage+cookie" === t && kt.is_supported() ? kt : "sessionstorage" === t && Pt.is_supported() ? Pt : "memory" === t ? Ft : "cookie" === t ? mt : kt.is_supported() ? kt : mt;
1665
+ }
1666
+ }, {
1606
1667
  key: "properties",
1607
1668
  value: function() {
1608
1669
  var e = {};
1609
- return G(this.props, (function(t, n) {
1610
- if (n === Me && I(t)) for (var r = Object.keys(t), i = 0; i < r.length; i++) e["$feature/".concat(r[i])] = t[r[i]]; else s = n,
1611
- a = !1, (C(o = He) ? a : A && o.indexOf === A ? -1 != o.indexOf(s) : (G(o, (function(e) {
1612
- if (a || (a = e === s)) return V;
1670
+ return K(this.props, (function(t, n) {
1671
+ if (n === je && P(t)) for (var r = Object.keys(t), i = 0; i < r.length; i++) e["$feature/".concat(r[i])] = t[r[i]]; else s = n,
1672
+ a = !1, (I(o = Je) ? a : N && o.indexOf === N ? -1 != o.indexOf(s) : (K(o, (function(e) {
1673
+ if (a || (a = e === s)) return Q;
1613
1674
  })), a)) || (e[n] = t);
1614
1675
  var o, s, a;
1615
1676
  })), e;
@@ -1619,7 +1680,7 @@ var St = {
1619
1680
  value: function() {
1620
1681
  if (!this.disabled) {
1621
1682
  var e = this.storage.parse(this.name);
1622
- e && (this.props = z({}, e));
1683
+ e && (this.props = X({}, e));
1623
1684
  }
1624
1685
  }
1625
1686
  }, {
@@ -1641,10 +1702,10 @@ var St = {
1641
1702
  key: "register_once",
1642
1703
  value: function(e, t, n) {
1643
1704
  var r = this;
1644
- if (I(e)) {
1645
- R(t) && (t = "None"), this.expire_days = R(n) ? this.default_expiry : n;
1705
+ if (P(e)) {
1706
+ x(t) && (t = "None"), this.expire_days = x(n) ? this.default_expiry : n;
1646
1707
  var i = !1;
1647
- if (G(e, (function(e, n) {
1708
+ if (K(e, (function(e, n) {
1648
1709
  r.props.hasOwnProperty(n) && r.props[n] !== t || (r.props[n] = e, i = !0);
1649
1710
  })), i) return this.save(), !0;
1650
1711
  }
@@ -1654,10 +1715,10 @@ var St = {
1654
1715
  key: "register",
1655
1716
  value: function(e, t) {
1656
1717
  var n = this;
1657
- if (I(e)) {
1658
- this.expire_days = R(t) ? this.default_expiry : t;
1718
+ if (P(e)) {
1719
+ this.expire_days = x(t) ? this.default_expiry : t;
1659
1720
  var r = !1;
1660
- if (G(e, (function(t, i) {
1721
+ if (K(e, (function(t, i) {
1661
1722
  e.hasOwnProperty(i) && n.props[i] !== t && (n.props[i] = t, r = !0);
1662
1723
  })), r) return this.save(), !0;
1663
1724
  }
@@ -1671,26 +1732,26 @@ var St = {
1671
1732
  }, {
1672
1733
  key: "update_campaign_params",
1673
1734
  value: function() {
1674
- this.campaign_params_saved || (this.register(St.campaignParams(this.custom_campaign_params)),
1735
+ this.campaign_params_saved || (this.register(Tn.campaignParams(this.config.custom_campaign_params)),
1675
1736
  this.campaign_params_saved = !0);
1676
1737
  }
1677
1738
  }, {
1678
1739
  key: "update_search_keyword",
1679
1740
  value: function() {
1680
- this.register(St.searchInfo());
1741
+ this.register(Tn.searchInfo());
1681
1742
  }
1682
1743
  }, {
1683
1744
  key: "update_referrer_info",
1684
1745
  value: function() {
1685
1746
  this.register({
1686
- $referrer: this.props.$referrer || St.referrer(),
1687
- $referring_domain: this.props.$referring_domain || St.referringDomain()
1747
+ $referrer: this.props.$referrer || Tn.referrer(),
1748
+ $referring_domain: this.props.$referring_domain || Tn.referringDomain()
1688
1749
  });
1689
1750
  }
1690
1751
  }, {
1691
1752
  key: "get_referrer_info",
1692
1753
  value: function() {
1693
- return Z({
1754
+ return ie({
1694
1755
  $referrer: this.props.$referrer,
1695
1756
  $referring_domain: this.props.$referring_domain
1696
1757
  });
@@ -1698,15 +1759,19 @@ var St = {
1698
1759
  }, {
1699
1760
  key: "safe_merge",
1700
1761
  value: function(e) {
1701
- return G(this.props, (function(t, n) {
1762
+ return K(this.props, (function(t, n) {
1702
1763
  n in e || (e[n] = t);
1703
1764
  })), e;
1704
1765
  }
1705
1766
  }, {
1706
1767
  key: "update_config",
1707
- value: function(e) {
1708
- this.default_expiry = this.expire_days = e.cookie_expiration, this.set_disabled(e.disable_persistence),
1709
- this.set_cross_subdomain(e.cross_subdomain_cookie), this.set_secure(e.secure_cookie);
1768
+ value: function(e, t) {
1769
+ if (this.default_expiry = this.expire_days = e.cookie_expiration, this.set_disabled(e.disable_persistence),
1770
+ this.set_cross_subdomain(e.cross_subdomain_cookie), this.set_secure(e.secure_cookie),
1771
+ e.persistence !== t.persistence) {
1772
+ var n = this.buildStorage(e), r = this.props;
1773
+ this.clear(), this.storage = n, this.props = r, this.save();
1774
+ }
1710
1775
  }
1711
1776
  }, {
1712
1777
  key: "set_disabled",
@@ -1731,39 +1796,39 @@ var St = {
1731
1796
  }, {
1732
1797
  key: "set_event_timer",
1733
1798
  value: function(e, t) {
1734
- var n = this.props[Pe] || {};
1735
- n[e] = t, this.props[Pe] = n, this.save();
1799
+ var n = this.props[$e] || {};
1800
+ n[e] = t, this.props[$e] = n, this.save();
1736
1801
  }
1737
1802
  }, {
1738
1803
  key: "remove_event_timer",
1739
1804
  value: function(e) {
1740
- var t = (this.props[Pe] || {})[e];
1741
- return R(t) || (delete this.props[Pe][e], this.save()), t;
1805
+ var t = (this.props[$e] || {})[e];
1806
+ return x(t) || (delete this.props[$e][e], this.save()), t;
1742
1807
  }
1743
1808
  }, {
1744
1809
  key: "get_user_state",
1745
1810
  value: function() {
1746
- return this.props[Ne] || "anonymous";
1811
+ return this.props[Ge] || "anonymous";
1747
1812
  }
1748
1813
  }, {
1749
1814
  key: "set_user_state",
1750
1815
  value: function(e) {
1751
- this.props[Ne] = e, this.save();
1816
+ this.props[Ge] = e, this.save();
1752
1817
  }
1753
1818
  }, {
1754
1819
  key: "get_quota_limits",
1755
1820
  value: function() {
1756
- return this.props[Le] || {};
1821
+ return this.props[Qe] || {};
1757
1822
  }
1758
1823
  }, {
1759
1824
  key: "set_quota_limits",
1760
1825
  value: function(e) {
1761
- this.props[Le] = e, this.save();
1826
+ this.props[Qe] = e, this.save();
1762
1827
  }
1763
1828
  } ]), e;
1764
- }(), It = 2, xt = 4, Rt = 3, Et = 6, Ct = 0, Ot = "rrweb/console@1";
1829
+ }(), An = 2, qn = 4;
1765
1830
 
1766
- var $t = o((function e(t) {
1831
+ var Mn = o((function e(t) {
1767
1832
  var n, i, o = this, a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
1768
1833
  r(this, e), s(this, "bucketSize", 100), s(this, "refillRate", 10), s(this, "mutationBuckets", {}),
1769
1834
  s(this, "loggedTracker", {}), s(this, "refillBuckets", (function() {
@@ -1781,10 +1846,10 @@ var $t = o((function e(t) {
1781
1846
  var t, n, r, i, o, s, a, u;
1782
1847
  return (null !== (t = null === (n = e.removes) || void 0 === n ? void 0 : n.length) && void 0 !== t ? t : 0) + (null !== (r = null === (i = e.attributes) || void 0 === i ? void 0 : i.length) && void 0 !== r ? r : 0) + (null !== (o = null === (s = e.texts) || void 0 === s ? void 0 : s.length) && void 0 !== o ? o : 0) + (null !== (a = null === (u = e.adds) || void 0 === u ? void 0 : u.length) && void 0 !== a ? a : 0);
1783
1848
  })), s(this, "throttleMutations", (function(e) {
1784
- if (e.type !== Rt || e.data.source !== Ct) return e;
1849
+ if (3 !== e.type || 0 !== e.data.source) return e;
1785
1850
  var t = e.data, n = o.numberOfChanges(t);
1786
1851
  t.attributes && (t.attributes = t.attributes.filter((function(e) {
1787
- var t, n, r, i = f(o.getNodeOrRelevantParent(e.id), 2), s = i[0], a = i[1];
1852
+ var t, n, r, i = h(o.getNodeOrRelevantParent(e.id), 2), s = i[0], a = i[1];
1788
1853
  if (0 === o.mutationBuckets[s]) return !1;
1789
1854
  (o.mutationBuckets[s] = null !== (t = o.mutationBuckets[s]) && void 0 !== t ? t : o.bucketSize,
1790
1855
  o.mutationBuckets[s] = Math.max(o.mutationBuckets[s] - 1, 0), 0 === o.mutationBuckets[s]) && (o.loggedTracker[s] || (o.loggedTracker[s] = !0,
@@ -1798,11 +1863,11 @@ var $t = o((function e(t) {
1798
1863
  setInterval((function() {
1799
1864
  o.refillBuckets();
1800
1865
  }), 1e3);
1801
- })), Mt = function(e) {
1866
+ })), Dn = function(e) {
1802
1867
  return e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot",
1803
1868
  e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom",
1804
1869
  e[e.Plugin = 6] = "Plugin", e;
1805
- }(Mt || {}), Tt = {
1870
+ }(Dn || {}), Nn = {
1806
1871
  initiatorTypes: [ "audio", "beacon", "body", "css", "early-hint", "embed", "fetch", "frame", "iframe", "icon", "image", "img", "input", "link", "navigation", "object", "ping", "script", "track", "video", "xmlhttprequest" ],
1807
1872
  maskRequestFn: function(e) {
1808
1873
  return e;
@@ -1813,48 +1878,116 @@ var $t = o((function e(t) {
1813
1878
  recordPerformance: !1,
1814
1879
  performanceEntryTypeToObserve: [ "first-input", "navigation", "paint", "resource" ],
1815
1880
  payloadSizeLimitBytes: 1e6
1816
- }, At = [ "authorization", "x-forwarded-for", "authorization", "cookie", "set-cookie", "x-api-key", "x-real-ip", "remote-addr", "forwarded", "proxy-authorization", "x-csrf-token", "x-csrftoken", "x-xsrf-token" ], Dt = [ "/s/", "/e/", "/i/vo/e/" ];
1881
+ }, Ln = [ "authorization", "x-forwarded-for", "authorization", "cookie", "set-cookie", "x-api-key", "x-real-ip", "remote-addr", "forwarded", "proxy-authorization", "x-csrf-token", "x-csrftoken", "x-xsrf-token" ], Bn = [ "/s/", "/e/", "/i/vo/e/" ];
1817
1882
 
1818
- function qt(e, t, n, r) {
1819
- var i = null == t ? void 0 : t["content-length"];
1820
- return i && parseInt(i) > n ? "".concat(r, " body too large to record") : e;
1883
+ function jn(e, t, n, r) {
1884
+ if (C(e)) return e;
1885
+ var i = (null == t ? void 0 : t["content-length"]) || function(e) {
1886
+ return new Blob([ e ]).size;
1887
+ }(e);
1888
+ return E(i) && (i = parseInt(i)), i > n ? "[SessionReplay] ".concat(r, " body too large to record (").concat(i, " bytes)") : e;
1821
1889
  }
1822
1890
 
1823
- var Bt, Nt = function(e, n) {
1891
+ var Hn = function(e, n) {
1824
1892
  var r, i, o, s = e.session_recording, a = !1 !== s.recordHeaders && n.recordHeaders, u = !1 !== s.recordBody && n.recordBody, l = !1 !== s.recordPerformance && n.recordPerformance, c = (r = s,
1825
1893
  o = Math.min(1e6, null !== (i = r.payloadSizeLimitBytes) && void 0 !== i ? i : 1e6),
1826
1894
  function(e) {
1827
- return null != e && e.requestBody && (e.requestBody = qt(e.requestBody, e.requestHeaders, o, "Request")),
1828
- null != e && e.responseBody && (e.responseBody = qt(e.responseBody, e.responseHeaders, o, "Response")),
1895
+ return null != e && e.requestBody && (e.requestBody = jn(e.requestBody, e.requestHeaders, o, "Request")),
1896
+ null != e && e.responseBody && (e.responseBody = jn(e.responseBody, e.responseHeaders, o, "Response")),
1829
1897
  e;
1830
1898
  }), d = function(e) {
1831
1899
  return c(function(e) {
1832
- var t = yt(e.name);
1833
- if (!(t && t.pathname && Dt.includes(t.pathname))) return e;
1900
+ var t = It(e.name);
1901
+ if (!(t && t.pathname && Bn.includes(t.pathname))) return e;
1834
1902
  }((t = e, Object.keys(null !== (n = t.requestHeaders) && void 0 !== n ? n : {}).forEach((function(e) {
1835
1903
  var n;
1836
- At.includes(e.toLowerCase()) && (null === (n = t.requestHeaders) || void 0 === n || delete n[e]);
1904
+ Ln.includes(e.toLowerCase()) && (null === (n = t.requestHeaders) || void 0 === n || delete n[e]);
1837
1905
  })), t)));
1838
1906
  var t, n;
1839
- }, h = P(e.session_recording.maskNetworkRequestFn);
1840
- return h && P(e.session_recording.maskCapturedNetworkRequestFn) && H.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),
1841
- h && (e.session_recording.maskCapturedNetworkRequestFn = function(n) {
1907
+ }, f = R(e.session_recording.maskNetworkRequestFn);
1908
+ return f && R(e.session_recording.maskCapturedNetworkRequestFn) && G.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),
1909
+ f && (e.session_recording.maskCapturedNetworkRequestFn = function(n) {
1842
1910
  var r = e.session_recording.maskNetworkRequestFn({
1843
1911
  url: n.name
1844
1912
  });
1845
1913
  return t(t({}, n), {}, {
1846
1914
  name: null == r ? void 0 : r.url
1847
1915
  });
1848
- }), s.maskRequestFn = P(e.session_recording.maskCapturedNetworkRequestFn) ? function(t) {
1916
+ }), s.maskRequestFn = R(e.session_recording.maskCapturedNetworkRequestFn) ? function(t) {
1849
1917
  var n, r, i, o = d(t);
1850
1918
  return o && null !== (n = null === (r = (i = e.session_recording).maskCapturedNetworkRequestFn) || void 0 === r ? void 0 : r.call(i, o)) && void 0 !== n ? n : void 0;
1851
- } : void 0, s.maskRequestFn || (s.maskRequestFn = d), t(t(t({}, Tt), s), {}, {
1919
+ } : void 0, s.maskRequestFn || (s.maskRequestFn = d), t(t(t({}, Nn), s), {}, {
1852
1920
  recordHeaders: a,
1853
1921
  recordBody: u,
1854
1922
  recordPerformance: l,
1855
1923
  recordInitialRequests: l
1856
1924
  });
1857
- }, Lt = "/s/", jt = 3e5;
1925
+ }, Un = "__ph_opt_in_out_";
1926
+
1927
+ function Vn(e, t) {
1928
+ Xn(!0, e, t);
1929
+ }
1930
+
1931
+ function Wn(e, t) {
1932
+ Xn(!1, e, t);
1933
+ }
1934
+
1935
+ function zn(e, t) {
1936
+ return "1" === Kn(e, t);
1937
+ }
1938
+
1939
+ function Gn(e, t) {
1940
+ return !!function(e) {
1941
+ if (e && e.respectDnt) {
1942
+ var t = e && e.window || A, n = null == t ? void 0 : t.navigator, r = !1;
1943
+ return K([ null == n ? void 0 : n.doNotTrack, n.msDoNotTrack, t.doNotTrack ], (function(e) {
1944
+ Z([ !0, 1, "1", "yes" ], e) && (r = !0);
1945
+ })), r;
1946
+ }
1947
+ return !1;
1948
+ }(t) || "0" === Kn(e, t);
1949
+ }
1950
+
1951
+ function Qn(e, t) {
1952
+ Yn(t = t || {}).remove(Jn(e, t), !!t.crossSubdomainCookie);
1953
+ }
1954
+
1955
+ function Yn(e) {
1956
+ return "localStorage" === (e = e || {}).persistenceType ? bt : "localStorage+cookie" === e.persistenceType ? kt : mt;
1957
+ }
1958
+
1959
+ function Jn(e, t) {
1960
+ return ((t = t || {}).persistencePrefix || Un) + e;
1961
+ }
1962
+
1963
+ function Kn(e, t) {
1964
+ return Yn(t).get(Jn(e, t));
1965
+ }
1966
+
1967
+ function Xn(e, t, n) {
1968
+ E(t) && t.length ? (Yn(n = n || {}).set(Jn(t, n), e ? 1 : 0, T(n.cookieExpiration) ? n.cookieExpiration : null, n.crossSubdomainCookie, n.secureCookie),
1969
+ n.capture && e && n.capture(n.captureEventName || "$opt_in", n.captureProperties || {}, {
1970
+ send_instantly: !0
1971
+ })) : G.error("gdpr." + (e ? "optIn" : "optOut") + " called with an invalid token");
1972
+ }
1973
+
1974
+ function Zn(e) {
1975
+ var t = !1;
1976
+ try {
1977
+ var n = e.config.token, r = e.config.respect_dnt, i = e.config.opt_out_capturing_persistence_type, o = e.config.opt_out_capturing_cookie_prefix || void 0, s = e.config.window;
1978
+ n && (t = Gn(n, {
1979
+ respectDnt: r,
1980
+ persistenceType: i,
1981
+ persistencePrefix: o,
1982
+ window: s
1983
+ }));
1984
+ } catch (e) {
1985
+ G.error("Unexpected error when checking capturing opt-out status: " + e);
1986
+ }
1987
+ return t;
1988
+ }
1989
+
1990
+ var er, tr = 3e5, nr = tr;
1858
1991
 
1859
1992
  !function(e) {
1860
1993
  e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction",
@@ -1863,19 +1996,29 @@ var Bt, Nt = function(e, n) {
1863
1996
  e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation",
1864
1997
  e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration",
1865
1998
  e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet";
1866
- }(Bt || (Bt = {}));
1999
+ }(er || (er = {}));
1867
2000
 
1868
- var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.Input, Bt.TouchMove, Bt.MediaInteraction, Bt.Drag ], Vt = function() {
2001
+ var rr = [ er.MouseMove, er.MouseInteraction, er.Scroll, er.ViewportResize, er.Input, er.TouchMove, er.MediaInteraction, er.Drag ], ir = function(e) {
2002
+ return {
2003
+ rrwebMethod: e,
2004
+ enqueuedAt: Date.now(),
2005
+ attempt: 1
2006
+ };
2007
+ }, or = "[SessionRecording]", sr = function() {
1869
2008
  function e(t) {
1870
2009
  var n = this;
1871
- if (r(this, e), s(this, "isIdle", !1), s(this, "_linkedFlagSeen", !1), s(this, "_lastActivityTimestamp", Date.now()),
1872
- s(this, "windowId", null), s(this, "sessionId", null), s(this, "_linkedFlag", null),
1873
- s(this, "_sampleRate", null), s(this, "_minimumDuration", null), s(this, "_forceAllowLocalhostNetworkCapture", !1),
1874
- this.instance = t, this._captureStarted = !1, this._endpoint = Lt, this.stopRrweb = void 0,
1875
- this.receivedDecide = !1, null == D || D.addEventListener("beforeunload", (function() {
2010
+ if (r(this, e), s(this, "queuedRRWebEvents", []), s(this, "isIdle", !1), s(this, "_linkedFlagSeen", !1),
2011
+ s(this, "_lastActivityTimestamp", Date.now()), s(this, "windowId", null), s(this, "sessionId", null),
2012
+ s(this, "_linkedFlag", null), s(this, "_sampleRate", null), s(this, "_minimumDuration", null),
2013
+ s(this, "_forceAllowLocalhostNetworkCapture", !1), this.instance = t, this._captureStarted = !1,
2014
+ this._endpoint = "/s/", this.stopRrweb = void 0, this.receivedDecide = !1, null == A || A.addEventListener("beforeunload", (function() {
1876
2015
  n._flushBuffer();
1877
- })), !this.instance.sessionManager) throw H.error("Session recording started without valid sessionManager"),
1878
- new Error("Session recording started without valid sessionManager. This is a bug.");
2016
+ })), null == A || A.addEventListener("offline", (function() {
2017
+ n._tryAddCustomEvent("browser offline", {});
2018
+ })), null == A || A.addEventListener("online", (function() {
2019
+ n._tryAddCustomEvent("browser online", {});
2020
+ })), !this.instance.sessionManager) throw G.error(or + " started without valid sessionManager"),
2021
+ new Error(or + " started without valid sessionManager. This is a bug.");
1879
2022
  this.buffer = this.clearBuffer();
1880
2023
  }
1881
2024
  return o(e, [ {
@@ -1886,14 +2029,14 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
1886
2029
  }, {
1887
2030
  key: "sessionManager",
1888
2031
  get: function() {
1889
- if (!this.instance.sessionManager) throw H.error("Session recording started without valid sessionManager"),
1890
- new Error("Session recording started without valid sessionManager. This is a bug.");
2032
+ if (!this.instance.sessionManager) throw G.error(or + " started without valid sessionManager"),
2033
+ new Error(or + " started without valid sessionManager. This is a bug.");
1891
2034
  return this.instance.sessionManager;
1892
2035
  }
1893
2036
  }, {
1894
2037
  key: "isSampled",
1895
2038
  get: function() {
1896
- return O(this._sampleRate) ? this.instance.get_property($e) : null;
2039
+ return T(this._sampleRate) ? this.instance.get_property(Be) : null;
1897
2040
  }
1898
2041
  }, {
1899
2042
  key: "sessionDuration",
@@ -1904,25 +2047,35 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
1904
2047
  }, {
1905
2048
  key: "isRecordingEnabled",
1906
2049
  get: function() {
1907
- var e = !!this.instance.get_property(xe), t = !this.instance.config.disable_session_recording;
1908
- return D && e && t;
2050
+ var e = !!this.instance.get_property(Ae), t = !this.instance.config.disable_session_recording;
2051
+ return A && e && t;
1909
2052
  }
1910
2053
  }, {
1911
2054
  key: "isConsoleLogCaptureEnabled",
1912
2055
  get: function() {
1913
- var e = !!this.instance.get_property(Re), t = this.instance.config.enable_recording_console_log;
2056
+ var e = !!this.instance.get_property(qe), t = this.instance.config.enable_recording_console_log;
1914
2057
  return null != t ? t : e;
1915
2058
  }
2059
+ }, {
2060
+ key: "canvasRecording",
2061
+ get: function() {
2062
+ var e = this.instance.get_property(Ne);
2063
+ return e && e.fps && e.quality ? {
2064
+ enabled: e.enabled,
2065
+ fps: e.fps,
2066
+ quality: e.quality
2067
+ } : void 0;
2068
+ }
1916
2069
  }, {
1917
2070
  key: "recordingVersion",
1918
2071
  get: function() {
1919
- var e, t = this.instance.get_property(Ee);
2072
+ var e, t = this.instance.get_property(Me);
1920
2073
  return (null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.recorderVersion) || t || "v1";
1921
2074
  }
1922
2075
  }, {
1923
2076
  key: "networkPayloadCapture",
1924
2077
  get: function() {
1925
- var e, t, n = this.instance.get_property(Ce), r = {
2078
+ var e, t, n = this.instance.get_property(De), r = {
1926
2079
  recordHeaders: null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.recordHeaders,
1927
2080
  recordBody: null === (t = this.instance.config.session_recording) || void 0 === t ? void 0 : t.recordBody
1928
2081
  }, i = (null == r ? void 0 : r.recordHeaders) || (null == n ? void 0 : n.recordHeaders), o = (null == r ? void 0 : r.recordBody) || (null == n ? void 0 : n.recordBody), s = this.instance.config.capture_performance || (null == n ? void 0 : n.capturePerformance);
@@ -1935,56 +2088,64 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
1935
2088
  }, {
1936
2089
  key: "status",
1937
2090
  get: function() {
1938
- return this.receivedDecide ? this.isRecordingEnabled ? E(this._linkedFlag) && !this._linkedFlagSeen ? "buffering" : $(this.isSampled) ? this.isSampled ? "sampled" : "disabled" : "active" : "disabled" : "buffering";
2091
+ return this.receivedDecide ? this.isRecordingEnabled ? C(this._linkedFlag) || this._linkedFlagSeen ? $(this.isSampled) ? this.isSampled ? "sampled" : "disabled" : "active" : "buffering" : "disabled" : "buffering";
1939
2092
  }
1940
2093
  }, {
1941
2094
  key: "startRecordingIfEnabled",
1942
2095
  value: function() {
1943
- this.isRecordingEnabled ? this.startCaptureAndTrySendingQueuedSnapshots() : (this.stopRecording(),
2096
+ this.isRecordingEnabled ? (this._startCapture(), G.info(or + " started")) : (this.stopRecording(),
1944
2097
  this.clearBuffer());
1945
2098
  }
1946
2099
  }, {
1947
2100
  key: "stopRecording",
1948
2101
  value: function() {
1949
2102
  this._captureStarted && this.stopRrweb && (this.stopRrweb(), this.stopRrweb = void 0,
1950
- this._captureStarted = !1);
2103
+ this._captureStarted = !1, G.info(or + " stopped"));
1951
2104
  }
1952
2105
  }, {
1953
2106
  key: "makeSamplingDecision",
1954
2107
  value: function(e) {
1955
2108
  var t, n = this.sessionId !== e;
1956
- if (O(this._sampleRate)) {
2109
+ if (T(this._sampleRate)) {
1957
2110
  var r, i = this.isSampled;
1958
2111
  if (n || !$(i)) r = Math.random() < this._sampleRate; else r = i;
1959
- r || H.warn("[SessionSampling] Sample rate (".concat(this._sampleRate, ") has determined that this sessionId (").concat(e, ") will not be sent to the server.")),
1960
- null === (t = this.instance.persistence) || void 0 === t || t.register(s({}, $e, r));
2112
+ r || G.warn(or + " Sample rate (".concat(this._sampleRate, ") has determined that this sessionId (").concat(e, ") will not be sent to the server.")),
2113
+ null === (t = this.instance.persistence) || void 0 === t || t.register(s({}, Be, r));
1961
2114
  } else {
1962
2115
  var o;
1963
- null === (o = this.instance.persistence) || void 0 === o || o.register(s({}, $e, null));
2116
+ null === (o = this.instance.persistence) || void 0 === o || o.register(s({}, Be, null));
1964
2117
  }
1965
2118
  }
1966
2119
  }, {
1967
2120
  key: "afterDecideResponse",
1968
2121
  value: function(e) {
1969
- var n, r, i, o, a, u, l, c, d = this;
1970
- this.instance.persistence && this.instance.persistence.register((s(c = {}, xe, !!e.sessionRecording),
1971
- s(c, Re, null === (a = e.sessionRecording) || void 0 === a ? void 0 : a.consoleLogRecordingEnabled),
1972
- s(c, Ee, null === (u = e.sessionRecording) || void 0 === u ? void 0 : u.recorderVersion),
1973
- s(c, Ce, t({
2122
+ var n, r, i, o, a, u, l, c, d, f, h, p = this;
2123
+ this.instance.persistence && this.instance.persistence.register((s(h = {}, Ae, !!e.sessionRecording),
2124
+ s(h, qe, null === (a = e.sessionRecording) || void 0 === a ? void 0 : a.consoleLogRecordingEnabled),
2125
+ s(h, Me, null === (u = e.sessionRecording) || void 0 === u ? void 0 : u.recorderVersion),
2126
+ s(h, De, t({
1974
2127
  capturePerformance: e.capturePerformance
1975
2128
  }, null === (l = e.sessionRecording) || void 0 === l ? void 0 : l.networkPayloadCapture)),
1976
- c));
1977
- var h = null === (n = e.sessionRecording) || void 0 === n ? void 0 : n.sampleRate;
1978
- this._sampleRate = R(h) || C(h) ? null : parseFloat(h);
1979
- var f, p = null === (r = e.sessionRecording) || void 0 === r ? void 0 : r.minimumDurationMilliseconds;
1980
- (this._minimumDuration = R(p) ? null : p, this._linkedFlag = (null === (i = e.sessionRecording) || void 0 === i ? void 0 : i.linkedFlag) || null,
1981
- null !== (o = e.sessionRecording) && void 0 !== o && o.endpoint) && (this._endpoint = null === (f = e.sessionRecording) || void 0 === f ? void 0 : f.endpoint);
1982
- if (O(this._sampleRate) && this.sessionManager.onSessionId((function(e) {
1983
- d.makeSamplingDecision(e);
1984
- })), E(this._linkedFlag)) {
1985
- var _ = this._linkedFlag;
1986
- this.instance.onFeatureFlags((function(e) {
1987
- d._linkedFlagSeen = e.includes(_);
2129
+ s(h, Ne, {
2130
+ enabled: null === (c = e.sessionRecording) || void 0 === c ? void 0 : c.recordCanvas,
2131
+ fps: null === (d = e.sessionRecording) || void 0 === d ? void 0 : d.canvasFps,
2132
+ quality: null === (f = e.sessionRecording) || void 0 === f ? void 0 : f.canvasQuality
2133
+ }), h));
2134
+ var _ = null === (n = e.sessionRecording) || void 0 === n ? void 0 : n.sampleRate;
2135
+ this._sampleRate = C(_) ? null : parseFloat(_);
2136
+ var g, v = null === (r = e.sessionRecording) || void 0 === r ? void 0 : r.minimumDurationMilliseconds;
2137
+ (this._minimumDuration = x(v) ? null : v, this._linkedFlag = (null === (i = e.sessionRecording) || void 0 === i ? void 0 : i.linkedFlag) || null,
2138
+ null !== (o = e.sessionRecording) && void 0 !== o && o.endpoint) && (this._endpoint = null === (g = e.sessionRecording) || void 0 === g ? void 0 : g.endpoint);
2139
+ if (T(this._sampleRate) && this.sessionManager.onSessionId((function(e) {
2140
+ p.makeSamplingDecision(e);
2141
+ })), !C(this._linkedFlag)) {
2142
+ var m, y, b = E(this._linkedFlag) ? this._linkedFlag : null === (m = this._linkedFlag) || void 0 === m ? void 0 : m.flag, w = E(this._linkedFlag) ? null : null === (y = this._linkedFlag) || void 0 === y ? void 0 : y.variant;
2143
+ this.instance.onFeatureFlags((function(e, t) {
2144
+ var n = P(t) && b in t, r = w ? t[b] === w : n;
2145
+ r && G.info(or + " linked flag matched", {
2146
+ linkedFlag: b,
2147
+ linkedVariant: w
2148
+ }), p._linkedFlagSeen = r;
1988
2149
  }));
1989
2150
  }
1990
2151
  this.receivedDecide = !0, this.startRecordingIfEnabled();
@@ -2003,23 +2164,18 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2003
2164
  payload: [ JSON.stringify(e) ]
2004
2165
  }
2005
2166
  },
2006
- timestamp: J()
2167
+ timestamp: te()
2007
2168
  });
2008
2169
  }
2009
- }, {
2010
- key: "startCaptureAndTrySendingQueuedSnapshots",
2011
- value: function() {
2012
- this._startCapture();
2013
- }
2014
2170
  }, {
2015
2171
  key: "_startCapture",
2016
2172
  value: function() {
2017
2173
  var e = this;
2018
- if (!R(Object.assign) && !this._captureStarted && !this.instance.config.disable_session_recording) {
2174
+ if (!x(Object.assign) && !(this._captureStarted || this.instance.config.disable_session_recording || Zn(this.instance))) {
2019
2175
  this._captureStarted = !0, this.sessionManager.checkAndGetSessionAndWindowId();
2020
2176
  var t = "v2" === this.recordingVersion ? "recorder-v2.js" : "recorder.js";
2021
- this.instance.__loaded_recorder_version !== this.recordingVersion ? oe(this.instance.config.api_host + "/static/".concat(t, "?v=").concat(m.LIB_VERSION), (function(n) {
2022
- if (n) return H.error("Could not load ".concat(t), n);
2177
+ this.instance.__loaded_recorder_version !== this.recordingVersion ? le(this.instance.requestRouter.endpointFor("assets", "/static/".concat(t, "?v=").concat(m.LIB_VERSION)), (function(n) {
2178
+ if (n) return G.error(or + " could not load ".concat(t), n);
2023
2179
  e._onScriptLoaded();
2024
2180
  })) : this._onScriptLoaded();
2025
2181
  }
@@ -2028,54 +2184,56 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2028
2184
  key: "_isInteractiveEvent",
2029
2185
  value: function(e) {
2030
2186
  var t;
2031
- return e.type === Rt && -1 !== Ht.indexOf(null === (t = e.data) || void 0 === t ? void 0 : t.source);
2187
+ return 3 === e.type && -1 !== rr.indexOf(null === (t = e.data) || void 0 === t ? void 0 : t.source);
2032
2188
  }
2033
2189
  }, {
2034
2190
  key: "_updateWindowAndSessionIds",
2035
2191
  value: function(e) {
2036
2192
  var t = this._isInteractiveEvent(e);
2037
- if (t || this.isIdle || e.timestamp - this._lastActivityTimestamp > jt && (this.isIdle = !0,
2193
+ t || this.isIdle || e.timestamp - this._lastActivityTimestamp > nr && (this.isIdle = !0,
2038
2194
  this._tryAddCustomEvent("sessionIdle", {
2039
2195
  reason: "user inactivity",
2040
2196
  timeSinceLastActive: e.timestamp - this._lastActivityTimestamp,
2041
- threshold: jt
2042
- })), t && (this._lastActivityTimestamp = e.timestamp, this.isIdle && (this.isIdle = !1,
2197
+ threshold: nr
2198
+ }));
2199
+ var n = !1;
2200
+ if (t && (this._lastActivityTimestamp = e.timestamp, this.isIdle && (this.isIdle = !1,
2043
2201
  this._tryAddCustomEvent("sessionNoLongerIdle", {
2044
2202
  reason: "user activity",
2045
2203
  type: e.type
2046
- }), this._tryTakeFullSnapshot())), !this.isIdle) {
2047
- var n = this.sessionManager.checkAndGetSessionAndWindowId(!t, e.timestamp), r = n.windowId, i = n.sessionId, o = this.sessionId !== i, s = this.windowId !== r;
2048
- -1 === [ It, xt ].indexOf(e.type) && (s || o) && this._tryTakeFullSnapshot(), this.windowId = r,
2049
- this.sessionId = i;
2204
+ }), n = !0)), !this.isIdle) {
2205
+ var r = this.sessionManager.checkAndGetSessionAndWindowId(!t, e.timestamp), i = r.windowId, o = r.sessionId, s = this.sessionId !== o, a = this.windowId !== i;
2206
+ this.windowId = i, this.sessionId = o, (n || -1 === [ An, qn ].indexOf(e.type) && (a || s)) && this._tryTakeFullSnapshot();
2050
2207
  }
2051
2208
  }
2052
2209
  }, {
2053
- key: "_tryRRwebMethod",
2210
+ key: "_tryRRWebMethod",
2054
2211
  value: function(e) {
2055
- if (!this._captureStarted) return !1;
2056
2212
  try {
2057
- return e(), !0;
2058
- } catch (e) {
2059
- return H.error("[Session-Recording] using rrweb when not started.", e), !1;
2213
+ return e.rrwebMethod(), !0;
2214
+ } catch (t) {
2215
+ return G.warn(or + " could not emit queued rrweb event.", t), this.queuedRRWebEvents.length < 10 && this.queuedRRWebEvents.push({
2216
+ enqueuedAt: e.enqueuedAt || Date.now(),
2217
+ attempt: e.attempt++,
2218
+ rrwebMethod: e.rrwebMethod
2219
+ }), !1;
2060
2220
  }
2061
2221
  }
2062
2222
  }, {
2063
2223
  key: "_tryAddCustomEvent",
2064
2224
  value: function(e, t) {
2065
2225
  var n = this;
2066
- return this._tryRRwebMethod((function() {
2067
- var r;
2068
- return null === (r = n.rrwebRecord) || void 0 === r ? void 0 : r.addCustomEvent(e, t);
2069
- }));
2226
+ return this._tryRRWebMethod(ir((function() {
2227
+ return n.rrwebRecord.addCustomEvent(e, t);
2228
+ })));
2070
2229
  }
2071
2230
  }, {
2072
2231
  key: "_tryTakeFullSnapshot",
2073
2232
  value: function() {
2074
2233
  var e = this;
2075
- return this._tryRRwebMethod((function() {
2076
- var t;
2077
- return null === (t = e.rrwebRecord) || void 0 === t ? void 0 : t.takeFullSnapshot();
2078
- }));
2234
+ return this._tryRRWebMethod(ir((function() {
2235
+ return e.rrwebRecord.takeFullSnapshot();
2236
+ })));
2079
2237
  }
2080
2238
  }, {
2081
2239
  key: "_onScriptLoaded",
@@ -2095,59 +2253,85 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2095
2253
  inlineStylesheet: !0,
2096
2254
  recordCrossOriginIframes: !1
2097
2255
  };
2098
- this.rrwebRecord = D.rrweb ? D.rrweb.record : D.rrwebRecord;
2256
+ this.rrwebRecord = A.rrweb ? A.rrweb.record : A.rrwebRecord;
2099
2257
  for (var i = this.instance.config.session_recording, o = 0, s = Object.entries(i || {}); o < s.length; o++) {
2100
- var a = f(s[o], 2), u = a[0], l = a[1];
2258
+ var a = h(s[o], 2), u = a[0], l = a[1];
2101
2259
  u in r && (r[u] = l);
2102
2260
  }
2103
- this.rrwebRecord ? (this.mutationRateLimiter = null !== (e = this.mutationRateLimiter) && void 0 !== e ? e : new $t(this.rrwebRecord, {
2104
- onBlockedNode: function(e, t) {
2105
- var r = "Too many mutations on node '".concat(e, "'. Rate limiting. This could be due to SVG animations or something similar");
2106
- H.info(r, {
2107
- node: t
2108
- }), n.log("[PostHog Recorder] " + r, "warn");
2109
- }
2110
- }), this.stopRrweb = this.rrwebRecord(t({
2111
- emit: function(e) {
2112
- n.onRRwebEmit(e);
2113
- },
2114
- plugins: this._gatherRRWebPlugins()
2115
- }, r)), this.instance._addCaptureHook((function(e) {
2116
- try {
2117
- if ("$pageview" === e) {
2118
- var t = D ? n._maskUrl(D.location.href) : "";
2119
- if (!t) return;
2120
- n._tryAddCustomEvent("$pageview", {
2121
- href: t
2122
- });
2261
+ if (this.canvasRecording && this.canvasRecording.enabled && (r.recordCanvas = !0,
2262
+ r.sampling = {
2263
+ canvas: this.canvasRecording.fps
2264
+ }, r.dataURLOptions = {
2265
+ type: "image/webp",
2266
+ quality: this.canvasRecording.quality
2267
+ }), this.rrwebRecord) {
2268
+ this.mutationRateLimiter = null !== (e = this.mutationRateLimiter) && void 0 !== e ? e : new Mn(this.rrwebRecord, {
2269
+ onBlockedNode: function(e, t) {
2270
+ var r = "Too many mutations on node '".concat(e, "'. Rate limiting. This could be due to SVG animations or something similar");
2271
+ G.info(r, {
2272
+ node: t
2273
+ }), n.log(or + " " + r, "warn");
2123
2274
  }
2124
- } catch (e) {
2125
- H.error("Could not add $pageview to rrweb session", e);
2126
- }
2127
- })), this._lastActivityTimestamp = Date.now(), this.isIdle = !1) : H.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");
2275
+ }), this._scheduleFullSnapshot();
2276
+ var c = this._gatherRRWebPlugins();
2277
+ this.stopRrweb = this.rrwebRecord(t({
2278
+ emit: function(e) {
2279
+ n.onRRwebEmit(e);
2280
+ },
2281
+ plugins: c
2282
+ }, r)), this.instance._addCaptureHook((function(e) {
2283
+ try {
2284
+ if ("$pageview" === e) {
2285
+ var t = A ? n._maskUrl(A.location.href) : "";
2286
+ if (!t) return;
2287
+ n._tryAddCustomEvent("$pageview", {
2288
+ href: t
2289
+ }), n._tryTakeFullSnapshot();
2290
+ }
2291
+ } catch (e) {
2292
+ G.error("Could not add $pageview to rrweb session", e);
2293
+ }
2294
+ })), this._lastActivityTimestamp = Date.now(), this.isIdle = !1, this._tryAddCustomEvent("$session_options", {
2295
+ sessionRecordingOptions: r,
2296
+ activePlugins: c.map((function(e) {
2297
+ return null == e ? void 0 : e.name;
2298
+ }))
2299
+ }), this._tryAddCustomEvent("$posthog_config", {
2300
+ config: this.instance.config
2301
+ });
2302
+ } else G.error(or + "onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.");
2303
+ }
2304
+ }, {
2305
+ key: "_scheduleFullSnapshot",
2306
+ value: function() {
2307
+ var e = this;
2308
+ this._fullSnapshotTimer && clearInterval(this._fullSnapshotTimer), this._fullSnapshotTimer = setInterval((function() {
2309
+ e._tryTakeFullSnapshot();
2310
+ }), tr);
2128
2311
  }
2129
2312
  }, {
2130
2313
  key: "_gatherRRWebPlugins",
2131
2314
  value: function() {
2132
2315
  var e = [];
2133
- (L.rrwebConsoleRecord && this.isConsoleLogCaptureEnabled && e.push(L.rrwebConsoleRecord.getRecordConsolePlugin()),
2134
- this.networkPayloadCapture && P(L.getRecordNetworkPlugin)) && (!mt.includes(location.hostname) || this._forceAllowLocalhostNetworkCapture ? e.push(L.getRecordNetworkPlugin(Nt(this.instance.config, this.networkPayloadCapture))) : H.info("[SessionReplay-NetworkCapture] not started because we are on localhost."));
2316
+ (W.rrwebConsoleRecord && this.isConsoleLogCaptureEnabled && e.push(W.rrwebConsoleRecord.getRecordConsolePlugin()),
2317
+ this.networkPayloadCapture && R(W.getRecordNetworkPlugin)) && (!xt.includes(location.hostname) || this._forceAllowLocalhostNetworkCapture ? e.push(W.getRecordNetworkPlugin(Hn(this.instance.config, this.networkPayloadCapture))) : G.info(or + " NetworkCapture not started because we are on localhost."));
2135
2318
  return e;
2136
2319
  }
2137
2320
  }, {
2138
2321
  key: "onRRwebEmit",
2139
2322
  value: function(e) {
2140
- if (e && I(e)) {
2141
- if (e.type === Mt.Meta) {
2323
+ if (this._processQueuedEvents(), e && P(e)) {
2324
+ if (e.type === Dn.Meta) {
2142
2325
  var t = this._maskUrl(e.data.href);
2143
2326
  if (!t) return;
2144
2327
  e.data.href = t;
2145
2328
  }
2329
+ e.type === Dn.FullSnapshot && this._scheduleFullSnapshot();
2146
2330
  var n = this.mutationRateLimiter ? this.mutationRateLimiter.throttleMutations(e) : e;
2147
2331
  if (n) {
2148
2332
  var r = function(e) {
2149
2333
  var t = e;
2150
- if (t && I(t) && t.type === Et && I(t.data) && t.data.plugin === Ot) {
2334
+ if (t && P(t) && 6 === t.type && P(t.data) && "rrweb/console@1" === t.data.plugin) {
2151
2335
  t.data.payload.payload.length > 10 && (t.data.payload.payload = t.data.payload.payload.slice(0, 10),
2152
2336
  t.data.payload.payload.push("...[truncated]"));
2153
2337
  for (var n = [], r = 0; r < t.data.payload.payload.length; r++) t.data.payload.payload[r] && t.data.payload.payload[r].length > 2e3 ? n.push(t.data.payload.payload[r].slice(0, 2e3) + "...[truncated]") : n.push(t.data.payload.payload[r]);
@@ -2155,7 +2339,7 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2155
2339
  }
2156
2340
  return e;
2157
2341
  }(n), i = JSON.stringify(r).length;
2158
- if (this._updateWindowAndSessionIds(r), !this.isIdle) {
2342
+ if (this._updateWindowAndSessionIds(r), !this.isIdle || r.type === Dn.Custom) {
2159
2343
  var o = {
2160
2344
  $snapshot_bytes: i,
2161
2345
  $snapshot_data: r,
@@ -2167,6 +2351,25 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2167
2351
  }
2168
2352
  }
2169
2353
  }
2354
+ }, {
2355
+ key: "_processQueuedEvents",
2356
+ value: function() {
2357
+ var e = this;
2358
+ if (this.queuedRRWebEvents.length) {
2359
+ var t = p(this.queuedRRWebEvents);
2360
+ this.queuedRRWebEvents = [], t.forEach((function(n) {
2361
+ Date.now() - n.enqueuedAt > 2e3 ? e._tryAddCustomEvent("rrwebQueueTimeout", {
2362
+ enqueuedAt: n.enqueuedAt,
2363
+ attempt: n.attempt,
2364
+ queueLength: t.length
2365
+ }) : e._tryRRWebMethod(n) && e._tryAddCustomEvent("rrwebQueueSuccess", {
2366
+ enqueuedAt: n.enqueuedAt,
2367
+ attempt: n.attempt,
2368
+ queueLength: t.length
2369
+ });
2370
+ }));
2371
+ }
2372
+ }
2170
2373
  }, {
2171
2374
  key: "_maskUrl",
2172
2375
  value: function(e) {
@@ -2194,7 +2397,7 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2194
2397
  value: function() {
2195
2398
  var e = this;
2196
2399
  this.flushBufferTimer && (clearTimeout(this.flushBufferTimer), this.flushBufferTimer = void 0);
2197
- var t = this._minimumDuration, n = this.sessionDuration, r = O(n) && n >= 0, i = O(t) && r && n < t;
2400
+ var t = this._minimumDuration, n = this.sessionDuration, r = T(n) && n >= 0, i = T(t) && r && n < t;
2198
2401
  return "buffering" === this.status || i ? (this.flushBufferTimer = setTimeout((function() {
2199
2402
  e._flushBuffer();
2200
2403
  }), 2e3), this.buffer || this.clearBuffer()) : this.buffer && 0 !== this.buffer.data.length ? (this._captureSnapshot({
@@ -2209,7 +2412,7 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2209
2412
  value: function(e) {
2210
2413
  var t, n = this, r = 2 + ((null === (t = this.buffer) || void 0 === t ? void 0 : t.data.length) || 0);
2211
2414
  (!this.buffer || this.buffer.size + e.$snapshot_bytes + r > 943718.4 || this.buffer.sessionId && this.buffer.sessionId !== this.sessionId) && (this.buffer = this._flushBuffer()),
2212
- C(this.buffer.sessionId) && !C(this.sessionId) && (this.buffer.sessionId = this.sessionId,
2415
+ I(this.buffer.sessionId) && !I(this.sessionId) && (this.buffer.sessionId = this.sessionId,
2213
2416
  this.buffer.windowId = this.windowId), this.buffer.size += e.$snapshot_bytes, this.buffer.data.push(e.$snapshot_data),
2214
2417
  this.flushBufferTimer || (this.flushBufferTimer = setTimeout((function() {
2215
2418
  n._flushBuffer();
@@ -2219,33 +2422,32 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2219
2422
  key: "_captureSnapshot",
2220
2423
  value: function(e) {
2221
2424
  this.instance.capture("$snapshot", e, {
2222
- transport: "XHR",
2223
2425
  method: "POST",
2224
- endpoint: this._endpoint,
2426
+ _url: this.instance.requestRouter.endpointFor("api", this._endpoint),
2225
2427
  _noTruncate: !0,
2226
2428
  _batchKey: "recordings",
2227
2429
  _metrics: {
2228
- rrweb_full_snapshot: e.$snapshot_data.type === It
2430
+ rrweb_full_snapshot: e.$snapshot_data.type === An
2229
2431
  }
2230
2432
  });
2231
2433
  }
2232
2434
  } ]), e;
2233
- }(), Ut = function() {
2435
+ }(), ar = function() {
2234
2436
  function e(t) {
2235
2437
  r(this, e), this.instance = t, this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags();
2236
2438
  }
2237
2439
  return o(e, [ {
2238
2440
  key: "call",
2239
2441
  value: function() {
2240
- var e = this, t = ne(JSON.stringify({
2442
+ var e = this, t = se(JSON.stringify({
2241
2443
  token: this.instance.config.token,
2242
2444
  distinct_id: this.instance.get_distinct_id(),
2243
2445
  groups: this.instance.getGroups(),
2244
- person_properties: this.instance.get_property(Ae),
2245
- group_properties: this.instance.get_property(De),
2446
+ person_properties: this.instance.get_property(Ue),
2447
+ group_properties: this.instance.get_property(Ve),
2246
2448
  disable_flags: this.instance.config.advanced_disable_feature_flags || this.instance.config.advanced_disable_feature_flags_on_first_load || void 0
2247
2449
  }));
2248
- this.instance._send_request("".concat(this.instance.config.api_host, "/decide/?v=3"), {
2450
+ this.instance._send_request(this.instance.requestRouter.endpointFor("api", "/decide/?v=3"), {
2249
2451
  data: t,
2250
2452
  verbose: !0
2251
2453
  }, {
@@ -2260,42 +2462,42 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2260
2462
  var t, n = this;
2261
2463
  if (this.instance.featureFlags.setReloadingPaused(!1), this.instance.featureFlags._startReloadTimer(),
2262
2464
  0 !== (null == e ? void 0 : e.status)) {
2263
- if (!B || !B.body) return H.info("document not ready yet, trying again in 500 milliseconds..."),
2465
+ if (!B || !B.body) return G.info("document not ready yet, trying again in 500 milliseconds..."),
2264
2466
  void setTimeout((function() {
2265
2467
  n.parseDecideResponse(e);
2266
2468
  }), 500);
2267
2469
  this.instance.toolbar.afterDecideResponse(e), null === (t = this.instance.sessionRecording) || void 0 === t || t.afterDecideResponse(e),
2268
- Ue.afterDecideResponse(e, this.instance), this.instance._afterDecideResponse(e),
2470
+ Ze.afterDecideResponse(e, this.instance), this.instance._afterDecideResponse(e),
2269
2471
  this.instance.config.advanced_disable_feature_flags_on_first_load || this.instance.config.advanced_disable_feature_flags || this.instance.featureFlags.receivedFeatureFlags(e);
2270
- var r = null == D ? void 0 : D.extendPostHogWithSurveys;
2271
- e.surveys && !r && oe(this.instance.config.api_host + "/static/surveys.js", (function(e) {
2272
- if (e) return H.error("Could not load surveys script", e);
2273
- D.extendPostHogWithSurveys(n.instance);
2472
+ var r = null == A ? void 0 : A.extendPostHogWithSurveys;
2473
+ e.surveys && !r && le(this.instance.requestRouter.endpointFor("assets", "/static/surveys.js"), (function(e) {
2474
+ if (e) return G.error("Could not load surveys script", e);
2475
+ A.extendPostHogWithSurveys(n.instance);
2274
2476
  }));
2275
- var i = null == D ? void 0 : D.extendPostHogWithExceptionAutoCapture;
2276
- if (e.autocaptureExceptions && e.autocaptureExceptions && R(i) && oe(this.instance.config.api_host + "/static/exception-autocapture.js", (function(t) {
2277
- if (t) return H.error("Could not load exception autocapture script", t);
2278
- D.extendPostHogWithExceptionAutocapture(n.instance, e);
2477
+ var i = null == A ? void 0 : A.extendPostHogWithExceptionAutoCapture;
2478
+ if (e.autocaptureExceptions && e.autocaptureExceptions && x(i) && le(this.instance.requestRouter.endpointFor("assets", "/static/exception-autocapture.js"), (function(t) {
2479
+ if (t) return G.error("Could not load exception autocapture script", t);
2480
+ A.extendPostHogWithExceptionAutocapture(n.instance, e);
2279
2481
  })), e.siteApps) if (this.instance.config.opt_in_site_apps) {
2280
- var o, s = this.instance.config.api_host, a = v(e.siteApps);
2482
+ var o, s = v(e.siteApps);
2281
2483
  try {
2282
- var u = function() {
2283
- var e = o.value, t = e.id, r = e.url, i = [ s, "/" === s[s.length - 1] && "/" === r[0] ? r.substring(1) : r ].join("");
2284
- L["__$$ph_site_app_".concat(t)] = n.instance, oe(i, (function(e) {
2285
- e && H.error("Error while initializing PostHog app with config id ".concat(t), e);
2484
+ var a = function() {
2485
+ var e = o.value, t = e.id, r = e.url, i = n.instance.requestRouter.endpointFor("api", r);
2486
+ W["__$$ph_site_app_".concat(t)] = n.instance, le(i, (function(e) {
2487
+ e && G.error("Error while initializing PostHog app with config id ".concat(t), e);
2286
2488
  }));
2287
2489
  };
2288
- for (a.s(); !(o = a.n()).done; ) u();
2490
+ for (s.s(); !(o = s.n()).done; ) a();
2289
2491
  } catch (e) {
2290
- a.e(e);
2492
+ s.e(e);
2291
2493
  } finally {
2292
- a.f();
2494
+ s.f();
2293
2495
  }
2294
- } else e.siteApps.length > 0 && H.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
2295
- } else H.error("Failed to fetch feature flags from PostHog.");
2496
+ } else e.siteApps.length > 0 && G.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
2497
+ } else G.error("Failed to fetch feature flags from PostHog.");
2296
2498
  }
2297
2499
  } ]), e;
2298
- }(), Wt = [ "https://app.posthog.com", "https://eu.posthog.com" ], Gt = [ "source" ], zt = null != D && D.location ? wt(D.location.hash, "__posthog") || wt(location.hash, "state") : null, Yt = function() {
2500
+ }(), ur = [ "source" ], lr = null != A && A.location ? Ot(A.location.hash, "__posthog") || Ot(location.hash, "state") : null, cr = function() {
2299
2501
  function e(t) {
2300
2502
  r(this, e), this.instance = t;
2301
2503
  }
@@ -2311,20 +2513,20 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2311
2513
  key: "maybeLoadToolbar",
2312
2514
  value: function() {
2313
2515
  var e, t, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
2314
- if (!D || !B) return !1;
2315
- n = null !== (e = n) && void 0 !== e ? e : D.location, i = null !== (t = i) && void 0 !== t ? t : D.history;
2516
+ if (!A || !B) return !1;
2517
+ n = null !== (e = n) && void 0 !== e ? e : A.location, i = null !== (t = i) && void 0 !== t ? t : A.history;
2316
2518
  try {
2317
2519
  if (!r) {
2318
2520
  try {
2319
- D.localStorage.setItem("test", "test"), D.localStorage.removeItem("test");
2521
+ A.localStorage.setItem("test", "test"), A.localStorage.removeItem("test");
2320
2522
  } catch (e) {
2321
2523
  return !1;
2322
2524
  }
2323
- r = null == D ? void 0 : D.localStorage;
2525
+ r = null == A ? void 0 : A.localStorage;
2324
2526
  }
2325
- var o, s = zt || wt(n.hash, "__posthog") || wt(n.hash, "state"), a = s ? X((function() {
2527
+ var o, s = lr || Ot(n.hash, "__posthog") || Ot(n.hash, "state"), a = s ? ne((function() {
2326
2528
  return JSON.parse(atob(decodeURIComponent(s)));
2327
- })) || X((function() {
2529
+ })) || ne((function() {
2328
2530
  return JSON.parse(decodeURIComponent(s));
2329
2531
  })) : null;
2330
2532
  return a && "ph_authorize" === a.action ? ((o = a).source = "url", o && Object.keys(o).length > 0 && (a.desiredHash ? n.hash = a.desiredHash : i ? i.replaceState("", B.title, n.pathname + n.search) : n.hash = "")) : ((o = JSON.parse(r.getItem("_postHogToolbarParams") || "{}")).source = "localstorage",
@@ -2338,21 +2540,21 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2338
2540
  key: "loadToolbar",
2339
2541
  value: function(e) {
2340
2542
  var n = this;
2341
- if (!D || L._postHogToolbarLoaded) return !1;
2342
- L._postHogToolbarLoaded = !0;
2343
- var r = this.instance.config.api_host, i = 3e5, o = Math.floor(Date.now() / i) * i, s = "".concat(r).concat(r.endsWith("/") ? "" : "/", "static/toolbar.js?t=").concat(o), a = !Wt.includes(this.instance.config.api_host) && this.instance.config.advanced_disable_toolbar_metrics, u = t(t({
2543
+ if (!A || W._postHogToolbarLoaded) return !1;
2544
+ W._postHogToolbarLoaded = !0;
2545
+ var r = 3e5, i = Math.floor(Date.now() / r) * r, o = this.instance.requestRouter.endpointFor("assets", "/static/toolbar.js?t=".concat(i)), s = "custom" === this.instance.requestRouter.region && this.instance.config.advanced_disable_toolbar_metrics, a = t(t({
2344
2546
  token: this.instance.config.token
2345
2547
  }, e), {}, {
2346
- apiURL: r
2347
- }, a ? {
2548
+ apiURL: this.instance.requestRouter.endpointFor("ui")
2549
+ }, s ? {
2348
2550
  instrument: !1
2349
2551
  } : {});
2350
- u.source;
2351
- var l = c(u, Gt);
2352
- return D.localStorage.setItem("_postHogToolbarParams", JSON.stringify(l)), oe(s, (function(e) {
2353
- e ? H.error("Failed to load toolbar", e) : (L.ph_load_toolbar || L.ph_load_editor)(u, n.instance);
2354
- })), ie(D, "turbolinks:load", (function() {
2355
- L._postHogToolbarLoaded = !1, n.loadToolbar(u);
2552
+ a.source;
2553
+ var u = c(a, ur);
2554
+ return A.localStorage.setItem("_postHogToolbarParams", JSON.stringify(u)), le(o, (function(e) {
2555
+ e ? G.error("Failed to load toolbar", e) : (W.ph_load_toolbar || W.ph_load_editor)(a, n.instance);
2556
+ })), ue(A, "turbolinks:load", (function() {
2557
+ W._postHogToolbarLoaded = !1, n.loadToolbar(a);
2356
2558
  })), !0;
2357
2559
  }
2358
2560
  }, {
@@ -2367,56 +2569,7 @@ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.I
2367
2569
  return this.maybeLoadToolbar(e, t, n);
2368
2570
  }
2369
2571
  } ]), e;
2370
- }(), Qt = "__ph_opt_in_out_";
2371
-
2372
- function Jt(e, t) {
2373
- on(!0, e, t);
2374
- }
2375
-
2376
- function Xt(e, t) {
2377
- on(!1, e, t);
2378
- }
2379
-
2380
- function Kt(e, t) {
2381
- return "1" === rn(e, t);
2382
- }
2383
-
2384
- function Zt(e, t) {
2385
- return !!function(e) {
2386
- if (e && e.respectDnt) {
2387
- var t = e && e.window || D, n = null == t ? void 0 : t.navigator, r = !1;
2388
- return G([ null == n ? void 0 : n.doNotTrack, n.msDoNotTrack, t.doNotTrack ], (function(e) {
2389
- Y([ !0, 1, "1", "yes" ], e) && (r = !0);
2390
- })), r;
2391
- }
2392
- return !1;
2393
- }(t) || "0" === rn(e, t);
2394
- }
2395
-
2396
- function en(e, t) {
2397
- tn(t = t || {}).remove(nn(e, t), !!t.crossSubdomainCookie);
2398
- }
2399
-
2400
- function tn(e) {
2401
- return "localStorage" === (e = e || {}).persistenceType ? dt : "localStorage+cookie" === e.persistenceType ? ft : lt;
2402
- }
2403
-
2404
- function nn(e, t) {
2405
- return ((t = t || {}).persistencePrefix || Qt) + e;
2406
- }
2407
-
2408
- function rn(e, t) {
2409
- return tn(t).get(nn(e, t));
2410
- }
2411
-
2412
- function on(e, t, n) {
2413
- E(t) && t.length ? (tn(n = n || {}).set(nn(t, n), e ? 1 : 0, O(n.cookieExpiration) ? n.cookieExpiration : null, n.crossSubdomainCookie, n.secureCookie),
2414
- n.capture && e && n.capture(n.captureEventName || "$opt_in", n.captureProperties || {}, {
2415
- send_instantly: !0
2416
- })) : H.error("gdpr." + (e ? "optIn" : "optOut") + " called with an invalid token");
2417
- }
2418
-
2419
- var sn = function() {
2572
+ }(), dr = function() {
2420
2573
  function e() {
2421
2574
  var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 3e3;
2422
2575
  r(this, e), this.isPolling = !0, this._event_queue = [], this._empty_queue_count = 0,
@@ -2439,9 +2592,9 @@ var sn = function() {
2439
2592
  return (new Date).getTime();
2440
2593
  }
2441
2594
  } ]), e;
2442
- }(), an = function(e) {
2443
- a(i, sn);
2444
- var n = h(i);
2595
+ }(), fr = function(e) {
2596
+ a(i, dr);
2597
+ var n = f(i);
2445
2598
  function i(e) {
2446
2599
  var t, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 3e3;
2447
2600
  return r(this, i), (t = n.call(this, o)).handlePollRequest = e, t;
@@ -2463,7 +2616,7 @@ var sn = function() {
2463
2616
  if (e._event_queue.length > 0) {
2464
2617
  var t = e.formatQueue(), n = function(n) {
2465
2618
  var r = t[n], i = r.url, o = r.data, s = r.options;
2466
- G(o, (function(t, n) {
2619
+ K(o, (function(t, n) {
2467
2620
  o[n].offset = Math.abs(o[n].timestamp - e.getTime()), delete o[n].timestamp;
2468
2621
  })), e.handlePollRequest(i, o, s);
2469
2622
  };
@@ -2496,9 +2649,9 @@ var sn = function() {
2496
2649
  key: "formatQueue",
2497
2650
  value: function() {
2498
2651
  var e = {};
2499
- return G(this._event_queue, (function(t) {
2652
+ return K(this._event_queue, (function(t) {
2500
2653
  var n = t.url, r = t.data, i = t.options, o = (i ? i._batchKey : null) || n;
2501
- R(e[o]) && (e[o] = {
2654
+ x(e[o]) && (e[o] = {
2502
2655
  data: [],
2503
2656
  url: n,
2504
2657
  options: i
@@ -2507,68 +2660,68 @@ var sn = function() {
2507
2660
  })), e;
2508
2661
  }
2509
2662
  } ]), i;
2510
- }(), un = Uint8Array, ln = Uint16Array, cn = Uint32Array, dn = new un([ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0 ]), hn = new un([ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0 ]), fn = new un([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]), pn = function(e, t) {
2511
- for (var n = new ln(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
2512
- var i = new cn(n[30]);
2663
+ }(), hr = Uint8Array, pr = Uint16Array, _r = Uint32Array, gr = new hr([ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0 ]), vr = new hr([ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0 ]), mr = new hr([ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]), yr = function(e, t) {
2664
+ for (var n = new pr(31), r = 0; r < 31; ++r) n[r] = t += 1 << e[r - 1];
2665
+ var i = new _r(n[30]);
2513
2666
  for (r = 1; r < 30; ++r) for (var o = n[r]; o < n[r + 1]; ++o) i[o] = o - n[r] << 5 | r;
2514
2667
  return [ n, i ];
2515
- }, _n = pn(dn, 2), gn = _n[0], vn = _n[1];
2668
+ }, br = yr(gr, 2), wr = br[0], kr = br[1];
2516
2669
 
2517
- gn[28] = 258, vn[258] = 28;
2670
+ wr[28] = 258, kr[258] = 28;
2518
2671
 
2519
- for (var mn = pn(hn, 0)[1], yn = new ln(32768), bn = 0; bn < 32768; ++bn) {
2520
- var kn = (43690 & bn) >>> 1 | (21845 & bn) << 1;
2521
- kn = (61680 & (kn = (52428 & kn) >>> 2 | (13107 & kn) << 2)) >>> 4 | (3855 & kn) << 4,
2522
- yn[bn] = ((65280 & kn) >>> 8 | (255 & kn) << 8) >>> 1;
2672
+ for (var Sr = yr(vr, 0)[1], Fr = new pr(32768), Rr = 0; Rr < 32768; ++Rr) {
2673
+ var Pr = (43690 & Rr) >>> 1 | (21845 & Rr) << 1;
2674
+ Pr = (61680 & (Pr = (52428 & Pr) >>> 2 | (13107 & Pr) << 2)) >>> 4 | (3855 & Pr) << 4,
2675
+ Fr[Rr] = ((65280 & Pr) >>> 8 | (255 & Pr) << 8) >>> 1;
2523
2676
  }
2524
2677
 
2525
- var wn = function(e, t, n) {
2526
- for (var r = e.length, i = 0, o = new ln(t); i < r; ++i) ++o[e[i] - 1];
2527
- var s, a = new ln(t);
2678
+ var xr = function(e, t, n) {
2679
+ for (var r = e.length, i = 0, o = new pr(t); i < r; ++i) ++o[e[i] - 1];
2680
+ var s, a = new pr(t);
2528
2681
  for (i = 0; i < t; ++i) a[i] = a[i - 1] + o[i - 1] << 1;
2529
2682
  if (n) {
2530
- s = new ln(1 << t);
2683
+ s = new pr(1 << t);
2531
2684
  var u = 15 - t;
2532
- for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], c = t - e[i], d = a[e[i] - 1]++ << c, h = d | (1 << c) - 1; d <= h; ++d) s[yn[d] >>> u] = l;
2533
- } else for (s = new ln(r), i = 0; i < r; ++i) s[i] = yn[a[e[i] - 1]++] >>> 15 - e[i];
2685
+ for (i = 0; i < r; ++i) if (e[i]) for (var l = i << 4 | e[i], c = t - e[i], d = a[e[i] - 1]++ << c, f = d | (1 << c) - 1; d <= f; ++d) s[Fr[d] >>> u] = l;
2686
+ } else for (s = new pr(r), i = 0; i < r; ++i) s[i] = Fr[a[e[i] - 1]++] >>> 15 - e[i];
2534
2687
  return s;
2535
- }, Sn = new un(288);
2688
+ }, Er = new hr(288);
2536
2689
 
2537
- for (bn = 0; bn < 144; ++bn) Sn[bn] = 8;
2690
+ for (Rr = 0; Rr < 144; ++Rr) Er[Rr] = 8;
2538
2691
 
2539
- for (bn = 144; bn < 256; ++bn) Sn[bn] = 9;
2692
+ for (Rr = 144; Rr < 256; ++Rr) Er[Rr] = 9;
2540
2693
 
2541
- for (bn = 256; bn < 280; ++bn) Sn[bn] = 7;
2694
+ for (Rr = 256; Rr < 280; ++Rr) Er[Rr] = 7;
2542
2695
 
2543
- for (bn = 280; bn < 288; ++bn) Sn[bn] = 8;
2696
+ for (Rr = 280; Rr < 288; ++Rr) Er[Rr] = 8;
2544
2697
 
2545
- var Fn = new un(32);
2698
+ var Ir = new hr(32);
2546
2699
 
2547
- for (bn = 0; bn < 32; ++bn) Fn[bn] = 5;
2700
+ for (Rr = 0; Rr < 32; ++Rr) Ir[Rr] = 5;
2548
2701
 
2549
- var Pn, In = wn(Sn, 9, 0), xn = wn(Fn, 5, 0), Rn = function(e) {
2702
+ var Cr, Tr = xr(Er, 9, 0), $r = xr(Ir, 5, 0), Or = function(e) {
2550
2703
  return (e / 8 >> 0) + (7 & e && 1);
2551
- }, En = function(e, t, n) {
2704
+ }, Ar = function(e, t, n) {
2552
2705
  (null == t || t < 0) && (t = 0), (null == n || n > e.length) && (n = e.length);
2553
- var r = new (e instanceof ln ? ln : e instanceof cn ? cn : un)(n - t);
2706
+ var r = new (e instanceof pr ? pr : e instanceof _r ? _r : hr)(n - t);
2554
2707
  return r.set(e.subarray(t, n)), r;
2555
- }, Cn = function(e, t, n) {
2708
+ }, qr = function(e, t, n) {
2556
2709
  n <<= 7 & t;
2557
2710
  var r = t / 8 >> 0;
2558
2711
  e[r] |= n, e[r + 1] |= n >>> 8;
2559
- }, On = function(e, t, n) {
2712
+ }, Mr = function(e, t, n) {
2560
2713
  n <<= 7 & t;
2561
2714
  var r = t / 8 >> 0;
2562
2715
  e[r] |= n, e[r + 1] |= n >>> 8, e[r + 2] |= n >>> 16;
2563
- }, $n = function(e, t) {
2716
+ }, Dr = function(e, t) {
2564
2717
  for (var n = [], r = 0; r < e.length; ++r) e[r] && n.push({
2565
2718
  s: r,
2566
2719
  f: e[r]
2567
2720
  });
2568
2721
  var i = n.length, o = n.slice();
2569
- if (!i) return [ new un(0), 0 ];
2722
+ if (!i) return [ new hr(0), 0 ];
2570
2723
  if (1 == i) {
2571
- var s = new un(n[0].s + 1);
2724
+ var s = new hr(n[0].s + 1);
2572
2725
  return s[n[0].s] = 1, [ s, 1 ];
2573
2726
  }
2574
2727
  n.sort((function(e, t) {
@@ -2590,35 +2743,35 @@ var Pn, In = wn(Sn, 9, 0), xn = wn(Fn, 5, 0), Rn = function(e) {
2590
2743
  l: a,
2591
2744
  r: u
2592
2745
  };
2593
- var h = o[0].s;
2594
- for (r = 1; r < i; ++r) o[r].s > h && (h = o[r].s);
2595
- var f = new ln(h + 1), p = Mn(n[c - 1], f, 0);
2746
+ var f = o[0].s;
2747
+ for (r = 1; r < i; ++r) o[r].s > f && (f = o[r].s);
2748
+ var h = new pr(f + 1), p = Nr(n[c - 1], h, 0);
2596
2749
  if (p > t) {
2597
2750
  r = 0;
2598
2751
  var _ = 0, g = p - t, v = 1 << g;
2599
2752
  for (o.sort((function(e, t) {
2600
- return f[t.s] - f[e.s] || e.f - t.f;
2753
+ return h[t.s] - h[e.s] || e.f - t.f;
2601
2754
  })); r < i; ++r) {
2602
2755
  var m = o[r].s;
2603
- if (!(f[m] > t)) break;
2604
- _ += v - (1 << p - f[m]), f[m] = t;
2756
+ if (!(h[m] > t)) break;
2757
+ _ += v - (1 << p - h[m]), h[m] = t;
2605
2758
  }
2606
2759
  for (_ >>>= g; _ > 0; ) {
2607
2760
  var y = o[r].s;
2608
- f[y] < t ? _ -= 1 << t - f[y]++ - 1 : ++r;
2761
+ h[y] < t ? _ -= 1 << t - h[y]++ - 1 : ++r;
2609
2762
  }
2610
2763
  for (;r >= 0 && _; --r) {
2611
2764
  var b = o[r].s;
2612
- f[b] == t && (--f[b], ++_);
2765
+ h[b] == t && (--h[b], ++_);
2613
2766
  }
2614
2767
  p = t;
2615
2768
  }
2616
- return [ new un(f), p ];
2617
- }, Mn = function e(t, n, r) {
2769
+ return [ new hr(h), p ];
2770
+ }, Nr = function e(t, n, r) {
2618
2771
  return -1 == t.s ? Math.max(e(t.l, n, r + 1), e(t.r, n, r + 1)) : n[t.s] = r;
2619
- }, Tn = function(e) {
2772
+ }, Lr = function(e) {
2620
2773
  for (var t = e.length; t && !e[--t]; ) ;
2621
- for (var n = new ln(++t), r = 0, i = e[0], o = 1, s = function(e) {
2774
+ for (var n = new pr(++t), r = 0, i = e[0], o = 1, s = function(e) {
2622
2775
  n[r++] = e;
2623
2776
  }, a = 1; a <= t; ++a) if (e[a] == i && a != t) ++o; else {
2624
2777
  if (!i && o > 2) {
@@ -2632,134 +2785,134 @@ var Pn, In = wn(Sn, 9, 0), xn = wn(Fn, 5, 0), Rn = function(e) {
2632
2785
  o = 1, i = e[a];
2633
2786
  }
2634
2787
  return [ n.subarray(0, r), t ];
2635
- }, An = function(e, t) {
2788
+ }, Br = function(e, t) {
2636
2789
  for (var n = 0, r = 0; r < t.length; ++r) n += e[r] * t[r];
2637
2790
  return n;
2638
- }, Dn = function(e, t, n) {
2639
- var r = n.length, i = Rn(t + 2);
2791
+ }, jr = function(e, t, n) {
2792
+ var r = n.length, i = Or(t + 2);
2640
2793
  e[i] = 255 & r, e[i + 1] = r >>> 8, e[i + 2] = 255 ^ e[i], e[i + 3] = 255 ^ e[i + 1];
2641
2794
  for (var o = 0; o < r; ++o) e[i + o + 4] = n[o];
2642
2795
  return 8 * (i + 4 + r);
2643
- }, qn = function(e, t, n, r, i, o, s, a, u, l, c) {
2644
- Cn(t, c++, n), ++i[256];
2645
- for (var d = $n(i, 15), h = d[0], f = d[1], p = $n(o, 15), _ = p[0], g = p[1], v = Tn(h), m = v[0], y = v[1], b = Tn(_), k = b[0], w = b[1], S = new ln(19), F = 0; F < m.length; ++F) S[31 & m[F]]++;
2646
- for (F = 0; F < k.length; ++F) S[31 & k[F]]++;
2647
- for (var P = $n(S, 7), I = P[0], x = P[1], R = 19; R > 4 && !I[fn[R - 1]]; --R) ;
2648
- var E, C, O, $, M = l + 5 << 3, T = An(i, Sn) + An(o, Fn) + s, A = An(i, h) + An(o, _) + s + 14 + 3 * R + An(S, I) + (2 * S[16] + 3 * S[17] + 7 * S[18]);
2649
- if (M <= T && M <= A) return Dn(t, c, e.subarray(u, u + l));
2650
- if (Cn(t, c, 1 + (A < T)), c += 2, A < T) {
2651
- E = wn(h, f, 0), C = h, O = wn(_, g, 0), $ = _;
2652
- var D = wn(I, x, 0);
2653
- Cn(t, c, y - 257), Cn(t, c + 5, w - 1), Cn(t, c + 10, R - 4), c += 14;
2654
- for (F = 0; F < R; ++F) Cn(t, c + 3 * F, I[fn[F]]);
2655
- c += 3 * R;
2656
- for (var q = [ m, k ], B = 0; B < 2; ++B) {
2657
- var N = q[B];
2658
- for (F = 0; F < N.length; ++F) {
2659
- var L = 31 & N[F];
2660
- Cn(t, c, D[L]), c += I[L], L > 15 && (Cn(t, c, N[F] >>> 5 & 127), c += N[F] >>> 12);
2661
- }
2662
- }
2663
- } else E = In, C = Sn, O = xn, $ = Fn;
2796
+ }, Hr = function(e, t, n, r, i, o, s, a, u, l, c) {
2797
+ qr(t, c++, n), ++i[256];
2798
+ for (var d = Dr(i, 15), f = d[0], h = d[1], p = Dr(o, 15), _ = p[0], g = p[1], v = Lr(f), m = v[0], y = v[1], b = Lr(_), w = b[0], k = b[1], S = new pr(19), F = 0; F < m.length; ++F) S[31 & m[F]]++;
2799
+ for (F = 0; F < w.length; ++F) S[31 & w[F]]++;
2800
+ for (var R = Dr(S, 7), P = R[0], x = R[1], E = 19; E > 4 && !P[mr[E - 1]]; --E) ;
2801
+ var I, C, T, $, O = l + 5 << 3, A = Br(i, Er) + Br(o, Ir) + s, q = Br(i, f) + Br(o, _) + s + 14 + 3 * E + Br(S, P) + (2 * S[16] + 3 * S[17] + 7 * S[18]);
2802
+ if (O <= A && O <= q) return jr(t, c, e.subarray(u, u + l));
2803
+ if (qr(t, c, 1 + (q < A)), c += 2, q < A) {
2804
+ I = xr(f, h, 0), C = f, T = xr(_, g, 0), $ = _;
2805
+ var M = xr(P, x, 0);
2806
+ qr(t, c, y - 257), qr(t, c + 5, k - 1), qr(t, c + 10, E - 4), c += 14;
2807
+ for (F = 0; F < E; ++F) qr(t, c + 3 * F, P[mr[F]]);
2808
+ c += 3 * E;
2809
+ for (var D = [ m, w ], N = 0; N < 2; ++N) {
2810
+ var L = D[N];
2811
+ for (F = 0; F < L.length; ++F) {
2812
+ var B = 31 & L[F];
2813
+ qr(t, c, M[B]), c += P[B], B > 15 && (qr(t, c, L[F] >>> 5 & 127), c += L[F] >>> 12);
2814
+ }
2815
+ }
2816
+ } else I = Tr, C = Er, T = $r, $ = Ir;
2664
2817
  for (F = 0; F < a; ++F) if (r[F] > 255) {
2665
- L = r[F] >>> 18 & 31;
2666
- On(t, c, E[L + 257]), c += C[L + 257], L > 7 && (Cn(t, c, r[F] >>> 23 & 31), c += dn[L]);
2818
+ B = r[F] >>> 18 & 31;
2819
+ Mr(t, c, I[B + 257]), c += C[B + 257], B > 7 && (qr(t, c, r[F] >>> 23 & 31), c += gr[B]);
2667
2820
  var j = 31 & r[F];
2668
- On(t, c, O[j]), c += $[j], j > 3 && (On(t, c, r[F] >>> 5 & 8191), c += hn[j]);
2669
- } else On(t, c, E[r[F]]), c += C[r[F]];
2670
- return On(t, c, E[256]), c + C[256];
2671
- }, Bn = new cn([ 65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632 ]), Nn = new un(0), Ln = function() {
2672
- for (var e = new cn(256), t = 0; t < 256; ++t) {
2821
+ Mr(t, c, T[j]), c += $[j], j > 3 && (Mr(t, c, r[F] >>> 5 & 8191), c += vr[j]);
2822
+ } else Mr(t, c, I[r[F]]), c += C[r[F]];
2823
+ return Mr(t, c, I[256]), c + C[256];
2824
+ }, Ur = new _r([ 65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632 ]), Vr = new hr(0), Wr = function() {
2825
+ for (var e = new _r(256), t = 0; t < 256; ++t) {
2673
2826
  for (var n = t, r = 9; --r; ) n = (1 & n && 3988292384) ^ n >>> 1;
2674
2827
  e[t] = n;
2675
2828
  }
2676
2829
  return e;
2677
- }(), jn = function() {
2830
+ }(), zr = function() {
2678
2831
  var e = 4294967295;
2679
2832
  return {
2680
2833
  p: function(t) {
2681
- for (var n = e, r = 0; r < t.length; ++r) n = Ln[255 & n ^ t[r]] ^ n >>> 8;
2834
+ for (var n = e, r = 0; r < t.length; ++r) n = Wr[255 & n ^ t[r]] ^ n >>> 8;
2682
2835
  e = n;
2683
2836
  },
2684
2837
  d: function() {
2685
2838
  return 4294967295 ^ e;
2686
2839
  }
2687
2840
  };
2688
- }, Hn = function(e, t, n, r, i) {
2841
+ }, Gr = function(e, t, n, r, i) {
2689
2842
  return function(e, t, n, r, i, o) {
2690
- var s = e.length, a = new un(r + s + 5 * (1 + Math.floor(s / 7e3)) + i), u = a.subarray(r, a.length - i), l = 0;
2843
+ var s = e.length, a = new hr(r + s + 5 * (1 + Math.floor(s / 7e3)) + i), u = a.subarray(r, a.length - i), l = 0;
2691
2844
  if (!t || s < 8) for (var c = 0; c <= s; c += 65535) {
2692
2845
  var d = c + 65535;
2693
- d < s ? l = Dn(u, l, e.subarray(c, d)) : (u[c] = o, l = Dn(u, l, e.subarray(c, s)));
2846
+ d < s ? l = jr(u, l, e.subarray(c, d)) : (u[c] = o, l = jr(u, l, e.subarray(c, s)));
2694
2847
  } else {
2695
- for (var h = Bn[t - 1], f = h >>> 13, p = 8191 & h, _ = (1 << n) - 1, g = new ln(32768), v = new ln(_ + 1), m = Math.ceil(n / 3), y = 2 * m, b = function(t) {
2848
+ for (var f = Ur[t - 1], h = f >>> 13, p = 8191 & f, _ = (1 << n) - 1, g = new pr(32768), v = new pr(_ + 1), m = Math.ceil(n / 3), y = 2 * m, b = function(t) {
2696
2849
  return (e[t] ^ e[t + 1] << m ^ e[t + 2] << y) & _;
2697
- }, k = new cn(25e3), w = new ln(288), S = new ln(32), F = 0, P = 0, I = (c = 0,
2698
- 0), x = 0, R = 0; c < s; ++c) {
2699
- var E = b(c), C = 32767 & c, O = v[E];
2700
- if (g[C] = O, v[E] = C, x <= c) {
2850
+ }, w = new _r(25e3), k = new pr(288), S = new pr(32), F = 0, R = 0, P = (c = 0,
2851
+ 0), x = 0, E = 0; c < s; ++c) {
2852
+ var I = b(c), C = 32767 & c, T = v[I];
2853
+ if (g[C] = T, v[I] = C, x <= c) {
2701
2854
  var $ = s - c;
2702
- if ((F > 7e3 || I > 24576) && $ > 423) {
2703
- l = qn(e, u, 0, k, w, S, P, I, R, c - R, l), I = F = P = 0, R = c;
2704
- for (var M = 0; M < 286; ++M) w[M] = 0;
2705
- for (M = 0; M < 30; ++M) S[M] = 0;
2855
+ if ((F > 7e3 || P > 24576) && $ > 423) {
2856
+ l = Hr(e, u, 0, w, k, S, R, P, E, c - E, l), P = F = R = 0, E = c;
2857
+ for (var O = 0; O < 286; ++O) k[O] = 0;
2858
+ for (O = 0; O < 30; ++O) S[O] = 0;
2706
2859
  }
2707
- var T = 2, A = 0, D = p, q = C - O & 32767;
2708
- if ($ > 2 && E == b(c - q)) for (var B = Math.min(f, $) - 1, N = Math.min(32767, c), L = Math.min(258, $); q <= N && --D && C != O; ) {
2709
- if (e[c + T] == e[c + T - q]) {
2710
- for (var j = 0; j < L && e[c + j] == e[c + j - q]; ++j) ;
2711
- if (j > T) {
2712
- if (T = j, A = q, j > B) break;
2713
- var H = Math.min(q, j - 2), V = 0;
2714
- for (M = 0; M < H; ++M) {
2715
- var U = c - q + M + 32768 & 32767, W = U - g[U] + 32768 & 32767;
2716
- W > V && (V = W, O = U);
2860
+ var A = 2, q = 0, M = p, D = C - T & 32767;
2861
+ if ($ > 2 && I == b(c - D)) for (var N = Math.min(h, $) - 1, L = Math.min(32767, c), B = Math.min(258, $); D <= L && --M && C != T; ) {
2862
+ if (e[c + A] == e[c + A - D]) {
2863
+ for (var j = 0; j < B && e[c + j] == e[c + j - D]; ++j) ;
2864
+ if (j > A) {
2865
+ if (A = j, q = D, j > N) break;
2866
+ var H = Math.min(D, j - 2), U = 0;
2867
+ for (O = 0; O < H; ++O) {
2868
+ var V = c - D + O + 32768 & 32767, W = V - g[V] + 32768 & 32767;
2869
+ W > U && (U = W, T = V);
2717
2870
  }
2718
2871
  }
2719
2872
  }
2720
- q += (C = O) - (O = g[C]) + 32768 & 32767;
2873
+ D += (C = T) - (T = g[C]) + 32768 & 32767;
2721
2874
  }
2722
- if (A) {
2723
- k[I++] = 268435456 | vn[T] << 18 | mn[A];
2724
- var G = 31 & vn[T], z = 31 & mn[A];
2725
- P += dn[G] + hn[z], ++w[257 + G], ++S[z], x = c + T, ++F;
2726
- } else k[I++] = e[c], ++w[e[c]];
2875
+ if (q) {
2876
+ w[P++] = 268435456 | kr[A] << 18 | Sr[q];
2877
+ var z = 31 & kr[A], G = 31 & Sr[q];
2878
+ R += gr[z] + vr[G], ++k[257 + z], ++S[G], x = c + A, ++F;
2879
+ } else w[P++] = e[c], ++k[e[c]];
2727
2880
  }
2728
2881
  }
2729
- l = qn(e, u, o, k, w, S, P, I, R, c - R, l), o || (l = Dn(u, l, Nn));
2882
+ l = Hr(e, u, o, w, k, S, R, P, E, c - E, l), o || (l = jr(u, l, Vr));
2730
2883
  }
2731
- return En(a, 0, r + Rn(l) + i);
2884
+ return Ar(a, 0, r + Or(l) + i);
2732
2885
  }(e, null == t.level ? 6 : t.level, null == t.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(e.length)))) : 12 + t.mem, n, r, !i);
2733
- }, Vn = function(e, t, n) {
2886
+ }, Qr = function(e, t, n) {
2734
2887
  for (;n; ++t) e[t] = n, n >>>= 8;
2735
- }, Un = function(e, t) {
2888
+ }, Yr = function(e, t) {
2736
2889
  var n = t.filename;
2737
2890
  if (e[0] = 31, e[1] = 139, e[2] = 8, e[8] = t.level < 2 ? 4 : 9 == t.level ? 2 : 0,
2738
- e[9] = 3, 0 != t.mtime && Vn(e, 4, Math.floor(new Date(t.mtime || Date.now()) / 1e3)),
2891
+ e[9] = 3, 0 != t.mtime && Qr(e, 4, Math.floor(new Date(t.mtime || Date.now()) / 1e3)),
2739
2892
  n) {
2740
2893
  e[3] = 8;
2741
2894
  for (var r = 0; r <= n.length; ++r) e[r + 10] = n.charCodeAt(r);
2742
2895
  }
2743
- }, Wn = function(e) {
2896
+ }, Jr = function(e) {
2744
2897
  return 10 + (e.filename && e.filename.length + 1 || 0);
2745
2898
  };
2746
2899
 
2747
- function Gn(e, t) {
2900
+ function Kr(e, t) {
2748
2901
  void 0 === t && (t = {});
2749
- var n = jn(), r = e.length;
2902
+ var n = zr(), r = e.length;
2750
2903
  n.p(e);
2751
- var i = Hn(e, t, Wn(t), 8), o = i.length;
2752
- return Un(i, t), Vn(i, o - 8, n.d()), Vn(i, o - 4, r), i;
2904
+ var i = Gr(e, t, Jr(t), 8), o = i.length;
2905
+ return Yr(i, t), Qr(i, o - 8, n.d()), Qr(i, o - 4, r), i;
2753
2906
  }
2754
2907
 
2755
- function zn(e, t) {
2908
+ function Xr(e, t) {
2756
2909
  var n = e.length;
2757
2910
  if (!t && "undefined" != typeof TextEncoder) return (new TextEncoder).encode(e);
2758
- for (var r = new un(e.length + (e.length >>> 1)), i = 0, o = function(e) {
2911
+ for (var r = new hr(e.length + (e.length >>> 1)), i = 0, o = function(e) {
2759
2912
  r[i++] = e;
2760
2913
  }, s = 0; s < n; ++s) {
2761
2914
  if (i + 5 > r.length) {
2762
- var a = new un(i + 8 + (n - s << 1));
2915
+ var a = new hr(i + 8 + (n - s << 1));
2763
2916
  a.set(r), r = a;
2764
2917
  }
2765
2918
  var u = e.charCodeAt(s);
@@ -2767,14 +2920,14 @@ function zn(e, t) {
2767
2920
  o(128 | u >>> 12 & 63), o(128 | u >>> 6 & 63), o(128 | 63 & u)) : (o(224 | u >>> 12),
2768
2921
  o(128 | u >>> 6 & 63), o(128 | 63 & u));
2769
2922
  }
2770
- return En(r, 0, i);
2923
+ return Ar(r, 0, i);
2771
2924
  }
2772
2925
 
2773
2926
  !function(e) {
2774
2927
  e.GZipJS = "gzip-js", e.Base64 = "base64";
2775
- }(Pn || (Pn = {}));
2928
+ }(Cr || (Cr = {}));
2776
2929
 
2777
- var Yn = function(e, t, n) {
2930
+ var Zr = function(e, t, n) {
2778
2931
  var r = t || {};
2779
2932
  r.ip = n.ip ? 1 : 0, r._ = (new Date).getTime().toString(), r.ver = m.LIB_VERSION;
2780
2933
  var i = e.split("?");
@@ -2783,7 +2936,7 @@ var Yn = function(e, t, n) {
2783
2936
  try {
2784
2937
  for (s.s(); !(o = s.n()).done; ) {
2785
2938
  var a = o.value.split("=")[0];
2786
- R(r[a]) || delete r[a];
2939
+ x(r[a]) || delete r[a];
2787
2940
  }
2788
2941
  } catch (e) {
2789
2942
  s.e(e);
@@ -2792,14 +2945,8 @@ var Yn = function(e, t, n) {
2792
2945
  }
2793
2946
  }
2794
2947
  var u = e.indexOf("?") > -1 ? "&" : "?";
2795
- return e + u + function(e) {
2796
- var t, n, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "&", i = [];
2797
- return G(e, (function(e, r) {
2798
- R(e) || R(r) || "undefined" === r || (t = encodeURIComponent(e.toString()), n = encodeURIComponent(r),
2799
- i[i.length] = n + "=" + t);
2800
- })), i.join(r);
2801
- }(r);
2802
- }, Qn = function e(t, n) {
2948
+ return e + u + Tt(r);
2949
+ }, ei = function e(t, n) {
2803
2950
  if (n.blob && t.buffer) return new Blob([ F(t) ? t : t.buffer ], {
2804
2951
  type: "text/plain"
2805
2952
  });
@@ -2814,51 +2961,101 @@ var Yn = function(e, t, n) {
2814
2961
  return "POST" !== n.method ? null : (i = S(t) || F(t) ? "data=" + encodeURIComponent(t) : "data=" + encodeURIComponent(t.data),
2815
2962
  "compression" in t && t.compression && (i += "&compression=" + t.compression), i);
2816
2963
  var i;
2817
- }, Jn = function(e) {
2818
- var t = e.url, n = e.data, r = e.headers, i = e.options, o = e.callback, s = e.retriesPerformedSoFar, a = e.retryQueue, u = e.onXHRError, l = e.timeout, c = void 0 === l ? 6e4 : l, d = e.onResponse;
2819
- O(s) && s > 0 && (t = Yn(t, {
2964
+ }, ti = function(e) {
2965
+ if (H && "fetch" === e.options.transport) {
2966
+ var n, r = ei(e.data, e.options), i = new Headers;
2967
+ K(i, (function(e, t) {
2968
+ i.append(t, e);
2969
+ })), "POST" !== e.options.method || e.options.blob || i.append("Content-Type", "application/x-www-form-urlencoded");
2970
+ var o = e.url;
2971
+ return T(e.retriesPerformedSoFar) && e.retriesPerformedSoFar > 0 && (o = Zr(o, {
2972
+ retry_count: e.retriesPerformedSoFar
2973
+ }, {})), void H(o, {
2974
+ method: (null === (n = e.options) || void 0 === n ? void 0 : n.method) || "GET",
2975
+ headers: i,
2976
+ keepalive: "POST" === e.options.method,
2977
+ body: r
2978
+ }).then((function(n) {
2979
+ var r = n.status;
2980
+ return n.text().then((function(n) {
2981
+ var o, s;
2982
+ if (null === (o = e.onResponse) || void 0 === o || o.call(e, {
2983
+ statusCode: r,
2984
+ responseText: n
2985
+ }), 200 !== r) R(e.onError) && e.onError({
2986
+ statusCode: r,
2987
+ responseText: n
2988
+ }), (r < 400 || r > 500) && e.retryQueue.enqueue(t(t({}, e), {}, {
2989
+ headers: i,
2990
+ retriesPerformedSoFar: (e.retriesPerformedSoFar || 0) + 1
2991
+ })), null === (s = e.callback) || void 0 === s || s.call(e, {
2992
+ status: 0
2993
+ }); else try {
2994
+ var a;
2995
+ null === (a = e.callback) || void 0 === a || a.call(e, JSON.parse(n));
2996
+ } catch (e) {
2997
+ G.error(e);
2998
+ }
2999
+ }));
3000
+ })).catch((function(t) {
3001
+ var n;
3002
+ G.error(t), null === (n = e.callback) || void 0 === n || n.call(e, {
3003
+ status: 0
3004
+ });
3005
+ }));
3006
+ }
3007
+ return ni(e);
3008
+ }, ni = function(e) {
3009
+ var t = e.url, n = e.data, r = e.headers, i = e.options, o = e.callback, s = e.retriesPerformedSoFar, a = e.retryQueue, u = e.onError, l = e.timeout, c = void 0 === l ? 6e4 : l, d = e.onResponse;
3010
+ T(s) && s > 0 && (t = Zr(t, {
2820
3011
  retry_count: s
2821
3012
  }, {}));
2822
- var h = new XMLHttpRequest;
2823
- h.open(i.method || "GET", t, !0);
2824
- var f = Qn(n, i);
2825
- G(r, (function(e, t) {
2826
- h.setRequestHeader(t, e);
2827
- })), "POST" !== i.method || i.blob || h.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"),
2828
- h.timeout = c, h.withCredentials = !0, h.onreadystatechange = function() {
2829
- if (4 === h.readyState) if (null == d || d(h), 200 === h.status) {
2830
- if (o) {
2831
- var e;
2832
- try {
2833
- e = JSON.parse(h.responseText);
2834
- } catch (e) {
2835
- return void H.error(e);
3013
+ var f = new XMLHttpRequest;
3014
+ f.open(i.method || "GET", t, !0);
3015
+ var h = ei(n, i);
3016
+ K(r, (function(e, t) {
3017
+ f.setRequestHeader(t, e);
3018
+ })), "POST" !== i.method || i.blob || f.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"),
3019
+ f.timeout = c, f.withCredentials = !0, f.onreadystatechange = function() {
3020
+ if (4 === f.readyState) {
3021
+ var e = {
3022
+ statusCode: f.status,
3023
+ responseText: f.responseText
3024
+ };
3025
+ if (null == d || d(e), 200 === f.status) {
3026
+ if (o) {
3027
+ var l;
3028
+ try {
3029
+ l = JSON.parse(f.responseText);
3030
+ } catch (e) {
3031
+ return void G.error(e);
3032
+ }
3033
+ o(l);
2836
3034
  }
2837
- o(e);
2838
- }
2839
- } else P(u) && u(h), (h.status < 400 || h.status > 500) && a.enqueue({
2840
- url: t,
2841
- data: n,
2842
- options: i,
2843
- headers: r,
2844
- retriesPerformedSoFar: (s || 0) + 1,
2845
- callback: o
2846
- }), null == o || o({
2847
- status: 0
2848
- });
2849
- }, h.send(f);
2850
- }, Xn = 18e5;
3035
+ } else R(u) && u(e), (f.status < 400 || f.status > 500) && a.enqueue({
3036
+ url: t,
3037
+ data: n,
3038
+ options: i,
3039
+ headers: r,
3040
+ retriesPerformedSoFar: (s || 0) + 1,
3041
+ callback: o
3042
+ }), null == o || o({
3043
+ status: 0
3044
+ });
3045
+ }
3046
+ }, f.send(h);
3047
+ };
2851
3048
 
2852
- var Kn = function(e) {
2853
- a(i, sn);
2854
- var n = h(i);
3049
+ var ri, ii = function(e) {
3050
+ a(i, dr);
3051
+ var n = f(i);
2855
3052
  function i(e, t) {
2856
3053
  var o;
2857
3054
  return r(this, i), (o = n.call(this)).isPolling = !1, o.queue = [], o.areWeOnline = !0,
2858
- o.onXHRError = e, o.rateLimiter = t, !R(D) && "onLine" in D.navigator && (o.areWeOnline = D.navigator.onLine,
2859
- D.addEventListener("online", (function() {
3055
+ o.onRequestError = e, o.rateLimiter = t, !x(A) && "onLine" in A.navigator && (o.areWeOnline = A.navigator.onLine,
3056
+ A.addEventListener("online", (function() {
2860
3057
  o._handleWeAreNowOnline();
2861
- })), D.addEventListener("offline", (function() {
3058
+ })), A.addEventListener("offline", (function() {
2862
3059
  o.areWeOnline = !1;
2863
3060
  }))), o;
2864
3061
  }
@@ -2868,7 +3065,7 @@ var Kn = function(e) {
2868
3065
  var t = e.retriesPerformedSoFar || 0;
2869
3066
  if (!(t >= 10)) {
2870
3067
  var n = function(e) {
2871
- var t = 3e3 * Math.pow(2, e), n = t / 2, r = Math.min(Xn, t), i = (Math.random() - .5) * (r - n);
3068
+ var t = 3e3 * Math.pow(2, e), n = t / 2, r = Math.min(18e5, t), i = (Math.random() - .5) * (r - n);
2872
3069
  return Math.ceil(r + i);
2873
3070
  }(t), r = new Date(Date.now() + n);
2874
3071
  this.queue.push({
@@ -2876,7 +3073,7 @@ var Kn = function(e) {
2876
3073
  requestData: e
2877
3074
  });
2878
3075
  var i = "Enqueued failed request for retry in ".concat(n);
2879
- navigator.onLine || (i += " (Browser is offline)"), H.warn(i), this.isPolling || (this.isPolling = !0,
3076
+ navigator.onLine || (i += " (Browser is offline)"), G.warn(i), this.isPolling || (this.isPolling = !0,
2880
3077
  this.poll());
2881
3078
  }
2882
3079
  }
@@ -2919,12 +3116,12 @@ var Kn = function(e) {
2919
3116
  try {
2920
3117
  for (n.s(); !(e = n.n()).done; ) {
2921
3118
  var r = e.value.requestData, i = r.url, o = r.data, s = r.options;
2922
- if (this.rateLimiter.isRateLimited(s._batchKey)) H.warn("[RetryQueue] is quota limited. Dropping request."); else try {
2923
- null == D || D.navigator.sendBeacon(i, Qn(o, t(t({}, s), {}, {
3119
+ if (this.rateLimiter.isRateLimited(s._batchKey)) G.warn("[RetryQueue] is quota limited. Dropping request."); else try {
3120
+ null == A || A.navigator.sendBeacon(i, ei(o, t(t({}, s), {}, {
2924
3121
  sendBeacon: !0
2925
3122
  })));
2926
3123
  } catch (e) {
2927
- H.error(e);
3124
+ G.error(e);
2928
3125
  }
2929
3126
  }
2930
3127
  } catch (e) {
@@ -2938,7 +3135,7 @@ var Kn = function(e) {
2938
3135
  key: "_executeXhrRequest",
2939
3136
  value: function(e) {
2940
3137
  var t = e.url, n = e.data, r = e.options, i = e.headers, o = e.callback, s = e.retriesPerformedSoFar;
2941
- this.rateLimiter.isRateLimited(r._batchKey) || Jn({
3138
+ this.rateLimiter.isRateLimited(r._batchKey) || ti({
2942
3139
  url: t,
2943
3140
  data: n || {},
2944
3141
  options: r || {},
@@ -2946,7 +3143,7 @@ var Kn = function(e) {
2946
3143
  retriesPerformedSoFar: s || 0,
2947
3144
  callback: o,
2948
3145
  retryQueue: this,
2949
- onXHRError: this.onXHRError,
3146
+ onError: this.onRequestError,
2950
3147
  onResponse: this.rateLimiter.checkForLimiting
2951
3148
  });
2952
3149
  }
@@ -2956,18 +3153,18 @@ var Kn = function(e) {
2956
3153
  this.areWeOnline = !0, this.flush();
2957
3154
  }
2958
3155
  } ]), i;
2959
- }(), Zn = 1800, er = 60, tr = 864e5, nr = function() {
3156
+ }(), oi = 1800, si = function() {
2960
3157
  function e(t, n, i, o) {
2961
3158
  r(this, e), s(this, "_sessionIdChangedHandlers", []), this.config = t, this.persistence = n,
2962
3159
  this._windowId = void 0, this._sessionId = void 0, this._sessionStartTimestamp = null,
2963
- this._sessionActivityTimestamp = null, this._sessionIdGenerator = i || nt, this._windowIdGenerator = o || nt;
2964
- var a = t.persistence_name || t.token, u = t.session_idle_timeout_seconds || Zn;
2965
- if (O(u) ? u > Zn ? H.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead.") : u < er && H.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead.") : (H.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),
2966
- u = Zn), this._sessionTimeoutMs = 1e3 * Math.min(Math.max(u, er), Zn), this._window_id_storage_key = "ph_" + a + "_window_id",
3160
+ this._sessionActivityTimestamp = null, this._sessionIdGenerator = i || dt, this._windowIdGenerator = o || dt;
3161
+ var a = t.persistence_name || t.token, u = t.session_idle_timeout_seconds || oi;
3162
+ if (T(u) ? u > oi ? G.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead.") : u < 60 && G.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead.") : (G.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),
3163
+ u = oi), this._sessionTimeoutMs = 1e3 * Math.min(Math.max(u, 60), oi), this._window_id_storage_key = "ph_" + a + "_window_id",
2967
3164
  this._primary_window_exists_storage_key = "ph_" + a + "_primary_window_exists",
2968
3165
  this._canUseSessionStorage()) {
2969
- var l = vt.parse(this._window_id_storage_key), c = vt.parse(this._primary_window_exists_storage_key);
2970
- l && !c ? this._windowId = l : vt.remove(this._window_id_storage_key), vt.set(this._primary_window_exists_storage_key, !0);
3166
+ var l = Pt.parse(this._window_id_storage_key), c = Pt.parse(this._primary_window_exists_storage_key);
3167
+ l && !c ? this._windowId = l : Pt.remove(this._window_id_storage_key), Pt.set(this._primary_window_exists_storage_key, !0);
2971
3168
  }
2972
3169
  this._listenToReloadWindow();
2973
3170
  }
@@ -2975,7 +3172,7 @@ var Kn = function(e) {
2975
3172
  key: "onSessionId",
2976
3173
  value: function(e) {
2977
3174
  var t = this;
2978
- return R(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []),
3175
+ return x(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []),
2979
3176
  this._sessionIdChangedHandlers.push(e), this._sessionId && e(this._sessionId, this._windowId),
2980
3177
  function() {
2981
3178
  t._sessionIdChangedHandlers = t._sessionIdChangedHandlers.filter((function(t) {
@@ -2986,29 +3183,29 @@ var Kn = function(e) {
2986
3183
  }, {
2987
3184
  key: "_canUseSessionStorage",
2988
3185
  value: function() {
2989
- return "memory" !== this.config.persistence && !this.persistence.disabled && vt.is_supported();
3186
+ return "memory" !== this.config.persistence && !this.persistence.disabled && Pt.is_supported();
2990
3187
  }
2991
3188
  }, {
2992
3189
  key: "_setWindowId",
2993
3190
  value: function(e) {
2994
- e !== this._windowId && (this._windowId = e, this._canUseSessionStorage() && vt.set(this._window_id_storage_key, e));
3191
+ e !== this._windowId && (this._windowId = e, this._canUseSessionStorage() && Pt.set(this._window_id_storage_key, e));
2995
3192
  }
2996
3193
  }, {
2997
3194
  key: "_getWindowId",
2998
3195
  value: function() {
2999
- return this._windowId ? this._windowId : this._canUseSessionStorage() ? vt.parse(this._window_id_storage_key) : null;
3196
+ return this._windowId ? this._windowId : this._canUseSessionStorage() ? Pt.parse(this._window_id_storage_key) : null;
3000
3197
  }
3001
3198
  }, {
3002
3199
  key: "_setSessionId",
3003
3200
  value: function(e, t, n) {
3004
3201
  e === this._sessionId && t === this._sessionActivityTimestamp && n === this._sessionStartTimestamp || (this._sessionStartTimestamp = n,
3005
- this._sessionActivityTimestamp = t, this._sessionId = e, this.persistence.register(s({}, Oe, [ t, e, n ])));
3202
+ this._sessionActivityTimestamp = t, this._sessionId = e, this.persistence.register(s({}, Le, [ t, e, n ])));
3006
3203
  }
3007
3204
  }, {
3008
3205
  key: "_getSessionId",
3009
3206
  value: function() {
3010
3207
  if (this._sessionId && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [ this._sessionActivityTimestamp, this._sessionId, this._sessionStartTimestamp ];
3011
- var e = this.persistence.props[Oe];
3208
+ var e = this.persistence.props[Le];
3012
3209
  return S(e) && 2 === e.length && e.push(e[0]), e || [ 0, null, 0 ];
3013
3210
  }
3014
3211
  }, {
@@ -3020,101 +3217,128 @@ var Kn = function(e) {
3020
3217
  key: "_listenToReloadWindow",
3021
3218
  value: function() {
3022
3219
  var e = this;
3023
- null == D || D.addEventListener("beforeunload", (function() {
3024
- e._canUseSessionStorage() && vt.remove(e._primary_window_exists_storage_key);
3220
+ null == A || A.addEventListener("beforeunload", (function() {
3221
+ e._canUseSessionStorage() && Pt.remove(e._primary_window_exists_storage_key);
3025
3222
  }));
3026
3223
  }
3027
3224
  }, {
3028
3225
  key: "checkAndGetSessionAndWindowId",
3029
3226
  value: function() {
3030
- var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null) || (new Date).getTime(), n = f(this._getSessionId(), 3), r = n[0], i = n[1], o = n[2], s = this._getWindowId(), a = o && o > 0 && Math.abs(t - o) > tr, u = !1, l = !i, c = !e && Math.abs(t - r) > this._sessionTimeoutMs;
3031
- l || c || a ? (i = this._sessionIdGenerator(), s = this._windowIdGenerator(), o = t,
3032
- u = !0) : s || (s = this._windowIdGenerator(), u = !0);
3033
- var d = 0 === r || !e || a ? t : r, h = 0 === o ? (new Date).getTime() : o;
3034
- return this._setWindowId(s), this._setSessionId(i, d, h), u && this._sessionIdChangedHandlers.forEach((function(e) {
3227
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null) || (new Date).getTime(), n = h(this._getSessionId(), 3), r = n[0], i = n[1], o = n[2], s = this._getWindowId(), a = o && o > 0 && Math.abs(t - o) > 864e5, u = !1, l = !i, c = !e && Math.abs(t - r) > this._sessionTimeoutMs;
3228
+ l || c || a ? (i = this._sessionIdGenerator(), s = this._windowIdGenerator(), G.info("[SessionId] new session ID generated", {
3229
+ sessionId: i,
3230
+ windowId: s,
3231
+ changeReason: {
3232
+ noSessionId: l,
3233
+ activityTimeout: c,
3234
+ sessionPastMaximumLength: a
3235
+ }
3236
+ }), o = t, u = !0) : s || (s = this._windowIdGenerator(), u = !0);
3237
+ var d = 0 === r || !e || a ? t : r, f = 0 === o ? (new Date).getTime() : o;
3238
+ return this._setWindowId(s), this._setSessionId(i, d, f), u && this._sessionIdChangedHandlers.forEach((function(e) {
3035
3239
  return e(i, s);
3036
3240
  })), {
3037
3241
  sessionId: i,
3038
3242
  windowId: s,
3039
- sessionStartTimestamp: h
3243
+ sessionStartTimestamp: f
3040
3244
  };
3041
3245
  }
3042
3246
  } ]), e;
3043
- }(), rr = o((function e(t, n, i, o) {
3247
+ }();
3248
+
3249
+ !function(e) {
3250
+ e.US = "us", e.EU = "eu", e.CUSTOM = "custom";
3251
+ }(ri || (ri = {}));
3252
+
3253
+ var ai = function() {
3254
+ function e(t) {
3255
+ r(this, e), this.instance = t;
3256
+ }
3257
+ return o(e, [ {
3258
+ key: "apiHost",
3259
+ get: function() {
3260
+ return this.instance.config.api_host.trim().replace(/\/$/, "");
3261
+ }
3262
+ }, {
3263
+ key: "uiHost",
3264
+ get: function() {
3265
+ var e;
3266
+ return null === (e = this.instance.config.ui_host) || void 0 === e ? void 0 : e.replace(/\/$/, "");
3267
+ }
3268
+ }, {
3269
+ key: "region",
3270
+ get: function() {
3271
+ switch (this.apiHost) {
3272
+ case "https://app.posthog.com":
3273
+ case "https://us.posthog.com":
3274
+ return ri.US;
3275
+
3276
+ case "https://eu.posthog.com":
3277
+ return ri.EU;
3278
+
3279
+ default:
3280
+ return ri.CUSTOM;
3281
+ }
3282
+ }
3283
+ }, {
3284
+ key: "endpointFor",
3285
+ value: function(e) {
3286
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
3287
+ if (t && (t = "/" === t[0] ? t : "/".concat(t)), "ui" === e) return (this.uiHost || this.apiHost) + t;
3288
+ if (this.region === ri.CUSTOM) return this.apiHost + t;
3289
+ var n = "i.posthog.com" + t;
3290
+ switch (e) {
3291
+ case "assets":
3292
+ return "https://".concat(this.region, "-assets.").concat(n);
3293
+
3294
+ case "api":
3295
+ return "https://".concat(this.region, ".").concat(n);
3296
+ }
3297
+ }
3298
+ } ]), e;
3299
+ }(), ui = o((function e(t, n, i, o) {
3044
3300
  r(this, e), this.name = "posthog-js", this.setupOnce = function(e) {
3045
3301
  e((function(e) {
3046
3302
  var r, s, a, u, l;
3047
3303
  if ("error" !== e.level || !t.__loaded) return e;
3048
3304
  e.tags || (e.tags = {});
3049
- var c = t.config.ui_host || t.config.api_host;
3050
- e.tags["PostHog Person URL"] = c + "/person/" + t.get_distinct_id(), t.sessionRecordingStarted() && (e.tags["PostHog Recording URL"] = t.get_session_replay_url({
3305
+ var c = t.requestRouter.endpointFor("ui", "/person/" + t.get_distinct_id());
3306
+ e.tags["PostHog Person URL"] = c, t.sessionRecordingStarted() && (e.tags["PostHog Recording URL"] = t.get_session_replay_url({
3051
3307
  withTimestamp: !0
3052
3308
  }));
3053
- var d = (null === (r = e.exception) || void 0 === r ? void 0 : r.values) || [], h = {
3309
+ var d = (null === (r = e.exception) || void 0 === r ? void 0 : r.values) || [], f = {
3054
3310
  $exception_message: null === (s = d[0]) || void 0 === s ? void 0 : s.value,
3055
3311
  $exception_type: null === (a = d[0]) || void 0 === a ? void 0 : a.type,
3056
- $exception_personURL: c + "/person/" + t.get_distinct_id(),
3312
+ $exception_personURL: c,
3057
3313
  $sentry_event_id: e.event_id,
3058
3314
  $sentry_exception: e.exception,
3059
3315
  $sentry_exception_message: null === (u = d[0]) || void 0 === u ? void 0 : u.value,
3060
3316
  $sentry_exception_type: null === (l = d[0]) || void 0 === l ? void 0 : l.type,
3061
3317
  $sentry_tags: e.tags
3062
3318
  };
3063
- return n && i && (h.$sentry_url = (o || "https://sentry.io/organizations/") + n + "/issues/?project=" + i + "&query=" + e.event_id),
3064
- t.capture("$exception", h), e;
3319
+ return n && i && (f.$sentry_url = (o || "https://sentry.io/organizations/") + n + "/issues/?project=" + i + "&query=" + e.event_id),
3320
+ t.capture("$exception", f), e;
3065
3321
  }));
3066
3322
  };
3067
- })), ir = function(e) {
3068
- Promise && Promise.resolve || H.warn("This browser does not have Promise support, and can not use the segment integration");
3069
- var t = function(t, n) {
3070
- t.event.userId || t.event.anonymousId === e.get_distinct_id() || e.reset(), t.event.userId && t.event.userId !== e.get_distinct_id() && (e.register({
3071
- distinct_id: t.event.userId
3072
- }), e.reloadFeatureFlags());
3073
- var r = e._calculate_event_properties(n, t.event.properties);
3074
- return t.event.properties = Object.assign({}, r, t.event.properties), t;
3075
- };
3076
- return {
3077
- name: "PostHog JS",
3078
- type: "enrichment",
3079
- version: "1.0.0",
3080
- isLoaded: function() {
3081
- return !0;
3082
- },
3083
- load: function() {
3084
- return Promise.resolve();
3085
- },
3086
- track: function(e) {
3087
- return t(e, e.event.event);
3088
- },
3089
- page: function(e) {
3090
- return t(e, "$pageview");
3091
- },
3092
- identify: function(e) {
3093
- return t(e, "$identify");
3094
- },
3095
- screen: function(e) {
3096
- return t(e, "$screen");
3097
- }
3098
- };
3099
- }, or = function() {
3100
- function e() {
3101
- var t = this;
3323
+ })), li = function() {
3324
+ function e(t) {
3325
+ var n = this;
3102
3326
  r(this, e), s(this, "_hasSeenPageView", !1), s(this, "_updateScrollData", (function() {
3103
- var e, n, r, i;
3104
- t._pageViewData || (t._pageViewData = t._createPageViewData());
3105
- var o = t._pageViewData, s = t._scrollY(), a = t._scrollHeight(), u = t._contentY(), l = t._contentHeight();
3327
+ var e, t, r, i;
3328
+ n._pageViewData || (n._pageViewData = n._createPageViewData());
3329
+ var o = n._pageViewData, s = n._scrollY(), a = n._scrollHeight(), u = n._contentY(), l = n._contentHeight();
3106
3330
  o.lastScrollY = s, o.maxScrollY = Math.max(s, null !== (e = o.maxScrollY) && void 0 !== e ? e : 0),
3107
- o.maxScrollHeight = Math.max(a, null !== (n = o.maxScrollHeight) && void 0 !== n ? n : 0),
3331
+ o.maxScrollHeight = Math.max(a, null !== (t = o.maxScrollHeight) && void 0 !== t ? t : 0),
3108
3332
  o.lastContentY = u, o.maxContentY = Math.max(u, null !== (r = o.maxContentY) && void 0 !== r ? r : 0),
3109
3333
  o.maxContentHeight = Math.max(l, null !== (i = o.maxContentHeight) && void 0 !== i ? i : 0);
3110
- }));
3334
+ })), this._instance = t;
3111
3335
  }
3112
3336
  return o(e, [ {
3113
3337
  key: "_createPageViewData",
3114
3338
  value: function() {
3115
3339
  var e;
3116
3340
  return {
3117
- pathname: null !== (e = null == D ? void 0 : D.location.pathname) && void 0 !== e ? e : ""
3341
+ pathname: null !== (e = null == A ? void 0 : A.location.pathname) && void 0 !== e ? e : ""
3118
3342
  };
3119
3343
  }
3120
3344
  }, {
@@ -3143,79 +3367,101 @@ var Kn = function(e) {
3143
3367
  return t = Math.ceil(t), n = Math.ceil(n), r = Math.ceil(r), i = Math.ceil(i), o = Math.ceil(o),
3144
3368
  s = Math.ceil(s), {
3145
3369
  $prev_pageview_last_scroll: n,
3146
- $prev_pageview_last_scroll_percentage: t <= 1 ? 1 : sr(n / t, 0, 1),
3370
+ $prev_pageview_last_scroll_percentage: t <= 1 ? 1 : ci(n / t, 0, 1),
3147
3371
  $prev_pageview_max_scroll: r,
3148
- $prev_pageview_max_scroll_percentage: t <= 1 ? 1 : sr(r / t, 0, 1),
3372
+ $prev_pageview_max_scroll_percentage: t <= 1 ? 1 : ci(r / t, 0, 1),
3149
3373
  $prev_pageview_last_content: o,
3150
- $prev_pageview_last_content_percentage: i <= 1 ? 1 : sr(o / i, 0, 1),
3374
+ $prev_pageview_last_content_percentage: i <= 1 ? 1 : ci(o / i, 0, 1),
3151
3375
  $prev_pageview_max_content: s,
3152
- $prev_pageview_max_content_percentage: i <= 1 ? 1 : sr(s / i, 0, 1)
3376
+ $prev_pageview_max_content_percentage: i <= 1 ? 1 : ci(s / i, 0, 1)
3153
3377
  };
3154
3378
  }
3155
3379
  }, {
3156
3380
  key: "startMeasuringScrollPosition",
3157
3381
  value: function() {
3158
- null == D || D.addEventListener("scroll", this._updateScrollData), null == D || D.addEventListener("scrollend", this._updateScrollData),
3159
- null == D || D.addEventListener("resize", this._updateScrollData);
3382
+ null == A || A.addEventListener("scroll", this._updateScrollData, !0), null == A || A.addEventListener("scrollend", this._updateScrollData, !0),
3383
+ null == A || A.addEventListener("resize", this._updateScrollData);
3160
3384
  }
3161
3385
  }, {
3162
3386
  key: "stopMeasuringScrollPosition",
3163
3387
  value: function() {
3164
- null == D || D.removeEventListener("scroll", this._updateScrollData), null == D || D.removeEventListener("scrollend", this._updateScrollData),
3165
- null == D || D.removeEventListener("resize", this._updateScrollData);
3388
+ null == A || A.removeEventListener("scroll", this._updateScrollData), null == A || A.removeEventListener("scrollend", this._updateScrollData),
3389
+ null == A || A.removeEventListener("resize", this._updateScrollData);
3390
+ }
3391
+ }, {
3392
+ key: "_scrollElement",
3393
+ value: function() {
3394
+ if (!this._instance.config.scroll_root_selector) return null == A ? void 0 : A.document.documentElement;
3395
+ var e, t = v(S(this._instance.config.scroll_root_selector) ? this._instance.config.scroll_root_selector : [ this._instance.config.scroll_root_selector ]);
3396
+ try {
3397
+ for (t.s(); !(e = t.n()).done; ) {
3398
+ var n = e.value, r = null == A ? void 0 : A.document.querySelector(n);
3399
+ if (r) return r;
3400
+ }
3401
+ } catch (e) {
3402
+ t.e(e);
3403
+ } finally {
3404
+ t.f();
3405
+ }
3166
3406
  }
3167
3407
  }, {
3168
3408
  key: "_scrollHeight",
3169
3409
  value: function() {
3170
- return D ? Math.max(0, D.document.documentElement.scrollHeight - D.document.documentElement.clientHeight) : 0;
3410
+ var e = this._scrollElement();
3411
+ return e ? Math.max(0, e.scrollHeight - e.clientHeight) : 0;
3171
3412
  }
3172
3413
  }, {
3173
3414
  key: "_scrollY",
3174
3415
  value: function() {
3175
- return D && (D.scrollY || D.pageYOffset || D.document.documentElement.scrollTop) || 0;
3416
+ if (this._instance.config.scroll_root_selector) {
3417
+ var e = this._scrollElement();
3418
+ return e && e.scrollTop || 0;
3419
+ }
3420
+ return A && (A.scrollY || A.pageYOffset || A.document.documentElement.scrollTop) || 0;
3176
3421
  }
3177
3422
  }, {
3178
3423
  key: "_contentHeight",
3179
3424
  value: function() {
3180
- return (null == D ? void 0 : D.document.documentElement.scrollHeight) || 0;
3425
+ var e = this._scrollElement();
3426
+ return (null == e ? void 0 : e.scrollHeight) || 0;
3181
3427
  }
3182
3428
  }, {
3183
3429
  key: "_contentY",
3184
3430
  value: function() {
3185
- var e = (null == D ? void 0 : D.document.documentElement.clientHeight) || 0;
3186
- return this._scrollY() + e;
3431
+ var e = this._scrollElement(), t = (null == e ? void 0 : e.clientHeight) || 0;
3432
+ return this._scrollY() + t;
3187
3433
  }
3188
3434
  } ]), e;
3189
3435
  }();
3190
3436
 
3191
- function sr(e, t, n) {
3437
+ function ci(e, t, n) {
3192
3438
  return Math.max(t, Math.min(e, n));
3193
3439
  }
3194
3440
 
3195
- var ar, ur, lr, cr = {
3441
+ var di, fi, hi, pi = {
3196
3442
  icontains: function(e) {
3197
- return !!D && D.location.href.toLowerCase().indexOf(e.toLowerCase()) > -1;
3443
+ return !!A && A.location.href.toLowerCase().indexOf(e.toLowerCase()) > -1;
3198
3444
  },
3199
3445
  regex: function(e) {
3200
- return !!D && bt(D.location.href, e);
3446
+ return !!A && Ct(A.location.href, e);
3201
3447
  },
3202
3448
  exact: function(e) {
3203
- return (null == D ? void 0 : D.location.href) === e;
3449
+ return (null == A ? void 0 : A.location.href) === e;
3204
3450
  }
3205
- }, dr = function() {
3451
+ }, _i = function() {
3206
3452
  function e(t) {
3207
3453
  r(this, e), this.instance = t;
3208
3454
  }
3209
3455
  return o(e, [ {
3210
3456
  key: "getSurveys",
3211
3457
  value: function(e) {
3212
- var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(qe);
3458
+ var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(We);
3213
3459
  if (r && !n) return e(r);
3214
- this.instance._send_request("".concat(this.instance.config.api_host, "/api/surveys/?token=").concat(this.instance.config.token), {}, {
3460
+ this.instance._send_request(this.instance.requestRouter.endpointFor("api", "/api/surveys/?token=".concat(this.instance.config.token)), {}, {
3215
3461
  method: "GET"
3216
3462
  }, (function(n) {
3217
3463
  var r, i = n.surveys || [];
3218
- return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, qe, i)),
3464
+ return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, We, i)),
3219
3465
  e(i);
3220
3466
  }));
3221
3467
  }
@@ -3229,7 +3475,7 @@ var ar, ur, lr, cr = {
3229
3475
  })).filter((function(e) {
3230
3476
  var t, n, r, i;
3231
3477
  if (!e.conditions) return !0;
3232
- var o = null === (t = e.conditions) || void 0 === t || !t.url || cr[null !== (n = null === (r = e.conditions) || void 0 === r ? void 0 : r.urlMatchType) && void 0 !== n ? n : "icontains"](e.conditions.url), s = null === (i = e.conditions) || void 0 === i || !i.selector || (null == B ? void 0 : B.querySelector(e.conditions.selector));
3478
+ var o = null === (t = e.conditions) || void 0 === t || !t.url || pi[null !== (n = null === (r = e.conditions) || void 0 === r ? void 0 : r.urlMatchType) && void 0 !== n ? n : "icontains"](e.conditions.url), s = null === (i = e.conditions) || void 0 === i || !i.selector || (null == B ? void 0 : B.querySelector(e.conditions.selector));
3233
3479
  return o && s;
3234
3480
  })).filter((function(e) {
3235
3481
  if (!e.linked_flag_key && !e.targeting_flag_key) return !0;
@@ -3240,18 +3486,19 @@ var ar, ur, lr, cr = {
3240
3486
  }), n);
3241
3487
  }
3242
3488
  } ]), e;
3243
- }(), hr = 6e4, fr = function() {
3489
+ }(), gi = function() {
3244
3490
  function e() {
3245
3491
  var t = this;
3246
3492
  r(this, e), s(this, "limits", {}), s(this, "checkForLimiting", (function(e) {
3247
- try {
3248
- var n = e.responseText;
3249
- if (!n || !n.length) return;
3493
+ var n = e.responseText;
3494
+ if (n && n.length) try {
3250
3495
  (JSON.parse(n).quota_limited || []).forEach((function(e) {
3251
- H.info("[RateLimiter] ".concat(e || "events", " is quota limited.")), t.limits[e] = (new Date).getTime() + hr;
3496
+ G.info("[RateLimiter] ".concat(e || "events", " is quota limited.")), t.limits[e] = (new Date).getTime() + 6e4;
3252
3497
  }));
3253
3498
  } catch (e) {
3254
- return void H.error(e);
3499
+ return void G.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(null == e ? void 0 : e.message, '"'), {
3500
+ text: n
3501
+ });
3255
3502
  }
3256
3503
  }));
3257
3504
  }
@@ -3262,12 +3509,12 @@ var ar, ur, lr, cr = {
3262
3509
  return !1 !== t && (new Date).getTime() < t;
3263
3510
  }
3264
3511
  } ]), e;
3265
- }(), pr = function() {
3512
+ }(), vi = function() {
3266
3513
  return t({
3267
- initialPathName: (null == D ? void 0 : D.location.pathname) || "",
3268
- referringDomain: St.referringDomain()
3269
- }, St.campaignParams());
3270
- }, _r = function() {
3514
+ initialPathName: (null == j ? void 0 : j.pathname) || "",
3515
+ referringDomain: Tn.referringDomain()
3516
+ }, Tn.campaignParams());
3517
+ }, mi = function() {
3271
3518
  function e(t, n, i) {
3272
3519
  var o = this;
3273
3520
  r(this, e), s(this, "_onSessionIdCallback", (function(e) {
@@ -3277,15 +3524,15 @@ var ar, ur, lr, cr = {
3277
3524
  sessionId: e,
3278
3525
  props: o._sessionSourceParamGenerator()
3279
3526
  };
3280
- o._persistence.register(s({}, je, n));
3527
+ o._persistence.register(s({}, Ye, n));
3281
3528
  }
3282
- })), this._sessionIdManager = t, this._persistence = n, this._sessionSourceParamGenerator = i || pr,
3529
+ })), this._sessionIdManager = t, this._persistence = n, this._sessionSourceParamGenerator = i || vi,
3283
3530
  this._sessionIdManager.onSessionId(this._onSessionIdCallback);
3284
3531
  }
3285
3532
  return o(e, [ {
3286
3533
  key: "_getStoredProps",
3287
3534
  value: function() {
3288
- return this._persistence.props[je];
3535
+ return this._persistence.props[Ye];
3289
3536
  }
3290
3537
  }, {
3291
3538
  key: "getSessionProps",
@@ -3302,10 +3549,10 @@ var ar, ur, lr, cr = {
3302
3549
  } : {};
3303
3550
  }
3304
3551
  } ]), e;
3305
- }(), gr = [ "ahrefsbot", "ahrefssiteaudit", "applebot", "baiduspider", "bingbot", "bingpreview", "bot.htm", "bot.php", "crawler", "duckduckbot", "facebookexternal", "facebookcatalog", "gptbot", "http://yandex.com/bots", "hubspot", "ia_archiver", "linkedinbot", "mj12bot", "msnbot", "nessus", "petalbot", "pinterest", "prerender", "rogerbot", "screaming frog", "semrushbot", "sitebulb", "slurp", "turnitin", "twitterbot", "vercelbot", "yahoo! slurp", "yandexbot", "adsbot-google", "apis-google", "duplexweb-google", "feedfetcher-google", "google favicon", "google web preview", "google-read-aloud", "googlebot", "googleweblight", "mediapartners-google", "storebot-google" ], vr = function(e, t) {
3552
+ }(), yi = [ "ahrefsbot", "ahrefssiteaudit", "applebot", "baiduspider", "bingbot", "bingpreview", "bot.htm", "bot.php", "crawler", "duckduckbot", "facebookexternal", "facebookcatalog", "gptbot", "http://yandex.com/bots", "hubspot", "ia_archiver", "linkedinbot", "mj12bot", "msnbot", "nessus", "petalbot", "pinterest", "prerender", "rogerbot", "screaming frog", "semrushbot", "sitebulb", "slurp", "turnitin", "twitterbot", "vercelbot", "yahoo! slurp", "yandexbot", "adsbot-google", "apis-google", "duplexweb-google", "feedfetcher-google", "google favicon", "google web preview", "google-read-aloud", "googlebot", "googleweblight", "mediapartners-google", "storebot-google" ], bi = function(e, t) {
3306
3553
  if (!e) return !1;
3307
3554
  var n = e.toLowerCase();
3308
- return gr.concat(t || []).some((function(e) {
3555
+ return yi.concat(t || []).some((function(e) {
3309
3556
  var t = e.toLowerCase();
3310
3557
  return n.includes ? n.includes(t) : -1 !== n.indexOf(t);
3311
3558
  }));
@@ -3313,9 +3560,9 @@ var ar, ur, lr, cr = {
3313
3560
 
3314
3561
  !function(e) {
3315
3562
  e[e.INIT_MODULE = 0] = "INIT_MODULE", e[e.INIT_SNIPPET = 1] = "INIT_SNIPPET";
3316
- }(ar || (ar = {}));
3563
+ }(di || (di = {}));
3317
3564
 
3318
- var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XMLHttpRequest) && "withCredentials" in new XMLHttpRequest, wr = !kr && -1 === (null == N ? void 0 : N.indexOf("MSIE")) && -1 === (null == N ? void 0 : N.indexOf("Mozilla")), Sr = function() {
3565
+ var wi = function() {}, ki = {}, Si = "posthog", Fi = !Et && -1 === (null == V ? void 0 : V.indexOf("MSIE")) && -1 === (null == V ? void 0 : V.indexOf("Mozilla")), Ri = function() {
3319
3566
  var e, t, n;
3320
3567
  return {
3321
3568
  api_host: "https://app.posthog.com",
@@ -3330,7 +3577,7 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3330
3577
  persistence: "localStorage+cookie",
3331
3578
  persistence_name: "",
3332
3579
  cookie_name: "",
3333
- loaded: mr,
3580
+ loaded: wi,
3334
3581
  store_google: !0,
3335
3582
  custom_campaign_params: [],
3336
3583
  custom_blocked_useragents: [],
@@ -3345,17 +3592,19 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3345
3592
  disable_persistence: !1,
3346
3593
  disable_cookie: !1,
3347
3594
  enable_recording_console_log: void 0,
3348
- secure_cookie: "https:" === (null == D || null === (e = D.location) || void 0 === e ? void 0 : e.protocol),
3595
+ secure_cookie: "https:" === (null == A || null === (e = A.location) || void 0 === e ? void 0 : e.protocol),
3349
3596
  ip: !0,
3350
3597
  opt_out_capturing_by_default: !1,
3351
3598
  opt_out_persistence_by_default: !1,
3599
+ opt_out_useragent_filter: !1,
3352
3600
  opt_out_capturing_persistence_type: "localStorage",
3353
3601
  opt_out_capturing_cookie_prefix: null,
3354
3602
  opt_in_site_apps: !1,
3355
3603
  property_blacklist: [],
3604
+ property_denylist: [],
3356
3605
  respect_dnt: !1,
3357
3606
  sanitize_properties: null,
3358
- xhr_headers: {},
3607
+ request_headers: {},
3359
3608
  inapp_protocol: "//",
3360
3609
  inapp_link_new_window: !1,
3361
3610
  request_batching: !0,
@@ -3367,14 +3616,14 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3367
3616
  advanced_disable_feature_flags: !1,
3368
3617
  advanced_disable_feature_flags_on_first_load: !1,
3369
3618
  advanced_disable_toolbar_metrics: !1,
3370
- on_xhr_error: function(e) {
3371
- var t = "Bad HTTP status: " + e.status + " " + e.statusText;
3372
- H.error(t);
3619
+ on_request_error: function(e) {
3620
+ var t = "Bad HTTP status: " + e.statusCode + " " + e.responseText;
3621
+ G.error(t);
3373
3622
  },
3374
3623
  get_device_id: function(e) {
3375
3624
  return e;
3376
3625
  },
3377
- _onCapture: mr,
3626
+ _onCapture: wi,
3378
3627
  capture_performance: void 0,
3379
3628
  name: "posthog",
3380
3629
  callback_fn: "posthog._jsc",
@@ -3382,8 +3631,8 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3382
3631
  disable_compression: !1,
3383
3632
  session_idle_timeout_seconds: 1800
3384
3633
  };
3385
- }, Fr = function(e, t, n, r) {
3386
- var i, o = n !== br && lr ? n ? lr[n] : void 0 : lr, s = {
3634
+ }, Pi = function(e, t, n, r) {
3635
+ var i, o = n !== Si && hi ? n ? hi[n] : void 0 : hi, s = {
3387
3636
  initComplete: !1,
3388
3637
  syncCode: !1
3389
3638
  }, a = function(e) {
@@ -3391,21 +3640,21 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3391
3640
  s[e] || (s[e] = !0, s.initComplete && s.syncCode && (null == r || r(t)));
3392
3641
  };
3393
3642
  };
3394
- if (o && ur === ar.INIT_MODULE) i = o; else {
3395
- if (o && !S(o)) return void H.error("You have already initialized " + n);
3396
- i = new Ir;
3643
+ if (o && fi === di.INIT_MODULE) i = o; else {
3644
+ if (o && !S(o)) return void G.error("You have already initialized " + n);
3645
+ i = new Ei;
3397
3646
  }
3398
- if (i._init(e, t, n, a("initComplete")), i.toolbar.maybeLoadToolbar(), i.sessionRecording = new Vt(i),
3399
- i.sessionRecording.startRecordingIfEnabled(), i.config.__preview_measure_pageview_stats && i.pageViewManager.startMeasuringScrollPosition(),
3400
- i.__autocapture = i.config.autocapture, Ue._setIsAutocaptureEnabled(i), Ue._isAutocaptureEnabled) {
3647
+ if (i._init(e, t, n, a("initComplete")), i.toolbar.maybeLoadToolbar(), i.sessionRecording = new sr(i),
3648
+ i.sessionRecording.startRecordingIfEnabled(), i.config.disable_scroll_properties || i.pageViewManager.startMeasuringScrollPosition(),
3649
+ i.__autocapture = i.config.autocapture, Ze._setIsAutocaptureEnabled(i), Ze._isAutocaptureEnabled) {
3401
3650
  i.__autocapture = i.config.autocapture;
3402
- Ue.enabledForProject(i.config.token, 100, 100) ? Ue.isBrowserSupported() ? Ue.init(i) : (i.__autocapture = !1,
3403
- H.info("Disabling Automatic Event Collection because this browser is not supported")) : (i.__autocapture = !1,
3404
- H.info("Not in active bucket: disabling Automatic Event Collection."));
3651
+ Ze.enabledForProject(i.config.token, 100, 100) ? Ze.isBrowserSupported() ? Ze.init(i) : (i.__autocapture = !1,
3652
+ G.info("Disabling Automatic Event Collection because this browser is not supported")) : (i.__autocapture = !1,
3653
+ G.info("Not in active bucket: disabling Automatic Event Collection."));
3405
3654
  }
3406
- return m.DEBUG = m.DEBUG || i.config.debug, !R(o) && S(o) && (i._execute_array.call(i.people, o.people),
3655
+ return m.DEBUG = m.DEBUG || i.config.debug, !x(o) && S(o) && (i._execute_array.call(i.people, o.people),
3407
3656
  i._execute_array(o)), a("syncCode")(i), i;
3408
- }, Pr = function() {
3657
+ }, xi = function() {
3409
3658
  function e() {
3410
3659
  r(this, e), s(this, "__forceAllowLocalhost", !1);
3411
3660
  }
@@ -3415,21 +3664,53 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3415
3664
  return this.__forceAllowLocalhost;
3416
3665
  },
3417
3666
  set: function(e) {
3418
- H.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),
3667
+ G.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),
3419
3668
  this.__forceAllowLocalhost = e;
3420
3669
  }
3421
3670
  } ]), e;
3422
- }(), Ir = function() {
3671
+ }(), Ei = function() {
3423
3672
  function e() {
3424
3673
  var t = this;
3425
- r(this, e), s(this, "webPerformance", new Pr), this.config = Sr(), this.compression = {},
3426
- this.decideEndpointWasHit = !1, this.SentryIntegration = rr, this.segmentIntegration = function() {
3427
- return ir(t);
3674
+ r(this, e), s(this, "webPerformance", new xi), this.config = Ri(), this.compression = {},
3675
+ this.decideEndpointWasHit = !1, this.SentryIntegration = ui, this.segmentIntegration = function() {
3676
+ return function(e) {
3677
+ Promise && Promise.resolve || G.warn("This browser does not have Promise support, and can not use the segment integration");
3678
+ var t = function(t, n) {
3679
+ t.event.userId || t.event.anonymousId === e.get_distinct_id() || e.reset(), t.event.userId && t.event.userId !== e.get_distinct_id() && (e.register({
3680
+ distinct_id: t.event.userId
3681
+ }), e.reloadFeatureFlags());
3682
+ var r = e._calculate_event_properties(n, t.event.properties);
3683
+ return t.event.properties = Object.assign({}, r, t.event.properties), t;
3684
+ };
3685
+ return {
3686
+ name: "PostHog JS",
3687
+ type: "enrichment",
3688
+ version: "1.0.0",
3689
+ isLoaded: function() {
3690
+ return !0;
3691
+ },
3692
+ load: function() {
3693
+ return Promise.resolve();
3694
+ },
3695
+ track: function(e) {
3696
+ return t(e, e.event.event);
3697
+ },
3698
+ page: function(e) {
3699
+ return t(e, "$pageview");
3700
+ },
3701
+ identify: function(e) {
3702
+ return t(e, "$identify");
3703
+ },
3704
+ screen: function(e) {
3705
+ return t(e, "$screen");
3706
+ }
3707
+ };
3708
+ }(t);
3428
3709
  }, this.__captureHooks = [], this.__request_queue = [], this.__loaded = !1, this.__loaded_recorder_version = void 0,
3429
3710
  this.__autocapture = void 0, this._jsc = function() {}, this.analyticsDefaultEndpoint = "/e/",
3430
- this.elementsChainAsString = !1, this.featureFlags = new Qe(this), this.toolbar = new Yt(this),
3431
- this.pageViewManager = new or, this.surveys = new dr(this), this.rateLimiter = new fr,
3432
- this.people = {
3711
+ this.elementsChainAsString = !1, this.featureFlags = new it(this), this.toolbar = new cr(this),
3712
+ this.pageViewManager = new li(this), this.surveys = new _i(this), this.rateLimiter = new gi,
3713
+ this.requestRouter = new ai(this), this.people = {
3433
3714
  set: function(e, n, r) {
3434
3715
  var i = E(e) ? s({}, e, n) : e;
3435
3716
  t.setPersonProperties(i), null == r || r({});
@@ -3443,14 +3724,16 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3443
3724
  return o(e, [ {
3444
3725
  key: "init",
3445
3726
  value: function(e, t, n) {
3446
- if (R(n)) H.critical("You must name your new library: init(token, config, name)"); else {
3447
- if (n !== br) {
3448
- var r = Fr(e, t, n, (function(e) {
3449
- lr[n] = e, e._loaded();
3727
+ if (x(n)) G.critical("You must name your new library: init(token, config, name)"); else if (x(e) || function(e) {
3728
+ return E(e) && 0 === e.trim().length;
3729
+ }(e)) G.critical("You must provide a token to initialize posthog"); else {
3730
+ if (n !== Si) {
3731
+ var r = Pi(e, t, n, (function(e) {
3732
+ hi[n] = e, e._loaded();
3450
3733
  }));
3451
- return lr[n] = r, r;
3734
+ return hi[n] = r, r;
3452
3735
  }
3453
- H.critical("You must initialize the main posthog object right after you include the PostHog js snippet");
3736
+ G.critical("You must initialize the main posthog object right after you include the PostHog js snippet");
3454
3737
  }
3455
3738
  }
3456
3739
  }, {
@@ -3466,24 +3749,24 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3466
3749
  c[e] || (c[e] = !0, c.segmentRegister && c.syncCode && (null == u || u(o)));
3467
3750
  };
3468
3751
  };
3469
- (this.set_config(z({}, Sr(), s, {
3752
+ (s.request_headers = s.request_headers || s.xhr_headers, this.set_config(X({}, Ri(), s, {
3470
3753
  name: a,
3471
3754
  token: e,
3472
- callback_fn: (a === br ? a : br + "." + a) + "._jsc"
3473
- })), this._jsc = function() {}, null != D && null !== (n = D.rrweb) && void 0 !== n && n.record || null != D && D.rrwebRecord) && (this.__loaded_recorder_version = null == D || null === (l = D.rrweb) || void 0 === l ? void 0 : l.version);
3474
- if (this.persistence = new Pt(this.config), this._requestQueue = new an(this._handle_queued_event.bind(this)),
3475
- this._retryQueue = new Kn(this.config.on_xhr_error, this.rateLimiter), this.__captureHooks = [],
3476
- this.__request_queue = [], this.sessionManager = new nr(this.config, this.persistence),
3477
- this.sessionPropsManager = new _r(this.sessionManager, this.persistence), this.sessionPersistence = "sessionStorage" === this.config.persistence ? this.persistence : new Pt(t(t({}, this.config), {}, {
3755
+ callback_fn: (a === Si ? a : Si + "." + a) + "._jsc"
3756
+ })), this._jsc = function() {}, null != A && null !== (n = A.rrweb) && void 0 !== n && n.record || null != A && A.rrwebRecord) && (this.__loaded_recorder_version = null == A || null === (l = A.rrweb) || void 0 === l ? void 0 : l.version);
3757
+ if (this.persistence = new On(this.config), this.sessionPersistence = "sessionStorage" === this.config.persistence ? this.persistence : new On(t(t({}, this.config), {}, {
3478
3758
  persistence: "sessionStorage"
3479
- })), this._gdpr_init(), s.segment ? (this.config.get_device_id = function() {
3759
+ })), this._requestQueue = new fr(this._handle_queued_event.bind(this)), this._retryQueue = new ii(this.config.on_request_error, this.rateLimiter),
3760
+ this.__captureHooks = [], this.__request_queue = [], this.sessionManager = new si(this.config, this.persistence),
3761
+ this.sessionPropsManager = new mi(this.sessionManager, this.persistence), this._gdpr_init(),
3762
+ s.segment ? (this.config.get_device_id = function() {
3480
3763
  return s.segment.user().anonymousId();
3481
3764
  }, s.segment.user().id() && (this.register({
3482
3765
  distinct_id: s.segment.user().id()
3483
3766
  }), this.persistence.set_user_state("identified")), s.segment.register(this.segmentIntegration()).then(d("segmentRegister"))) : d("segmentRegister")(),
3484
3767
  void 0 !== (null === (r = s.bootstrap) || void 0 === r ? void 0 : r.distinctID)) {
3485
- var h, f, p = this.config.get_device_id(nt()), _ = null !== (h = s.bootstrap) && void 0 !== h && h.isIdentifiedID ? p : s.bootstrap.distinctID;
3486
- this.persistence.set_user_state(null !== (f = s.bootstrap) && void 0 !== f && f.isIdentifiedID ? "identified" : "anonymous"),
3768
+ var f, h, p = this.config.get_device_id(dt()), _ = null !== (f = s.bootstrap) && void 0 !== f && f.isIdentifiedID ? p : s.bootstrap.distinctID;
3769
+ this.persistence.set_user_state(null !== (h = s.bootstrap) && void 0 !== h && h.isIdentifiedID ? "identified" : "anonymous"),
3487
3770
  this.register({
3488
3771
  distinct_id: s.bootstrap.distinctID,
3489
3772
  $device_id: _
@@ -3510,13 +3793,13 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3510
3793
  });
3511
3794
  }
3512
3795
  if (!this.get_distinct_id()) {
3513
- var b = this.config.get_device_id(nt());
3796
+ var b = this.config.get_device_id(dt());
3514
3797
  this.register_once({
3515
3798
  distinct_id: b,
3516
3799
  $device_id: b
3517
3800
  }, ""), this.persistence.set_user_state("anonymous");
3518
3801
  }
3519
- null == D || null === (i = D.addEventListener) || void 0 === i || i.call(D, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this)),
3802
+ null == A || null === (i = A.addEventListener) || void 0 === i || i.call(A, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this)),
3520
3803
  d("syncCode")();
3521
3804
  }
3522
3805
  }, {
@@ -3547,13 +3830,13 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3547
3830
  try {
3548
3831
  this.config.loaded(this);
3549
3832
  } catch (e) {
3550
- H.critical("`loaded` function failed", e);
3833
+ G.critical("`loaded` function failed", e);
3551
3834
  }
3552
3835
  this._start_queue_if_opted_in(), this.config.capture_pageview && B && this.capture("$pageview", {
3553
3836
  title: B.title
3554
3837
  }, {
3555
3838
  send_instantly: !0
3556
- }), e || (new Ut(this).call(), this.featureFlags.resetRequestQueue());
3839
+ }), e || (new ar(this).call(), this.featureFlags.resetRequestQueue());
3557
3840
  }
3558
3841
  }, {
3559
3842
  key: "_start_queue_if_opted_in",
@@ -3565,15 +3848,15 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3565
3848
  key: "_dom_loaded",
3566
3849
  value: function() {
3567
3850
  var e = this;
3568
- this.has_opted_out_capturing() || W(this.__request_queue, (function(t) {
3851
+ this.has_opted_out_capturing() || J(this.__request_queue, (function(t) {
3569
3852
  e._send_request.apply(e, p(t));
3570
3853
  })), this.__request_queue = [], this._start_queue_if_opted_in();
3571
3854
  }
3572
3855
  }, {
3573
3856
  key: "_prepare_callback",
3574
3857
  value: function(e, t) {
3575
- if (R(e)) return null;
3576
- if (kr) return function(n) {
3858
+ if (x(e)) return null;
3859
+ if (Et) return function(n) {
3577
3860
  e(n, t);
3578
3861
  };
3579
3862
  var n = this._jsc, r = "" + Math.floor(1e8 * Math.random()), i = this.config.callback_fn + "[" + r + "]";
@@ -3594,56 +3877,56 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3594
3877
  key: "_handle_queued_event",
3595
3878
  value: function(e, t, n) {
3596
3879
  var r = JSON.stringify(t);
3597
- this.__compress_and_send_json_request(e, r, n || yr, mr);
3880
+ this.__compress_and_send_json_request(e, r, n || ki, wi);
3598
3881
  }
3599
3882
  }, {
3600
3883
  key: "__compress_and_send_json_request",
3601
3884
  value: function(e, n, r, i) {
3602
3885
  var o = function(e, n, r) {
3603
- return e === Pn.GZipJS ? [ Gn(zn(n), {
3886
+ return e === Cr.GZipJS ? [ Kr(Xr(n), {
3604
3887
  mtime: 0
3605
3888
  }), t(t({}, r), {}, {
3606
3889
  blob: !0,
3607
3890
  urlQueryArgs: {
3608
- compression: Pn.GZipJS
3891
+ compression: Cr.GZipJS
3609
3892
  }
3610
3893
  }) ] : [ {
3611
- data: ne(n)
3894
+ data: se(n)
3612
3895
  }, r ];
3613
- }(this.compression[Pn.GZipJS] ? Pn.GZipJS : Pn.Base64, n, r), s = f(o, 2), a = s[0], u = s[1];
3896
+ }(this.compression[Cr.GZipJS] ? Cr.GZipJS : Cr.Base64, n, r), s = h(o, 2), a = s[0], u = s[1];
3614
3897
  this._send_request(e, a, u, i);
3615
3898
  }
3616
3899
  }, {
3617
3900
  key: "_send_request",
3618
3901
  value: function(e, n, r, i) {
3619
- if (this.__loaded && this._retryQueue && !this.rateLimiter.isRateLimited(r._batchKey)) if (wr) this.__request_queue.push([ e, n, r, i ]); else {
3902
+ if (this.__loaded && this._retryQueue && !this.rateLimiter.isRateLimited(r._batchKey)) if (Fi) this.__request_queue.push([ e, n, r, i ]); else {
3620
3903
  var o = {
3621
3904
  method: this.config.api_method,
3622
3905
  transport: this.config.api_transport,
3623
3906
  verbose: this.config.verbose
3624
3907
  };
3625
- r = z(o, r || {}), kr || (r.method = "GET");
3626
- var s = D && "sendBeacon" in D.navigator && "sendBeacon" === r.transport;
3627
- if (e = Yn(e, r.urlQueryArgs || {}, {
3908
+ r = X(o, r || {}), Et || (r.method = "GET");
3909
+ var s = A && "sendBeacon" in A.navigator && "sendBeacon" === r.transport;
3910
+ if (e = Zr(e, r.urlQueryArgs || {}, {
3628
3911
  ip: this.config.ip
3629
3912
  }), s) try {
3630
- null == D || D.navigator.sendBeacon(e, Qn(n, t(t({}, r), {}, {
3913
+ null == A || A.navigator.sendBeacon(e, ei(n, t(t({}, r), {}, {
3631
3914
  sendBeacon: !0
3632
3915
  })));
3633
- } catch (e) {} else if (kr || !B) try {
3634
- Jn({
3916
+ } catch (e) {} else if (Et || !B) try {
3917
+ ti({
3635
3918
  url: e,
3636
3919
  data: n,
3637
- headers: this.config.xhr_headers,
3920
+ headers: this.config.request_headers,
3638
3921
  options: r,
3639
3922
  callback: i,
3640
3923
  retriesPerformedSoFar: 0,
3641
3924
  retryQueue: this._retryQueue,
3642
- onXHRError: this.config.on_xhr_error,
3925
+ onError: this.config.on_request_error,
3643
3926
  onResponse: this.rateLimiter.checkForLimiting
3644
3927
  });
3645
3928
  } catch (e) {
3646
- H.error(e);
3929
+ G.error(e);
3647
3930
  } else {
3648
3931
  var a, u = B.createElement("script");
3649
3932
  u.type = "text/javascript", u.async = !0, u.defer = !0, u.src = e;
@@ -3656,14 +3939,14 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3656
3939
  key: "_execute_array",
3657
3940
  value: function(e) {
3658
3941
  var t, n = this, r = [], i = [], o = [];
3659
- W(e, (function(e) {
3660
- e && (t = e[0], S(t) ? o.push(e) : P(e) ? e.call(n) : S(e) && "alias" === t ? r.push(e) : S(e) && -1 !== t.indexOf("capture") && P(n[t]) ? o.push(e) : i.push(e));
3942
+ J(e, (function(e) {
3943
+ e && (t = e[0], S(t) ? o.push(e) : R(e) ? e.call(n) : S(e) && "alias" === t ? r.push(e) : S(e) && -1 !== t.indexOf("capture") && R(n[t]) ? o.push(e) : i.push(e));
3661
3944
  }));
3662
3945
  var s = function(e, t) {
3663
- W(e, (function(e) {
3946
+ J(e, (function(e) {
3664
3947
  if (S(e[0])) {
3665
3948
  var n = t;
3666
- G(e, (function(e) {
3949
+ K(e, (function(e) {
3667
3950
  n = n[e[0]].apply(n, e.slice(1));
3668
3951
  }));
3669
3952
  } else this[e[0]].apply(this, e.slice(1));
@@ -3685,41 +3968,34 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3685
3968
  }, {
3686
3969
  key: "capture",
3687
3970
  value: function(e, n) {
3688
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : yr;
3689
- if (!this.__loaded || !this.sessionPersistence || !this._requestQueue) return H.uninitializedWarning("posthog.capture");
3690
- if (!function(e) {
3691
- var t = !1;
3692
- try {
3693
- var n = e.config.token, r = e.config.respect_dnt, i = e.config.opt_out_capturing_persistence_type, o = e.config.opt_out_capturing_cookie_prefix || void 0, s = e.config.window;
3694
- n && (t = Zt(n, {
3695
- respectDnt: r,
3696
- persistenceType: i,
3697
- persistencePrefix: o,
3698
- window: s
3699
- }));
3700
- } catch (e) {
3701
- H.error("Unexpected error when checking capturing opt-out status: " + e);
3702
- }
3703
- return t;
3704
- }(this)) {
3705
- var i = (r = r || yr).transport;
3706
- if (i && (r.transport = i), !R(e) && E(e)) {
3707
- if (!N || !vr(N, this.config.custom_blocked_useragents)) {
3971
+ var r, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : ki;
3972
+ if (!this.__loaded || !this.sessionPersistence || !this._requestQueue) return G.uninitializedWarning("posthog.capture");
3973
+ if (!Zn(this)) {
3974
+ var o = (i = i || ki).transport;
3975
+ if (o && (i.transport = o), !x(e) && E(e)) {
3976
+ if (!V || this.config.opt_out_useragent_filter || !bi(V, this.config.custom_blocked_useragents)) {
3708
3977
  this.sessionPersistence.update_search_keyword(), this.config.store_google && this.sessionPersistence.update_campaign_params(),
3709
3978
  this.config.save_referrer && this.sessionPersistence.update_referrer_info();
3710
- var o = {
3711
- uuid: nt(),
3979
+ var s = {
3980
+ uuid: dt(),
3712
3981
  event: e,
3713
3982
  properties: this._calculate_event_properties(e, n || {})
3714
3983
  };
3715
- "$identify" === e && (o.$set = r.$set, o.$set_once = r.$set_once), (o = te(o, r._noTruncate ? null : this.config.properties_string_max_length)).timestamp = r.timestamp || new Date;
3716
- var s = t(t({}, o.properties.$set), o.$set);
3717
- x(s) || this.setPersonPropertiesForFlags(s), H.info("send", o);
3718
- var a = JSON.stringify(o), u = this.config.api_host + (r.endpoint || this.analyticsDefaultEndpoint), l = r !== yr;
3719
- return !this.config.request_batching || l && !r._batchKey || r.send_instantly ? this.__compress_and_send_json_request(u, a, r) : this._requestQueue.enqueue(u, o, r),
3720
- this._invokeCaptureHooks(e, o), o;
3984
+ "$identify" === e && (s.$set = i.$set, s.$set_once = i.$set_once), (s = oe(s, i._noTruncate ? null : this.config.properties_string_max_length)).timestamp = i.timestamp || new Date,
3985
+ x(i.timestamp) || (s.properties.$event_time_override_provided = !0, s.properties.$event_time_override_system_time = new Date);
3986
+ var a = t(t({}, s.properties.$set), s.$set);
3987
+ (function(e) {
3988
+ if (P(e)) {
3989
+ for (var t in e) if (w.call(e, t)) return !1;
3990
+ return !0;
3991
+ }
3992
+ return !1;
3993
+ })(a) || this.setPersonPropertiesForFlags(a), G.info("send", s);
3994
+ var u = JSON.stringify(s), l = null !== (r = i._url) && void 0 !== r ? r : this.requestRouter.endpointFor("api", this.analyticsDefaultEndpoint), c = i !== ki;
3995
+ return !this.config.request_batching || c && !i._batchKey || i.send_instantly ? this.__compress_and_send_json_request(l, u, i) : this._requestQueue.enqueue(l, s, i),
3996
+ this._invokeCaptureHooks(e, s), s;
3721
3997
  }
3722
- } else H.error("No event name provided to posthog.capture");
3998
+ } else G.error("No event name provided to posthog.capture");
3723
3999
  }
3724
4000
  }
3725
4001
  }, {
@@ -3730,7 +4006,7 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3730
4006
  }, {
3731
4007
  key: "_invokeCaptureHooks",
3732
4008
  value: function(e, t) {
3733
- this.config._onCapture(e, t), G(this.__captureHooks, (function(t) {
4009
+ this.config._onCapture(e, t), K(this.__captureHooks, (function(t) {
3734
4010
  return t(e);
3735
4011
  }));
3736
4012
  }
@@ -3743,33 +4019,33 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3743
4019
  var o = t(t({}, this.persistence.properties()), this.sessionPersistence.properties());
3744
4020
  return i.distinct_id = o.distinct_id, i;
3745
4021
  }
3746
- var s = St.properties();
4022
+ var s = Tn.properties();
3747
4023
  if (this.sessionManager) {
3748
4024
  var a = this.sessionManager.checkAndGetSessionAndWindowId(), u = a.sessionId, l = a.windowId;
3749
4025
  i.$session_id = u, i.$window_id = l;
3750
4026
  }
3751
4027
  if (this.sessionPropsManager && this.config.__preview_send_client_session_params && ("$pageview" === e || "$pageleave" === e || "$autocapture" === e)) {
3752
4028
  var c = this.sessionPropsManager.getSessionProps();
3753
- i = z(i, c);
4029
+ i = X(i, c);
3754
4030
  }
3755
- if (this.config.__preview_measure_pageview_stats) {
4031
+ if (!this.config.disable_scroll_properties) {
3756
4032
  var d = {};
3757
4033
  "$pageview" === e ? d = this.pageViewManager.doPageView() : "$pageleave" === e && (d = this.pageViewManager.doPageLeave()),
3758
- i = z(i, d);
4034
+ i = X(i, d);
3759
4035
  }
3760
4036
  if ("$pageview" === e && B && (i.title = B.title), "$performance_event" === e) {
3761
- var h = this.persistence.properties();
3762
- return i.distinct_id = h.distinct_id, i.$current_url = s.$current_url, i;
4037
+ var f = this.persistence.properties();
4038
+ return i.distinct_id = f.distinct_id, i.$current_url = s.$current_url, i;
3763
4039
  }
3764
- if (!R(r)) {
3765
- var f = (new Date).getTime() - r;
3766
- i.$duration = parseFloat((f / 1e3).toFixed(3));
4040
+ if (!x(r)) {
4041
+ var h = (new Date).getTime() - r;
4042
+ i.$duration = parseFloat((h / 1e3).toFixed(3));
3767
4043
  }
3768
- i = z({}, St.properties(), this.persistence.properties(), this.sessionPersistence.properties(), i);
3769
- var p = this.config.property_blacklist;
3770
- S(p) ? G(p, (function(e) {
4044
+ (V && this.config.opt_out_useragent_filter && (i.$browser_type = bi(V, this.config.custom_blocked_useragents) ? "bot" : "browser"),
4045
+ i = X({}, Tn.properties(), this.persistence.properties(), this.sessionPersistence.properties(), i),
4046
+ S(this.config.property_denylist) && S(this.config.property_blacklist)) ? K([].concat(p(this.config.property_blacklist), p(this.config.property_denylist)), (function(e) {
3771
4047
  delete i[e];
3772
- })) : H.error("Invalid value for property_blacklist config: " + p);
4048
+ })) : G.error("Invalid value for property_denylist config: " + this.config.property_denylist + " or property_blacklist config: " + this.config.property_blacklist);
3773
4049
  var _ = this.config.sanitize_properties;
3774
4050
  return _ && (i = _(i, e)), i;
3775
4051
  }
@@ -3870,8 +4146,9 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3870
4146
  }, {
3871
4147
  key: "identify",
3872
4148
  value: function(e, t, n) {
3873
- if (!this.__loaded || !this.persistence) return H.uninitializedWarning("posthog.identify");
3874
- if (e) if ([ "distinct_id", "distinctid" ].includes(e.toLowerCase())) H.critical('The string "'.concat(e, '" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.')); else {
4149
+ if (!this.__loaded || !this.persistence) return G.uninitializedWarning("posthog.identify");
4150
+ if (T(e) && (e = e.toString(), G.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),
4151
+ e) if ([ "distinct_id", "distinctid" ].includes(e.toLowerCase())) G.critical('The string "'.concat(e, '" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.')); else {
3875
4152
  var r = this.get_distinct_id();
3876
4153
  if (this.register({
3877
4154
  $user_id: e
@@ -3882,7 +4159,7 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3882
4159
  $device_id: i
3883
4160
  }, "");
3884
4161
  }
3885
- e !== r && e !== this.get_property(Fe) && (this.unregister(Fe), this.register({
4162
+ e !== r && e !== this.get_property(Te) && (this.unregister(Te), this.register({
3886
4163
  distinct_id: e
3887
4164
  }));
3888
4165
  var o = "anonymous" === this.persistence.get_user_state();
@@ -3894,8 +4171,8 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3894
4171
  $set: t || {},
3895
4172
  $set_once: n || {}
3896
4173
  }), this.featureFlags.setAnonymousDistinctId(r)) : (t || n) && this.setPersonProperties(t, n),
3897
- e !== r && (this.reloadFeatureFlags(), this.unregister(Be));
3898
- } else H.error("Unique user id has not been set in posthog.identify");
4174
+ e !== r && (this.reloadFeatureFlags(), this.unregister(ze));
4175
+ } else G.error("Unique user id has not been set in posthog.identify");
3899
4176
  }
3900
4177
  }, {
3901
4178
  key: "setPersonProperties",
@@ -3917,7 +4194,7 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3917
4194
  $group_key: n,
3918
4195
  $group_set: r
3919
4196
  }), this.setGroupPropertiesForFlags(s({}, e, r))), i[e] === n || r || this.reloadFeatureFlags();
3920
- } else H.error("posthog.group requires a group type and group key");
4197
+ } else G.error("posthog.group requires a group type and group key");
3921
4198
  }
3922
4199
  }, {
3923
4200
  key: "resetGroups",
@@ -3952,12 +4229,12 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3952
4229
  key: "reset",
3953
4230
  value: function(e) {
3954
4231
  var t, n, r, i;
3955
- if (!this.__loaded) return H.uninitializedWarning("posthog.reset");
4232
+ if (!this.__loaded) return G.uninitializedWarning("posthog.reset");
3956
4233
  var o = this.get_property("$device_id");
3957
4234
  null === (t = this.persistence) || void 0 === t || t.clear(), null === (n = this.sessionPersistence) || void 0 === n || n.clear(),
3958
4235
  null === (r = this.persistence) || void 0 === r || r.set_user_state("anonymous"),
3959
4236
  null === (i = this.sessionManager) || void 0 === i || i.resetSessionId();
3960
- var s = this.config.get_device_id(nt());
4237
+ var s = this.config.get_device_id(dt());
3961
4238
  this.register_once({
3962
4239
  distinct_id: s,
3963
4240
  $device_id: e ? s : o
@@ -3983,36 +4260,40 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
3983
4260
  key: "get_session_replay_url",
3984
4261
  value: function(e) {
3985
4262
  if (!this.sessionManager) return "";
3986
- var t = this.config.ui_host || this.config.api_host, n = this.sessionManager.checkAndGetSessionAndWindowId(!0), r = n.sessionId, i = n.sessionStartTimestamp, o = t + "/replay/" + r;
3987
- if (null != e && e.withTimestamp && i) {
3988
- var s, a = null !== (s = e.timestampLookBack) && void 0 !== s ? s : 10;
3989
- if (!i) return o;
3990
- var u = Math.max(Math.floor(((new Date).getTime() - i) / 1e3) - a, 0);
3991
- o += "?t=".concat(u);
4263
+ var t = this.sessionManager.checkAndGetSessionAndWindowId(!0), n = t.sessionId, r = t.sessionStartTimestamp, i = this.requestRouter.endpointFor("ui", "/replay/" + n);
4264
+ if (null != e && e.withTimestamp && r) {
4265
+ var o, s = null !== (o = e.timestampLookBack) && void 0 !== o ? o : 10;
4266
+ if (!r) return i;
4267
+ var a = Math.max(Math.floor(((new Date).getTime() - r) / 1e3) - s, 0);
4268
+ i += "?t=".concat(a);
3992
4269
  }
3993
- return o;
4270
+ return i;
3994
4271
  }
3995
4272
  }, {
3996
4273
  key: "alias",
3997
4274
  value: function(e, t) {
3998
- return e === this.get_property(Se) ? (H.critical("Attempting to create alias for existing People user - aborting."),
3999
- -2) : (R(t) && (t = this.get_distinct_id()), e !== t ? (this._register_single(Fe, e),
4275
+ return e === this.get_property(Ce) ? (G.critical("Attempting to create alias for existing People user - aborting."),
4276
+ -2) : (x(t) && (t = this.get_distinct_id()), e !== t ? (this._register_single(Te, e),
4000
4277
  this.capture("$create_alias", {
4001
4278
  alias: e,
4002
4279
  distinct_id: t
4003
- })) : (H.warn("alias matches current distinct_id - skipping api call."), this.identify(e),
4280
+ })) : (G.warn("alias matches current distinct_id - skipping api call."), this.identify(e),
4004
4281
  -1));
4005
4282
  }
4006
4283
  }, {
4007
4284
  key: "set_config",
4008
4285
  value: function(e) {
4009
- var n, r, i = t({}, this.config);
4010
- I(e) && (z(this.config, e), this.config.persistence_name || (this.config.persistence_name = this.config.cookie_name),
4286
+ var n, r = t({}, this.config);
4287
+ if (P(e) && (X(this.config, e), this.config.persistence_name || (this.config.persistence_name = this.config.cookie_name),
4011
4288
  this.config.disable_persistence || (this.config.disable_persistence = this.config.disable_cookie),
4012
- this.config.api_host = this.config.api_host.replace(/\/$/, ""), null === (n = this.persistence) || void 0 === n || n.update_config(this.config),
4013
- null === (r = this.sessionPersistence) || void 0 === r || r.update_config(this.config),
4014
- dt.is_supported() && "true" === dt.get("ph_debug") && (this.config.debug = !0),
4015
- this.config.debug && (m.DEBUG = !0), this.sessionRecording && !R(e.disable_session_recording) && i.disable_session_recording !== e.disable_session_recording && (e.disable_session_recording ? this.sessionRecording.stopRecording() : this.sessionRecording.startRecordingIfEnabled()));
4289
+ null === (n = this.persistence) || void 0 === n || n.update_config(this.config, r),
4290
+ this.sessionPersistence = "sessionStorage" === this.config.persistence ? this.persistence : new On(t(t({}, this.config), {}, {
4291
+ persistence: "sessionStorage"
4292
+ })), bt.is_supported() && "true" === bt.get("ph_debug") && (this.config.debug = !0),
4293
+ this.config.debug && (m.DEBUG = !0), this.sessionRecording && !x(e.disable_session_recording))) {
4294
+ var i = r.disable_session_recording !== e.disable_session_recording, o = !Zn(this) && !e.disable_session_recording && !this.sessionRecording.started;
4295
+ (i || o) && (e.disable_session_recording ? this.sessionRecording.stopRecording() : this.sessionRecording.startRecordingIfEnabled());
4296
+ }
4016
4297
  }
4017
4298
  }, {
4018
4299
  key: "startSessionRecording",
@@ -4054,13 +4335,13 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
4054
4335
  }, {
4055
4336
  key: "toString",
4056
4337
  value: function() {
4057
- var e, t = null !== (e = this.config.name) && void 0 !== e ? e : br;
4058
- return t !== br && (t = br + "." + t), t;
4338
+ var e, t = null !== (e = this.config.name) && void 0 !== e ? e : Si;
4339
+ return t !== Si && (t = Si + "." + t), t;
4059
4340
  }
4060
4341
  }, {
4061
4342
  key: "_gdpr_init",
4062
4343
  value: function() {
4063
- "localStorage" === this.config.opt_out_capturing_persistence_type && dt.is_supported() && (!this.has_opted_in_capturing() && this.has_opted_in_capturing({
4344
+ "localStorage" === this.config.opt_out_capturing_persistence_type && bt.is_supported() && (!this.has_opted_in_capturing() && this.has_opted_in_capturing({
4064
4345
  persistence_type: "cookie"
4065
4346
  }) && this.opt_in_capturing({
4066
4347
  enable_persistence: !1
@@ -4073,7 +4354,7 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
4073
4354
  enable_persistence: !1
4074
4355
  })), this.has_opted_out_capturing() ? this._gdpr_update_persistence({
4075
4356
  clear_persistence: !0
4076
- }) : this.has_opted_in_capturing() || !this.config.opt_out_capturing_by_default && !lt.get("ph_optout") || (lt.remove("ph_optout"),
4357
+ }) : this.has_opted_in_capturing() || !this.config.opt_out_capturing_by_default && !mt.get("ph_optout") || (mt.remove("ph_optout"),
4077
4358
  this.opt_out_capturing({
4078
4359
  clear_persistence: this.config.opt_out_persistence_by_default
4079
4360
  }));
@@ -4092,14 +4373,14 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
4092
4373
  }, {
4093
4374
  key: "_gdpr_call_func",
4094
4375
  value: function(e, t) {
4095
- return t = z({
4376
+ return t = X({
4096
4377
  capture: this.capture.bind(this),
4097
4378
  persistence_type: this.config.opt_out_capturing_persistence_type,
4098
4379
  cookie_prefix: this.config.opt_out_capturing_cookie_prefix,
4099
4380
  cookie_expiration: this.config.cookie_expiration,
4100
4381
  cross_subdomain_cookie: this.config.cross_subdomain_cookie,
4101
4382
  secure_cookie: this.config.secure_cookie
4102
- }, t || {}), dt.is_supported() || "localStorage" !== t.persistence_type || (t.persistence_type = "cookie"),
4383
+ }, t || {}), bt.is_supported() || "localStorage" !== t.persistence_type || (t.persistence_type = "cookie"),
4103
4384
  e(this.config.token, {
4104
4385
  capture: t.capture,
4105
4386
  captureEventName: t.capture_event_name,
@@ -4114,43 +4395,43 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
4114
4395
  }, {
4115
4396
  key: "opt_in_capturing",
4116
4397
  value: function(e) {
4117
- e = z({
4398
+ e = X({
4118
4399
  enable_persistence: !0
4119
- }, e || {}), this._gdpr_call_func(Jt, e), this._gdpr_update_persistence(e);
4400
+ }, e || {}), this._gdpr_call_func(Vn, e), this._gdpr_update_persistence(e);
4120
4401
  }
4121
4402
  }, {
4122
4403
  key: "opt_out_capturing",
4123
4404
  value: function(e) {
4124
- var t = z({
4405
+ var t = X({
4125
4406
  clear_persistence: !0
4126
4407
  }, e || {});
4127
- this._gdpr_call_func(Xt, t), this._gdpr_update_persistence(t);
4408
+ this._gdpr_call_func(Wn, t), this._gdpr_update_persistence(t);
4128
4409
  }
4129
4410
  }, {
4130
4411
  key: "has_opted_in_capturing",
4131
4412
  value: function(e) {
4132
- return this._gdpr_call_func(Kt, e);
4413
+ return this._gdpr_call_func(zn, e);
4133
4414
  }
4134
4415
  }, {
4135
4416
  key: "has_opted_out_capturing",
4136
4417
  value: function(e) {
4137
- return this._gdpr_call_func(Zt, e);
4418
+ return this._gdpr_call_func(Gn, e);
4138
4419
  }
4139
4420
  }, {
4140
4421
  key: "clear_opt_in_out_capturing",
4141
4422
  value: function(e) {
4142
- var t = z({
4423
+ var t = X({
4143
4424
  enable_persistence: !0
4144
4425
  }, null != e ? e : {});
4145
- this._gdpr_call_func(en, t), this._gdpr_update_persistence(t);
4426
+ this._gdpr_call_func(Qn, t), this._gdpr_update_persistence(t);
4146
4427
  }
4147
4428
  }, {
4148
4429
  key: "debug",
4149
4430
  value: function(e) {
4150
- !1 === e ? (null == D || D.console.log("You've disabled debug mode."), localStorage && localStorage.removeItem("ph_debug"),
4431
+ !1 === e ? (null == A || A.console.log("You've disabled debug mode."), localStorage && localStorage.removeItem("ph_debug"),
4151
4432
  this.set_config({
4152
4433
  debug: !1
4153
- })) : (null == D || D.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),
4434
+ })) : (null == A || A.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),
4154
4435
  localStorage && localStorage.setItem("ph_debug", "true"), this.set_config({
4155
4436
  debug: !0
4156
4437
  }));
@@ -4159,39 +4440,39 @@ var mr = function() {}, yr = {}, br = "posthog", kr = (null == D ? void 0 : D.XM
4159
4440
  }();
4160
4441
 
4161
4442
  !function(e, t) {
4162
- for (var n = 0; n < t.length; n++) e.prototype[t[n]] = K(e.prototype[t[n]]);
4163
- }(Ir, [ "identify" ]);
4164
-
4165
- var xr, Rr, Er = {}, Cr = function() {
4166
- lr.init = function(e, t, n) {
4167
- if (n) return lr[n] || (lr[n] = Er[n] = Fr(e || "", t || {}, n, (function(e) {
4168
- lr[n] = Er[n] = e, e._loaded();
4169
- }))), lr[n];
4170
- var r = lr;
4171
- return Er[br] ? r = Er[br] : e && (r = Fr(e, t || {}, br, (function(e) {
4172
- Er[br] = e, e._loaded();
4173
- })), Er[br] = r), lr = r, ur === ar.INIT_SNIPPET && (L[br] = lr), G(Er, (function(e, t) {
4174
- t !== br && (lr[t] = e);
4443
+ for (var n = 0; n < t.length; n++) e.prototype[t[n]] = re(e.prototype[t[n]]);
4444
+ }(Ei, [ "identify" ]);
4445
+
4446
+ var Ii, Ci, Ti = {}, $i = function() {
4447
+ hi.init = function(e, t, n) {
4448
+ if (n) return hi[n] || (hi[n] = Ti[n] = Pi(e || "", t || {}, n, (function(e) {
4449
+ hi[n] = Ti[n] = e, e._loaded();
4450
+ }))), hi[n];
4451
+ var r = hi;
4452
+ return Ti[Si] ? r = Ti[Si] : e && (r = Pi(e, t || {}, Si, (function(e) {
4453
+ Ti[Si] = e, e._loaded();
4454
+ })), Ti[Si] = r), hi = r, fi === di.INIT_SNIPPET && (W[Si] = hi), K(Ti, (function(e, t) {
4455
+ t !== Si && (hi[t] = e);
4175
4456
  })), r;
4176
4457
  };
4177
- }, Or = function() {
4178
- function e() {
4179
- e.done || (e.done = !0, wr = !1, G(Er, (function(e) {
4180
- e._dom_loaded();
4181
- })));
4182
- }
4183
- null != B && B.addEventListener && ("complete" === B.readyState ? e() : B.addEventListener("DOMContentLoaded", e, !1)),
4184
- D && ie(D, "load", e, !0);
4185
4458
  };
4186
4459
 
4187
4460
  !function(e) {
4188
4461
  e.Popover = "popover", e.API = "api", e.Widget = "widget";
4189
- }(xr || (xr = {})), function(e) {
4462
+ }(Ii || (Ii = {})), function(e) {
4190
4463
  e.Open = "open", e.MultipleChoice = "multiple_choice", e.SingleChoice = "single_choice",
4191
4464
  e.Rating = "rating", e.Link = "link";
4192
- }(Rr || (Rr = {}));
4465
+ }(Ci || (Ci = {}));
4193
4466
 
4194
- var $r = (ur = ar.INIT_MODULE, lr = new Ir, Cr(), lr.init(), Or(), lr);
4467
+ var Oi = (fi = di.INIT_MODULE, hi = new Ei, $i(), hi.init(), function() {
4468
+ function e() {
4469
+ e.done || (e.done = !0, Fi = !1, K(Ti, (function(e) {
4470
+ e._dom_loaded();
4471
+ })));
4472
+ }
4473
+ null != B && B.addEventListener && ("complete" === B.readyState ? e() : B.addEventListener("DOMContentLoaded", e, !1)),
4474
+ A && ue(A, "load", e, !0);
4475
+ }(), hi);
4195
4476
 
4196
4477
  class PostHogController extends Controller {
4197
4478
  static values={
@@ -4199,7 +4480,7 @@ class PostHogController extends Controller {
4199
4480
  identification: Object
4200
4481
  };
4201
4482
  connect() {
4202
- $r.init(this.apiKeyValue, {
4483
+ Oi.init(this.apiKeyValue, {
4203
4484
  api_host: "https://eu.posthog.com",
4204
4485
  custom_campaign_params: [ "ref" ],
4205
4486
  session_recording: {
@@ -4211,7 +4492,7 @@ class PostHogController extends Controller {
4211
4492
  });
4212
4493
  if (Object.keys(this.identificationValue).length) {
4213
4494
  const {id: id, email: email, name: name} = this.identificationValue;
4214
- $r.identify(id.toString(), {
4495
+ Oi.identify(id.toString(), {
4215
4496
  email: email,
4216
4497
  name: name
4217
4498
  });