moonshot-rails 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,4197 @@
1
- import posthog from "posthog-js";
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ import { post } from "@rails/request.js";
4
+
5
+ function e(e, t) {
6
+ var n = Object.keys(e);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var r = Object.getOwnPropertySymbols(e);
9
+ t && (r = r.filter((function(t) {
10
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
11
+ }))), n.push.apply(n, r);
12
+ }
13
+ return n;
14
+ }
15
+
16
+ function t(t) {
17
+ for (var n = 1; n < arguments.length; n++) {
18
+ var r = null != arguments[n] ? arguments[n] : {};
19
+ n % 2 ? e(Object(r), !0).forEach((function(e) {
20
+ s(t, e, r[e]);
21
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : e(Object(r)).forEach((function(e) {
22
+ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
23
+ }));
24
+ }
25
+ return t;
26
+ }
27
+
28
+ function n(e) {
29
+ return n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
30
+ return typeof e;
31
+ } : function(e) {
32
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
33
+ }, n(e);
34
+ }
35
+
36
+ function r(e, t) {
37
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
38
+ }
39
+
40
+ function i(e, t) {
41
+ for (var n = 0; n < t.length; n++) {
42
+ var r = t[n];
43
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
44
+ Object.defineProperty(e, r.key, r);
45
+ }
46
+ }
47
+
48
+ function o(e, t, n) {
49
+ return t && i(e.prototype, t), n && i(e, n), Object.defineProperty(e, "prototype", {
50
+ writable: !1
51
+ }), e;
52
+ }
53
+
54
+ function s(e, t, n) {
55
+ return t in e ? Object.defineProperty(e, t, {
56
+ value: n,
57
+ enumerable: !0,
58
+ configurable: !0,
59
+ writable: !0
60
+ }) : e[t] = n, e;
61
+ }
62
+
63
+ function a(e, t) {
64
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
65
+ e.prototype = Object.create(t && t.prototype, {
66
+ constructor: {
67
+ value: e,
68
+ writable: !0,
69
+ configurable: !0
70
+ }
71
+ }), Object.defineProperty(e, "prototype", {
72
+ writable: !1
73
+ }), t && l(e, t);
74
+ }
75
+
76
+ function u(e) {
77
+ return u = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
78
+ return e.__proto__ || Object.getPrototypeOf(e);
79
+ }, u(e);
80
+ }
81
+
82
+ function l(e, t) {
83
+ return l = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
84
+ return e.__proto__ = t, e;
85
+ }, l(e, t);
86
+ }
87
+
88
+ function c(e, t) {
89
+ if (null == e) return {};
90
+ var n, r, i = function(e, t) {
91
+ if (null == e) return {};
92
+ var n, r, i = {}, o = Object.keys(e);
93
+ for (r = 0; r < o.length; r++) n = o[r], t.indexOf(n) >= 0 || (i[n] = e[n]);
94
+ return i;
95
+ }(e, t);
96
+ if (Object.getOwnPropertySymbols) {
97
+ var o = Object.getOwnPropertySymbols(e);
98
+ for (r = 0; r < o.length; r++) n = o[r], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
99
+ }
100
+ return i;
101
+ }
102
+
103
+ function d(e, t) {
104
+ if (t && ("object" == typeof t || "function" == typeof t)) return t;
105
+ if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
106
+ return function(e) {
107
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
108
+ return e;
109
+ }(e);
110
+ }
111
+
112
+ function h(e) {
113
+ var t = function() {
114
+ if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
115
+ if (Reflect.construct.sham) return !1;
116
+ if ("function" == typeof Proxy) return !0;
117
+ try {
118
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))),
119
+ !0;
120
+ } catch (e) {
121
+ return !1;
122
+ }
123
+ }();
124
+ return function() {
125
+ var n, r = u(e);
126
+ if (t) {
127
+ var i = u(this).constructor;
128
+ n = Reflect.construct(r, arguments, i);
129
+ } else n = r.apply(this, arguments);
130
+ return d(this, n);
131
+ };
132
+ }
133
+
134
+ function f(e, t) {
135
+ return function(e) {
136
+ if (Array.isArray(e)) return e;
137
+ }(e) || function(e, t) {
138
+ var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
139
+ if (null == n) return;
140
+ var r, i, o = [], s = !0, a = !1;
141
+ try {
142
+ for (n = n.call(e); !(s = (r = n.next()).done) && (o.push(r.value), !t || o.length !== t); s = !0) ;
143
+ } catch (e) {
144
+ a = !0, i = e;
145
+ } finally {
146
+ try {
147
+ s || null == n.return || n.return();
148
+ } finally {
149
+ if (a) throw i;
150
+ }
151
+ }
152
+ return o;
153
+ }(e, t) || _(e, t) || function() {
154
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
155
+ }();
156
+ }
157
+
158
+ function p(e) {
159
+ return function(e) {
160
+ if (Array.isArray(e)) return g(e);
161
+ }(e) || function(e) {
162
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
163
+ }(e) || _(e) || function() {
164
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
165
+ }();
166
+ }
167
+
168
+ function _(e, t) {
169
+ if (e) {
170
+ if ("string" == typeof e) return g(e, t);
171
+ var n = Object.prototype.toString.call(e).slice(8, -1);
172
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? g(e, t) : void 0;
173
+ }
174
+ }
175
+
176
+ function g(e, t) {
177
+ (null == t || t > e.length) && (t = e.length);
178
+ for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n];
179
+ return r;
180
+ }
181
+
182
+ function v(e, t) {
183
+ var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
184
+ if (!n) {
185
+ if (Array.isArray(e) || (n = _(e)) || t && e && "number" == typeof e.length) {
186
+ n && (e = n);
187
+ var r = 0, i = function() {};
188
+ return {
189
+ s: i,
190
+ n: function() {
191
+ return r >= e.length ? {
192
+ done: !0
193
+ } : {
194
+ done: !1,
195
+ value: e[r++]
196
+ };
197
+ },
198
+ e: function(e) {
199
+ throw e;
200
+ },
201
+ f: i
202
+ };
203
+ }
204
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
205
+ }
206
+ var o, s = !0, a = !1;
207
+ return {
208
+ s: function() {
209
+ n = n.call(e);
210
+ },
211
+ n: function() {
212
+ var e = n.next();
213
+ return s = e.done, e;
214
+ },
215
+ e: function(e) {
216
+ a = !0, o = e;
217
+ },
218
+ f: function() {
219
+ try {
220
+ s || null == n.return || n.return();
221
+ } finally {
222
+ if (a) throw o;
223
+ }
224
+ }
225
+ };
226
+ }
227
+
228
+ var m = {
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);
233
+ }, F = function(e) {
234
+ return "[object Uint8Array]" === w.call(e);
235
+ }, P = function(e) {
236
+ return "function" == typeof e;
237
+ }, I = function(e) {
238
+ return e === Object(e) && !S(e);
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
+ return void 0 === e;
247
+ }, E = function(e) {
248
+ return "[object String]" == w.call(e);
249
+ }, C = function(e) {
250
+ return null === e;
251
+ }, O = function(e) {
252
+ return "[object Number]" == w.call(e);
253
+ }, $ = 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 = {
256
+ _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));
260
+ }
261
+ },
262
+ info: function() {
263
+ 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));
265
+ },
266
+ warn: function() {
267
+ 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));
269
+ },
270
+ error: function() {
271
+ 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));
273
+ },
274
+ critical: function() {
275
+ 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));
277
+ },
278
+ uninitializedWarning: function(e) {
279
+ H.error("You must initialize PostHog before calling ".concat(e));
280
+ }
281
+ }, V = {}, U = function(e) {
282
+ return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
283
+ };
284
+
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;
287
+ }
288
+
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;
293
+ }
294
+ }
295
+
296
+ var z = function(e) {
297
+ 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) {
299
+ for (var n in t) void 0 !== t[n] && (e[n] = t[n]);
300
+ })), e;
301
+ };
302
+
303
+ function Y(e, t) {
304
+ return -1 !== e.indexOf(t);
305
+ }
306
+
307
+ function Q(e) {
308
+ for (var t = Object.keys(e), n = t.length, r = new Array(n); n--; ) r[n] = [ t[n], e[t[n]] ];
309
+ return r;
310
+ }
311
+
312
+ var J = function() {
313
+ return Date.now = Date.now || function() {
314
+ return +new Date;
315
+ }, Date.now();
316
+ }, X = function(e) {
317
+ try {
318
+ return e();
319
+ } catch (e) {
320
+ return;
321
+ }
322
+ }, K = function(e) {
323
+ return function() {
324
+ try {
325
+ for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++) n[r] = arguments[r];
326
+ return e.apply(this, n);
327
+ } 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);
330
+ }
331
+ };
332
+ }, Z = function(e) {
333
+ var t = {};
334
+ return G(e, (function(e, n) {
335
+ E(e) && e.length > 0 && (t[n] = e);
336
+ })), t;
337
+ };
338
+
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;
344
+ }, i = new Set, function e(t, n) {
345
+ 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) {
347
+ o.push(e(t));
348
+ }))) : (o = {}, G(t, (function(t, n) {
349
+ i.has(t) || (o[n] = e(t, n));
350
+ }))), o);
351
+ var o;
352
+ }(n);
353
+ var n, r, i;
354
+ }
355
+
356
+ function ne(e) {
357
+ var t, n, r, i, o, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", a = 0, u = 0, l = "", c = [];
358
+ if (!e) return e;
359
+ e = re(e);
360
+ do {
361
+ t = (o = e.charCodeAt(a++) << 16 | e.charCodeAt(a++) << 8 | e.charCodeAt(a++)) >> 18 & 63,
362
+ 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);
363
+ } while (a < e.length);
364
+ switch (l = c.join(""), e.length % 3) {
365
+ case 1:
366
+ l = l.slice(0, -2) + "==";
367
+ break;
368
+
369
+ case 2:
370
+ l = l.slice(0, -1) + "=";
371
+ }
372
+ return l;
373
+ }
374
+
375
+ var re = function(e) {
376
+ var t, n, r, i, o = "";
377
+ for (t = n = 0, r = (e = (e + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n")).length,
378
+ i = 0; i < r; i++) {
379
+ var s = e.charCodeAt(i), a = null;
380
+ 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);
382
+ }
383
+ return n > t && (o += e.substring(t, e.length)), o;
384
+ }, ie = function() {
385
+ function e(t) {
386
+ return t && (t.preventDefault = e.preventDefault, t.stopPropagation = e.stopPropagation),
387
+ t;
388
+ }
389
+ return e.preventDefault = function() {
390
+ this.returnValue = !1;
391
+ }, e.stopPropagation = function() {
392
+ this.cancelBubble = !0;
393
+ }, function(t, n, r, i, o) {
394
+ if (t) if (t.addEventListener && !i) t.addEventListener(n, r, !!o); else {
395
+ var s = "on" + n, a = t[s];
396
+ t[s] = function(t, n, r) {
397
+ return function(i) {
398
+ if (i = i || e(null == D ? void 0 : D.event)) {
399
+ var o, s = !0;
400
+ P(r) && (o = r(i));
401
+ var a = n.call(t, i);
402
+ return !1 !== o && !1 !== a || (s = !1), s;
403
+ }
404
+ };
405
+ }(t, r, a);
406
+ } else H.error("No valid element provided to register_event");
407
+ };
408
+ }();
409
+
410
+ function oe(e, t) {
411
+ var n = function() {
412
+ if (!B) return t("document not found");
413
+ var n = B.createElement("script");
414
+ n.type = "text/javascript", n.src = e, n.onload = function(e) {
415
+ return t(void 0, e);
416
+ }, n.onerror = function(e) {
417
+ return t(e);
418
+ };
419
+ var r, i = B.querySelectorAll("body > script");
420
+ i.length > 0 ? null === (r = i[0].parentNode) || void 0 === r || r.insertBefore(n, i[0]) : B.body.appendChild(n);
421
+ };
422
+ null != B && B.body ? n() : null == B || B.addEventListener("DOMContentLoaded", n);
423
+ }
424
+
425
+ function se(e) {
426
+ return e ? U(e).split(/\s+/) : [];
427
+ }
428
+
429
+ function ae(e) {
430
+ var t = "";
431
+ switch (n(e.className)) {
432
+ case "string":
433
+ t = e.className;
434
+ break;
435
+
436
+ case "object":
437
+ t = ("baseVal" in e.className ? e.className.baseVal : null) || e.getAttribute("class") || "";
438
+ break;
439
+
440
+ default:
441
+ t = "";
442
+ }
443
+ return se(t);
444
+ }
445
+
446
+ function ue(e) {
447
+ 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);
451
+ }
452
+
453
+ function le(e) {
454
+ return !!e && 1 === e.nodeType;
455
+ }
456
+
457
+ function ce(e, t) {
458
+ return !!e && !!e.tagName && e.tagName.toLowerCase() === t.toLowerCase();
459
+ }
460
+
461
+ function de(e) {
462
+ return !!e && 3 === e.nodeType;
463
+ }
464
+
465
+ function he(e) {
466
+ return !!e && 11 === e.nodeType;
467
+ }
468
+
469
+ var fe = [ "a", "button", "form", "input", "select", "textarea", "label" ];
470
+
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;
475
+ }
476
+ if (Y(ae(e), "ph-include")) return !0;
477
+ var r = e.type || "";
478
+ if (E(r)) switch (r.toLowerCase()) {
479
+ case "hidden":
480
+ case "password":
481
+ return !1;
482
+ }
483
+ var i = e.name || e.id || "";
484
+ if (E(i)) {
485
+ if (/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g, ""))) return !1;
486
+ }
487
+ return !0;
488
+ }
489
+
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"));
492
+ }
493
+
494
+ function ge(e) {
495
+ if (C(e) || R(e)) return !1;
496
+ if (E(e)) {
497
+ e = U(e);
498
+ 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
+ if (/(^\d{3}-?\d{2}-?\d{4}$)/.test(e)) return !1;
500
+ }
501
+ return !0;
502
+ }
503
+
504
+ function ve(e) {
505
+ var t = ue(e);
506
+ return ge(t = "".concat(t, " ").concat(me(e)).trim()) ? t : "";
507
+ }
508
+
509
+ function me(e) {
510
+ var t = "";
511
+ return e && e.childNodes && e.childNodes.length && G(e.childNodes, (function(e) {
512
+ var n;
513
+ 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());
516
+ } catch (e) {
517
+ H.error(e);
518
+ }
519
+ })), t;
520
+ }
521
+
522
+ function ye(e) {
523
+ return function(e) {
524
+ var n = e.map((function(e) {
525
+ var n, r, i = "";
526
+ if (e.tag_name && (i += e.tag_name), e.attr_class) {
527
+ e.attr_class.sort();
528
+ var o, s = v(e.attr_class);
529
+ try {
530
+ for (s.s(); !(o = s.n()).done; ) {
531
+ var a = o.value;
532
+ i += ".".concat(a.replace(/"/g, ""));
533
+ }
534
+ } catch (e) {
535
+ s.e(e);
536
+ } finally {
537
+ s.f();
538
+ }
539
+ }
540
+ var u = t(t(t(t({}, e.text ? {
541
+ text: e.text
542
+ } : {}), {}, {
543
+ "nth-child": null !== (n = e.nth_child) && void 0 !== n ? n : 0,
544
+ "nth-of-type": null !== (r = e.nth_of_type) && void 0 !== r ? r : 0
545
+ }, e.href ? {
546
+ href: e.href
547
+ } : {}), e.attr_id ? {
548
+ attr_id: e.attr_id
549
+ } : {}), e.attributes), l = {};
550
+ return Q(u).sort((function(e, t) {
551
+ var n = f(e, 1)[0], r = f(t, 1)[0];
552
+ return n.localeCompare(r);
553
+ })).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];
558
+ return "".concat(n, '="').concat(r, '"');
559
+ })).join("");
560
+ }));
561
+ return n.join(";");
562
+ }(function(e) {
563
+ return e.map((function(e) {
564
+ var t, n, r = {
565
+ text: null === (t = e.$el_text) || void 0 === t ? void 0 : t.slice(0, 400),
566
+ tag_name: e.tag_name,
567
+ href: null === (n = e.attr__href) || void 0 === n ? void 0 : n.slice(0, 2048),
568
+ attr_class: ke(e),
569
+ attr_id: e.attr__id,
570
+ nth_child: e.nth_child,
571
+ nth_of_type: e.nth_of_type,
572
+ attributes: {}
573
+ };
574
+ return Q(e).filter((function(e) {
575
+ return 0 === f(e, 1)[0].indexOf("attr__");
576
+ })).forEach((function(e) {
577
+ var t = f(e, 2), n = t[0], i = t[1];
578
+ return r.attributes[n] = i;
579
+ })), r;
580
+ }));
581
+ }(e));
582
+ }
583
+
584
+ function be(e) {
585
+ return e.replace(/"|\\"/g, '\\"');
586
+ }
587
+
588
+ function ke(e) {
589
+ var t = e.attr__class;
590
+ return t ? S(t) ? t : se(t) : void 0;
591
+ }
592
+
593
+ var we = function() {
594
+ function e(t) {
595
+ r(this, e), this.clicks = [], this.enabled = t;
596
+ }
597
+ return o(e, [ {
598
+ key: "isRageClick",
599
+ value: function(e, t, n) {
600
+ if (!this.enabled) return !1;
601
+ var r = this.clicks[this.clicks.length - 1];
602
+ if (r && Math.abs(e - r.x) + Math.abs(t - r.y) < 30 && n - r.timestamp < 1e3) {
603
+ if (this.clicks.push({
604
+ x: e,
605
+ y: t,
606
+ timestamp: n
607
+ }), 3 === this.clicks.length) return !0;
608
+ } else this.clicks = [ {
609
+ x: e,
610
+ y: t,
611
+ timestamp: n
612
+ } ];
613
+ return !1;
614
+ }
615
+ } ]), 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 ];
617
+
618
+ function Ve(e, t) {
619
+ return t.length > e ? t.slice(0, e) + "..." : t;
620
+ }
621
+
622
+ var Ue = {
623
+ _initializedTokens: [],
624
+ _isDisabledServerSide: null,
625
+ _isAutocaptureEnabled: !1,
626
+ _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;
628
+ this._isAutocaptureEnabled = r && !n;
629
+ },
630
+ _previousElementSibling: function(e) {
631
+ if (e.previousElementSibling) return e.previousElementSibling;
632
+ var t = e;
633
+ do {
634
+ t = t.previousSibling;
635
+ } while (t && !le(t));
636
+ return t;
637
+ },
638
+ _getAugmentPropertiesFromElement: function(e) {
639
+ if (!pe(e)) return {};
640
+ var t = {};
641
+ return G(e.attributes, (function(e) {
642
+ if (0 === e.name.indexOf("data-ph-capture-attribute")) {
643
+ var n = e.name.replace("data-ph-capture-attribute-", ""), r = e.value;
644
+ n && r && ge(r) && (t[n] = r);
645
+ }
646
+ })), t;
647
+ },
648
+ _getPropertiesFromElement: function(e, t, n) {
649
+ var r, i = e.tagName.toLowerCase(), o = {
650
+ tag_name: i
651
+ };
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);
654
+ s.length > 0 && (o.classes = s.filter((function(e) {
655
+ return "" !== e;
656
+ })));
657
+ var a = null === (r = this.config) || void 0 === r ? void 0 : r.element_attribute_ignorelist;
658
+ G(e.attributes, (function(n) {
659
+ 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,
661
+ !E(r) || "_ngcontent" !== r.substring(0, 10) && "_nghost" !== r.substring(0, 7)))) {
662
+ var i = n.value;
663
+ "class" === n.name && (i = se(i).join(" ")), o["attr__" + n.name] = Ve(1024, i);
664
+ }
665
+ }));
666
+ for (var u = 1, l = 1, c = e; c = this._previousElementSibling(c); ) u++, c.tagName === e.tagName && l++;
667
+ return o.nth_child = u, o.nth_of_type = l, o;
668
+ },
669
+ _getDefaultProperties: function(e) {
670
+ return {
671
+ $event_type: e,
672
+ $ce_version: 1
673
+ };
674
+ },
675
+ _extractCustomPropertyValue: function(e) {
676
+ var t = [];
677
+ return G(null == B ? void 0 : B.querySelectorAll(e.css_selector), (function(e) {
678
+ var n;
679
+ [ "input", "select" ].indexOf(e.tagName.toLowerCase()) > -1 ? n = e.value : e.textContent && (n = e.textContent),
680
+ ge(n) && t.push(n);
681
+ })), t.join(", ");
682
+ },
683
+ _getCustomProperties: function(e) {
684
+ 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));
689
+ }));
690
+ }));
691
+ })), n;
692
+ },
693
+ _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;
695
+ var t;
696
+ },
697
+ _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));
762
+ 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)
768
+ } : {
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;
774
+ }
775
+ },
776
+ _navigate: function(e) {
777
+ D && (D.location.href = e);
778
+ },
779
+ _addDomEventHandlers: function(e) {
780
+ var t = this;
781
+ if (D && B) {
782
+ var n = function(n) {
783
+ n = n || (null == D ? void 0 : D.event), t._captureEvent(n, e);
784
+ };
785
+ ie(B, "submit", n, !1, !0), ie(B, "change", n, !1, !0), ie(B, "click", n, !1, !0);
786
+ }
787
+ },
788
+ _customProperties: [],
789
+ rageclicks: null,
790
+ config: void 0,
791
+ init: function(e) {
792
+ var t;
793
+ $(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
+ return new RegExp(e);
795
+ }))), this.rageclicks = new we(e.config.rageclick);
796
+ },
797
+ afterDecideResponse: function(e, t) {
798
+ 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)),
800
+ this._isDisabledServerSide = !!e.autocapture_opt_out, this._setIsAutocaptureEnabled(t),
801
+ this._initializedTokens.push(n), e && e.config && e.config.enable_collect_everything && this._isAutocaptureEnabled ? (e.custom_properties && (this._customProperties = e.custom_properties),
802
+ this._addDomEventHandlers(t)) : t.__autocapture = !1);
803
+ },
804
+ enabledForProject: function(e, t, n) {
805
+ if (!e) return !0;
806
+ t = R(t) ? 10 : t, n = R(n) ? 10 : n;
807
+ for (var r = 0, i = 0; i < e.length; i++) r += e.charCodeAt(i);
808
+ return r % t < n;
809
+ },
810
+ isBrowserSupported: function() {
811
+ return P(null == B ? void 0 : B.querySelectorAll);
812
+ }
813
+ };
814
+
815
+ !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);
820
+
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 || {}));
823
+ try {
824
+ for (r.s(); !(t = r.n()).done; ) {
825
+ var i = f(t.value, 2), o = i[0], s = i[1];
826
+ s && (n[o] = s);
827
+ }
828
+ } catch (e) {
829
+ r.e(e);
830
+ } finally {
831
+ r.f();
832
+ }
833
+ return n;
834
+ }, Qe = function() {
835
+ function e(t) {
836
+ r(this, e), this.instance = t, this._override_warning = !1, this.featureFlagEventHandlers = [],
837
+ this.reloadFeatureFlagsQueued = !1, this.reloadFeatureFlagsInAction = !1;
838
+ }
839
+ return o(e, [ {
840
+ key: "getFlags",
841
+ value: function() {
842
+ return Object.keys(this.getFlagVariants());
843
+ }
844
+ }, {
845
+ key: "getFlagVariants",
846
+ value: function() {
847
+ var e = this.instance.get_property(Me), t = this.instance.get_property(Ge);
848
+ 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!", {
851
+ enabledFlags: e,
852
+ overriddenFlags: t,
853
+ finalFlags: n
854
+ }), this._override_warning = !0), n;
855
+ }
856
+ }, {
857
+ key: "getFlagPayloads",
858
+ value: function() {
859
+ return this.instance.get_property(ze) || {};
860
+ }
861
+ }, {
862
+ key: "reloadFeatureFlags",
863
+ value: function() {
864
+ this.reloadFeatureFlagsQueued || (this.reloadFeatureFlagsQueued = !0, this._startReloadTimer());
865
+ }
866
+ }, {
867
+ key: "setAnonymousDistinctId",
868
+ value: function(e) {
869
+ this.$anon_distinct_id = e;
870
+ }
871
+ }, {
872
+ key: "setReloadingPaused",
873
+ value: function(e) {
874
+ this.reloadFeatureFlagsInAction = e;
875
+ }
876
+ }, {
877
+ key: "resetRequestQueue",
878
+ value: function() {
879
+ this.reloadFeatureFlagsQueued = !1;
880
+ }
881
+ }, {
882
+ key: "_startReloadTimer",
883
+ value: function() {
884
+ var e = this;
885
+ this.reloadFeatureFlagsQueued && !this.reloadFeatureFlagsInAction && setTimeout((function() {
886
+ !e.reloadFeatureFlagsInAction && e.reloadFeatureFlagsQueued && (e.reloadFeatureFlagsQueued = !1,
887
+ e._reloadFeatureFlagsRequest());
888
+ }), 5);
889
+ }
890
+ }, {
891
+ key: "_reloadFeatureFlagsRequest",
892
+ value: function() {
893
+ var e = this;
894
+ if (!this.instance.config.advanced_disable_feature_flags) {
895
+ 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({
897
+ token: t,
898
+ distinct_id: this.instance.get_distinct_id(),
899
+ groups: this.instance.getGroups(),
900
+ $anon_distinct_id: this.$anon_distinct_id,
901
+ person_properties: n,
902
+ group_properties: r,
903
+ disable_flags: this.instance.config.advanced_disable_feature_flags || void 0
904
+ }));
905
+ this.instance._send_request(this.instance.config.api_host + "/decide/?v=3", {
906
+ data: i
907
+ }, {
908
+ method: "POST"
909
+ }, this.instance._prepare_callback((function(t) {
910
+ e.$anon_distinct_id = void 0, e.receivedFeatureFlags(t), e.setReloadingPaused(!1),
911
+ e._startReloadTimer();
912
+ })));
913
+ }
914
+ }
915
+ }, {
916
+ key: "getFeatureFlag",
917
+ value: function(e) {
918
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
919
+ 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) || {};
921
+ 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)),
923
+ this.instance.capture("$feature_flag_called", {
924
+ $feature_flag: e,
925
+ $feature_flag_response: r
926
+ });
927
+ return r;
928
+ }
929
+ H.warn('getFeatureFlag for key "' + e + "\" failed. Feature flags didn't load in time.");
930
+ }
931
+ }, {
932
+ key: "getFeatureFlagPayload",
933
+ value: function(e) {
934
+ return this.getFlagPayloads()[e];
935
+ }
936
+ }, {
937
+ key: "isFeatureEnabled",
938
+ value: function(e) {
939
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
940
+ 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.");
942
+ }
943
+ }, {
944
+ key: "addFeatureFlagsHandler",
945
+ value: function(e) {
946
+ this.featureFlagEventHandlers.push(e);
947
+ }
948
+ }, {
949
+ key: "removeFeatureFlagsHandler",
950
+ value: function(e) {
951
+ this.featureFlagEventHandlers = this.featureFlagEventHandlers.filter((function(t) {
952
+ return t !== e;
953
+ }));
954
+ }
955
+ }, {
956
+ key: "receivedFeatureFlags",
957
+ value: function(e) {
958
+ if (this.instance.persistence) {
959
+ this.instance.decideEndpointWasHit = !0;
960
+ var n = this.getFlagVariants(), r = this.getFlagPayloads();
961
+ !function(e, n) {
962
+ var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}, o = e.featureFlags, a = e.featureFlagPayloads;
963
+ if (o) if (S(o)) {
964
+ var u, l = {};
965
+ 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));
967
+ } 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));
971
+ }
972
+ }(e, this.instance.persistence, n, r), this._fireFeatureFlagsCallbacks();
973
+ }
974
+ }
975
+ }, {
976
+ key: "override",
977
+ 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)) {
980
+ 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));
983
+ }
984
+ }, {
985
+ key: "onFeatureFlags",
986
+ value: function(e) {
987
+ var t = this;
988
+ if (this.addFeatureFlagsHandler(e), this.instance.decideEndpointWasHit) {
989
+ var n = this._prepareFeatureFlagsForCallbacks(), r = n.flags, i = n.flagVariants;
990
+ e(r, i);
991
+ }
992
+ return function() {
993
+ return t.removeFeatureFlagsHandler(e);
994
+ };
995
+ }
996
+ }, {
997
+ key: "updateEarlyAccessFeatureEnrollment",
998
+ value: function(e, n) {
999
+ var r, i, o = s({}, "$feature_enrollment/".concat(e), n);
1000
+ this.instance.capture("$feature_enrollment_update", {
1001
+ $feature_flag: e,
1002
+ $feature_enrollment: n,
1003
+ $set: o
1004
+ }), this.setPersonPropertiesForFlags(o, !1);
1005
+ 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();
1008
+ }
1009
+ }, {
1010
+ key: "getEarlyAccessFeatures",
1011
+ value: function(e) {
1012
+ var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(Te);
1013
+ 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), {}, {
1015
+ method: "GET"
1016
+ }, (function(n) {
1017
+ var r, i = n.earlyAccessFeatures;
1018
+ return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, Te, i)),
1019
+ e(i);
1020
+ }));
1021
+ }
1022
+ }, {
1023
+ key: "_prepareFeatureFlagsForCallbacks",
1024
+ value: function() {
1025
+ var e = this.getFlags(), t = this.getFlagVariants();
1026
+ return {
1027
+ flags: e.filter((function(e) {
1028
+ return t[e];
1029
+ })),
1030
+ flagVariants: Object.keys(t).filter((function(e) {
1031
+ return t[e];
1032
+ })).reduce((function(e, n) {
1033
+ return e[n] = t[n], e;
1034
+ }), {})
1035
+ };
1036
+ }
1037
+ }, {
1038
+ key: "_fireFeatureFlagsCallbacks",
1039
+ value: function() {
1040
+ var e = this._prepareFeatureFlagsForCallbacks(), t = e.flags, n = e.flagVariants;
1041
+ this.featureFlagEventHandlers.forEach((function(e) {
1042
+ return e(t, n);
1043
+ }));
1044
+ }
1045
+ }, {
1046
+ key: "setPersonPropertiesForFlags",
1047
+ 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();
1050
+ }
1051
+ }, {
1052
+ key: "resetPersonPropertiesForFlags",
1053
+ value: function() {
1054
+ this.instance.unregister(Ae);
1055
+ }
1056
+ }, {
1057
+ key: "setGroupPropertiesForFlags",
1058
+ value: function(e) {
1059
+ var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], r = this.instance.get_property(De) || {};
1060
+ 0 !== Object.keys(r).length && Object.keys(r).forEach((function(n) {
1061
+ 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();
1063
+ }
1064
+ }, {
1065
+ key: "resetGroupPropertiesForFlags",
1066
+ value: function(e) {
1067
+ 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);
1071
+ }
1072
+ } ]), e;
1073
+ }();
1074
+
1075
+ Math.trunc || (Math.trunc = function(e) {
1076
+ return e < 0 ? Math.ceil(e) : Math.floor(e);
1077
+ }), Number.isInteger || (Number.isInteger = function(e) {
1078
+ return O(e) && isFinite(e) && Math.floor(e) === e;
1079
+ });
1080
+
1081
+ var Je = "0123456789abcdef", Xe = function() {
1082
+ function e(t) {
1083
+ if (r(this, e), this.bytes = t, 16 !== t.length) throw new TypeError("not 128-bit length");
1084
+ }
1085
+ return o(e, [ {
1086
+ key: "toString",
1087
+ 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]),
1089
+ 3 !== t && 5 !== t && 7 !== t && 9 !== t || (e += "-");
1090
+ if (36 !== e.length) throw new Error("Invalid UUIDv7 was generated");
1091
+ return e;
1092
+ }
1093
+ }, {
1094
+ key: "clone",
1095
+ value: function() {
1096
+ return new e(this.bytes.slice(0));
1097
+ }
1098
+ }, {
1099
+ key: "equals",
1100
+ value: function(e) {
1101
+ return 0 === this.compareTo(e);
1102
+ }
1103
+ }, {
1104
+ key: "compareTo",
1105
+ value: function(e) {
1106
+ for (var t = 0; t < 16; t++) {
1107
+ var n = this.bytes[t] - e.bytes[t];
1108
+ if (0 !== n) return Math.sign(n);
1109
+ }
1110
+ return 0;
1111
+ }
1112
+ } ], [ {
1113
+ key: "fromFieldsV7",
1114
+ value: function(t, n, r, i) {
1115
+ if (!Number.isInteger(t) || !Number.isInteger(n) || !Number.isInteger(r) || !Number.isInteger(i) || t < 0 || n < 0 || r < 0 || i < 0 || t > 0xffffffffffff || n > 4095 || r > 1073741823 || i > 4294967295) throw new RangeError("invalid field value");
1116
+ var o = new Uint8Array(16);
1117
+ return o[0] = t / Math.pow(2, 40), o[1] = t / Math.pow(2, 32), o[2] = t / Math.pow(2, 24),
1118
+ o[3] = t / Math.pow(2, 16), o[4] = t / Math.pow(2, 8), o[5] = t, o[6] = 112 | n >>> 8,
1119
+ o[7] = n, o[8] = 128 | r >>> 24, o[9] = r >>> 16, o[10] = r >>> 8, o[11] = r, o[12] = i >>> 24,
1120
+ o[13] = i >>> 16, o[14] = i >>> 8, o[15] = i, new e(o);
1121
+ }
1122
+ } ]), e;
1123
+ }(), Ke = function() {
1124
+ function e() {
1125
+ r(this, e), s(this, "timestamp", 0), s(this, "counter", 0), s(this, "random", new tt);
1126
+ }
1127
+ return o(e, [ {
1128
+ key: "generate",
1129
+ value: function() {
1130
+ var e = this.generateOrAbort();
1131
+ if (R(e)) {
1132
+ this.timestamp = 0;
1133
+ var t = this.generateOrAbort();
1134
+ if (R(t)) throw new Error("Could not generate UUID after timestamp reset");
1135
+ return t;
1136
+ }
1137
+ return e;
1138
+ }
1139
+ }, {
1140
+ key: "generateOrAbort",
1141
+ value: function() {
1142
+ var e = Date.now();
1143
+ if (e > this.timestamp) this.timestamp = e, this.resetCounter(); else {
1144
+ if (!(e + 1e4 > this.timestamp)) return;
1145
+ this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());
1146
+ }
1147
+ return Xe.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());
1148
+ }
1149
+ }, {
1150
+ key: "resetCounter",
1151
+ value: function() {
1152
+ this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());
1153
+ }
1154
+ } ]), e;
1155
+ }(), Ze = function(e) {
1156
+ if ("undefined" != typeof UUIDV7_DENY_WEAK_RNG && UUIDV7_DENY_WEAK_RNG) throw new Error("no cryptographically strong RNG available");
1157
+ for (var t = 0; t < e.length; t++) e[t] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());
1158
+ return e;
1159
+ };
1160
+
1161
+ D && !R(D.crypto) && crypto.getRandomValues && (Ze = function(e) {
1162
+ return crypto.getRandomValues(e);
1163
+ });
1164
+
1165
+ var et, tt = function() {
1166
+ function e() {
1167
+ r(this, e), s(this, "buffer", new Uint32Array(8)), s(this, "cursor", 1 / 0);
1168
+ }
1169
+ return o(e, [ {
1170
+ key: "nextUint32",
1171
+ value: function() {
1172
+ return this.cursor >= this.buffer.length && (Ze(this.buffer), this.cursor = 0),
1173
+ this.buffer[this.cursor++];
1174
+ }
1175
+ } ]), 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
+ };
1186
+
1187
+ function ut(e, t) {
1188
+ if (t) {
1189
+ var n = function(e) {
1190
+ var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : B;
1191
+ if (ot) return ot;
1192
+ if (!t) return "";
1193
+ 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--; ) {
1195
+ 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);
1197
+ }
1198
+ return ot;
1199
+ }(e);
1200
+ if (!n) {
1201
+ var r = at(e);
1202
+ r !== n && H.info("Warning: cookie subdomain discovery mismatch", r, n), n = r;
1203
+ }
1204
+ return n ? "; domain=." + n : "";
1205
+ }
1206
+ return "";
1207
+ }
1208
+
1209
+ var lt = {
1210
+ is_supported: function() {
1211
+ return !!B;
1212
+ },
1213
+ error: function(e) {
1214
+ H.error("cookieStore error: " + e);
1215
+ },
1216
+ get: function(e) {
1217
+ if (B) {
1218
+ try {
1219
+ for (var t = e + "=", n = B.cookie.split(";").filter((function(e) {
1220
+ return e.length;
1221
+ })), r = 0; r < n.length; r++) {
1222
+ for (var i = n[r]; " " == i.charAt(0); ) i = i.substring(1, i.length);
1223
+ if (0 === i.indexOf(t)) return decodeURIComponent(i.substring(t.length, i.length));
1224
+ }
1225
+ } catch (e) {}
1226
+ return null;
1227
+ }
1228
+ },
1229
+ parse: function(e) {
1230
+ var t;
1231
+ try {
1232
+ t = JSON.parse(lt.get(e)) || {};
1233
+ } catch (e) {}
1234
+ return t;
1235
+ },
1236
+ set: function(e, t, n, r, i) {
1237
+ if (B) try {
1238
+ var o = "", s = "", a = ut(B.location.hostname, r);
1239
+ if (n) {
1240
+ var u = new Date;
1241
+ u.setTime(u.getTime() + 24 * n * 60 * 60 * 1e3), o = "; expires=" + u.toUTCString();
1242
+ }
1243
+ i && (s = "; secure");
1244
+ 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),
1246
+ B.cookie = l, l;
1247
+ } catch (e) {
1248
+ return;
1249
+ }
1250
+ },
1251
+ remove: function(e, t) {
1252
+ try {
1253
+ lt.set(e, "", -1, t);
1254
+ } catch (e) {
1255
+ return;
1256
+ }
1257
+ }
1258
+ }, ct = null, dt = {
1259
+ is_supported: function() {
1260
+ if (!C(ct)) return ct;
1261
+ var e = !0;
1262
+ if (R(D)) e = !1; else try {
1263
+ var t = "__mplssupport__";
1264
+ dt.set(t, "xyz"), '"xyz"' !== dt.get(t) && (e = !1), dt.remove(t);
1265
+ } catch (t) {
1266
+ e = !1;
1267
+ }
1268
+ return e || H.error("localStorage unsupported; falling back to cookie store"), ct = e,
1269
+ e;
1270
+ },
1271
+ error: function(e) {
1272
+ H.error("localStorage error: " + e);
1273
+ },
1274
+ get: function(e) {
1275
+ try {
1276
+ return null == D ? void 0 : D.localStorage.getItem(e);
1277
+ } catch (e) {
1278
+ dt.error(e);
1279
+ }
1280
+ return null;
1281
+ },
1282
+ parse: function(e) {
1283
+ try {
1284
+ return JSON.parse(dt.get(e)) || {};
1285
+ } catch (e) {}
1286
+ return null;
1287
+ },
1288
+ set: function(e, t) {
1289
+ try {
1290
+ null == D || D.localStorage.setItem(e, JSON.stringify(t));
1291
+ } catch (e) {
1292
+ dt.error(e);
1293
+ }
1294
+ },
1295
+ remove: function(e) {
1296
+ try {
1297
+ null == D || D.localStorage.removeItem(e);
1298
+ } catch (e) {
1299
+ dt.error(e);
1300
+ }
1301
+ }
1302
+ }, ht = [ "distinct_id", Oe, $e ], ft = t(t({}, dt), {}, {
1303
+ parse: function(e) {
1304
+ try {
1305
+ var t = {};
1306
+ try {
1307
+ t = lt.parse(e) || {};
1308
+ } catch (e) {}
1309
+ var n = z(t, JSON.parse(dt.get(e) || "{}"));
1310
+ return dt.set(e, n), n;
1311
+ } catch (e) {}
1312
+ return null;
1313
+ },
1314
+ set: function(e, t, n, r, i) {
1315
+ try {
1316
+ dt.set(e, t);
1317
+ var o = {};
1318
+ ht.forEach((function(e) {
1319
+ t[e] && (o[e] = t[e]);
1320
+ })), Object.keys(o).length && lt.set(e, o, n, r, i);
1321
+ } catch (e) {
1322
+ dt.error(e);
1323
+ }
1324
+ },
1325
+ remove: function(e, t) {
1326
+ try {
1327
+ null == D || D.localStorage.removeItem(e), lt.remove(e, t);
1328
+ } catch (e) {
1329
+ dt.error(e);
1330
+ }
1331
+ }
1332
+ }), pt = {}, _t = {
1333
+ is_supported: function() {
1334
+ return !0;
1335
+ },
1336
+ error: function(e) {
1337
+ H.error("memoryStorage error: " + e);
1338
+ },
1339
+ get: function(e) {
1340
+ return pt[e] || null;
1341
+ },
1342
+ parse: function(e) {
1343
+ return pt[e] || null;
1344
+ },
1345
+ set: function(e, t) {
1346
+ pt[e] = t;
1347
+ },
1348
+ remove: function(e) {
1349
+ delete pt[e];
1350
+ }
1351
+ }, gt = null, vt = {
1352
+ is_supported: function() {
1353
+ if (!C(gt)) return gt;
1354
+ if (gt = !0, R(D)) gt = !1; else try {
1355
+ var e = "__support__";
1356
+ vt.set(e, "xyz"), '"xyz"' !== vt.get(e) && (gt = !1), vt.remove(e);
1357
+ } catch (e) {
1358
+ gt = !1;
1359
+ }
1360
+ return gt;
1361
+ },
1362
+ error: function(e) {
1363
+ H.error("sessionStorage error: ", e);
1364
+ },
1365
+ get: function(e) {
1366
+ try {
1367
+ return null == D ? void 0 : D.sessionStorage.getItem(e);
1368
+ } catch (e) {
1369
+ vt.error(e);
1370
+ }
1371
+ return null;
1372
+ },
1373
+ parse: function(e) {
1374
+ try {
1375
+ return JSON.parse(vt.get(e)) || null;
1376
+ } catch (e) {}
1377
+ return null;
1378
+ },
1379
+ set: function(e, t) {
1380
+ try {
1381
+ null == D || D.sessionStorage.setItem(e, JSON.stringify(t));
1382
+ } catch (e) {
1383
+ vt.error(e);
1384
+ }
1385
+ },
1386
+ remove: function(e) {
1387
+ try {
1388
+ null == D || D.sessionStorage.removeItem(e);
1389
+ } catch (e) {
1390
+ vt.error(e);
1391
+ }
1392
+ }
1393
+ }, mt = [ "localhost", "127.0.0.1" ], yt = function(e) {
1394
+ var t = null == B ? void 0 : B.createElement("a");
1395
+ return R(t) ? null : (t.href = e, t);
1396
+ }, bt = function(e, t) {
1397
+ return !!function(e) {
1398
+ try {
1399
+ new RegExp(e);
1400
+ } catch (e) {
1401
+ return !1;
1402
+ }
1403
+ return !0;
1404
+ }(t) && new RegExp(t).test(e);
1405
+ }, kt = function(e, t) {
1406
+ for (var n, r = ((e.split("#")[0] || "").split("?")[1] || "").split("&"), i = 0; i < r.length; i++) {
1407
+ var o = r[i].split("=");
1408
+ if (o[0] === t) {
1409
+ n = o;
1410
+ break;
1411
+ }
1412
+ }
1413
+ if (!S(n) || n.length < 2) return "";
1414
+ var s = n[1];
1415
+ try {
1416
+ s = decodeURIComponent(s);
1417
+ } catch (e) {
1418
+ H.error("Skipping decoding for malformed query param: " + s);
1419
+ }
1420
+ return s.replace(/\+/g, " ");
1421
+ }, wt = function(e, t) {
1422
+ var n = e.match(new RegExp(t + "=([^&]*)"));
1423
+ return n ? n[1] : null;
1424
+ };
1425
+
1426
+ var St = {
1427
+ campaignParams: function(e) {
1428
+ 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) : "";
1431
+ t.length && (n[e] = t);
1432
+ })), n;
1433
+ },
1434
+ searchEngine: function() {
1435
+ 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;
1437
+ },
1438
+ searchInfo: function() {
1439
+ var e = St.searchEngine(), t = "yahoo" != e ? "q" : "p", n = {};
1440
+ if (!C(e)) {
1441
+ n.$search_engine = e;
1442
+ var r = B ? kt(B.referrer, t) : "";
1443
+ r.length && (n.ph_keyword = r);
1444
+ }
1445
+ return n;
1446
+ },
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
+ },
1452
+ 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]);
1475
+ }
1476
+ return null;
1477
+ },
1478
+ browserLanguage: function() {
1479
+ return navigator.language || navigator.userLanguage;
1480
+ },
1481
+ 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
+ };
1529
+ }
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" : "";
1543
+ },
1544
+ deviceType: function(e) {
1545
+ var t = this.device(e);
1546
+ return "iPad" === t || "Android Tablet" === t ? "Tablet" : t ? "Mobile" : "Desktop";
1547
+ },
1548
+ referrer: function() {
1549
+ return (null == B ? void 0 : B.referrer) || "$direct";
1550
+ },
1551
+ referringDomain: function() {
1552
+ var e;
1553
+ return null != B && B.referrer && (null === (e = yt(B.referrer)) || void 0 === e ? void 0 : e.host) || "$direct";
1554
+ },
1555
+ properties: function() {
1556
+ if (!N) return {};
1557
+ var e = St.os(N), t = e.os_name, n = e.os_version;
1558
+ return z(Z({
1559
+ $os: t,
1560
+ $os_version: n,
1561
+ $browser: St.browser(N, navigator.vendor, L.opera),
1562
+ $device: St.device(N),
1563
+ $device_type: St.deviceType(N)
1564
+ }), {
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,
1575
+ $lib: "web",
1576
+ $lib_version: m.LIB_VERSION,
1577
+ $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),
1578
+ $time: J() / 1e3
1579
+ });
1580
+ },
1581
+ 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({
1585
+ $os: t,
1586
+ $os_version: n,
1587
+ $browser: St.browser(N, navigator.vendor, L.opera)
1588
+ }), {
1589
+ $browser_version: St.browserVersion(N, navigator.vendor, L.opera)
1590
+ });
1591
+ }
1592
+ }, Ft = [ "cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory" ], Pt = function() {
1593
+ 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();
1604
+ }
1605
+ return o(e, [ {
1606
+ key: "properties",
1607
+ value: function() {
1608
+ 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;
1613
+ })), a)) || (e[n] = t);
1614
+ var o, s, a;
1615
+ })), e;
1616
+ }
1617
+ }, {
1618
+ key: "load",
1619
+ value: function() {
1620
+ if (!this.disabled) {
1621
+ var e = this.storage.parse(this.name);
1622
+ e && (this.props = z({}, e));
1623
+ }
1624
+ }
1625
+ }, {
1626
+ key: "save",
1627
+ value: function() {
1628
+ this.disabled || this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure);
1629
+ }
1630
+ }, {
1631
+ key: "remove",
1632
+ value: function() {
1633
+ this.storage.remove(this.name, !1), this.storage.remove(this.name, !0);
1634
+ }
1635
+ }, {
1636
+ key: "clear",
1637
+ value: function() {
1638
+ this.remove(), this.props = {};
1639
+ }
1640
+ }, {
1641
+ key: "register_once",
1642
+ value: function(e, t, n) {
1643
+ var r = this;
1644
+ if (I(e)) {
1645
+ R(t) && (t = "None"), this.expire_days = R(n) ? this.default_expiry : n;
1646
+ var i = !1;
1647
+ if (G(e, (function(e, n) {
1648
+ r.props.hasOwnProperty(n) && r.props[n] !== t || (r.props[n] = e, i = !0);
1649
+ })), i) return this.save(), !0;
1650
+ }
1651
+ return !1;
1652
+ }
1653
+ }, {
1654
+ key: "register",
1655
+ value: function(e, t) {
1656
+ var n = this;
1657
+ if (I(e)) {
1658
+ this.expire_days = R(t) ? this.default_expiry : t;
1659
+ var r = !1;
1660
+ if (G(e, (function(t, i) {
1661
+ e.hasOwnProperty(i) && n.props[i] !== t && (n.props[i] = t, r = !0);
1662
+ })), r) return this.save(), !0;
1663
+ }
1664
+ return !1;
1665
+ }
1666
+ }, {
1667
+ key: "unregister",
1668
+ value: function(e) {
1669
+ e in this.props && (delete this.props[e], this.save());
1670
+ }
1671
+ }, {
1672
+ key: "update_campaign_params",
1673
+ value: function() {
1674
+ this.campaign_params_saved || (this.register(St.campaignParams(this.custom_campaign_params)),
1675
+ this.campaign_params_saved = !0);
1676
+ }
1677
+ }, {
1678
+ key: "update_search_keyword",
1679
+ value: function() {
1680
+ this.register(St.searchInfo());
1681
+ }
1682
+ }, {
1683
+ key: "update_referrer_info",
1684
+ value: function() {
1685
+ this.register({
1686
+ $referrer: this.props.$referrer || St.referrer(),
1687
+ $referring_domain: this.props.$referring_domain || St.referringDomain()
1688
+ });
1689
+ }
1690
+ }, {
1691
+ key: "get_referrer_info",
1692
+ value: function() {
1693
+ return Z({
1694
+ $referrer: this.props.$referrer,
1695
+ $referring_domain: this.props.$referring_domain
1696
+ });
1697
+ }
1698
+ }, {
1699
+ key: "safe_merge",
1700
+ value: function(e) {
1701
+ return G(this.props, (function(t, n) {
1702
+ n in e || (e[n] = t);
1703
+ })), e;
1704
+ }
1705
+ }, {
1706
+ 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);
1710
+ }
1711
+ }, {
1712
+ key: "set_disabled",
1713
+ value: function(e) {
1714
+ this.disabled = e, this.disabled ? this.remove() : this.save();
1715
+ }
1716
+ }, {
1717
+ key: "set_cross_subdomain",
1718
+ value: function(e) {
1719
+ e !== this.cross_subdomain && (this.cross_subdomain = e, this.remove(), this.save());
1720
+ }
1721
+ }, {
1722
+ key: "get_cross_subdomain",
1723
+ value: function() {
1724
+ return !!this.cross_subdomain;
1725
+ }
1726
+ }, {
1727
+ key: "set_secure",
1728
+ value: function(e) {
1729
+ e !== this.secure && (this.secure = e, this.remove(), this.save());
1730
+ }
1731
+ }, {
1732
+ key: "set_event_timer",
1733
+ value: function(e, t) {
1734
+ var n = this.props[Pe] || {};
1735
+ n[e] = t, this.props[Pe] = n, this.save();
1736
+ }
1737
+ }, {
1738
+ key: "remove_event_timer",
1739
+ value: function(e) {
1740
+ var t = (this.props[Pe] || {})[e];
1741
+ return R(t) || (delete this.props[Pe][e], this.save()), t;
1742
+ }
1743
+ }, {
1744
+ key: "get_user_state",
1745
+ value: function() {
1746
+ return this.props[Ne] || "anonymous";
1747
+ }
1748
+ }, {
1749
+ key: "set_user_state",
1750
+ value: function(e) {
1751
+ this.props[Ne] = e, this.save();
1752
+ }
1753
+ }, {
1754
+ key: "get_quota_limits",
1755
+ value: function() {
1756
+ return this.props[Le] || {};
1757
+ }
1758
+ }, {
1759
+ key: "set_quota_limits",
1760
+ value: function(e) {
1761
+ this.props[Le] = e, this.save();
1762
+ }
1763
+ } ]), e;
1764
+ }(), It = 2, xt = 4, Rt = 3, Et = 6, Ct = 0, Ot = "rrweb/console@1";
1765
+
1766
+ var $t = o((function e(t) {
1767
+ var n, i, o = this, a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
1768
+ r(this, e), s(this, "bucketSize", 100), s(this, "refillRate", 10), s(this, "mutationBuckets", {}),
1769
+ s(this, "loggedTracker", {}), s(this, "refillBuckets", (function() {
1770
+ Object.keys(o.mutationBuckets).forEach((function(e) {
1771
+ o.mutationBuckets[e] = o.mutationBuckets[e] + o.refillRate, o.mutationBuckets[e] >= o.bucketSize && delete o.mutationBuckets[e];
1772
+ }));
1773
+ })), s(this, "getNodeOrRelevantParent", (function(e) {
1774
+ var t = o.rrweb.mirror.getNode(e);
1775
+ if ("svg" !== (null == t ? void 0 : t.nodeName) && t instanceof Element) {
1776
+ var n = t.closest("svg");
1777
+ if (n) return [ o.rrweb.mirror.getId(n), n ];
1778
+ }
1779
+ return [ e, t ];
1780
+ })), s(this, "numberOfChanges", (function(e) {
1781
+ var t, n, r, i, o, s, a, u;
1782
+ 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
+ })), s(this, "throttleMutations", (function(e) {
1784
+ if (e.type !== Rt || e.data.source !== Ct) return e;
1785
+ var t = e.data, n = o.numberOfChanges(t);
1786
+ 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];
1788
+ if (0 === o.mutationBuckets[s]) return !1;
1789
+ (o.mutationBuckets[s] = null !== (t = o.mutationBuckets[s]) && void 0 !== t ? t : o.bucketSize,
1790
+ o.mutationBuckets[s] = Math.max(o.mutationBuckets[s] - 1, 0), 0 === o.mutationBuckets[s]) && (o.loggedTracker[s] || (o.loggedTracker[s] = !0,
1791
+ null === (n = (r = o.options).onBlockedNode) || void 0 === n || n.call(r, s, a)));
1792
+ return e;
1793
+ })));
1794
+ var r = o.numberOfChanges(t);
1795
+ return 0 !== r || n === r ? e : void 0;
1796
+ })), this.rrweb = t, this.options = a, this.refillRate = null !== (n = this.options.refillRate) && void 0 !== n ? n : this.refillRate,
1797
+ this.bucketSize = null !== (i = this.options.bucketSize) && void 0 !== i ? i : this.bucketSize,
1798
+ setInterval((function() {
1799
+ o.refillBuckets();
1800
+ }), 1e3);
1801
+ })), Mt = function(e) {
1802
+ return e[e.DomContentLoaded = 0] = "DomContentLoaded", e[e.Load = 1] = "Load", e[e.FullSnapshot = 2] = "FullSnapshot",
1803
+ e[e.IncrementalSnapshot = 3] = "IncrementalSnapshot", e[e.Meta = 4] = "Meta", e[e.Custom = 5] = "Custom",
1804
+ e[e.Plugin = 6] = "Plugin", e;
1805
+ }(Mt || {}), Tt = {
1806
+ initiatorTypes: [ "audio", "beacon", "body", "css", "early-hint", "embed", "fetch", "frame", "iframe", "icon", "image", "img", "input", "link", "navigation", "object", "ping", "script", "track", "video", "xmlhttprequest" ],
1807
+ maskRequestFn: function(e) {
1808
+ return e;
1809
+ },
1810
+ recordHeaders: !1,
1811
+ recordBody: !1,
1812
+ recordInitialRequests: !1,
1813
+ recordPerformance: !1,
1814
+ performanceEntryTypeToObserve: [ "first-input", "navigation", "paint", "resource" ],
1815
+ 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/" ];
1817
+
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;
1821
+ }
1822
+
1823
+ var Bt, Nt = function(e, n) {
1824
+ 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
+ o = Math.min(1e6, null !== (i = r.payloadSizeLimitBytes) && void 0 !== i ? i : 1e6),
1826
+ 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")),
1829
+ e;
1830
+ }), d = function(e) {
1831
+ return c(function(e) {
1832
+ var t = yt(e.name);
1833
+ if (!(t && t.pathname && Dt.includes(t.pathname))) return e;
1834
+ }((t = e, Object.keys(null !== (n = t.requestHeaders) && void 0 !== n ? n : {}).forEach((function(e) {
1835
+ var n;
1836
+ At.includes(e.toLowerCase()) && (null === (n = t.requestHeaders) || void 0 === n || delete n[e]);
1837
+ })), t)));
1838
+ 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) {
1842
+ var r = e.session_recording.maskNetworkRequestFn({
1843
+ url: n.name
1844
+ });
1845
+ return t(t({}, n), {}, {
1846
+ name: null == r ? void 0 : r.url
1847
+ });
1848
+ }), s.maskRequestFn = P(e.session_recording.maskCapturedNetworkRequestFn) ? function(t) {
1849
+ var n, r, i, o = d(t);
1850
+ 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), {}, {
1852
+ recordHeaders: a,
1853
+ recordBody: u,
1854
+ recordPerformance: l,
1855
+ recordInitialRequests: l
1856
+ });
1857
+ }, Lt = "/s/", jt = 3e5;
1858
+
1859
+ !function(e) {
1860
+ e[e.Mutation = 0] = "Mutation", e[e.MouseMove = 1] = "MouseMove", e[e.MouseInteraction = 2] = "MouseInteraction",
1861
+ e[e.Scroll = 3] = "Scroll", e[e.ViewportResize = 4] = "ViewportResize", e[e.Input = 5] = "Input",
1862
+ e[e.TouchMove = 6] = "TouchMove", e[e.MediaInteraction = 7] = "MediaInteraction",
1863
+ e[e.StyleSheetRule = 8] = "StyleSheetRule", e[e.CanvasMutation = 9] = "CanvasMutation",
1864
+ e[e.Font = 10] = "Font", e[e.Log = 11] = "Log", e[e.Drag = 12] = "Drag", e[e.StyleDeclaration = 13] = "StyleDeclaration",
1865
+ e[e.Selection = 14] = "Selection", e[e.AdoptedStyleSheet = 15] = "AdoptedStyleSheet";
1866
+ }(Bt || (Bt = {}));
1867
+
1868
+ var Ht = [ Bt.MouseMove, Bt.MouseInteraction, Bt.Scroll, Bt.ViewportResize, Bt.Input, Bt.TouchMove, Bt.MediaInteraction, Bt.Drag ], Vt = function() {
1869
+ function e(t) {
1870
+ 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() {
1876
+ 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.");
1879
+ this.buffer = this.clearBuffer();
1880
+ }
1881
+ return o(e, [ {
1882
+ key: "started",
1883
+ get: function() {
1884
+ return this._captureStarted;
1885
+ }
1886
+ }, {
1887
+ key: "sessionManager",
1888
+ 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.");
1891
+ return this.instance.sessionManager;
1892
+ }
1893
+ }, {
1894
+ key: "isSampled",
1895
+ get: function() {
1896
+ return O(this._sampleRate) ? this.instance.get_property($e) : null;
1897
+ }
1898
+ }, {
1899
+ key: "sessionDuration",
1900
+ get: function() {
1901
+ var e, t, n = null === (e = this.buffer) || void 0 === e ? void 0 : e.data[(null === (t = this.buffer) || void 0 === t ? void 0 : t.data.length) - 1], r = this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;
1902
+ return n ? n.timestamp - r : null;
1903
+ }
1904
+ }, {
1905
+ key: "isRecordingEnabled",
1906
+ get: function() {
1907
+ var e = !!this.instance.get_property(xe), t = !this.instance.config.disable_session_recording;
1908
+ return D && e && t;
1909
+ }
1910
+ }, {
1911
+ key: "isConsoleLogCaptureEnabled",
1912
+ get: function() {
1913
+ var e = !!this.instance.get_property(Re), t = this.instance.config.enable_recording_console_log;
1914
+ return null != t ? t : e;
1915
+ }
1916
+ }, {
1917
+ key: "recordingVersion",
1918
+ get: function() {
1919
+ var e, t = this.instance.get_property(Ee);
1920
+ return (null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.recorderVersion) || t || "v1";
1921
+ }
1922
+ }, {
1923
+ key: "networkPayloadCapture",
1924
+ get: function() {
1925
+ var e, t, n = this.instance.get_property(Ce), r = {
1926
+ recordHeaders: null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.recordHeaders,
1927
+ recordBody: null === (t = this.instance.config.session_recording) || void 0 === t ? void 0 : t.recordBody
1928
+ }, 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);
1929
+ return i || o || s ? {
1930
+ recordHeaders: i,
1931
+ recordBody: o,
1932
+ recordPerformance: s
1933
+ } : void 0;
1934
+ }
1935
+ }, {
1936
+ key: "status",
1937
+ get: function() {
1938
+ return this.receivedDecide ? this.isRecordingEnabled ? E(this._linkedFlag) && !this._linkedFlagSeen ? "buffering" : $(this.isSampled) ? this.isSampled ? "sampled" : "disabled" : "active" : "disabled" : "buffering";
1939
+ }
1940
+ }, {
1941
+ key: "startRecordingIfEnabled",
1942
+ value: function() {
1943
+ this.isRecordingEnabled ? this.startCaptureAndTrySendingQueuedSnapshots() : (this.stopRecording(),
1944
+ this.clearBuffer());
1945
+ }
1946
+ }, {
1947
+ key: "stopRecording",
1948
+ value: function() {
1949
+ this._captureStarted && this.stopRrweb && (this.stopRrweb(), this.stopRrweb = void 0,
1950
+ this._captureStarted = !1);
1951
+ }
1952
+ }, {
1953
+ key: "makeSamplingDecision",
1954
+ value: function(e) {
1955
+ var t, n = this.sessionId !== e;
1956
+ if (O(this._sampleRate)) {
1957
+ var r, i = this.isSampled;
1958
+ 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));
1961
+ } else {
1962
+ var o;
1963
+ null === (o = this.instance.persistence) || void 0 === o || o.register(s({}, $e, null));
1964
+ }
1965
+ }
1966
+ }, {
1967
+ key: "afterDecideResponse",
1968
+ 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({
1974
+ capturePerformance: e.capturePerformance
1975
+ }, 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(_);
1988
+ }));
1989
+ }
1990
+ this.receivedDecide = !0, this.startRecordingIfEnabled();
1991
+ }
1992
+ }, {
1993
+ key: "log",
1994
+ value: function(e) {
1995
+ var t, n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "log";
1996
+ null === (t = this.instance.sessionRecording) || void 0 === t || t.onRRwebEmit({
1997
+ type: 6,
1998
+ data: {
1999
+ plugin: "rrweb/console@1",
2000
+ payload: {
2001
+ level: n,
2002
+ trace: [],
2003
+ payload: [ JSON.stringify(e) ]
2004
+ }
2005
+ },
2006
+ timestamp: J()
2007
+ });
2008
+ }
2009
+ }, {
2010
+ key: "startCaptureAndTrySendingQueuedSnapshots",
2011
+ value: function() {
2012
+ this._startCapture();
2013
+ }
2014
+ }, {
2015
+ key: "_startCapture",
2016
+ value: function() {
2017
+ var e = this;
2018
+ if (!R(Object.assign) && !this._captureStarted && !this.instance.config.disable_session_recording) {
2019
+ this._captureStarted = !0, this.sessionManager.checkAndGetSessionAndWindowId();
2020
+ 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);
2023
+ e._onScriptLoaded();
2024
+ })) : this._onScriptLoaded();
2025
+ }
2026
+ }
2027
+ }, {
2028
+ key: "_isInteractiveEvent",
2029
+ value: function(e) {
2030
+ var t;
2031
+ return e.type === Rt && -1 !== Ht.indexOf(null === (t = e.data) || void 0 === t ? void 0 : t.source);
2032
+ }
2033
+ }, {
2034
+ key: "_updateWindowAndSessionIds",
2035
+ value: function(e) {
2036
+ var t = this._isInteractiveEvent(e);
2037
+ if (t || this.isIdle || e.timestamp - this._lastActivityTimestamp > jt && (this.isIdle = !0,
2038
+ this._tryAddCustomEvent("sessionIdle", {
2039
+ reason: "user inactivity",
2040
+ timeSinceLastActive: e.timestamp - this._lastActivityTimestamp,
2041
+ threshold: jt
2042
+ })), t && (this._lastActivityTimestamp = e.timestamp, this.isIdle && (this.isIdle = !1,
2043
+ this._tryAddCustomEvent("sessionNoLongerIdle", {
2044
+ reason: "user activity",
2045
+ 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;
2050
+ }
2051
+ }
2052
+ }, {
2053
+ key: "_tryRRwebMethod",
2054
+ value: function(e) {
2055
+ if (!this._captureStarted) return !1;
2056
+ try {
2057
+ return e(), !0;
2058
+ } catch (e) {
2059
+ return H.error("[Session-Recording] using rrweb when not started.", e), !1;
2060
+ }
2061
+ }
2062
+ }, {
2063
+ key: "_tryAddCustomEvent",
2064
+ value: function(e, t) {
2065
+ 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
+ }));
2070
+ }
2071
+ }, {
2072
+ key: "_tryTakeFullSnapshot",
2073
+ value: function() {
2074
+ 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
+ }));
2079
+ }
2080
+ }, {
2081
+ key: "_onScriptLoaded",
2082
+ value: function() {
2083
+ var e, n = this, r = {
2084
+ blockClass: "ph-no-capture",
2085
+ blockSelector: void 0,
2086
+ ignoreClass: "ph-ignore-input",
2087
+ maskTextClass: "ph-mask",
2088
+ maskTextSelector: void 0,
2089
+ maskTextFn: void 0,
2090
+ maskAllInputs: !0,
2091
+ maskInputOptions: {},
2092
+ maskInputFn: void 0,
2093
+ slimDOMOptions: {},
2094
+ collectFonts: !1,
2095
+ inlineStylesheet: !0,
2096
+ recordCrossOriginIframes: !1
2097
+ };
2098
+ this.rrwebRecord = D.rrweb ? D.rrweb.record : D.rrwebRecord;
2099
+ 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];
2101
+ u in r && (r[u] = l);
2102
+ }
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
+ });
2123
+ }
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.");
2128
+ }
2129
+ }, {
2130
+ key: "_gatherRRWebPlugins",
2131
+ value: function() {
2132
+ 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."));
2135
+ return e;
2136
+ }
2137
+ }, {
2138
+ key: "onRRwebEmit",
2139
+ value: function(e) {
2140
+ if (e && I(e)) {
2141
+ if (e.type === Mt.Meta) {
2142
+ var t = this._maskUrl(e.data.href);
2143
+ if (!t) return;
2144
+ e.data.href = t;
2145
+ }
2146
+ var n = this.mutationRateLimiter ? this.mutationRateLimiter.throttleMutations(e) : e;
2147
+ if (n) {
2148
+ var r = function(e) {
2149
+ var t = e;
2150
+ if (t && I(t) && t.type === Et && I(t.data) && t.data.plugin === Ot) {
2151
+ t.data.payload.payload.length > 10 && (t.data.payload.payload = t.data.payload.payload.slice(0, 10),
2152
+ t.data.payload.payload.push("...[truncated]"));
2153
+ 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]);
2154
+ return t.data.payload.payload = n, e;
2155
+ }
2156
+ return e;
2157
+ }(n), i = JSON.stringify(r).length;
2158
+ if (this._updateWindowAndSessionIds(r), !this.isIdle) {
2159
+ var o = {
2160
+ $snapshot_bytes: i,
2161
+ $snapshot_data: r,
2162
+ $session_id: this.sessionId,
2163
+ $window_id: this.windowId
2164
+ };
2165
+ "disabled" !== this.status ? this._captureSnapshotBuffered(o) : this.clearBuffer();
2166
+ }
2167
+ }
2168
+ }
2169
+ }
2170
+ }, {
2171
+ key: "_maskUrl",
2172
+ value: function(e) {
2173
+ var t = this.instance.config.session_recording;
2174
+ if (t.maskNetworkRequestFn) {
2175
+ var n, r = {
2176
+ url: e
2177
+ };
2178
+ return null === (n = r = t.maskNetworkRequestFn(r)) || void 0 === n ? void 0 : n.url;
2179
+ }
2180
+ return e;
2181
+ }
2182
+ }, {
2183
+ key: "clearBuffer",
2184
+ value: function() {
2185
+ return this.buffer = void 0, {
2186
+ size: 0,
2187
+ data: [],
2188
+ sessionId: this.sessionId,
2189
+ windowId: this.windowId
2190
+ };
2191
+ }
2192
+ }, {
2193
+ key: "_flushBuffer",
2194
+ value: function() {
2195
+ var e = this;
2196
+ 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;
2198
+ return "buffering" === this.status || i ? (this.flushBufferTimer = setTimeout((function() {
2199
+ e._flushBuffer();
2200
+ }), 2e3), this.buffer || this.clearBuffer()) : this.buffer && 0 !== this.buffer.data.length ? (this._captureSnapshot({
2201
+ $snapshot_bytes: this.buffer.size,
2202
+ $snapshot_data: this.buffer.data,
2203
+ $session_id: this.buffer.sessionId,
2204
+ $window_id: this.buffer.windowId
2205
+ }), this.clearBuffer()) : this.buffer || this.clearBuffer();
2206
+ }
2207
+ }, {
2208
+ key: "_captureSnapshotBuffered",
2209
+ value: function(e) {
2210
+ var t, n = this, r = 2 + ((null === (t = this.buffer) || void 0 === t ? void 0 : t.data.length) || 0);
2211
+ (!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,
2213
+ this.buffer.windowId = this.windowId), this.buffer.size += e.$snapshot_bytes, this.buffer.data.push(e.$snapshot_data),
2214
+ this.flushBufferTimer || (this.flushBufferTimer = setTimeout((function() {
2215
+ n._flushBuffer();
2216
+ }), 2e3));
2217
+ }
2218
+ }, {
2219
+ key: "_captureSnapshot",
2220
+ value: function(e) {
2221
+ this.instance.capture("$snapshot", e, {
2222
+ transport: "XHR",
2223
+ method: "POST",
2224
+ endpoint: this._endpoint,
2225
+ _noTruncate: !0,
2226
+ _batchKey: "recordings",
2227
+ _metrics: {
2228
+ rrweb_full_snapshot: e.$snapshot_data.type === It
2229
+ }
2230
+ });
2231
+ }
2232
+ } ]), e;
2233
+ }(), Ut = function() {
2234
+ function e(t) {
2235
+ r(this, e), this.instance = t, this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags();
2236
+ }
2237
+ return o(e, [ {
2238
+ key: "call",
2239
+ value: function() {
2240
+ var e = this, t = ne(JSON.stringify({
2241
+ token: this.instance.config.token,
2242
+ distinct_id: this.instance.get_distinct_id(),
2243
+ groups: this.instance.getGroups(),
2244
+ person_properties: this.instance.get_property(Ae),
2245
+ group_properties: this.instance.get_property(De),
2246
+ disable_flags: this.instance.config.advanced_disable_feature_flags || this.instance.config.advanced_disable_feature_flags_on_first_load || void 0
2247
+ }));
2248
+ this.instance._send_request("".concat(this.instance.config.api_host, "/decide/?v=3"), {
2249
+ data: t,
2250
+ verbose: !0
2251
+ }, {
2252
+ method: "POST"
2253
+ }, (function(t) {
2254
+ return e.parseDecideResponse(t);
2255
+ }));
2256
+ }
2257
+ }, {
2258
+ key: "parseDecideResponse",
2259
+ value: function(e) {
2260
+ var t, n = this;
2261
+ if (this.instance.featureFlags.setReloadingPaused(!1), this.instance.featureFlags._startReloadTimer(),
2262
+ 0 !== (null == e ? void 0 : e.status)) {
2263
+ if (!B || !B.body) return H.info("document not ready yet, trying again in 500 milliseconds..."),
2264
+ void setTimeout((function() {
2265
+ n.parseDecideResponse(e);
2266
+ }), 500);
2267
+ 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),
2269
+ 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);
2274
+ }));
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);
2279
+ })), e.siteApps) if (this.instance.config.opt_in_site_apps) {
2280
+ var o, s = this.instance.config.api_host, a = v(e.siteApps);
2281
+ 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);
2286
+ }));
2287
+ };
2288
+ for (a.s(); !(o = a.n()).done; ) u();
2289
+ } catch (e) {
2290
+ a.e(e);
2291
+ } finally {
2292
+ a.f();
2293
+ }
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.");
2296
+ }
2297
+ } ]), 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() {
2299
+ function e(t) {
2300
+ r(this, e), this.instance = t;
2301
+ }
2302
+ return o(e, [ {
2303
+ key: "afterDecideResponse",
2304
+ value: function(e) {
2305
+ var n = e.toolbarParams || e.editorParams || (e.toolbarVersion ? {
2306
+ toolbarVersion: e.toolbarVersion
2307
+ } : {});
2308
+ e.isAuthenticated && n.toolbarVersion && 0 === n.toolbarVersion.indexOf("toolbar") && this.loadToolbar(t({}, n));
2309
+ }
2310
+ }, {
2311
+ key: "maybeLoadToolbar",
2312
+ value: function() {
2313
+ 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;
2316
+ try {
2317
+ if (!r) {
2318
+ try {
2319
+ D.localStorage.setItem("test", "test"), D.localStorage.removeItem("test");
2320
+ } catch (e) {
2321
+ return !1;
2322
+ }
2323
+ r = null == D ? void 0 : D.localStorage;
2324
+ }
2325
+ var o, s = zt || wt(n.hash, "__posthog") || wt(n.hash, "state"), a = s ? X((function() {
2326
+ return JSON.parse(atob(decodeURIComponent(s)));
2327
+ })) || X((function() {
2328
+ return JSON.parse(decodeURIComponent(s));
2329
+ })) : null;
2330
+ 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",
2331
+ delete o.userIntent), !(!o.token || this.instance.config.token !== o.token) && (this.loadToolbar(o),
2332
+ !0);
2333
+ } catch (e) {
2334
+ return !1;
2335
+ }
2336
+ }
2337
+ }, {
2338
+ key: "loadToolbar",
2339
+ value: function(e) {
2340
+ 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({
2344
+ token: this.instance.config.token
2345
+ }, e), {}, {
2346
+ apiURL: r
2347
+ }, a ? {
2348
+ instrument: !1
2349
+ } : {});
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);
2356
+ })), !0;
2357
+ }
2358
+ }, {
2359
+ key: "_loadEditor",
2360
+ value: function(e) {
2361
+ return this.loadToolbar(e);
2362
+ }
2363
+ }, {
2364
+ key: "maybeLoadEditor",
2365
+ value: function() {
2366
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0, n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
2367
+ return this.maybeLoadToolbar(e, t, n);
2368
+ }
2369
+ } ]), 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() {
2420
+ function e() {
2421
+ var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 3e3;
2422
+ r(this, e), this.isPolling = !0, this._event_queue = [], this._empty_queue_count = 0,
2423
+ this._poller = void 0, this._pollInterval = t;
2424
+ }
2425
+ return o(e, [ {
2426
+ key: "setPollInterval",
2427
+ value: function(e) {
2428
+ this._pollInterval = e, this.isPolling && this.poll();
2429
+ }
2430
+ }, {
2431
+ key: "poll",
2432
+ value: function() {}
2433
+ }, {
2434
+ key: "unload",
2435
+ value: function() {}
2436
+ }, {
2437
+ key: "getTime",
2438
+ value: function() {
2439
+ return (new Date).getTime();
2440
+ }
2441
+ } ]), e;
2442
+ }(), an = function(e) {
2443
+ a(i, sn);
2444
+ var n = h(i);
2445
+ function i(e) {
2446
+ var t, o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 3e3;
2447
+ return r(this, i), (t = n.call(this, o)).handlePollRequest = e, t;
2448
+ }
2449
+ return o(i, [ {
2450
+ key: "enqueue",
2451
+ value: function(e, t, n) {
2452
+ this._event_queue.push({
2453
+ url: e,
2454
+ data: t,
2455
+ options: n
2456
+ }), this.isPolling || (this.isPolling = !0, this.poll());
2457
+ }
2458
+ }, {
2459
+ key: "poll",
2460
+ value: function() {
2461
+ var e = this;
2462
+ clearTimeout(this._poller), this._poller = setTimeout((function() {
2463
+ if (e._event_queue.length > 0) {
2464
+ var t = e.formatQueue(), n = function(n) {
2465
+ var r = t[n], i = r.url, o = r.data, s = r.options;
2466
+ G(o, (function(t, n) {
2467
+ o[n].offset = Math.abs(o[n].timestamp - e.getTime()), delete o[n].timestamp;
2468
+ })), e.handlePollRequest(i, o, s);
2469
+ };
2470
+ for (var r in t) n(r);
2471
+ e._event_queue.length = 0, e._empty_queue_count = 0;
2472
+ } else e._empty_queue_count++;
2473
+ e._empty_queue_count > 4 && (e.isPolling = !1, e._empty_queue_count = 0), e.isPolling && e.poll();
2474
+ }), this._pollInterval);
2475
+ }
2476
+ }, {
2477
+ key: "unload",
2478
+ value: function() {
2479
+ var e = this;
2480
+ clearTimeout(this._poller);
2481
+ var n = this._event_queue.length > 0 ? this.formatQueue() : {};
2482
+ this._event_queue.length = 0;
2483
+ var r = Object.values(n);
2484
+ [].concat(p(r.filter((function(e) {
2485
+ return 0 === e.url.indexOf("/e");
2486
+ }))), p(r.filter((function(e) {
2487
+ return 0 !== e.url.indexOf("/e");
2488
+ })))).map((function(n) {
2489
+ var r = n.url, i = n.data, o = n.options;
2490
+ e.handlePollRequest(r, i, t(t({}, o), {}, {
2491
+ transport: "sendBeacon"
2492
+ }));
2493
+ }));
2494
+ }
2495
+ }, {
2496
+ key: "formatQueue",
2497
+ value: function() {
2498
+ var e = {};
2499
+ return G(this._event_queue, (function(t) {
2500
+ var n = t.url, r = t.data, i = t.options, o = (i ? i._batchKey : null) || n;
2501
+ R(e[o]) && (e[o] = {
2502
+ data: [],
2503
+ url: n,
2504
+ options: i
2505
+ }), i && e[o].options && e[o].options._metrics && !e[o].options._metrics.rrweb_full_snapshot && (e[o].options._metrics.rrweb_full_snapshot = i._metrics.rrweb_full_snapshot),
2506
+ e[o].data.push(r);
2507
+ })), e;
2508
+ }
2509
+ } ]), 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]);
2513
+ for (r = 1; r < 30; ++r) for (var o = n[r]; o < n[r + 1]; ++o) i[o] = o - n[r] << 5 | r;
2514
+ return [ n, i ];
2515
+ }, _n = pn(dn, 2), gn = _n[0], vn = _n[1];
2516
+
2517
+ gn[28] = 258, vn[258] = 28;
2518
+
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;
2523
+ }
2524
+
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);
2528
+ for (i = 0; i < t; ++i) a[i] = a[i - 1] + o[i - 1] << 1;
2529
+ if (n) {
2530
+ s = new ln(1 << t);
2531
+ 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];
2534
+ return s;
2535
+ }, Sn = new un(288);
2536
+
2537
+ for (bn = 0; bn < 144; ++bn) Sn[bn] = 8;
2538
+
2539
+ for (bn = 144; bn < 256; ++bn) Sn[bn] = 9;
2540
+
2541
+ for (bn = 256; bn < 280; ++bn) Sn[bn] = 7;
2542
+
2543
+ for (bn = 280; bn < 288; ++bn) Sn[bn] = 8;
2544
+
2545
+ var Fn = new un(32);
2546
+
2547
+ for (bn = 0; bn < 32; ++bn) Fn[bn] = 5;
2548
+
2549
+ var Pn, In = wn(Sn, 9, 0), xn = wn(Fn, 5, 0), Rn = function(e) {
2550
+ return (e / 8 >> 0) + (7 & e && 1);
2551
+ }, En = function(e, t, n) {
2552
+ (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);
2554
+ return r.set(e.subarray(t, n)), r;
2555
+ }, Cn = function(e, t, n) {
2556
+ n <<= 7 & t;
2557
+ var r = t / 8 >> 0;
2558
+ e[r] |= n, e[r + 1] |= n >>> 8;
2559
+ }, On = function(e, t, n) {
2560
+ n <<= 7 & t;
2561
+ var r = t / 8 >> 0;
2562
+ e[r] |= n, e[r + 1] |= n >>> 8, e[r + 2] |= n >>> 16;
2563
+ }, $n = function(e, t) {
2564
+ for (var n = [], r = 0; r < e.length; ++r) e[r] && n.push({
2565
+ s: r,
2566
+ f: e[r]
2567
+ });
2568
+ var i = n.length, o = n.slice();
2569
+ if (!i) return [ new un(0), 0 ];
2570
+ if (1 == i) {
2571
+ var s = new un(n[0].s + 1);
2572
+ return s[n[0].s] = 1, [ s, 1 ];
2573
+ }
2574
+ n.sort((function(e, t) {
2575
+ return e.f - t.f;
2576
+ })), n.push({
2577
+ s: -1,
2578
+ f: 25001
2579
+ });
2580
+ var a = n[0], u = n[1], l = 0, c = 1, d = 2;
2581
+ for (n[0] = {
2582
+ s: -1,
2583
+ f: a.f + u.f,
2584
+ l: a,
2585
+ r: u
2586
+ }; c != i - 1; ) a = n[n[l].f < n[d].f ? l++ : d++], u = n[l != c && n[l].f < n[d].f ? l++ : d++],
2587
+ n[c++] = {
2588
+ s: -1,
2589
+ f: a.f + u.f,
2590
+ l: a,
2591
+ r: u
2592
+ };
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);
2596
+ if (p > t) {
2597
+ r = 0;
2598
+ var _ = 0, g = p - t, v = 1 << g;
2599
+ for (o.sort((function(e, t) {
2600
+ return f[t.s] - f[e.s] || e.f - t.f;
2601
+ })); r < i; ++r) {
2602
+ var m = o[r].s;
2603
+ if (!(f[m] > t)) break;
2604
+ _ += v - (1 << p - f[m]), f[m] = t;
2605
+ }
2606
+ for (_ >>>= g; _ > 0; ) {
2607
+ var y = o[r].s;
2608
+ f[y] < t ? _ -= 1 << t - f[y]++ - 1 : ++r;
2609
+ }
2610
+ for (;r >= 0 && _; --r) {
2611
+ var b = o[r].s;
2612
+ f[b] == t && (--f[b], ++_);
2613
+ }
2614
+ p = t;
2615
+ }
2616
+ return [ new un(f), p ];
2617
+ }, Mn = function e(t, n, r) {
2618
+ 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) {
2620
+ 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) {
2622
+ n[r++] = e;
2623
+ }, a = 1; a <= t; ++a) if (e[a] == i && a != t) ++o; else {
2624
+ if (!i && o > 2) {
2625
+ for (;o > 138; o -= 138) s(32754);
2626
+ o > 2 && (s(o > 10 ? o - 11 << 5 | 28690 : o - 3 << 5 | 12305), o = 0);
2627
+ } else if (o > 3) {
2628
+ for (s(i), --o; o > 6; o -= 6) s(8304);
2629
+ o > 2 && (s(o - 3 << 5 | 8208), o = 0);
2630
+ }
2631
+ for (;o--; ) s(i);
2632
+ o = 1, i = e[a];
2633
+ }
2634
+ return [ n.subarray(0, r), t ];
2635
+ }, An = function(e, t) {
2636
+ for (var n = 0, r = 0; r < t.length; ++r) n += e[r] * t[r];
2637
+ return n;
2638
+ }, Dn = function(e, t, n) {
2639
+ var r = n.length, i = Rn(t + 2);
2640
+ e[i] = 255 & r, e[i + 1] = r >>> 8, e[i + 2] = 255 ^ e[i], e[i + 3] = 255 ^ e[i + 1];
2641
+ for (var o = 0; o < r; ++o) e[i + o + 4] = n[o];
2642
+ 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;
2664
+ 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]);
2667
+ 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) {
2673
+ for (var n = t, r = 9; --r; ) n = (1 & n && 3988292384) ^ n >>> 1;
2674
+ e[t] = n;
2675
+ }
2676
+ return e;
2677
+ }(), jn = function() {
2678
+ var e = 4294967295;
2679
+ return {
2680
+ p: function(t) {
2681
+ for (var n = e, r = 0; r < t.length; ++r) n = Ln[255 & n ^ t[r]] ^ n >>> 8;
2682
+ e = n;
2683
+ },
2684
+ d: function() {
2685
+ return 4294967295 ^ e;
2686
+ }
2687
+ };
2688
+ }, Hn = function(e, t, n, r, i) {
2689
+ 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;
2691
+ if (!t || s < 8) for (var c = 0; c <= s; c += 65535) {
2692
+ 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)));
2694
+ } 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) {
2696
+ 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) {
2701
+ 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;
2706
+ }
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);
2717
+ }
2718
+ }
2719
+ }
2720
+ q += (C = O) - (O = g[C]) + 32768 & 32767;
2721
+ }
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]];
2727
+ }
2728
+ }
2729
+ l = qn(e, u, o, k, w, S, P, I, R, c - R, l), o || (l = Dn(u, l, Nn));
2730
+ }
2731
+ return En(a, 0, r + Rn(l) + i);
2732
+ }(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) {
2734
+ for (;n; ++t) e[t] = n, n >>>= 8;
2735
+ }, Un = function(e, t) {
2736
+ var n = t.filename;
2737
+ 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)),
2739
+ n) {
2740
+ e[3] = 8;
2741
+ for (var r = 0; r <= n.length; ++r) e[r + 10] = n.charCodeAt(r);
2742
+ }
2743
+ }, Wn = function(e) {
2744
+ return 10 + (e.filename && e.filename.length + 1 || 0);
2745
+ };
2746
+
2747
+ function Gn(e, t) {
2748
+ void 0 === t && (t = {});
2749
+ var n = jn(), r = e.length;
2750
+ 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;
2753
+ }
2754
+
2755
+ function zn(e, t) {
2756
+ var n = e.length;
2757
+ 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) {
2759
+ r[i++] = e;
2760
+ }, s = 0; s < n; ++s) {
2761
+ if (i + 5 > r.length) {
2762
+ var a = new un(i + 8 + (n - s << 1));
2763
+ a.set(r), r = a;
2764
+ }
2765
+ var u = e.charCodeAt(s);
2766
+ u < 128 || t ? o(u) : u < 2048 ? (o(192 | u >>> 6), o(128 | 63 & u)) : u > 55295 && u < 57344 ? (o(240 | (u = 65536 + (1047552 & u) | 1023 & e.charCodeAt(++s)) >>> 18),
2767
+ o(128 | u >>> 12 & 63), o(128 | u >>> 6 & 63), o(128 | 63 & u)) : (o(224 | u >>> 12),
2768
+ o(128 | u >>> 6 & 63), o(128 | 63 & u));
2769
+ }
2770
+ return En(r, 0, i);
2771
+ }
2772
+
2773
+ !function(e) {
2774
+ e.GZipJS = "gzip-js", e.Base64 = "base64";
2775
+ }(Pn || (Pn = {}));
2776
+
2777
+ var Yn = function(e, t, n) {
2778
+ var r = t || {};
2779
+ r.ip = n.ip ? 1 : 0, r._ = (new Date).getTime().toString(), r.ver = m.LIB_VERSION;
2780
+ var i = e.split("?");
2781
+ if (i.length > 1) {
2782
+ var o, s = v(i[1].split("&"));
2783
+ try {
2784
+ for (s.s(); !(o = s.n()).done; ) {
2785
+ var a = o.value.split("=")[0];
2786
+ R(r[a]) || delete r[a];
2787
+ }
2788
+ } catch (e) {
2789
+ s.e(e);
2790
+ } finally {
2791
+ s.f();
2792
+ }
2793
+ }
2794
+ 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) {
2803
+ if (n.blob && t.buffer) return new Blob([ F(t) ? t : t.buffer ], {
2804
+ type: "text/plain"
2805
+ });
2806
+ if (n.sendBeacon || n.blob) {
2807
+ var r = e(t, {
2808
+ method: "POST"
2809
+ });
2810
+ return new Blob([ r ], {
2811
+ type: "application/x-www-form-urlencoded"
2812
+ });
2813
+ }
2814
+ return "POST" !== n.method ? null : (i = S(t) || F(t) ? "data=" + encodeURIComponent(t) : "data=" + encodeURIComponent(t.data),
2815
+ "compression" in t && t.compression && (i += "&compression=" + t.compression), i);
2816
+ 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, {
2820
+ retry_count: s
2821
+ }, {}));
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);
2836
+ }
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;
2851
+
2852
+ var Kn = function(e) {
2853
+ a(i, sn);
2854
+ var n = h(i);
2855
+ function i(e, t) {
2856
+ var o;
2857
+ 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() {
2860
+ o._handleWeAreNowOnline();
2861
+ })), D.addEventListener("offline", (function() {
2862
+ o.areWeOnline = !1;
2863
+ }))), o;
2864
+ }
2865
+ return o(i, [ {
2866
+ key: "enqueue",
2867
+ value: function(e) {
2868
+ var t = e.retriesPerformedSoFar || 0;
2869
+ if (!(t >= 10)) {
2870
+ 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);
2872
+ return Math.ceil(r + i);
2873
+ }(t), r = new Date(Date.now() + n);
2874
+ this.queue.push({
2875
+ retryAt: r,
2876
+ requestData: e
2877
+ });
2878
+ 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,
2880
+ this.poll());
2881
+ }
2882
+ }
2883
+ }, {
2884
+ key: "poll",
2885
+ value: function() {
2886
+ var e = this;
2887
+ this._poller && clearTimeout(this._poller), this._poller = setTimeout((function() {
2888
+ e.areWeOnline && e.queue.length > 0 && e.flush(), e.poll();
2889
+ }), this._pollInterval);
2890
+ }
2891
+ }, {
2892
+ key: "flush",
2893
+ value: function() {
2894
+ var e = new Date(Date.now()), t = this.queue.filter((function(t) {
2895
+ return t.retryAt < e;
2896
+ }));
2897
+ if (t.length > 0) {
2898
+ this.queue = this.queue.filter((function(t) {
2899
+ return t.retryAt >= e;
2900
+ }));
2901
+ var n, r = v(t);
2902
+ try {
2903
+ for (r.s(); !(n = r.n()).done; ) {
2904
+ var i = n.value.requestData;
2905
+ this._executeXhrRequest(i);
2906
+ }
2907
+ } catch (e) {
2908
+ r.e(e);
2909
+ } finally {
2910
+ r.f();
2911
+ }
2912
+ }
2913
+ }
2914
+ }, {
2915
+ key: "unload",
2916
+ value: function() {
2917
+ this._poller && (clearTimeout(this._poller), this._poller = void 0);
2918
+ var e, n = v(this.queue);
2919
+ try {
2920
+ for (n.s(); !(e = n.n()).done; ) {
2921
+ 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), {}, {
2924
+ sendBeacon: !0
2925
+ })));
2926
+ } catch (e) {
2927
+ H.error(e);
2928
+ }
2929
+ }
2930
+ } catch (e) {
2931
+ n.e(e);
2932
+ } finally {
2933
+ n.f();
2934
+ }
2935
+ this.queue = [];
2936
+ }
2937
+ }, {
2938
+ key: "_executeXhrRequest",
2939
+ value: function(e) {
2940
+ 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({
2942
+ url: t,
2943
+ data: n || {},
2944
+ options: r || {},
2945
+ headers: i || {},
2946
+ retriesPerformedSoFar: s || 0,
2947
+ callback: o,
2948
+ retryQueue: this,
2949
+ onXHRError: this.onXHRError,
2950
+ onResponse: this.rateLimiter.checkForLimiting
2951
+ });
2952
+ }
2953
+ }, {
2954
+ key: "_handleWeAreNowOnline",
2955
+ value: function() {
2956
+ this.areWeOnline = !0, this.flush();
2957
+ }
2958
+ } ]), i;
2959
+ }(), Zn = 1800, er = 60, tr = 864e5, nr = function() {
2960
+ function e(t, n, i, o) {
2961
+ r(this, e), s(this, "_sessionIdChangedHandlers", []), this.config = t, this.persistence = n,
2962
+ 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",
2967
+ this._primary_window_exists_storage_key = "ph_" + a + "_primary_window_exists",
2968
+ 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);
2971
+ }
2972
+ this._listenToReloadWindow();
2973
+ }
2974
+ return o(e, [ {
2975
+ key: "onSessionId",
2976
+ value: function(e) {
2977
+ var t = this;
2978
+ return R(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []),
2979
+ this._sessionIdChangedHandlers.push(e), this._sessionId && e(this._sessionId, this._windowId),
2980
+ function() {
2981
+ t._sessionIdChangedHandlers = t._sessionIdChangedHandlers.filter((function(t) {
2982
+ return t !== e;
2983
+ }));
2984
+ };
2985
+ }
2986
+ }, {
2987
+ key: "_canUseSessionStorage",
2988
+ value: function() {
2989
+ return "memory" !== this.config.persistence && !this.persistence.disabled && vt.is_supported();
2990
+ }
2991
+ }, {
2992
+ key: "_setWindowId",
2993
+ value: function(e) {
2994
+ e !== this._windowId && (this._windowId = e, this._canUseSessionStorage() && vt.set(this._window_id_storage_key, e));
2995
+ }
2996
+ }, {
2997
+ key: "_getWindowId",
2998
+ value: function() {
2999
+ return this._windowId ? this._windowId : this._canUseSessionStorage() ? vt.parse(this._window_id_storage_key) : null;
3000
+ }
3001
+ }, {
3002
+ key: "_setSessionId",
3003
+ value: function(e, t, n) {
3004
+ 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 ])));
3006
+ }
3007
+ }, {
3008
+ key: "_getSessionId",
3009
+ value: function() {
3010
+ if (this._sessionId && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [ this._sessionActivityTimestamp, this._sessionId, this._sessionStartTimestamp ];
3011
+ var e = this.persistence.props[Oe];
3012
+ return S(e) && 2 === e.length && e.push(e[0]), e || [ 0, null, 0 ];
3013
+ }
3014
+ }, {
3015
+ key: "resetSessionId",
3016
+ value: function() {
3017
+ this._setSessionId(null, null, null);
3018
+ }
3019
+ }, {
3020
+ key: "_listenToReloadWindow",
3021
+ value: function() {
3022
+ var e = this;
3023
+ null == D || D.addEventListener("beforeunload", (function() {
3024
+ e._canUseSessionStorage() && vt.remove(e._primary_window_exists_storage_key);
3025
+ }));
3026
+ }
3027
+ }, {
3028
+ key: "checkAndGetSessionAndWindowId",
3029
+ 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) {
3035
+ return e(i, s);
3036
+ })), {
3037
+ sessionId: i,
3038
+ windowId: s,
3039
+ sessionStartTimestamp: h
3040
+ };
3041
+ }
3042
+ } ]), e;
3043
+ }(), rr = o((function e(t, n, i, o) {
3044
+ r(this, e), this.name = "posthog-js", this.setupOnce = function(e) {
3045
+ e((function(e) {
3046
+ var r, s, a, u, l;
3047
+ if ("error" !== e.level || !t.__loaded) return e;
3048
+ 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({
3051
+ withTimestamp: !0
3052
+ }));
3053
+ var d = (null === (r = e.exception) || void 0 === r ? void 0 : r.values) || [], h = {
3054
+ $exception_message: null === (s = d[0]) || void 0 === s ? void 0 : s.value,
3055
+ $exception_type: null === (a = d[0]) || void 0 === a ? void 0 : a.type,
3056
+ $exception_personURL: c + "/person/" + t.get_distinct_id(),
3057
+ $sentry_event_id: e.event_id,
3058
+ $sentry_exception: e.exception,
3059
+ $sentry_exception_message: null === (u = d[0]) || void 0 === u ? void 0 : u.value,
3060
+ $sentry_exception_type: null === (l = d[0]) || void 0 === l ? void 0 : l.type,
3061
+ $sentry_tags: e.tags
3062
+ };
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;
3065
+ }));
3066
+ };
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;
3102
+ 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();
3106
+ 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),
3108
+ o.lastContentY = u, o.maxContentY = Math.max(u, null !== (r = o.maxContentY) && void 0 !== r ? r : 0),
3109
+ o.maxContentHeight = Math.max(l, null !== (i = o.maxContentHeight) && void 0 !== i ? i : 0);
3110
+ }));
3111
+ }
3112
+ return o(e, [ {
3113
+ key: "_createPageViewData",
3114
+ value: function() {
3115
+ var e;
3116
+ return {
3117
+ pathname: null !== (e = null == D ? void 0 : D.location.pathname) && void 0 !== e ? e : ""
3118
+ };
3119
+ }
3120
+ }, {
3121
+ key: "doPageView",
3122
+ value: function() {
3123
+ var e, n;
3124
+ return this._hasSeenPageView ? (n = this._pageViewData, this._pageViewData = this._createPageViewData()) : (this._hasSeenPageView = !0,
3125
+ n = void 0, this._pageViewData || (this._pageViewData = this._createPageViewData())),
3126
+ setTimeout(this._updateScrollData, 0), t({
3127
+ $prev_pageview_pathname: null === (e = n) || void 0 === e ? void 0 : e.pathname
3128
+ }, this._calculatePrevPageScrollProperties(n));
3129
+ }
3130
+ }, {
3131
+ key: "doPageLeave",
3132
+ value: function() {
3133
+ var e = this._pageViewData;
3134
+ return t({
3135
+ $prev_pageview_pathname: null == e ? void 0 : e.pathname
3136
+ }, this._calculatePrevPageScrollProperties(e));
3137
+ }
3138
+ }, {
3139
+ key: "_calculatePrevPageScrollProperties",
3140
+ value: function(e) {
3141
+ if (!e || null == e.maxScrollHeight || null == e.lastScrollY || null == e.maxScrollY || null == e.maxContentHeight || null == e.lastContentY || null == e.maxContentY) return {};
3142
+ var t = e.maxScrollHeight, n = e.lastScrollY, r = e.maxScrollY, i = e.maxContentHeight, o = e.lastContentY, s = e.maxContentY;
3143
+ return t = Math.ceil(t), n = Math.ceil(n), r = Math.ceil(r), i = Math.ceil(i), o = Math.ceil(o),
3144
+ s = Math.ceil(s), {
3145
+ $prev_pageview_last_scroll: n,
3146
+ $prev_pageview_last_scroll_percentage: t <= 1 ? 1 : sr(n / t, 0, 1),
3147
+ $prev_pageview_max_scroll: r,
3148
+ $prev_pageview_max_scroll_percentage: t <= 1 ? 1 : sr(r / t, 0, 1),
3149
+ $prev_pageview_last_content: o,
3150
+ $prev_pageview_last_content_percentage: i <= 1 ? 1 : sr(o / i, 0, 1),
3151
+ $prev_pageview_max_content: s,
3152
+ $prev_pageview_max_content_percentage: i <= 1 ? 1 : sr(s / i, 0, 1)
3153
+ };
3154
+ }
3155
+ }, {
3156
+ key: "startMeasuringScrollPosition",
3157
+ 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);
3160
+ }
3161
+ }, {
3162
+ key: "stopMeasuringScrollPosition",
3163
+ 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);
3166
+ }
3167
+ }, {
3168
+ key: "_scrollHeight",
3169
+ value: function() {
3170
+ return D ? Math.max(0, D.document.documentElement.scrollHeight - D.document.documentElement.clientHeight) : 0;
3171
+ }
3172
+ }, {
3173
+ key: "_scrollY",
3174
+ value: function() {
3175
+ return D && (D.scrollY || D.pageYOffset || D.document.documentElement.scrollTop) || 0;
3176
+ }
3177
+ }, {
3178
+ key: "_contentHeight",
3179
+ value: function() {
3180
+ return (null == D ? void 0 : D.document.documentElement.scrollHeight) || 0;
3181
+ }
3182
+ }, {
3183
+ key: "_contentY",
3184
+ value: function() {
3185
+ var e = (null == D ? void 0 : D.document.documentElement.clientHeight) || 0;
3186
+ return this._scrollY() + e;
3187
+ }
3188
+ } ]), e;
3189
+ }();
3190
+
3191
+ function sr(e, t, n) {
3192
+ return Math.max(t, Math.min(e, n));
3193
+ }
3194
+
3195
+ var ar, ur, lr, cr = {
3196
+ icontains: function(e) {
3197
+ return !!D && D.location.href.toLowerCase().indexOf(e.toLowerCase()) > -1;
3198
+ },
3199
+ regex: function(e) {
3200
+ return !!D && bt(D.location.href, e);
3201
+ },
3202
+ exact: function(e) {
3203
+ return (null == D ? void 0 : D.location.href) === e;
3204
+ }
3205
+ }, dr = function() {
3206
+ function e(t) {
3207
+ r(this, e), this.instance = t;
3208
+ }
3209
+ return o(e, [ {
3210
+ key: "getSurveys",
3211
+ value: function(e) {
3212
+ var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], r = this.instance.get_property(qe);
3213
+ 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), {}, {
3215
+ method: "GET"
3216
+ }, (function(n) {
3217
+ var r, i = n.surveys || [];
3218
+ return null === (r = t.instance.persistence) || void 0 === r || r.register(s({}, qe, i)),
3219
+ e(i);
3220
+ }));
3221
+ }
3222
+ }, {
3223
+ key: "getActiveMatchingSurveys",
3224
+ value: function(e) {
3225
+ var t = this, n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3226
+ this.getSurveys((function(n) {
3227
+ var r = n.filter((function(e) {
3228
+ return !(!e.start_date || e.end_date);
3229
+ })).filter((function(e) {
3230
+ var t, n, r, i;
3231
+ 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));
3233
+ return o && s;
3234
+ })).filter((function(e) {
3235
+ if (!e.linked_flag_key && !e.targeting_flag_key) return !0;
3236
+ var n = !e.linked_flag_key || t.instance.featureFlags.isFeatureEnabled(e.linked_flag_key), r = !e.targeting_flag_key || t.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key);
3237
+ return n && r;
3238
+ }));
3239
+ return e(r);
3240
+ }), n);
3241
+ }
3242
+ } ]), e;
3243
+ }(), hr = 6e4, fr = function() {
3244
+ function e() {
3245
+ var t = this;
3246
+ r(this, e), s(this, "limits", {}), s(this, "checkForLimiting", (function(e) {
3247
+ try {
3248
+ var n = e.responseText;
3249
+ if (!n || !n.length) return;
3250
+ (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;
3252
+ }));
3253
+ } catch (e) {
3254
+ return void H.error(e);
3255
+ }
3256
+ }));
3257
+ }
3258
+ return o(e, [ {
3259
+ key: "isRateLimited",
3260
+ value: function(e) {
3261
+ var t = this.limits[e || "events"] || !1;
3262
+ return !1 !== t && (new Date).getTime() < t;
3263
+ }
3264
+ } ]), e;
3265
+ }(), pr = function() {
3266
+ return t({
3267
+ initialPathName: (null == D ? void 0 : D.location.pathname) || "",
3268
+ referringDomain: St.referringDomain()
3269
+ }, St.campaignParams());
3270
+ }, _r = function() {
3271
+ function e(t, n, i) {
3272
+ var o = this;
3273
+ r(this, e), s(this, "_onSessionIdCallback", (function(e) {
3274
+ var t = o._getStoredProps();
3275
+ if (!t || t.sessionId !== e) {
3276
+ var n = {
3277
+ sessionId: e,
3278
+ props: o._sessionSourceParamGenerator()
3279
+ };
3280
+ o._persistence.register(s({}, je, n));
3281
+ }
3282
+ })), this._sessionIdManager = t, this._persistence = n, this._sessionSourceParamGenerator = i || pr,
3283
+ this._sessionIdManager.onSessionId(this._onSessionIdCallback);
3284
+ }
3285
+ return o(e, [ {
3286
+ key: "_getStoredProps",
3287
+ value: function() {
3288
+ return this._persistence.props[je];
3289
+ }
3290
+ }, {
3291
+ key: "getSessionProps",
3292
+ value: function() {
3293
+ var e, t = null === (e = this._getStoredProps()) || void 0 === e ? void 0 : e.props;
3294
+ return t ? {
3295
+ $client_session_initial_referring_host: t.referringDomain,
3296
+ $client_session_initial_pathname: t.initialPathName,
3297
+ $client_session_initial_utm_source: t.utm_source,
3298
+ $client_session_initial_utm_campaign: t.utm_campaign,
3299
+ $client_session_initial_utm_medium: t.utm_medium,
3300
+ $client_session_initial_utm_content: t.utm_content,
3301
+ $client_session_initial_utm_term: t.utm_term
3302
+ } : {};
3303
+ }
3304
+ } ]), 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) {
3306
+ if (!e) return !1;
3307
+ var n = e.toLowerCase();
3308
+ return gr.concat(t || []).some((function(e) {
3309
+ var t = e.toLowerCase();
3310
+ return n.includes ? n.includes(t) : -1 !== n.indexOf(t);
3311
+ }));
3312
+ };
3313
+
3314
+ !function(e) {
3315
+ e[e.INIT_MODULE = 0] = "INIT_MODULE", e[e.INIT_SNIPPET = 1] = "INIT_SNIPPET";
3316
+ }(ar || (ar = {}));
3317
+
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() {
3319
+ var e, t, n;
3320
+ return {
3321
+ api_host: "https://app.posthog.com",
3322
+ api_method: "POST",
3323
+ api_transport: "XHR",
3324
+ ui_host: null,
3325
+ token: "",
3326
+ autocapture: !0,
3327
+ rageclick: !0,
3328
+ cross_subdomain_cookie: (t = null == B ? void 0 : B.location, n = null == t ? void 0 : t.hostname,
3329
+ !!E(n) && "herokuapp.com" !== n.split(".").slice(-2).join(".")),
3330
+ persistence: "localStorage+cookie",
3331
+ persistence_name: "",
3332
+ cookie_name: "",
3333
+ loaded: mr,
3334
+ store_google: !0,
3335
+ custom_campaign_params: [],
3336
+ custom_blocked_useragents: [],
3337
+ save_referrer: !0,
3338
+ capture_pageview: !0,
3339
+ capture_pageleave: !0,
3340
+ debug: !1,
3341
+ verbose: !1,
3342
+ cookie_expiration: 365,
3343
+ upgrade: !1,
3344
+ disable_session_recording: !1,
3345
+ disable_persistence: !1,
3346
+ disable_cookie: !1,
3347
+ enable_recording_console_log: void 0,
3348
+ secure_cookie: "https:" === (null == D || null === (e = D.location) || void 0 === e ? void 0 : e.protocol),
3349
+ ip: !0,
3350
+ opt_out_capturing_by_default: !1,
3351
+ opt_out_persistence_by_default: !1,
3352
+ opt_out_capturing_persistence_type: "localStorage",
3353
+ opt_out_capturing_cookie_prefix: null,
3354
+ opt_in_site_apps: !1,
3355
+ property_blacklist: [],
3356
+ respect_dnt: !1,
3357
+ sanitize_properties: null,
3358
+ xhr_headers: {},
3359
+ inapp_protocol: "//",
3360
+ inapp_link_new_window: !1,
3361
+ request_batching: !0,
3362
+ properties_string_max_length: 65535,
3363
+ session_recording: {},
3364
+ mask_all_element_attributes: !1,
3365
+ mask_all_text: !1,
3366
+ advanced_disable_decide: !1,
3367
+ advanced_disable_feature_flags: !1,
3368
+ advanced_disable_feature_flags_on_first_load: !1,
3369
+ 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);
3373
+ },
3374
+ get_device_id: function(e) {
3375
+ return e;
3376
+ },
3377
+ _onCapture: mr,
3378
+ capture_performance: void 0,
3379
+ name: "posthog",
3380
+ callback_fn: "posthog._jsc",
3381
+ bootstrap: {},
3382
+ disable_compression: !1,
3383
+ session_idle_timeout_seconds: 1800
3384
+ };
3385
+ }, Fr = function(e, t, n, r) {
3386
+ var i, o = n !== br && lr ? n ? lr[n] : void 0 : lr, s = {
3387
+ initComplete: !1,
3388
+ syncCode: !1
3389
+ }, a = function(e) {
3390
+ return function(t) {
3391
+ s[e] || (s[e] = !0, s.initComplete && s.syncCode && (null == r || r(t)));
3392
+ };
3393
+ };
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;
3397
+ }
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) {
3401
+ 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."));
3405
+ }
3406
+ return m.DEBUG = m.DEBUG || i.config.debug, !R(o) && S(o) && (i._execute_array.call(i.people, o.people),
3407
+ i._execute_array(o)), a("syncCode")(i), i;
3408
+ }, Pr = function() {
3409
+ function e() {
3410
+ r(this, e), s(this, "__forceAllowLocalhost", !1);
3411
+ }
3412
+ return o(e, [ {
3413
+ key: "_forceAllowLocalhost",
3414
+ get: function() {
3415
+ return this.__forceAllowLocalhost;
3416
+ },
3417
+ set: function(e) {
3418
+ H.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),
3419
+ this.__forceAllowLocalhost = e;
3420
+ }
3421
+ } ]), e;
3422
+ }(), Ir = function() {
3423
+ function e() {
3424
+ 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);
3428
+ }, this.__captureHooks = [], this.__request_queue = [], this.__loaded = !1, this.__loaded_recorder_version = void 0,
3429
+ 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 = {
3433
+ set: function(e, n, r) {
3434
+ var i = E(e) ? s({}, e, n) : e;
3435
+ t.setPersonProperties(i), null == r || r({});
3436
+ },
3437
+ set_once: function(e, n, r) {
3438
+ var i = E(e) ? s({}, e, n) : e;
3439
+ t.setPersonProperties(void 0, i), null == r || r({});
3440
+ }
3441
+ };
3442
+ }
3443
+ return o(e, [ {
3444
+ key: "init",
3445
+ 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();
3450
+ }));
3451
+ return lr[n] = r, r;
3452
+ }
3453
+ H.critical("You must initialize the main posthog object right after you include the PostHog js snippet");
3454
+ }
3455
+ }
3456
+ }, {
3457
+ key: "_init",
3458
+ value: function(e) {
3459
+ var n, r, i, o = this, s = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, a = arguments.length > 2 ? arguments[2] : void 0, u = arguments.length > 3 ? arguments[3] : void 0;
3460
+ this.__loaded = !0, this.config = {}, this._triggered_notifs = [];
3461
+ var l, c = {
3462
+ segmentRegister: !1,
3463
+ syncCode: !1
3464
+ }, d = function(e) {
3465
+ return function() {
3466
+ c[e] || (c[e] = !0, c.segmentRegister && c.syncCode && (null == u || u(o)));
3467
+ };
3468
+ };
3469
+ (this.set_config(z({}, Sr(), s, {
3470
+ name: a,
3471
+ 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), {}, {
3478
+ persistence: "sessionStorage"
3479
+ })), this._gdpr_init(), s.segment ? (this.config.get_device_id = function() {
3480
+ return s.segment.user().anonymousId();
3481
+ }, s.segment.user().id() && (this.register({
3482
+ distinct_id: s.segment.user().id()
3483
+ }), this.persistence.set_user_state("identified")), s.segment.register(this.segmentIntegration()).then(d("segmentRegister"))) : d("segmentRegister")(),
3484
+ 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"),
3487
+ this.register({
3488
+ distinct_id: s.bootstrap.distinctID,
3489
+ $device_id: _
3490
+ });
3491
+ }
3492
+ if (this._hasBootstrappedFeatureFlags()) {
3493
+ var g, v, m = Object.keys((null === (g = s.bootstrap) || void 0 === g ? void 0 : g.featureFlags) || {}).filter((function(e) {
3494
+ var t, n;
3495
+ return !(null === (t = s.bootstrap) || void 0 === t || null === (n = t.featureFlags) || void 0 === n || !n[e]);
3496
+ })).reduce((function(e, t) {
3497
+ var n, r;
3498
+ return e[t] = (null === (n = s.bootstrap) || void 0 === n || null === (r = n.featureFlags) || void 0 === r ? void 0 : r[t]) || !1,
3499
+ e;
3500
+ }), {}), y = Object.keys((null === (v = s.bootstrap) || void 0 === v ? void 0 : v.featureFlagPayloads) || {}).filter((function(e) {
3501
+ return m[e];
3502
+ })).reduce((function(e, t) {
3503
+ var n, r, i, o;
3504
+ null !== (n = s.bootstrap) && void 0 !== n && null !== (r = n.featureFlagPayloads) && void 0 !== r && r[t] && (e[t] = null === (i = s.bootstrap) || void 0 === i || null === (o = i.featureFlagPayloads) || void 0 === o ? void 0 : o[t]);
3505
+ return e;
3506
+ }), {});
3507
+ this.featureFlags.receivedFeatureFlags({
3508
+ featureFlags: m,
3509
+ featureFlagPayloads: y
3510
+ });
3511
+ }
3512
+ if (!this.get_distinct_id()) {
3513
+ var b = this.config.get_device_id(nt());
3514
+ this.register_once({
3515
+ distinct_id: b,
3516
+ $device_id: b
3517
+ }, ""), this.persistence.set_user_state("anonymous");
3518
+ }
3519
+ null == D || null === (i = D.addEventListener) || void 0 === i || i.call(D, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this)),
3520
+ d("syncCode")();
3521
+ }
3522
+ }, {
3523
+ key: "_afterDecideResponse",
3524
+ value: function(e) {
3525
+ var t;
3526
+ if (this.compression = {}, e.supportedCompression && !this.config.disable_compression) {
3527
+ var n, r = {}, i = v(e.supportedCompression);
3528
+ try {
3529
+ for (i.s(); !(n = i.n()).done; ) {
3530
+ r[n.value] = !0;
3531
+ }
3532
+ } catch (e) {
3533
+ i.e(e);
3534
+ } finally {
3535
+ i.f();
3536
+ }
3537
+ this.compression = r;
3538
+ }
3539
+ null !== (t = e.analytics) && void 0 !== t && t.endpoint && (this.analyticsDefaultEndpoint = e.analytics.endpoint),
3540
+ e.elementsChainAsString && (this.elementsChainAsString = e.elementsChainAsString);
3541
+ }
3542
+ }, {
3543
+ key: "_loaded",
3544
+ value: function() {
3545
+ var e = this.config.advanced_disable_decide;
3546
+ e || this.featureFlags.setReloadingPaused(!0);
3547
+ try {
3548
+ this.config.loaded(this);
3549
+ } catch (e) {
3550
+ H.critical("`loaded` function failed", e);
3551
+ }
3552
+ this._start_queue_if_opted_in(), this.config.capture_pageview && B && this.capture("$pageview", {
3553
+ title: B.title
3554
+ }, {
3555
+ send_instantly: !0
3556
+ }), e || (new Ut(this).call(), this.featureFlags.resetRequestQueue());
3557
+ }
3558
+ }, {
3559
+ key: "_start_queue_if_opted_in",
3560
+ value: function() {
3561
+ var e;
3562
+ this.has_opted_out_capturing() || this.config.request_batching && (null === (e = this._requestQueue) || void 0 === e || e.poll());
3563
+ }
3564
+ }, {
3565
+ key: "_dom_loaded",
3566
+ value: function() {
3567
+ var e = this;
3568
+ this.has_opted_out_capturing() || W(this.__request_queue, (function(t) {
3569
+ e._send_request.apply(e, p(t));
3570
+ })), this.__request_queue = [], this._start_queue_if_opted_in();
3571
+ }
3572
+ }, {
3573
+ key: "_prepare_callback",
3574
+ value: function(e, t) {
3575
+ if (R(e)) return null;
3576
+ if (kr) return function(n) {
3577
+ e(n, t);
3578
+ };
3579
+ var n = this._jsc, r = "" + Math.floor(1e8 * Math.random()), i = this.config.callback_fn + "[" + r + "]";
3580
+ return n[r] = function(i) {
3581
+ delete n[r], e(i, t);
3582
+ }, i;
3583
+ }
3584
+ }, {
3585
+ key: "_handle_unload",
3586
+ value: function() {
3587
+ var e, t;
3588
+ this.config.request_batching ? (this.config.capture_pageview && this.config.capture_pageleave && this.capture("$pageleave"),
3589
+ null === (e = this._requestQueue) || void 0 === e || e.unload(), null === (t = this._retryQueue) || void 0 === t || t.unload()) : this.config.capture_pageview && this.config.capture_pageleave && this.capture("$pageleave", null, {
3590
+ transport: "sendBeacon"
3591
+ });
3592
+ }
3593
+ }, {
3594
+ key: "_handle_queued_event",
3595
+ value: function(e, t, n) {
3596
+ var r = JSON.stringify(t);
3597
+ this.__compress_and_send_json_request(e, r, n || yr, mr);
3598
+ }
3599
+ }, {
3600
+ key: "__compress_and_send_json_request",
3601
+ value: function(e, n, r, i) {
3602
+ var o = function(e, n, r) {
3603
+ return e === Pn.GZipJS ? [ Gn(zn(n), {
3604
+ mtime: 0
3605
+ }), t(t({}, r), {}, {
3606
+ blob: !0,
3607
+ urlQueryArgs: {
3608
+ compression: Pn.GZipJS
3609
+ }
3610
+ }) ] : [ {
3611
+ data: ne(n)
3612
+ }, r ];
3613
+ }(this.compression[Pn.GZipJS] ? Pn.GZipJS : Pn.Base64, n, r), s = f(o, 2), a = s[0], u = s[1];
3614
+ this._send_request(e, a, u, i);
3615
+ }
3616
+ }, {
3617
+ key: "_send_request",
3618
+ 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 {
3620
+ var o = {
3621
+ method: this.config.api_method,
3622
+ transport: this.config.api_transport,
3623
+ verbose: this.config.verbose
3624
+ };
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 || {}, {
3628
+ ip: this.config.ip
3629
+ }), s) try {
3630
+ null == D || D.navigator.sendBeacon(e, Qn(n, t(t({}, r), {}, {
3631
+ sendBeacon: !0
3632
+ })));
3633
+ } catch (e) {} else if (kr || !B) try {
3634
+ Jn({
3635
+ url: e,
3636
+ data: n,
3637
+ headers: this.config.xhr_headers,
3638
+ options: r,
3639
+ callback: i,
3640
+ retriesPerformedSoFar: 0,
3641
+ retryQueue: this._retryQueue,
3642
+ onXHRError: this.config.on_xhr_error,
3643
+ onResponse: this.rateLimiter.checkForLimiting
3644
+ });
3645
+ } catch (e) {
3646
+ H.error(e);
3647
+ } else {
3648
+ var a, u = B.createElement("script");
3649
+ u.type = "text/javascript", u.async = !0, u.defer = !0, u.src = e;
3650
+ var l = B.getElementsByTagName("script")[0];
3651
+ null === (a = l.parentNode) || void 0 === a || a.insertBefore(u, l);
3652
+ }
3653
+ }
3654
+ }
3655
+ }, {
3656
+ key: "_execute_array",
3657
+ value: function(e) {
3658
+ 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));
3661
+ }));
3662
+ var s = function(e, t) {
3663
+ W(e, (function(e) {
3664
+ if (S(e[0])) {
3665
+ var n = t;
3666
+ G(e, (function(e) {
3667
+ n = n[e[0]].apply(n, e.slice(1));
3668
+ }));
3669
+ } else this[e[0]].apply(this, e.slice(1));
3670
+ }), t);
3671
+ };
3672
+ s(r, this), s(i, this), s(o, this);
3673
+ }
3674
+ }, {
3675
+ key: "_hasBootstrappedFeatureFlags",
3676
+ value: function() {
3677
+ var e, t;
3678
+ return (null === (e = this.config.bootstrap) || void 0 === e ? void 0 : e.featureFlags) && Object.keys(null === (t = this.config.bootstrap) || void 0 === t ? void 0 : t.featureFlags).length > 0 || !1;
3679
+ }
3680
+ }, {
3681
+ key: "push",
3682
+ value: function(e) {
3683
+ this._execute_array([ e ]);
3684
+ }
3685
+ }, {
3686
+ key: "capture",
3687
+ 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)) {
3708
+ this.sessionPersistence.update_search_keyword(), this.config.store_google && this.sessionPersistence.update_campaign_params(),
3709
+ this.config.save_referrer && this.sessionPersistence.update_referrer_info();
3710
+ var o = {
3711
+ uuid: nt(),
3712
+ event: e,
3713
+ properties: this._calculate_event_properties(e, n || {})
3714
+ };
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;
3721
+ }
3722
+ } else H.error("No event name provided to posthog.capture");
3723
+ }
3724
+ }
3725
+ }, {
3726
+ key: "_addCaptureHook",
3727
+ value: function(e) {
3728
+ this.__captureHooks.push(e);
3729
+ }
3730
+ }, {
3731
+ key: "_invokeCaptureHooks",
3732
+ value: function(e, t) {
3733
+ this.config._onCapture(e, t), G(this.__captureHooks, (function(t) {
3734
+ return t(e);
3735
+ }));
3736
+ }
3737
+ }, {
3738
+ key: "_calculate_event_properties",
3739
+ value: function(e, n) {
3740
+ if (!this.persistence || !this.sessionPersistence) return n;
3741
+ var r = this.persistence.remove_event_timer(e), i = t({}, n);
3742
+ if (i.token = this.config.token, "$snapshot" === e) {
3743
+ var o = t(t({}, this.persistence.properties()), this.sessionPersistence.properties());
3744
+ return i.distinct_id = o.distinct_id, i;
3745
+ }
3746
+ var s = St.properties();
3747
+ if (this.sessionManager) {
3748
+ var a = this.sessionManager.checkAndGetSessionAndWindowId(), u = a.sessionId, l = a.windowId;
3749
+ i.$session_id = u, i.$window_id = l;
3750
+ }
3751
+ if (this.sessionPropsManager && this.config.__preview_send_client_session_params && ("$pageview" === e || "$pageleave" === e || "$autocapture" === e)) {
3752
+ var c = this.sessionPropsManager.getSessionProps();
3753
+ i = z(i, c);
3754
+ }
3755
+ if (this.config.__preview_measure_pageview_stats) {
3756
+ var d = {};
3757
+ "$pageview" === e ? d = this.pageViewManager.doPageView() : "$pageleave" === e && (d = this.pageViewManager.doPageLeave()),
3758
+ i = z(i, d);
3759
+ }
3760
+ 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;
3763
+ }
3764
+ if (!R(r)) {
3765
+ var f = (new Date).getTime() - r;
3766
+ i.$duration = parseFloat((f / 1e3).toFixed(3));
3767
+ }
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) {
3771
+ delete i[e];
3772
+ })) : H.error("Invalid value for property_blacklist config: " + p);
3773
+ var _ = this.config.sanitize_properties;
3774
+ return _ && (i = _(i, e)), i;
3775
+ }
3776
+ }, {
3777
+ key: "register",
3778
+ value: function(e, t) {
3779
+ var n;
3780
+ null === (n = this.persistence) || void 0 === n || n.register(e, t);
3781
+ }
3782
+ }, {
3783
+ key: "register_once",
3784
+ value: function(e, t, n) {
3785
+ var r;
3786
+ null === (r = this.persistence) || void 0 === r || r.register_once(e, t, n);
3787
+ }
3788
+ }, {
3789
+ key: "register_for_session",
3790
+ value: function(e) {
3791
+ var t;
3792
+ null === (t = this.sessionPersistence) || void 0 === t || t.register(e);
3793
+ }
3794
+ }, {
3795
+ key: "unregister",
3796
+ value: function(e) {
3797
+ var t;
3798
+ null === (t = this.persistence) || void 0 === t || t.unregister(e);
3799
+ }
3800
+ }, {
3801
+ key: "unregister_for_session",
3802
+ value: function(e) {
3803
+ var t;
3804
+ null === (t = this.sessionPersistence) || void 0 === t || t.unregister(e);
3805
+ }
3806
+ }, {
3807
+ key: "_register_single",
3808
+ value: function(e, t) {
3809
+ this.register(s({}, e, t));
3810
+ }
3811
+ }, {
3812
+ key: "getFeatureFlag",
3813
+ value: function(e, t) {
3814
+ return this.featureFlags.getFeatureFlag(e, t);
3815
+ }
3816
+ }, {
3817
+ key: "getFeatureFlagPayload",
3818
+ value: function(e) {
3819
+ var t = this.featureFlags.getFeatureFlagPayload(e);
3820
+ try {
3821
+ return JSON.parse(t);
3822
+ } catch (e) {
3823
+ return t;
3824
+ }
3825
+ }
3826
+ }, {
3827
+ key: "isFeatureEnabled",
3828
+ value: function(e, t) {
3829
+ return this.featureFlags.isFeatureEnabled(e, t);
3830
+ }
3831
+ }, {
3832
+ key: "reloadFeatureFlags",
3833
+ value: function() {
3834
+ this.featureFlags.reloadFeatureFlags();
3835
+ }
3836
+ }, {
3837
+ key: "updateEarlyAccessFeatureEnrollment",
3838
+ value: function(e, t) {
3839
+ this.featureFlags.updateEarlyAccessFeatureEnrollment(e, t);
3840
+ }
3841
+ }, {
3842
+ key: "getEarlyAccessFeatures",
3843
+ value: function(e) {
3844
+ var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3845
+ return this.featureFlags.getEarlyAccessFeatures(e, t);
3846
+ }
3847
+ }, {
3848
+ key: "onFeatureFlags",
3849
+ value: function(e) {
3850
+ return this.featureFlags.onFeatureFlags(e);
3851
+ }
3852
+ }, {
3853
+ key: "onSessionId",
3854
+ value: function(e) {
3855
+ var t, n;
3856
+ return null !== (t = null === (n = this.sessionManager) || void 0 === n ? void 0 : n.onSessionId(e)) && void 0 !== t ? t : function() {};
3857
+ }
3858
+ }, {
3859
+ key: "getSurveys",
3860
+ value: function(e) {
3861
+ var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3862
+ this.surveys.getSurveys(e, t);
3863
+ }
3864
+ }, {
3865
+ key: "getActiveMatchingSurveys",
3866
+ value: function(e) {
3867
+ var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
3868
+ this.surveys.getActiveMatchingSurveys(e, t);
3869
+ }
3870
+ }, {
3871
+ key: "identify",
3872
+ 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 {
3875
+ var r = this.get_distinct_id();
3876
+ if (this.register({
3877
+ $user_id: e
3878
+ }), !this.get_property("$device_id")) {
3879
+ var i = r;
3880
+ this.register_once({
3881
+ $had_persisted_distinct_id: !0,
3882
+ $device_id: i
3883
+ }, "");
3884
+ }
3885
+ e !== r && e !== this.get_property(Fe) && (this.unregister(Fe), this.register({
3886
+ distinct_id: e
3887
+ }));
3888
+ var o = "anonymous" === this.persistence.get_user_state();
3889
+ e !== r && o ? (this.persistence.set_user_state("identified"), this.setPersonPropertiesForFlags(t || {}, !1),
3890
+ this.capture("$identify", {
3891
+ distinct_id: e,
3892
+ $anon_distinct_id: r
3893
+ }, {
3894
+ $set: t || {},
3895
+ $set_once: n || {}
3896
+ }), 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");
3899
+ }
3900
+ }, {
3901
+ key: "setPersonProperties",
3902
+ value: function(e, t) {
3903
+ (e || t) && (this.setPersonPropertiesForFlags(e || {}), this.capture("$set", {
3904
+ $set: e || {},
3905
+ $set_once: t || {}
3906
+ }));
3907
+ }
3908
+ }, {
3909
+ key: "group",
3910
+ value: function(e, n, r) {
3911
+ if (e && n) {
3912
+ var i = this.getGroups();
3913
+ i[e] !== n && this.resetGroupPropertiesForFlags(e), this.register({
3914
+ $groups: t(t({}, i), {}, s({}, e, n))
3915
+ }), r && (this.capture("$groupidentify", {
3916
+ $group_type: e,
3917
+ $group_key: n,
3918
+ $group_set: r
3919
+ }), this.setGroupPropertiesForFlags(s({}, e, r))), i[e] === n || r || this.reloadFeatureFlags();
3920
+ } else H.error("posthog.group requires a group type and group key");
3921
+ }
3922
+ }, {
3923
+ key: "resetGroups",
3924
+ value: function() {
3925
+ this.register({
3926
+ $groups: {}
3927
+ }), this.resetGroupPropertiesForFlags(), this.reloadFeatureFlags();
3928
+ }
3929
+ }, {
3930
+ key: "setPersonPropertiesForFlags",
3931
+ value: function(e) {
3932
+ var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
3933
+ this.featureFlags.setPersonPropertiesForFlags(e, t);
3934
+ }
3935
+ }, {
3936
+ key: "resetPersonPropertiesForFlags",
3937
+ value: function() {
3938
+ this.featureFlags.resetPersonPropertiesForFlags();
3939
+ }
3940
+ }, {
3941
+ key: "setGroupPropertiesForFlags",
3942
+ value: function(e) {
3943
+ var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];
3944
+ this.featureFlags.setGroupPropertiesForFlags(e, t);
3945
+ }
3946
+ }, {
3947
+ key: "resetGroupPropertiesForFlags",
3948
+ value: function(e) {
3949
+ this.featureFlags.resetGroupPropertiesForFlags(e);
3950
+ }
3951
+ }, {
3952
+ key: "reset",
3953
+ value: function(e) {
3954
+ var t, n, r, i;
3955
+ if (!this.__loaded) return H.uninitializedWarning("posthog.reset");
3956
+ var o = this.get_property("$device_id");
3957
+ null === (t = this.persistence) || void 0 === t || t.clear(), null === (n = this.sessionPersistence) || void 0 === n || n.clear(),
3958
+ null === (r = this.persistence) || void 0 === r || r.set_user_state("anonymous"),
3959
+ null === (i = this.sessionManager) || void 0 === i || i.resetSessionId();
3960
+ var s = this.config.get_device_id(nt());
3961
+ this.register_once({
3962
+ distinct_id: s,
3963
+ $device_id: e ? s : o
3964
+ }, "");
3965
+ }
3966
+ }, {
3967
+ key: "get_distinct_id",
3968
+ value: function() {
3969
+ return this.get_property("distinct_id");
3970
+ }
3971
+ }, {
3972
+ key: "getGroups",
3973
+ value: function() {
3974
+ return this.get_property("$groups") || {};
3975
+ }
3976
+ }, {
3977
+ key: "get_session_id",
3978
+ value: function() {
3979
+ var e, t;
3980
+ return null !== (e = null === (t = this.sessionManager) || void 0 === t ? void 0 : t.checkAndGetSessionAndWindowId(!0).sessionId) && void 0 !== e ? e : "";
3981
+ }
3982
+ }, {
3983
+ key: "get_session_replay_url",
3984
+ value: function(e) {
3985
+ 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);
3992
+ }
3993
+ return o;
3994
+ }
3995
+ }, {
3996
+ key: "alias",
3997
+ 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),
4000
+ this.capture("$create_alias", {
4001
+ alias: e,
4002
+ distinct_id: t
4003
+ })) : (H.warn("alias matches current distinct_id - skipping api call."), this.identify(e),
4004
+ -1));
4005
+ }
4006
+ }, {
4007
+ key: "set_config",
4008
+ 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),
4011
+ 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()));
4016
+ }
4017
+ }, {
4018
+ key: "startSessionRecording",
4019
+ value: function() {
4020
+ this.set_config({
4021
+ disable_session_recording: !1
4022
+ });
4023
+ }
4024
+ }, {
4025
+ key: "stopSessionRecording",
4026
+ value: function() {
4027
+ this.set_config({
4028
+ disable_session_recording: !0
4029
+ });
4030
+ }
4031
+ }, {
4032
+ key: "sessionRecordingStarted",
4033
+ value: function() {
4034
+ var e;
4035
+ return !(null === (e = this.sessionRecording) || void 0 === e || !e.started);
4036
+ }
4037
+ }, {
4038
+ key: "loadToolbar",
4039
+ value: function(e) {
4040
+ return this.toolbar.loadToolbar(e);
4041
+ }
4042
+ }, {
4043
+ key: "get_property",
4044
+ value: function(e) {
4045
+ var t;
4046
+ return null === (t = this.persistence) || void 0 === t ? void 0 : t.props[e];
4047
+ }
4048
+ }, {
4049
+ key: "getSessionProperty",
4050
+ value: function(e) {
4051
+ var t;
4052
+ return null === (t = this.sessionPersistence) || void 0 === t ? void 0 : t.props[e];
4053
+ }
4054
+ }, {
4055
+ key: "toString",
4056
+ value: function() {
4057
+ var e, t = null !== (e = this.config.name) && void 0 !== e ? e : br;
4058
+ return t !== br && (t = br + "." + t), t;
4059
+ }
4060
+ }, {
4061
+ key: "_gdpr_init",
4062
+ value: function() {
4063
+ "localStorage" === this.config.opt_out_capturing_persistence_type && dt.is_supported() && (!this.has_opted_in_capturing() && this.has_opted_in_capturing({
4064
+ persistence_type: "cookie"
4065
+ }) && this.opt_in_capturing({
4066
+ enable_persistence: !1
4067
+ }), !this.has_opted_out_capturing() && this.has_opted_out_capturing({
4068
+ persistence_type: "cookie"
4069
+ }) && this.opt_out_capturing({
4070
+ clear_persistence: !1
4071
+ }), this.clear_opt_in_out_capturing({
4072
+ persistence_type: "cookie",
4073
+ enable_persistence: !1
4074
+ })), this.has_opted_out_capturing() ? this._gdpr_update_persistence({
4075
+ clear_persistence: !0
4076
+ }) : this.has_opted_in_capturing() || !this.config.opt_out_capturing_by_default && !lt.get("ph_optout") || (lt.remove("ph_optout"),
4077
+ this.opt_out_capturing({
4078
+ clear_persistence: this.config.opt_out_persistence_by_default
4079
+ }));
4080
+ }
4081
+ }, {
4082
+ key: "_gdpr_update_persistence",
4083
+ value: function(e) {
4084
+ var t, n, r, i, o;
4085
+ if (e && e.clear_persistence) r = !0; else {
4086
+ if (!e || !e.enable_persistence) return;
4087
+ r = !1;
4088
+ }
4089
+ this.config.disable_persistence || (null === (t = this.persistence) || void 0 === t ? void 0 : t.disabled) === r || (null === (i = this.persistence) || void 0 === i || i.set_disabled(r));
4090
+ this.config.disable_persistence || (null === (n = this.sessionPersistence) || void 0 === n ? void 0 : n.disabled) === r || (null === (o = this.sessionPersistence) || void 0 === o || o.set_disabled(r));
4091
+ }
4092
+ }, {
4093
+ key: "_gdpr_call_func",
4094
+ value: function(e, t) {
4095
+ return t = z({
4096
+ capture: this.capture.bind(this),
4097
+ persistence_type: this.config.opt_out_capturing_persistence_type,
4098
+ cookie_prefix: this.config.opt_out_capturing_cookie_prefix,
4099
+ cookie_expiration: this.config.cookie_expiration,
4100
+ cross_subdomain_cookie: this.config.cross_subdomain_cookie,
4101
+ secure_cookie: this.config.secure_cookie
4102
+ }, t || {}), dt.is_supported() || "localStorage" !== t.persistence_type || (t.persistence_type = "cookie"),
4103
+ e(this.config.token, {
4104
+ capture: t.capture,
4105
+ captureEventName: t.capture_event_name,
4106
+ captureProperties: t.capture_properties,
4107
+ persistenceType: t.persistence_type,
4108
+ persistencePrefix: t.cookie_prefix,
4109
+ cookieExpiration: t.cookie_expiration,
4110
+ crossSubdomainCookie: t.cross_subdomain_cookie,
4111
+ secureCookie: t.secure_cookie
4112
+ });
4113
+ }
4114
+ }, {
4115
+ key: "opt_in_capturing",
4116
+ value: function(e) {
4117
+ e = z({
4118
+ enable_persistence: !0
4119
+ }, e || {}), this._gdpr_call_func(Jt, e), this._gdpr_update_persistence(e);
4120
+ }
4121
+ }, {
4122
+ key: "opt_out_capturing",
4123
+ value: function(e) {
4124
+ var t = z({
4125
+ clear_persistence: !0
4126
+ }, e || {});
4127
+ this._gdpr_call_func(Xt, t), this._gdpr_update_persistence(t);
4128
+ }
4129
+ }, {
4130
+ key: "has_opted_in_capturing",
4131
+ value: function(e) {
4132
+ return this._gdpr_call_func(Kt, e);
4133
+ }
4134
+ }, {
4135
+ key: "has_opted_out_capturing",
4136
+ value: function(e) {
4137
+ return this._gdpr_call_func(Zt, e);
4138
+ }
4139
+ }, {
4140
+ key: "clear_opt_in_out_capturing",
4141
+ value: function(e) {
4142
+ var t = z({
4143
+ enable_persistence: !0
4144
+ }, null != e ? e : {});
4145
+ this._gdpr_call_func(en, t), this._gdpr_update_persistence(t);
4146
+ }
4147
+ }, {
4148
+ key: "debug",
4149
+ value: function(e) {
4150
+ !1 === e ? (null == D || D.console.log("You've disabled debug mode."), localStorage && localStorage.removeItem("ph_debug"),
4151
+ this.set_config({
4152
+ 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)`."),
4154
+ localStorage && localStorage.setItem("ph_debug", "true"), this.set_config({
4155
+ debug: !0
4156
+ }));
4157
+ }
4158
+ } ]), e;
4159
+ }();
4160
+
4161
+ !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);
4175
+ })), r;
4176
+ };
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
+ };
2
4186
 
3
- import { Controller } from "@hotwired/stimulus";
4187
+ !function(e) {
4188
+ e.Popover = "popover", e.API = "api", e.Widget = "widget";
4189
+ }(xr || (xr = {})), function(e) {
4190
+ e.Open = "open", e.MultipleChoice = "multiple_choice", e.SingleChoice = "single_choice",
4191
+ e.Rating = "rating", e.Link = "link";
4192
+ }(Rr || (Rr = {}));
4
4193
 
5
- import { post } from "@rails/request.js";
4194
+ var $r = (ur = ar.INIT_MODULE, lr = new Ir, Cr(), lr.init(), Or(), lr);
6
4195
 
7
4196
  class PostHogController extends Controller {
8
4197
  static values={
@@ -10,7 +4199,7 @@ class PostHogController extends Controller {
10
4199
  identification: Object
11
4200
  };
12
4201
  connect() {
13
- posthog.init(this.apiKeyValue, {
4202
+ $r.init(this.apiKeyValue, {
14
4203
  api_host: "https://eu.posthog.com",
15
4204
  custom_campaign_params: [ "ref" ],
16
4205
  session_recording: {
@@ -22,7 +4211,7 @@ class PostHogController extends Controller {
22
4211
  });
23
4212
  if (Object.keys(this.identificationValue).length) {
24
4213
  const {id: id, email: email, name: name} = this.identificationValue;
25
- posthog.identify(id, {
4214
+ $r.identify(id, {
26
4215
  email: email,
27
4216
  name: name
28
4217
  });
@@ -3870,9 +8059,559 @@ class ShepherdController extends Controller {
3870
8059
  }
3871
8060
  }
3872
8061
 
8062
+ var CrispMessage = function() {
8063
+ function CrispMessage(crisp) {
8064
+ this.parent = crisp;
8065
+ }
8066
+ CrispMessage.prototype.send = function(type, content) {
8067
+ this.parent.createSingletonIfNecessary();
8068
+ window.$crisp.push([ "do", "message:send", [ type, content ] ]);
8069
+ };
8070
+ CrispMessage.prototype.sendText = function(content) {
8071
+ this.send("text", content);
8072
+ };
8073
+ CrispMessage.prototype.sendFile = function(content) {
8074
+ this.send("file", content);
8075
+ };
8076
+ CrispMessage.prototype.sendAnimation = function(content) {
8077
+ this.send("animation", content);
8078
+ };
8079
+ CrispMessage.prototype.sendAudio = function(content) {
8080
+ this.send("audio", content);
8081
+ };
8082
+ CrispMessage.prototype.show = function(type, content) {
8083
+ this.parent.createSingletonIfNecessary();
8084
+ window.$crisp.push([ "do", "message:show", [ type, content ] ]);
8085
+ };
8086
+ CrispMessage.prototype.showText = function(content) {
8087
+ this.show("text", content);
8088
+ };
8089
+ CrispMessage.prototype.showFile = function(content) {
8090
+ this.show("file", content);
8091
+ };
8092
+ CrispMessage.prototype.showAnimation = function(content) {
8093
+ this.show("animation", content);
8094
+ };
8095
+ CrispMessage.prototype.showAudio = function(content) {
8096
+ this.show("audio", content);
8097
+ };
8098
+ CrispMessage.prototype.showPicker = function(content) {
8099
+ this.show("picker", content);
8100
+ };
8101
+ CrispMessage.prototype.showField = function(content) {
8102
+ this.show("field", content);
8103
+ };
8104
+ CrispMessage.prototype.showCarousel = function(content) {
8105
+ this.show("carousel", content);
8106
+ };
8107
+ CrispMessage.prototype.markAsRead = function() {
8108
+ this.parent.createSingletonIfNecessary();
8109
+ window.$crisp.push([ "do", "message:read" ]);
8110
+ };
8111
+ CrispMessage.prototype.startThread = function(name) {
8112
+ this.parent.createSingletonIfNecessary();
8113
+ window.$crisp.push([ "do", "message:thread:start", [ name ] ]);
8114
+ };
8115
+ CrispMessage.prototype.endThread = function(name) {
8116
+ this.parent.createSingletonIfNecessary();
8117
+ window.$crisp.push([ "do", "message:thread:end", [ name ] ]);
8118
+ };
8119
+ CrispMessage.prototype.onMessageSent = function(callback) {
8120
+ this.parent.createSingletonIfNecessary();
8121
+ window.$crisp.push([ "off", "message:sent" ]);
8122
+ window.$crisp.push([ "on", "message:sent", callback ]);
8123
+ };
8124
+ CrispMessage.prototype.onMessageReceived = function(callback) {
8125
+ this.parent.createSingletonIfNecessary();
8126
+ window.$crisp.push([ "off", "message:received" ]);
8127
+ window.$crisp.push([ "on", "message:received", callback ]);
8128
+ };
8129
+ CrispMessage.prototype.onMessageComposeSent = function(callback) {
8130
+ this.parent.createSingletonIfNecessary();
8131
+ window.$crisp.push([ "off", "message:compose:sent" ]);
8132
+ window.$crisp.push([ "on", "message:compose:sent", callback ]);
8133
+ };
8134
+ CrispMessage.prototype.onMessageComposeReceived = function(callback) {
8135
+ this.parent.createSingletonIfNecessary();
8136
+ window.$crisp.push([ "off", "message:compose:received" ]);
8137
+ window.$crisp.push([ "on", "message:compose:received", callback ]);
8138
+ };
8139
+ return CrispMessage;
8140
+ }();
8141
+
8142
+ var CrispUser = function() {
8143
+ function CrispUser(crisp) {
8144
+ this.parent = crisp;
8145
+ }
8146
+ CrispUser.prototype.setNickname = function(nickname) {
8147
+ this.parent.createSingletonIfNecessary();
8148
+ window.$crisp.push([ "set", "user:nickname", [ nickname ] ]);
8149
+ };
8150
+ CrispUser.prototype.setEmail = function(email, hmac) {
8151
+ this.parent.createSingletonIfNecessary();
8152
+ window.$crisp.push([ "set", "user:email", [ email, hmac ] ]);
8153
+ };
8154
+ CrispUser.prototype.setPhone = function(phone) {
8155
+ this.parent.createSingletonIfNecessary();
8156
+ window.$crisp.push([ "set", "user:phone", [ phone ] ]);
8157
+ };
8158
+ CrispUser.prototype.setAvatar = function(avatar) {
8159
+ this.parent.createSingletonIfNecessary();
8160
+ window.$crisp.push([ "set", "user:avatar", [ avatar ] ]);
8161
+ };
8162
+ CrispUser.prototype.setCompany = function(name, data) {
8163
+ var _payload = {};
8164
+ if (data && data.url) {
8165
+ _payload.url = data.url;
8166
+ }
8167
+ if (data && data.description) {
8168
+ _payload.description = data.description;
8169
+ }
8170
+ if (data && data.employment) {
8171
+ _payload.employment = [ data.employment.title ];
8172
+ if (data.employment.role) {
8173
+ _payload.employment.push(data.employment.role);
8174
+ }
8175
+ }
8176
+ this.parent.createSingletonIfNecessary();
8177
+ window.$crisp.push([ "set", "user:company", [ name, _payload ] ]);
8178
+ };
8179
+ CrispUser.prototype.getEmail = function() {
8180
+ if (!this.parent.isCrispInjected()) {
8181
+ return null;
8182
+ }
8183
+ return window.$crisp.get("user:email");
8184
+ };
8185
+ CrispUser.prototype.getPhone = function() {
8186
+ if (!this.parent.isCrispInjected()) {
8187
+ return null;
8188
+ }
8189
+ return window.$crisp.get("user:phone");
8190
+ };
8191
+ CrispUser.prototype.getNickname = function() {
8192
+ if (!this.parent.isCrispInjected()) {
8193
+ return null;
8194
+ }
8195
+ return window.$crisp.get("user:nickname");
8196
+ };
8197
+ CrispUser.prototype.getAvatar = function() {
8198
+ if (!this.parent.isCrispInjected()) {
8199
+ return null;
8200
+ }
8201
+ return window.$crisp.get("user:avatar");
8202
+ };
8203
+ CrispUser.prototype.getCompany = function() {
8204
+ if (!this.parent.isCrispInjected()) {
8205
+ return null;
8206
+ }
8207
+ return window.$crisp.get("user:company");
8208
+ };
8209
+ CrispUser.prototype.onEmailChanged = function(callback) {
8210
+ if (this.parent.isCrispInjected()) {
8211
+ window.$crisp.push([ "off", "user:email:changed" ]);
8212
+ window.$crisp.push([ "on", "user:email:changed", callback ]);
8213
+ }
8214
+ };
8215
+ CrispUser.prototype.onPhoneChanged = function(callback) {
8216
+ if (this.parent.isCrispInjected()) {
8217
+ window.$crisp.push([ "off", "user:phone:changed" ]);
8218
+ window.$crisp.push([ "on", "user:phone:changed", callback ]);
8219
+ }
8220
+ };
8221
+ CrispUser.prototype.onNicknameChanged = function(callback) {
8222
+ if (this.parent.isCrispInjected()) {
8223
+ window.$crisp.push([ "off", "user:nickname:changed" ]);
8224
+ window.$crisp.push([ "on", "user:nickname:changed", callback ]);
8225
+ }
8226
+ };
8227
+ CrispUser.prototype.onAvatarChanged = function(callback) {
8228
+ if (this.parent.isCrispInjected()) {
8229
+ window.$crisp.push([ "off", "user:avatar:changed" ]);
8230
+ window.$crisp.push([ "on", "user:avatar:changed", callback ]);
8231
+ }
8232
+ };
8233
+ return CrispUser;
8234
+ }();
8235
+
8236
+ var CrispTrigger = function() {
8237
+ function CrispTrigger(crisp) {
8238
+ this.parent = crisp;
8239
+ }
8240
+ CrispTrigger.prototype.run = function(name) {
8241
+ this.parent.createSingletonIfNecessary();
8242
+ window.$crisp.push([ "do", "trigger:run", [ name ] ]);
8243
+ };
8244
+ return CrispTrigger;
8245
+ }();
8246
+
8247
+ var EventsColors;
8248
+
8249
+ (function(EventsColors) {
8250
+ EventsColors["Red"] = "red";
8251
+ EventsColors["Orange"] = "orange";
8252
+ EventsColors["Yellow"] = "yellow";
8253
+ EventsColors["Green"] = "green";
8254
+ EventsColors["Blue"] = "blue";
8255
+ EventsColors["Purple"] = "purple";
8256
+ EventsColors["Pink"] = "pink";
8257
+ EventsColors["Brown"] = "brown";
8258
+ EventsColors["Grey"] = "grey";
8259
+ EventsColors["Black"] = "black";
8260
+ })(EventsColors || (EventsColors = {}));
8261
+
8262
+ var CrispSession = function() {
8263
+ function CrispSession(crisp) {
8264
+ this.parent = crisp;
8265
+ }
8266
+ CrispSession.prototype.reset = function(reload) {
8267
+ if (reload === void 0) {
8268
+ reload = false;
8269
+ }
8270
+ if (this.parent.isCrispInjected()) {
8271
+ window.$crisp.do("session:reset", [ reload ]);
8272
+ }
8273
+ };
8274
+ CrispSession.prototype.setSegments = function(segments, overwrite) {
8275
+ this.parent.createSingletonIfNecessary();
8276
+ $crisp.push([ "set", "session:segments", [ segments, overwrite ] ]);
8277
+ };
8278
+ CrispSession.prototype.setData = function(data) {
8279
+ var _this = this;
8280
+ var _payload = [];
8281
+ Object.entries(data).forEach((function(item) {
8282
+ if (_this.isValidDataValue(item[0])) {
8283
+ _payload.push([ item[0], item[1] ]);
8284
+ }
8285
+ }));
8286
+ this.parent.createSingletonIfNecessary();
8287
+ $crisp.push([ "set", "session:data", [ _payload ] ]);
8288
+ };
8289
+ CrispSession.prototype.pushEvent = function(name, data, color) {
8290
+ if (data === void 0) {
8291
+ data = {};
8292
+ }
8293
+ if (color === void 0) {
8294
+ color = EventsColors.Blue;
8295
+ }
8296
+ if (this.parent.isCrispInjected()) {
8297
+ window.$crisp.push([ "set", "session:event", [ [ [ name, data, color ] ] ] ]);
8298
+ }
8299
+ };
8300
+ CrispSession.prototype.getData = function(key) {
8301
+ if (!this.parent.isCrispInjected()) {
8302
+ return undefined;
8303
+ }
8304
+ return window.$crisp.get("session:data", key);
8305
+ };
8306
+ CrispSession.prototype.getIdentifier = function() {
8307
+ if (!this.parent.isCrispInjected()) {
8308
+ return null;
8309
+ }
8310
+ return window.$crisp.get("session:identifier");
8311
+ };
8312
+ CrispSession.prototype.onLoaded = function(callback) {
8313
+ this.parent.createSingletonIfNecessary();
8314
+ window.$crisp.push([ "off", "session:loaded" ]);
8315
+ window.$crisp.push([ "on", "session:loaded", callback ]);
8316
+ };
8317
+ CrispSession.prototype.isValidDataValue = function(value) {
8318
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
8319
+ };
8320
+ return CrispSession;
8321
+ }();
8322
+
8323
+ var CrispChat = function() {
8324
+ function CrispChat(crisp) {
8325
+ this.parent = crisp;
8326
+ }
8327
+ CrispChat.prototype.show = function() {
8328
+ this.parent.autoInjectIfNecessary();
8329
+ window.$crisp.push([ "do", "chat:show" ]);
8330
+ };
8331
+ CrispChat.prototype.hide = function() {
8332
+ this.parent.autoInjectIfNecessary();
8333
+ window.$crisp.push([ "do", "chat:hide" ]);
8334
+ };
8335
+ CrispChat.prototype.open = function() {
8336
+ this.parent.autoInjectIfNecessary();
8337
+ window.$crisp.push([ "do", "chat:open" ]);
8338
+ };
8339
+ CrispChat.prototype.close = function() {
8340
+ if (this.parent.isCrispInjected()) {
8341
+ window.$crisp.push([ "do", "chat:close" ]);
8342
+ }
8343
+ };
8344
+ CrispChat.prototype.setHelpdeskView = function() {
8345
+ this.parent.createSingletonIfNecessary();
8346
+ window.$crisp.push([ "do", "helpdesk:search" ]);
8347
+ };
8348
+ CrispChat.prototype.openHelpdeskArticle = function(locale, slug, title, category) {
8349
+ this.parent.createSingletonIfNecessary();
8350
+ window.$crisp.push([ "do", "helpdesk:article:open", [ locale, slug, title, category ] ]);
8351
+ };
8352
+ CrispChat.prototype.queryHelpdesk = function(query) {
8353
+ this.parent.createSingletonIfNecessary();
8354
+ window.$crisp.push([ "do", "helpdesk:query", [ query ] ]);
8355
+ };
8356
+ CrispChat.prototype.unreadCount = function() {
8357
+ if (!this.parent.isCrispInjected()) {
8358
+ return 0;
8359
+ }
8360
+ return window.$crisp.get("chat:unread:count");
8361
+ };
8362
+ CrispChat.prototype.isChatOpened = function() {
8363
+ if (!this.parent.isCrispInjected()) {
8364
+ return false;
8365
+ }
8366
+ return window.$crisp.is("chat:opened");
8367
+ };
8368
+ CrispChat.prototype.isVisible = function() {
8369
+ if (!this.parent.isCrispInjected()) {
8370
+ return false;
8371
+ }
8372
+ return window.$crisp.is("chat:visible");
8373
+ };
8374
+ CrispChat.prototype.onChatInitiated = function(callback) {
8375
+ this.parent.createSingletonIfNecessary();
8376
+ window.$crisp.push([ "off", "chat:initiated" ]);
8377
+ window.$crisp.push([ "on", "chat:initiated", callback ]);
8378
+ };
8379
+ CrispChat.prototype.onChatOpened = function(callback) {
8380
+ this.parent.createSingletonIfNecessary();
8381
+ window.$crisp.push([ "off", "chat:opened" ]);
8382
+ window.$crisp.push([ "on", "chat:opened", callback ]);
8383
+ };
8384
+ CrispChat.prototype.onChatClosed = function(callback) {
8385
+ this.parent.createSingletonIfNecessary();
8386
+ window.$crisp.push([ "off", "chat:closed" ]);
8387
+ window.$crisp.push([ "on", "chat:closed", callback ]);
8388
+ };
8389
+ CrispChat.prototype.onHelpdeskQueried = function(callback) {
8390
+ this.parent.createSingletonIfNecessary();
8391
+ window.$crisp.push([ "off", "helpdesk:queried" ]);
8392
+ window.$crisp.push([ "on", "helpdesk:queried", callback ]);
8393
+ };
8394
+ return CrispChat;
8395
+ }();
8396
+
8397
+ var ChatboxColors;
8398
+
8399
+ (function(ChatboxColors) {
8400
+ ChatboxColors["Default"] = "default";
8401
+ ChatboxColors["Amber"] = "amber";
8402
+ ChatboxColors["Black"] = "black";
8403
+ ChatboxColors["Blue"] = "blue";
8404
+ ChatboxColors["BlueGrey"] = "blue_grey";
8405
+ ChatboxColors["LightBlue"] = "light_blue";
8406
+ ChatboxColors["Brown"] = "brown";
8407
+ ChatboxColors["Cyan"] = "cyan";
8408
+ ChatboxColors["Green"] = "green";
8409
+ ChatboxColors["LightGreen"] = "light_green";
8410
+ ChatboxColors["Grey"] = "grey";
8411
+ ChatboxColors["Indigo"] = "indigo";
8412
+ ChatboxColors["Orange"] = "orange";
8413
+ ChatboxColors["DeepOrange"] = "deep_orange";
8414
+ ChatboxColors["Pink"] = "pink";
8415
+ ChatboxColors["Purple"] = "purple";
8416
+ ChatboxColors["DeepPurple"] = "deep_purple";
8417
+ ChatboxColors["Red"] = "red";
8418
+ ChatboxColors["Teal"] = "teal";
8419
+ })(ChatboxColors || (ChatboxColors = {}));
8420
+
8421
+ var ChatboxPosition;
8422
+
8423
+ (function(ChatboxPosition) {
8424
+ ChatboxPosition["Left"] = "left";
8425
+ ChatboxPosition["Right"] = "right";
8426
+ })(ChatboxPosition || (ChatboxPosition = {}));
8427
+
8428
+ var Crisp = function() {
8429
+ function Crisp() {
8430
+ this.clientUrl = "https://client.crisp.chat/l.js";
8431
+ this.websiteId = "";
8432
+ this.autoload = true;
8433
+ this.injected = false;
8434
+ this.chat = new CrispChat(this);
8435
+ this.session = new CrispSession(this);
8436
+ this.user = new CrispUser(this);
8437
+ this.message = new CrispMessage(this);
8438
+ this.trigger = new CrispTrigger(this);
8439
+ }
8440
+ Crisp.prototype.configure = function(websiteId, options) {
8441
+ if (options === void 0) {
8442
+ options = {};
8443
+ }
8444
+ this.websiteId = websiteId;
8445
+ this.tokenId = options.tokenId;
8446
+ this.locale = options.locale;
8447
+ this.sessionMerge = options.sessionMerge;
8448
+ this.cookieDomain = options.cookieDomain;
8449
+ this.cookieExpire = options.cookieExpire;
8450
+ this.lockFullview = options.lockFullview;
8451
+ this.lockMaximized = options.lockMaximized;
8452
+ this.safeMode = options.safeMode;
8453
+ if (options.clientUrl !== undefined) {
8454
+ this.clientUrl = options.clientUrl;
8455
+ }
8456
+ if (options.autoload !== undefined) {
8457
+ this.autoload = options.autoload;
8458
+ }
8459
+ if (this.autoload) {
8460
+ this.load();
8461
+ }
8462
+ };
8463
+ Crisp.prototype.load = function() {
8464
+ var _head = document.getElementsByTagName("head");
8465
+ this.createSingletonIfNecessary();
8466
+ if (this.isCrispInjected() === true) {
8467
+ return;
8468
+ }
8469
+ if (!this.websiteId) {
8470
+ throw new Error("websiteId must be set before loading Crisp");
8471
+ }
8472
+ window.CRISP_WEBSITE_ID = this.websiteId;
8473
+ window.CRISP_RUNTIME_CONFIG = {};
8474
+ if (this.tokenId) {
8475
+ window.CRISP_TOKEN_ID = this.tokenId;
8476
+ }
8477
+ if (this.sessionMerge) {
8478
+ window.CRISP_RUNTIME_CONFIG.session_merge = true;
8479
+ }
8480
+ if (this.locale) {
8481
+ window.CRISP_RUNTIME_CONFIG.locale = this.locale;
8482
+ }
8483
+ if (this.lockFullview) {
8484
+ window.CRISP_RUNTIME_CONFIG.lock_full_view = true;
8485
+ }
8486
+ if (this.lockMaximized) {
8487
+ window.CRISP_RUNTIME_CONFIG.lock_maximized = true;
8488
+ }
8489
+ if (this.cookieDomain) {
8490
+ window.CRISP_COOKIE_DOMAIN = this.cookieDomain;
8491
+ }
8492
+ if (this.cookieExpire) {
8493
+ window.CRISP_COOKIE_EXPIRE = this.cookieExpire;
8494
+ }
8495
+ if (!_head || !_head[0]) {
8496
+ return this.deferredLoading();
8497
+ }
8498
+ if (this.safeMode === true) {
8499
+ this.setSafeMode(true);
8500
+ }
8501
+ var _script = document.createElement("script");
8502
+ _script.src = this.clientUrl;
8503
+ _script.async = true;
8504
+ _head[0].appendChild(_script);
8505
+ this.injected = true;
8506
+ };
8507
+ Crisp.prototype.setTokenId = function(tokenId) {
8508
+ this.tokenId = tokenId;
8509
+ if (this.isCrispInjected() === true) {
8510
+ if (tokenId) {
8511
+ window.CRISP_TOKEN_ID = tokenId;
8512
+ } else {
8513
+ delete window.CRISP_TOKEN_ID;
8514
+ }
8515
+ }
8516
+ };
8517
+ Crisp.prototype.setZIndex = function(zIndex) {
8518
+ this.createSingletonIfNecessary();
8519
+ window.$crisp.push([ "config", "container:index", [ zIndex ] ]);
8520
+ };
8521
+ Crisp.prototype.setColorTheme = function(color) {
8522
+ this.createSingletonIfNecessary();
8523
+ window.$crisp.push([ "config", "color:theme", [ color ] ]);
8524
+ };
8525
+ Crisp.prototype.setHideOnAway = function(enabled) {
8526
+ this.createSingletonIfNecessary();
8527
+ window.$crisp.push([ "config", "hide:on:away", [ enabled ] ]);
8528
+ };
8529
+ Crisp.prototype.setHideOnMobile = function(enabled) {
8530
+ this.createSingletonIfNecessary();
8531
+ window.$crisp.push([ "config", "hide:on:mobile", [ enabled ] ]);
8532
+ };
8533
+ Crisp.prototype.setPosition = function(position) {
8534
+ this.createSingletonIfNecessary();
8535
+ $crisp.push([ "config", "position:reverse", [ position === ChatboxPosition.Left ] ]);
8536
+ };
8537
+ Crisp.prototype.setAvailabilityTooltip = function(enabled) {
8538
+ this.createSingletonIfNecessary();
8539
+ window.$crisp.push([ "config", "availability:tooltip", [ enabled ] ]);
8540
+ };
8541
+ Crisp.prototype.setVacationMode = function(enabled) {
8542
+ this.createSingletonIfNecessary();
8543
+ window.$crisp.push([ "config", "hide:vacation", [ enabled ] ]);
8544
+ };
8545
+ Crisp.prototype.setSafeMode = function(safe) {
8546
+ if (safe === void 0) {
8547
+ safe = true;
8548
+ }
8549
+ this.createSingletonIfNecessary();
8550
+ window.$crisp.push([ "safe", safe ]);
8551
+ };
8552
+ Crisp.prototype.muteSound = function(mute) {
8553
+ this.createSingletonIfNecessary();
8554
+ window.$crisp.push([ "config", "sound:mute", [ mute ] ]);
8555
+ };
8556
+ Crisp.prototype.toggleOperatorCount = function(enabled) {
8557
+ this.createSingletonIfNecessary();
8558
+ window.$crisp.push([ "config", "show:operator:count", [ enabled ] ]);
8559
+ };
8560
+ Crisp.prototype.onWebsiteAvailabilityChanged = function(callback) {
8561
+ this.createSingletonIfNecessary();
8562
+ window.$crisp.push([ "off", "website:availability:changed" ]);
8563
+ window.$crisp.push([ "on", "website:availability:changed", callback ]);
8564
+ };
8565
+ Crisp.prototype.createSingletonIfNecessary = function() {
8566
+ if (window.$crisp === undefined) {
8567
+ window.$crisp = [];
8568
+ }
8569
+ };
8570
+ Crisp.prototype.autoInjectIfNecessary = function() {
8571
+ if (!this.isCrispInjected()) {
8572
+ this.load();
8573
+ }
8574
+ };
8575
+ Crisp.prototype.isCrispInjected = function() {
8576
+ if (this.injected === true || window.$crisp && window.$crisp.is) {
8577
+ return true;
8578
+ }
8579
+ return false;
8580
+ };
8581
+ Crisp.prototype.deferredLoading = function() {
8582
+ var _this = this;
8583
+ document.addEventListener("DOMContentLoaded", (function() {
8584
+ _this.load();
8585
+ }));
8586
+ };
8587
+ return Crisp;
8588
+ }();
8589
+
8590
+ var singleton = new Crisp;
8591
+
8592
+ class CrispController extends Controller {
8593
+ static values={
8594
+ websiteId: String,
8595
+ identification: Object
8596
+ };
8597
+ connect() {
8598
+ singleton.configure(this.websiteIdValue);
8599
+ if (Object.keys(this.identificationValue).length) {
8600
+ const {email: email, name: name} = this.identificationValue;
8601
+ singleton.user.setEmail(email);
8602
+ singleton.user.setNickname(name);
8603
+ }
8604
+ }
8605
+ open(e) {
8606
+ e.preventDefault();
8607
+ singleton.chat.open();
8608
+ }
8609
+ }
8610
+
3873
8611
  function registerControllers(application) {
3874
8612
  application.register("shepherd", ShepherdController);
3875
8613
  application.register("post-hog", PostHogController);
8614
+ application.register("crisp", CrispController);
3876
8615
  }
3877
8616
 
3878
- export { PostHogController, ShepherdController, registerControllers };
8617
+ export { CrispController, PostHogController, ShepherdController, registerControllers };