@askdialog/dialog-vue 2.0.1 → 3.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4214 +1,47 @@
1
- import { defineComponent as Ae, createElementBlock as Me, openBlock as ie, createElementVNode as H, toDisplayString as Ci, Fragment as fs, renderList as Fn, createVNode as Bt, createBlock as Ht, ref as wt, withDirectives as Tn, withKeys as On, vModelText as Rn, onMounted as Dn, watch as _s, renderSlot as Mn, computed as ui, withCtx as An, createCommentVNode as Ln } from "vue";
2
- var gr;
3
- (function(r) {
4
- r.OPEN_ASSISTANT = "open_assistant", r.CLOSE_ASSISTANT = "close_assistant", r.SEND_MESSAGE = "PRODUCT_QUESTION", r.SEND_GENERIC_QUESTION = "GENERIC_QUESTION";
5
- })(gr || (gr = {}));
6
- var fr;
7
- (function(r) {
8
- r.USER_OPENED_ASSISTANT = "userOpenedAssistant", r.USER_CLOSED_ASSISTANT = "userClosedAssistant", r.USER_SENT_MESSAGE = "userSentMessage", r.USER_CLICKED_ON_PRODUCT_CARD = "userClickedOnProductCard", r.USER_OPENED_RECOMMENDATION = "userOpenedRecommendation", r.USER_ADDED_TO_CART = "userAddedToCart", r.USER_SEND_POSITIVE_FEEDBACK = "userSendPositiveFeedback", r.USER_SEND_NEGATIVE_FEEDBACK = "userSendNegativeFeedback";
9
- })(fr || (fr = {}));
10
- var d = typeof window < "u" ? window : void 0, Y = typeof globalThis < "u" ? globalThis : d, vs = Array.prototype, _r = vs.forEach, vr = vs.indexOf, Q = Y == null ? void 0 : Y.navigator, m = Y == null ? void 0 : Y.document, z = Y == null ? void 0 : Y.location, $i = Y == null ? void 0 : Y.fetch, Ii = Y != null && Y.XMLHttpRequest && "withCredentials" in new Y.XMLHttpRequest() ? Y.XMLHttpRequest : void 0, mr = Y == null ? void 0 : Y.AbortController, W = Q == null ? void 0 : Q.userAgent, k = d ?? {}, me = { DEBUG: !1, LIB_VERSION: "1.293.0" };
11
- function yr(r, e, t, i, s, n, a) {
12
- try {
13
- var o = r[n](a), l = o.value;
14
- } catch (c) {
15
- return void t(c);
16
- }
17
- o.done ? e(l) : Promise.resolve(l).then(i, s);
18
- }
19
- function br(r) {
20
- return function() {
21
- var e = this, t = arguments;
22
- return new Promise((function(i, s) {
23
- var n = r.apply(e, t);
24
- function a(l) {
25
- yr(n, i, s, a, o, "next", l);
26
- }
27
- function o(l) {
28
- yr(n, i, s, a, o, "throw", l);
29
- }
30
- a(void 0);
31
- }));
32
- };
33
- }
34
- function w() {
35
- return w = Object.assign ? Object.assign.bind() : function(r) {
36
- for (var e = 1; e < arguments.length; e++) {
37
- var t = arguments[e];
38
- for (var i in t) ({}).hasOwnProperty.call(t, i) && (r[i] = t[i]);
39
- }
40
- return r;
41
- }, w.apply(null, arguments);
42
- }
43
- function ms(r, e) {
44
- if (r == null) return {};
45
- var t = {};
46
- for (var i in r) if ({}.hasOwnProperty.call(r, i)) {
47
- if (e.indexOf(i) !== -1) continue;
48
- t[i] = r[i];
49
- }
50
- return t;
51
- }
52
- var Nn = ["amazonbot", "amazonproductbot", "app.hypefactors.com", "applebot", "archive.org_bot", "awariobot", "backlinksextendedbot", "baiduspider", "bingbot", "bingpreview", "chrome-lighthouse", "dataforseobot", "deepscan", "duckduckbot", "facebookexternal", "facebookcatalog", "http://yandex.com/bots", "hubspot", "ia_archiver", "leikibot", "linkedinbot", "meta-externalagent", "mj12bot", "msnbot", "nessus", "petalbot", "pinterest", "prerender", "rogerbot", "screaming frog", "sebot-wa", "sitebulb", "slackbot", "slurp", "trendictionbot", "turnitin", "twitterbot", "vercel-screenshot", "vercelbot", "yahoo! slurp", "yandexbot", "zoombot", "bot.htm", "bot.php", "(bot;", "bot/", "crawler", "ahrefsbot", "ahrefssiteaudit", "semrushbot", "siteauditbot", "splitsignalbot", "gptbot", "oai-searchbot", "chatgpt-user", "perplexitybot", "better uptime bot", "sentryuptimebot", "uptimerobot", "headlesschrome", "cypress", "google-hoteladsverifier", "adsbot-google", "apis-google", "duplexweb-google", "feedfetcher-google", "google favicon", "google web preview", "google-read-aloud", "googlebot", "googleother", "google-cloudvertexbot", "googleweblight", "mediapartners-google", "storebot-google", "google-inspectiontool", "bytespider"], wr = function(r, e) {
53
- if (e === void 0 && (e = []), !r) return !1;
54
- var t = r.toLowerCase();
55
- return Nn.concat(e).some(((i) => {
56
- var s = i.toLowerCase();
57
- return t.indexOf(s) !== -1;
58
- }));
59
- }, Un = ["$snapshot", "$pageview", "$pageleave", "$set", "survey dismissed", "survey sent", "survey shown", "$identify", "$groupidentify", "$create_alias", "$$client_ingestion_warning", "$web_experiment_applied", "$feature_enrollment_update", "$feature_flag_called"];
60
- function S(r, e) {
61
- return r.indexOf(e) !== -1;
62
- }
63
- var si = function(r) {
64
- return r.trim();
65
- }, Fi = function(r) {
66
- return r.replace(/^\$/, "");
67
- }, qn = Array.isArray, ys = Object.prototype, bs = ys.hasOwnProperty, ni = ys.toString, T = qn || function(r) {
68
- return ni.call(r) === "[object Array]";
69
- }, Te = (r) => typeof r == "function", j = (r) => r === Object(r) && !T(r), Ke = (r) => {
70
- if (j(r)) {
71
- for (var e in r) if (bs.call(r, e)) return !1;
72
- return !0;
73
- }
74
- return !1;
75
- }, v = (r) => r === void 0, N = (r) => ni.call(r) == "[object String]", Ti = (r) => N(r) && r.trim().length === 0, Ee = (r) => r === null, O = (r) => v(r) || Ee(r), fe = (r) => ni.call(r) == "[object Number]", Oe = (r) => ni.call(r) === "[object Boolean]", jn = (r) => r instanceof FormData, Bn = (r) => S(Un, r);
76
- function Oi(r) {
77
- return r === null || typeof r != "object";
78
- }
79
- function Vt(r, e) {
80
- return Object.prototype.toString.call(r) === "[object " + e + "]";
81
- }
82
- function ws(r) {
83
- return !v(Event) && (function(e, t) {
84
- try {
85
- return e instanceof t;
86
- } catch {
87
- return !1;
88
- }
89
- })(r, Event);
90
- }
91
- var Hn = [!0, "true", 1, "1", "yes"], hi = (r) => S(Hn, r), Vn = [!1, "false", 0, "0", "no"];
92
- function de(r, e, t, i, s) {
93
- return e > t && (i.warn("min cannot be greater than max."), e = t), fe(r) ? r > t ? (i.warn(" cannot be greater than max: " + t + ". Using max value instead."), t) : r < e ? (i.warn(" cannot be less than min: " + e + ". Using min value instead."), e) : r : (i.warn(" must be a number. using max or fallback. max: " + t + ", fallback: " + s), de(s || t, e, t, i));
94
- }
95
- class Gn {
96
- constructor(e) {
97
- this.t = {}, this.i = e.i, this.o = de(e.bucketSize, 0, 100, e.h), this.m = de(e.refillRate, 0, this.o, e.h), this.$ = de(e.refillInterval, 0, 864e5, e.h);
98
- }
99
- S(e, t) {
100
- var i = t - e.lastAccess, s = Math.floor(i / this.$);
101
- if (s > 0) {
102
- var n = s * this.m;
103
- e.tokens = Math.min(e.tokens + n, this.o), e.lastAccess = e.lastAccess + s * this.$;
104
- }
105
- }
106
- consumeRateLimit(e) {
107
- var t, i = Date.now(), s = String(e), n = this.t[s];
108
- return n ? this.S(n, i) : (n = { tokens: this.o, lastAccess: i }, this.t[s] = n), n.tokens === 0 || (n.tokens--, n.tokens === 0 && ((t = this.i) == null || t.call(this, e)), n.tokens === 0);
109
- }
110
- stop() {
111
- this.t = {};
112
- }
113
- }
114
- var Ot, Er, di, Wn = (r) => r instanceof Error;
115
- function zn(r) {
116
- var e = globalThis._posthogChunkIds;
117
- if (e) {
118
- var t = Object.keys(e);
119
- return di && t.length === Er || (Er = t.length, di = t.reduce(((i, s) => {
120
- Ot || (Ot = {});
121
- var n = Ot[s];
122
- if (n) i[n[0]] = n[1];
123
- else for (var a = r(s), o = a.length - 1; o >= 0; o--) {
124
- var l = a[o], c = l == null ? void 0 : l.filename, u = e[s];
125
- if (c && u) {
126
- i[c] = u, Ot[s] = [c, u];
127
- break;
128
- }
129
- }
130
- return i;
131
- }), {})), di;
132
- }
133
- }
134
- var et = "?";
135
- function Ri(r, e, t, i) {
136
- var s = { platform: "web:javascript", filename: r, function: e === "<anonymous>" ? et : e, in_app: !0 };
137
- return v(t) || (s.lineno = t), v(i) || (s.colno = i), s;
138
- }
139
- var Es = (r, e) => {
140
- var t = r.indexOf("safari-extension") !== -1, i = r.indexOf("safari-web-extension") !== -1;
141
- return t || i ? [r.indexOf("@") !== -1 ? r.split("@")[0] : et, t ? "safari-extension:" + e : "safari-web-extension:" + e] : [r, e];
142
- }, Yn = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i, Xn = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, Kn = /\((\S*)(?::(\d+))(?::(\d+))\)/, Jn = (r) => {
143
- var e = Yn.exec(r);
144
- if (e) {
145
- var [, t, i, s] = e;
146
- return Ri(t, et, +i, +s);
147
- }
148
- var n = Xn.exec(r);
149
- if (n) {
150
- if (n[2] && n[2].indexOf("eval") === 0) {
151
- var a = Kn.exec(n[2]);
152
- a && (n[2] = a[1], n[3] = a[2], n[4] = a[3]);
153
- }
154
- var [o, l] = Es(n[1] || et, n[2]);
155
- return Ri(l, o, n[3] ? +n[3] : void 0, n[4] ? +n[4] : void 0);
156
- }
157
- }, Zn = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i, Qn = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, ea = (r) => {
158
- var e = Zn.exec(r);
159
- if (e) {
160
- if (e[3] && e[3].indexOf(" > eval") > -1) {
161
- var t = Qn.exec(e[3]);
162
- t && (e[1] = e[1] || "eval", e[3] = t[1], e[4] = t[2], e[5] = "");
163
- }
164
- var i = e[3], s = e[1] || et;
165
- return [s, i] = Es(s, i), Ri(i, s, e[4] ? +e[4] : void 0, e[5] ? +e[5] : void 0);
166
- }
167
- }, kr = /\(error: (.*)\)/, xr = 50;
168
- function ta() {
169
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
170
- return function(i, s) {
171
- s === void 0 && (s = 0);
172
- for (var n = [], a = i.split(`
173
- `), o = s; o < a.length; o++) {
174
- var l = a[o];
175
- if (!(l.length > 1024)) {
176
- var c = kr.test(l) ? l.replace(kr, "$1") : l;
177
- if (!c.match(/\S*Error: /)) {
178
- for (var u of e) {
179
- var h = u(c);
180
- if (h) {
181
- n.push(h);
182
- break;
183
- }
184
- }
185
- if (n.length >= xr) break;
186
- }
187
- }
188
- }
189
- return (function(g) {
190
- if (!g.length) return [];
191
- var p = Array.from(g);
192
- return p.reverse(), p.slice(0, xr).map(((f) => {
193
- return w({}, f, { filename: f.filename || (_ = p, _[_.length - 1] || {}).filename, function: f.function || et });
194
- var _;
195
- }));
196
- })(n);
197
- };
198
- }
199
- class ia {
200
- constructor(e, t, i) {
201
- e === void 0 && (e = []), t === void 0 && (t = []), i === void 0 && (i = []), this.coercers = e, this.modifiers = i, this.stackParser = ta(...t);
202
- }
203
- buildFromUnknown(e, t) {
204
- t === void 0 && (t = {});
205
- var i = t && t.mechanism || { handled: !0, type: "generic" }, s = this.buildCoercingContext(i, t, 0).apply(e), n = this.buildParsingContext(), a = this.parseStacktrace(s, n);
206
- return { $exception_list: this.convertToExceptionList(a, i), $exception_level: "error" };
207
- }
208
- modifyFrames(e) {
209
- var t = this;
210
- return br((function* () {
211
- for (var i of e) i.stacktrace && i.stacktrace.frames && T(i.stacktrace.frames) && (i.stacktrace.frames = yield t.applyModifiers(i.stacktrace.frames));
212
- return e;
213
- }))();
214
- }
215
- coerceFallback(e) {
216
- var t;
217
- return { type: "Error", value: "Unknown error", stack: (t = e.syntheticException) == null ? void 0 : t.stack, synthetic: !0 };
218
- }
219
- parseStacktrace(e, t) {
220
- var i, s;
221
- return e.cause != null && (i = this.parseStacktrace(e.cause, t)), e.stack != "" && e.stack != null && (s = this.applyChunkIds(this.stackParser(e.stack, e.synthetic ? 1 : 0), t.chunkIdMap)), w({}, e, { cause: i, stack: s });
222
- }
223
- applyChunkIds(e, t) {
224
- return e.map(((i) => (i.filename && t && (i.chunk_id = t[i.filename]), i)));
225
- }
226
- applyCoercers(e, t) {
227
- for (var i of this.coercers) if (i.match(e)) return i.coerce(e, t);
228
- return this.coerceFallback(t);
229
- }
230
- applyModifiers(e) {
231
- var t = this;
232
- return br((function* () {
233
- var i = e;
234
- for (var s of t.modifiers) i = yield s(i);
235
- return i;
236
- }))();
237
- }
238
- convertToExceptionList(e, t) {
239
- var i, s, n, a = { type: e.type, value: e.value, mechanism: { type: (i = t.type) !== null && i !== void 0 ? i : "generic", handled: (s = t.handled) === null || s === void 0 || s, synthetic: (n = e.synthetic) !== null && n !== void 0 && n } };
240
- e.stack && (a.stacktrace = { type: "raw", frames: e.stack });
241
- var o = [a];
242
- return e.cause != null && o.push(...this.convertToExceptionList(e.cause, w({}, t, { handled: !0 }))), o;
243
- }
244
- buildParsingContext() {
245
- return { chunkIdMap: zn(this.stackParser) };
246
- }
247
- buildCoercingContext(e, t, i) {
248
- i === void 0 && (i = 0);
249
- var s = (n, a) => {
250
- if (a <= 4) {
251
- var o = this.buildCoercingContext(e, t, a);
252
- return this.applyCoercers(n, o);
253
- }
254
- };
255
- return w({}, t, { syntheticException: i == 0 ? t.syntheticException : void 0, mechanism: e, apply: (n) => s(n, i), next: (n) => s(n, i + 1) });
256
- }
257
- }
258
- class ra {
259
- match(e) {
260
- return this.isDOMException(e) || this.isDOMError(e);
261
- }
262
- coerce(e, t) {
263
- var i = N(e.stack);
264
- return { type: this.getType(e), value: this.getValue(e), stack: i ? e.stack : void 0, cause: e.cause ? t.next(e.cause) : void 0, synthetic: !1 };
265
- }
266
- getType(e) {
267
- return this.isDOMError(e) ? "DOMError" : "DOMException";
268
- }
269
- getValue(e) {
270
- var t = e.name || (this.isDOMError(e) ? "DOMError" : "DOMException");
271
- return e.message ? t + ": " + e.message : t;
272
- }
273
- isDOMException(e) {
274
- return Vt(e, "DOMException");
275
- }
276
- isDOMError(e) {
277
- return Vt(e, "DOMError");
278
- }
279
- }
280
- class sa {
281
- match(e) {
282
- return ((t) => t instanceof Error)(e);
283
- }
284
- coerce(e, t) {
285
- return { type: this.getType(e), value: this.getMessage(e, t), stack: this.getStack(e), cause: e.cause ? t.next(e.cause) : void 0, synthetic: !1 };
286
- }
287
- getType(e) {
288
- return e.name || e.constructor.name;
289
- }
290
- getMessage(e, t) {
291
- var i = e.message;
292
- return i.error && typeof i.error.message == "string" ? String(i.error.message) : String(i);
293
- }
294
- getStack(e) {
295
- return e.stacktrace || e.stack || void 0;
296
- }
297
- }
298
- class na {
299
- constructor() {
300
- }
301
- match(e) {
302
- return Vt(e, "ErrorEvent") && e.error != null;
303
- }
304
- coerce(e, t) {
305
- var i, s = t.apply(e.error);
306
- return s || { type: "ErrorEvent", value: e.message, stack: (i = t.syntheticException) == null ? void 0 : i.stack, synthetic: !0 };
307
- }
308
- }
309
- var aa = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
310
- class oa {
311
- match(e) {
312
- return typeof e == "string";
313
- }
314
- coerce(e, t) {
315
- var i, [s, n] = this.getInfos(e);
316
- return { type: s ?? "Error", value: n ?? e, stack: (i = t.syntheticException) == null ? void 0 : i.stack, synthetic: !0 };
317
- }
318
- getInfos(e) {
319
- var t = "Error", i = e, s = e.match(aa);
320
- return s && (t = s[1], i = s[2]), [t, i];
321
- }
322
- }
323
- var la = ["fatal", "error", "warning", "log", "info", "debug"];
324
- function ks(r, e) {
325
- e === void 0 && (e = 40);
326
- var t = Object.keys(r);
327
- if (t.sort(), !t.length) return "[object has no keys]";
328
- for (var i = t.length; i > 0; i--) {
329
- var s = t.slice(0, i).join(", ");
330
- if (!(s.length > e)) return i === t.length || s.length <= e ? s : s.slice(0, e) + "...";
331
- }
332
- return "";
333
- }
334
- class ca {
335
- match(e) {
336
- return typeof e == "object" && e !== null;
337
- }
338
- coerce(e, t) {
339
- var i, s = this.getErrorPropertyFromObject(e);
340
- return s ? t.apply(s) : { type: this.getType(e), value: this.getValue(e), stack: (i = t.syntheticException) == null ? void 0 : i.stack, level: this.isSeverityLevel(e.level) ? e.level : "error", synthetic: !0 };
341
- }
342
- getType(e) {
343
- return ws(e) ? e.constructor.name : "Error";
344
- }
345
- getValue(e) {
346
- if ("name" in e && typeof e.name == "string") {
347
- var t = "'" + e.name + "' captured as exception";
348
- return "message" in e && typeof e.message == "string" && (t += " with message: '" + e.message + "'"), t;
349
- }
350
- if ("message" in e && typeof e.message == "string") return e.message;
351
- var i = this.getObjectClassName(e);
352
- return (i && i !== "Object" ? "'" + i + "'" : "Object") + " captured as exception with keys: " + ks(e);
353
- }
354
- isSeverityLevel(e) {
355
- return N(e) && !Ti(e) && la.indexOf(e) >= 0;
356
- }
357
- getErrorPropertyFromObject(e) {
358
- for (var t in e) if (Object.prototype.hasOwnProperty.call(e, t)) {
359
- var i = e[t];
360
- if (Wn(i)) return i;
361
- }
362
- }
363
- getObjectClassName(e) {
364
- try {
365
- var t = Object.getPrototypeOf(e);
366
- return t ? t.constructor.name : void 0;
367
- } catch {
368
- return;
369
- }
370
- }
371
- }
372
- class ua {
373
- match(e) {
374
- return ws(e);
375
- }
376
- coerce(e, t) {
377
- var i, s = e.constructor.name;
378
- return { type: s, value: s + " captured as exception with keys: " + ks(e), stack: (i = t.syntheticException) == null ? void 0 : i.stack, synthetic: !0 };
379
- }
380
- }
381
- class ha {
382
- match(e) {
383
- return Oi(e);
384
- }
385
- coerce(e, t) {
386
- var i;
387
- return { type: "Error", value: "Primitive value captured as exception: " + String(e), stack: (i = t.syntheticException) == null ? void 0 : i.stack, synthetic: !0 };
388
- }
389
- }
390
- class da {
391
- match(e) {
392
- return Vt(e, "PromiseRejectionEvent");
393
- }
394
- coerce(e, t) {
395
- var i, s = this.getUnhandledRejectionReason(e);
396
- return Oi(s) ? { type: "UnhandledRejection", value: "Non-Error promise rejection captured with value: " + String(s), stack: (i = t.syntheticException) == null ? void 0 : i.stack, synthetic: !0 } : t.apply(s);
397
- }
398
- getUnhandledRejectionReason(e) {
399
- if (Oi(e)) return e;
400
- try {
401
- if ("reason" in e) return e.reason;
402
- if ("detail" in e && "reason" in e.detail) return e.detail.reason;
403
- } catch {
404
- }
405
- return e;
406
- }
407
- }
408
- var xs = (r) => {
409
- var e = { k: function(t) {
410
- if (d && (me.DEBUG || k.POSTHOG_DEBUG) && !v(d.console) && d.console) {
411
- for (var i = ("__rrweb_original__" in d.console[t]) ? d.console[t].__rrweb_original__ : d.console[t], s = arguments.length, n = new Array(s > 1 ? s - 1 : 0), a = 1; a < s; a++) n[a - 1] = arguments[a];
412
- i(r, ...n);
413
- }
414
- }, info: function() {
415
- for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
416
- e.k("log", ...i);
417
- }, warn: function() {
418
- for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
419
- e.k("warn", ...i);
420
- }, error: function() {
421
- for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
422
- e.k("error", ...i);
423
- }, critical: function() {
424
- for (var t = arguments.length, i = new Array(t), s = 0; s < t; s++) i[s] = arguments[s];
425
- console.error(r, ...i);
426
- }, uninitializedWarning: (t) => {
427
- e.error("You must initialize PostHog before calling " + t);
428
- }, createLogger: (t) => xs(r + " " + t) };
429
- return e;
430
- }, y = xs("[PostHog.js]"), U = y.createLogger, pa = U("[ExternalScriptsLoader]"), Sr = (r, e, t) => {
431
- if (r.config.disable_external_dependency_loading) return pa.warn(e + " was requested but loading of external scripts is disabled."), t("Loading of external scripts is disabled");
432
- var i = m == null ? void 0 : m.querySelectorAll("script");
433
- if (i) {
434
- for (var s, n = function() {
435
- if (i[a].src === e) {
436
- var l = i[a];
437
- return l.__posthog_loading_callback_fired ? { v: t() } : (l.addEventListener("load", ((c) => {
438
- l.__posthog_loading_callback_fired = !0, t(void 0, c);
439
- })), l.onerror = (c) => t(c), { v: void 0 });
440
- }
441
- }, a = 0; a < i.length; a++) if (s = n()) return s.v;
442
- }
443
- var o = () => {
444
- if (!m) return t("document not found");
445
- var l = m.createElement("script");
446
- if (l.type = "text/javascript", l.crossOrigin = "anonymous", l.src = e, l.onload = (h) => {
447
- l.__posthog_loading_callback_fired = !0, t(void 0, h);
448
- }, l.onerror = (h) => t(h), r.config.prepare_external_dependency_script && (l = r.config.prepare_external_dependency_script(l)), !l) return t("prepare_external_dependency_script returned null");
449
- var c, u = m.querySelectorAll("body > script");
450
- u.length > 0 ? (c = u[0].parentNode) == null || c.insertBefore(l, u[0]) : m.body.appendChild(l);
451
- };
452
- m != null && m.body ? o() : m == null || m.addEventListener("DOMContentLoaded", o);
453
- };
454
- k.__PosthogExtensions__ = k.__PosthogExtensions__ || {}, k.__PosthogExtensions__.loadExternalDependency = (r, e, t) => {
455
- var i = "/static/" + e + ".js?v=" + r.version;
456
- if (e === "remote-config" && (i = "/array/" + r.config.token + "/config.js"), e === "toolbar") {
457
- var s = 3e5;
458
- i = i + "&t=" + Math.floor(Date.now() / s) * s;
459
- }
460
- var n = r.requestRouter.endpointFor("assets", i);
461
- Sr(r, n, t);
462
- }, k.__PosthogExtensions__.loadSiteApp = (r, e, t) => {
463
- var i = r.requestRouter.endpointFor("api", e);
464
- Sr(r, i, t);
465
- };
466
- var Gt = {};
467
- function Re(r, e, t) {
468
- if (T(r)) {
469
- if (_r && r.forEach === _r) r.forEach(e, t);
470
- else if ("length" in r && r.length === +r.length) {
471
- for (var i = 0, s = r.length; i < s; i++) if (i in r && e.call(t, r[i], i) === Gt) return;
472
- }
473
- }
474
- }
475
- function F(r, e, t) {
476
- if (!O(r)) {
477
- if (T(r)) return Re(r, e, t);
478
- if (jn(r)) {
479
- for (var i of r.entries()) if (e.call(t, i[1], i[0]) === Gt) return;
480
- } else for (var s in r) if (bs.call(r, s) && e.call(t, r[s], s) === Gt) return;
481
- }
482
- }
483
- var A = function(r) {
484
- for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) t[i - 1] = arguments[i];
485
- return Re(t, (function(s) {
486
- for (var n in s) s[n] !== void 0 && (r[n] = s[n]);
487
- })), r;
488
- }, st = function(r) {
489
- for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) t[i - 1] = arguments[i];
490
- return Re(t, (function(s) {
491
- Re(s, (function(n) {
492
- r.push(n);
493
- }));
494
- })), r;
495
- };
496
- function Ut(r) {
497
- for (var e = Object.keys(r), t = e.length, i = new Array(t); t--; ) i[t] = [e[t], r[e[t]]];
498
- return i;
499
- }
500
- var Pr = function(r) {
501
- try {
502
- return r();
503
- } catch {
504
- return;
505
- }
506
- }, ga = function(r) {
507
- return function() {
508
- try {
509
- for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
510
- return r.apply(this, t);
511
- } catch (s) {
512
- y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."), y.critical(s);
513
- }
514
- };
515
- }, Qi = function(r) {
516
- var e = {};
517
- return F(r, (function(t, i) {
518
- (N(t) && t.length > 0 || fe(t)) && (e[i] = t);
519
- })), e;
520
- };
521
- function fa(r, e) {
522
- return t = r, i = (n) => N(n) && !Ee(e) ? n.slice(0, e) : n, s = /* @__PURE__ */ new Set(), (function n(a, o) {
523
- return a !== Object(a) ? i ? i(a, o) : a : s.has(a) ? void 0 : (s.add(a), T(a) ? (l = [], Re(a, ((c) => {
524
- l.push(n(c));
525
- }))) : (l = {}, F(a, ((c, u) => {
526
- s.has(c) || (l[u] = n(c, u));
527
- }))), l);
528
- var l;
529
- })(t);
530
- var t, i, s;
531
- }
532
- var _a = ["herokuapp.com", "vercel.app", "netlify.app"];
533
- function va(r) {
534
- var e = r == null ? void 0 : r.hostname;
535
- if (!N(e)) return !1;
536
- var t = e.split(".").slice(-2).join(".");
537
- for (var i of _a) if (t === i) return !1;
538
- return !0;
539
- }
540
- function Ss(r, e) {
541
- for (var t = 0; t < r.length; t++) if (e(r[t])) return r[t];
542
- }
543
- function L(r, e, t, i) {
544
- var { capture: s = !1, passive: n = !0 } = i ?? {};
545
- r == null || r.addEventListener(e, t, { capture: s, passive: n });
546
- }
547
- var Ps = "$people_distinct_id", gt = "__alias", ft = "__timers", Cr = "$autocapture_disabled_server_side", Di = "$heatmaps_enabled_server_side", $r = "$exception_capture_enabled_server_side", Mi = "$error_tracking_suppression_rules", Ir = "$error_tracking_capture_extension_exceptions", Fr = "$web_vitals_enabled_server_side", Cs = "$dead_clicks_enabled_server_side", Tr = "$web_vitals_allowed_metrics", pi = "$session_recording_remote_config", Wt = "$sesid", $s = "$session_is_sampled", Je = "$enabled_feature_flags", _t = "$early_access_features", Ai = "$feature_flag_details", vt = "$stored_person_properties", je = "$stored_group_properties", Li = "$surveys", Rt = "$surveys_activated", zt = "$flag_call_reported", ye = "$user_state", Ni = "$client_session_props", Ui = "$capture_rate_limit", qi = "$initial_campaign_params", ji = "$initial_referrer_info", Yt = "$initial_person_info", Xt = "$epp", Is = "__POSTHOG_TOOLBAR__", ot = "$posthog_cookieless", ma = [Ps, gt, "__cmpns", ft, "$session_recording_enabled_server_side", Di, Wt, Je, Mi, ye, _t, Ai, je, vt, Li, zt, Ni, Ui, qi, ji, Xt, Yt];
548
- function Or(r) {
549
- return r instanceof Element && (r.id === Is || !(r.closest == null || !r.closest(".toolbar-global-fade-container")));
550
- }
551
- function ai(r) {
552
- return !!r && r.nodeType === 1;
553
- }
554
- function De(r, e) {
555
- return !!r && !!r.tagName && r.tagName.toLowerCase() === e.toLowerCase();
556
- }
557
- function Fs(r) {
558
- return !!r && r.nodeType === 3;
559
- }
560
- function Ts(r) {
561
- return !!r && r.nodeType === 11;
562
- }
563
- function er(r) {
564
- return r ? si(r).split(/\s+/) : [];
565
- }
566
- function Rr(r) {
567
- var e = d == null ? void 0 : d.location.href;
568
- return !!(e && r && r.some(((t) => e.match(t))));
569
- }
570
- function Kt(r) {
571
- var e = "";
572
- switch (typeof r.className) {
573
- case "string":
574
- e = r.className;
575
- break;
576
- case "object":
577
- e = (r.className && "baseVal" in r.className ? r.className.baseVal : null) || r.getAttribute("class") || "";
578
- break;
579
- default:
580
- e = "";
581
- }
582
- return er(e);
583
- }
584
- function Os(r) {
585
- return O(r) ? null : si(r).split(/(\s+)/).filter(((e) => xt(e))).join("").replace(/[\r\n]/g, " ").replace(/[ ]+/g, " ").substring(0, 255);
586
- }
587
- function It(r) {
588
- var e = "";
589
- return Bi(r) && !Ls(r) && r.childNodes && r.childNodes.length && F(r.childNodes, (function(t) {
590
- var i;
591
- Fs(t) && t.textContent && (e += (i = Os(t.textContent)) !== null && i !== void 0 ? i : "");
592
- })), si(e);
593
- }
594
- function Rs(r) {
595
- return v(r.target) ? r.srcElement || null : (e = r.target) != null && e.shadowRoot ? r.composedPath()[0] || null : r.target || null;
596
- var e;
597
- }
598
- var tr = ["a", "button", "form", "input", "select", "textarea", "label"];
599
- function Ds(r, e) {
600
- if (v(e)) return !0;
601
- var t, i = function(n) {
602
- if (e.some(((a) => n.matches(a)))) return { v: !0 };
603
- };
604
- for (var s of r) if (t = i(s)) return t.v;
605
- return !1;
606
- }
607
- function Ms(r) {
608
- var e = r.parentNode;
609
- return !(!e || !ai(e)) && e;
610
- }
611
- var ya = ["next", "previous", "prev", ">", "<"], Dr = 10, Mr = [".ph-no-rageclick", ".ph-no-capture"];
612
- function ba(r, e) {
613
- if (!d || ir(r)) return !1;
614
- var t, i, s;
615
- if (Oe(e) ? (t = !!e && Mr, i = void 0) : (t = (s = e == null ? void 0 : e.css_selector_ignorelist) !== null && s !== void 0 ? s : Mr, i = e == null ? void 0 : e.content_ignorelist), t === !1) return !1;
616
- var { targetElementList: n } = As(r, !1);
617
- return !(function(a, o) {
618
- if (a === !1 || v(a)) return !1;
619
- var l;
620
- if (a === !0) l = ya;
621
- else {
622
- if (!T(a)) return !1;
623
- if (a.length > Dr) return y.error("[PostHog] content_ignorelist array cannot exceed " + Dr + " items. Use css_selector_ignorelist for more complex matching."), !1;
624
- l = a.map(((c) => c.toLowerCase()));
625
- }
626
- return o.some(((c) => {
627
- var { safeText: u, ariaLabel: h } = c;
628
- return l.some(((g) => u.includes(g) || h.includes(g)));
629
- }));
630
- })(i, n.map(((a) => {
631
- var o;
632
- return { safeText: It(a).toLowerCase(), ariaLabel: ((o = a.getAttribute("aria-label")) == null ? void 0 : o.toLowerCase().trim()) || "" };
633
- }))) && !Ds(n, t);
634
- }
635
- var ir = (r) => !r || De(r, "html") || !ai(r), As = (r, e) => {
636
- if (!d || ir(r)) return { parentIsUsefulElement: !1, targetElementList: [] };
637
- for (var t = !1, i = [r], s = r; s.parentNode && !De(s, "body"); ) if (Ts(s.parentNode)) i.push(s.parentNode.host), s = s.parentNode.host;
638
- else {
639
- var n = Ms(s);
640
- if (!n) break;
641
- if (e || tr.indexOf(n.tagName.toLowerCase()) > -1) t = !0;
642
- else {
643
- var a = d.getComputedStyle(n);
644
- a && a.getPropertyValue("cursor") === "pointer" && (t = !0);
645
- }
646
- i.push(n), s = n;
647
- }
648
- return { parentIsUsefulElement: t, targetElementList: i };
649
- };
650
- function wa(r, e, t, i, s) {
651
- var n, a, o, l;
652
- if (t === void 0 && (t = void 0), !d || ir(r) || (n = t) != null && n.url_allowlist && !Rr(t.url_allowlist) || (a = t) != null && a.url_ignorelist && Rr(t.url_ignorelist)) return !1;
653
- if ((o = t) != null && o.dom_event_allowlist) {
654
- var c = t.dom_event_allowlist;
655
- if (c && !c.some(((f) => e.type === f))) return !1;
656
- }
657
- var { parentIsUsefulElement: u, targetElementList: h } = As(r, i);
658
- if (!(function(f, _) {
659
- var b = _ == null ? void 0 : _.element_allowlist;
660
- if (v(b)) return !0;
661
- var E, x = function(P) {
662
- if (b.some(((M) => P.tagName.toLowerCase() === M))) return { v: !0 };
663
- };
664
- for (var $ of f) if (E = x($)) return E.v;
665
- return !1;
666
- })(h, t) || !Ds(h, (l = t) == null ? void 0 : l.css_selector_allowlist)) return !1;
667
- var g = d.getComputedStyle(r);
668
- if (g && g.getPropertyValue("cursor") === "pointer" && e.type === "click") return !0;
669
- var p = r.tagName.toLowerCase();
670
- switch (p) {
671
- case "html":
672
- return !1;
673
- case "form":
674
- return (s || ["submit"]).indexOf(e.type) >= 0;
675
- case "input":
676
- case "select":
677
- case "textarea":
678
- return (s || ["change", "click"]).indexOf(e.type) >= 0;
679
- default:
680
- return u ? (s || ["click"]).indexOf(e.type) >= 0 : (s || ["click"]).indexOf(e.type) >= 0 && (tr.indexOf(p) > -1 || r.getAttribute("contenteditable") === "true");
681
- }
682
- }
683
- function Bi(r) {
684
- for (var e = r; e.parentNode && !De(e, "body"); e = e.parentNode) {
685
- var t = Kt(e);
686
- if (S(t, "ph-sensitive") || S(t, "ph-no-capture")) return !1;
687
- }
688
- if (S(Kt(r), "ph-include")) return !0;
689
- var i = r.type || "";
690
- if (N(i)) switch (i.toLowerCase()) {
691
- case "hidden":
692
- case "password":
693
- return !1;
694
- }
695
- var s = r.name || r.id || "";
696
- return !(N(s) && /^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g, "")));
697
- }
698
- function Ls(r) {
699
- return !!(De(r, "input") && !["button", "checkbox", "submit", "reset"].includes(r.type) || De(r, "select") || De(r, "textarea") || r.getAttribute("contenteditable") === "true");
700
- }
701
- var Ns = "(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})", Ea = new RegExp("^(?:" + Ns + ")$"), ka = new RegExp(Ns), Us = "\\d{3}-?\\d{2}-?\\d{4}", xa = new RegExp("^(" + Us + ")$"), Sa = new RegExp("(" + Us + ")");
702
- function xt(r, e) {
703
- return e === void 0 && (e = !0), !(O(r) || N(r) && (r = si(r), (e ? Ea : ka).test((r || "").replace(/[- ]/g, "")) || (e ? xa : Sa).test(r)));
704
- }
705
- function qs(r) {
706
- var e = It(r);
707
- return xt(e = (e + " " + js(r)).trim()) ? e : "";
708
- }
709
- function js(r) {
710
- var e = "";
711
- return r && r.childNodes && r.childNodes.length && F(r.childNodes, (function(t) {
712
- var i;
713
- if (t && ((i = t.tagName) == null ? void 0 : i.toLowerCase()) === "span") try {
714
- var s = It(t);
715
- e = (e + " " + s).trim(), t.childNodes && t.childNodes.length && (e = (e + " " + js(t)).trim());
716
- } catch (n) {
717
- y.error("[AutoCapture]", n);
718
- }
719
- })), e;
720
- }
721
- function Pa(r) {
722
- return (function(e) {
723
- var t = e.map(((i) => {
724
- var s, n, a = "";
725
- if (i.tag_name && (a += i.tag_name), i.attr_class) for (var o of (i.attr_class.sort(), i.attr_class)) a += "." + o.replace(/"/g, "");
726
- var l = w({}, i.text ? { text: i.text } : {}, { "nth-child": (s = i.nth_child) !== null && s !== void 0 ? s : 0, "nth-of-type": (n = i.nth_of_type) !== null && n !== void 0 ? n : 0 }, i.href ? { href: i.href } : {}, i.attr_id ? { attr_id: i.attr_id } : {}, i.attributes), c = {};
727
- return Ut(l).sort(((u, h) => {
728
- var [g] = u, [p] = h;
729
- return g.localeCompare(p);
730
- })).forEach(((u) => {
731
- var [h, g] = u;
732
- return c[Ar(h.toString())] = Ar(g.toString());
733
- })), a += ":", a += Ut(c).map(((u) => {
734
- var [h, g] = u;
735
- return h + '="' + g + '"';
736
- })).join("");
737
- }));
738
- return t.join(";");
739
- })((function(e) {
740
- return e.map(((t) => {
741
- var i, s, n = { text: (i = t.$el_text) == null ? void 0 : i.slice(0, 400), tag_name: t.tag_name, href: (s = t.attr__href) == null ? void 0 : s.slice(0, 2048), attr_class: Ca(t), attr_id: t.attr__id, nth_child: t.nth_child, nth_of_type: t.nth_of_type, attributes: {} };
742
- return Ut(t).filter(((a) => {
743
- var [o] = a;
744
- return o.indexOf("attr__") === 0;
745
- })).forEach(((a) => {
746
- var [o, l] = a;
747
- return n.attributes[o] = l;
748
- })), n;
749
- }));
750
- })(r));
751
- }
752
- function Ar(r) {
753
- return r.replace(/"|\\"/g, '\\"');
754
- }
755
- function Ca(r) {
756
- var e = r.attr__class;
757
- return e ? T(e) ? e : er(e) : void 0;
758
- }
759
- class Bs {
760
- constructor(e) {
761
- this.disabled = e === !1;
762
- var t = j(e) ? e : {};
763
- this.thresholdPx = t.threshold_px || 30, this.timeoutMs = t.timeout_ms || 1e3, this.clickCount = t.click_count || 3, this.clicks = [];
764
- }
765
- isRageClick(e, t, i) {
766
- if (this.disabled) return !1;
767
- var s = this.clicks[this.clicks.length - 1];
768
- if (s && Math.abs(e - s.x) + Math.abs(t - s.y) < this.thresholdPx && i - s.timestamp < this.timeoutMs) {
769
- if (this.clicks.push({ x: e, y: t, timestamp: i }), this.clicks.length === this.clickCount) return !0;
770
- } else this.clicks = [{ x: e, y: t, timestamp: i }];
771
- return !1;
772
- }
773
- }
774
- var gi = "$copy_autocapture", we = (function(r) {
775
- return r.GZipJS = "gzip-js", r.Base64 = "base64", r;
776
- })({}), Jt = (r) => {
777
- var e = m == null ? void 0 : m.createElement("a");
778
- return v(e) ? null : (e.href = r, e);
779
- }, $a = function(r, e) {
780
- var t, i;
781
- e === void 0 && (e = "&");
782
- var s = [];
783
- return F(r, (function(n, a) {
784
- v(n) || v(a) || a === "undefined" || (t = encodeURIComponent(((o) => o instanceof File)(n) ? n.name : n.toString()), i = encodeURIComponent(a), s[s.length] = i + "=" + t);
785
- })), s.join(e);
786
- }, Zt = function(r, e) {
787
- for (var t, i = ((r.split("#")[0] || "").split(/\?(.*)/)[1] || "").replace(/^\?+/g, "").split("&"), s = 0; s < i.length; s++) {
788
- var n = i[s].split("=");
789
- if (n[0] === e) {
790
- t = n;
791
- break;
792
- }
793
- }
794
- if (!T(t) || t.length < 2) return "";
795
- var a = t[1];
796
- try {
797
- a = decodeURIComponent(a);
798
- } catch {
799
- y.error("Skipping decoding for malformed query param: " + a);
800
- }
801
- return a.replace(/\+/g, " ");
802
- }, Ft = function(r, e, t) {
803
- if (!r || !e || !e.length) return r;
804
- for (var i = r.split("#"), s = i[0] || "", n = i[1], a = s.split("?"), o = a[1], l = a[0], c = (o || "").split("&"), u = [], h = 0; h < c.length; h++) {
805
- var g = c[h].split("=");
806
- T(g) && (e.includes(g[0]) ? u.push(g[0] + "=" + t) : u.push(c[h]));
807
- }
808
- var p = l;
809
- return o != null && (p += "?" + u.join("&")), n != null && (p += "#" + n), p;
810
- }, Qt = function(r, e) {
811
- var t = r.match(new RegExp(e + "=([^&]*)"));
812
- return t ? t[1] : null;
813
- }, Lr = U("[AutoCapture]");
814
- function fi(r, e) {
815
- return e.length > r ? e.slice(0, r) + "..." : e;
816
- }
817
- function Ia(r) {
818
- if (r.previousElementSibling) return r.previousElementSibling;
819
- var e = r;
820
- do
821
- e = e.previousSibling;
822
- while (e && !ai(e));
823
- return e;
824
- }
825
- function Fa(r, e, t, i) {
826
- var s = r.tagName.toLowerCase(), n = { tag_name: s };
827
- tr.indexOf(s) > -1 && !t && (s.toLowerCase() === "a" || s.toLowerCase() === "button" ? n.$el_text = fi(1024, qs(r)) : n.$el_text = fi(1024, It(r)));
828
- var a = Kt(r);
829
- a.length > 0 && (n.classes = a.filter((function(u) {
830
- return u !== "";
831
- }))), F(r.attributes, (function(u) {
832
- var h;
833
- if ((!Ls(r) || ["name", "id", "class", "aria-label"].indexOf(u.name) !== -1) && (i == null || !i.includes(u.name)) && !e && xt(u.value) && (h = u.name, !N(h) || h.substring(0, 10) !== "_ngcontent" && h.substring(0, 7) !== "_nghost")) {
834
- var g = u.value;
835
- u.name === "class" && (g = er(g).join(" ")), n["attr__" + u.name] = fi(1024, g);
836
- }
837
- }));
838
- for (var o = 1, l = 1, c = r; c = Ia(c); ) o++, c.tagName === r.tagName && l++;
839
- return n.nth_child = o, n.nth_of_type = l, n;
840
- }
841
- function Ta(r, e) {
842
- for (var t, i, { e: s, maskAllElementAttributes: n, maskAllText: a, elementAttributeIgnoreList: o, elementsChainAsString: l } = e, c = [r], u = r; u.parentNode && !De(u, "body"); ) Ts(u.parentNode) ? (c.push(u.parentNode.host), u = u.parentNode.host) : (c.push(u.parentNode), u = u.parentNode);
843
- var h, g = [], p = {}, f = !1, _ = !1;
844
- if (F(c, ((P) => {
845
- var M = Bi(P);
846
- P.tagName.toLowerCase() === "a" && (f = P.getAttribute("href"), f = M && f && xt(f) && f), S(Kt(P), "ph-no-capture") && (_ = !0), g.push(Fa(P, n, a, o));
847
- var ne = (function(K) {
848
- if (!Bi(K)) return {};
849
- var C = {};
850
- return F(K.attributes, (function(le) {
851
- if (le.name && le.name.indexOf("data-ph-capture-attribute") === 0) {
852
- var J = le.name.replace("data-ph-capture-attribute-", ""), ae = le.value;
853
- J && ae && xt(ae) && (C[J] = ae);
854
- }
855
- })), C;
856
- })(P);
857
- A(p, ne);
858
- })), _) return { props: {}, explicitNoCapture: _ };
859
- if (a || (r.tagName.toLowerCase() === "a" || r.tagName.toLowerCase() === "button" ? g[0].$el_text = qs(r) : g[0].$el_text = It(r)), f) {
860
- var b, E;
861
- g[0].attr__href = f;
862
- var x = (b = Jt(f)) == null ? void 0 : b.host, $ = d == null || (E = d.location) == null ? void 0 : E.host;
863
- x && $ && x !== $ && (h = f);
864
- }
865
- return { props: A({ $event_type: s.type, $ce_version: 1 }, l ? {} : { $elements: g }, { $elements_chain: Pa(g) }, (t = g[0]) != null && t.$el_text ? { $el_text: (i = g[0]) == null ? void 0 : i.$el_text } : {}, h && s.type === "click" ? { $external_click_url: h } : {}, p) };
866
- }
867
- class Oa {
868
- constructor(e) {
869
- this.P = !1, this.T = null, this.I = !1, this.instance = e, this.rageclicks = new Bs(e.config.rageclick), this.R = null;
870
- }
871
- get C() {
872
- var e, t, i = j(this.instance.config.autocapture) ? this.instance.config.autocapture : {};
873
- return i.url_allowlist = (e = i.url_allowlist) == null ? void 0 : e.map(((s) => new RegExp(s))), i.url_ignorelist = (t = i.url_ignorelist) == null ? void 0 : t.map(((s) => new RegExp(s))), i;
874
- }
875
- O() {
876
- if (this.isBrowserSupported()) {
877
- if (d && m) {
878
- var e = (i) => {
879
- i = i || (d == null ? void 0 : d.event);
880
- try {
881
- this.F(i);
882
- } catch (s) {
883
- Lr.error("Failed to capture event", s);
884
- }
885
- };
886
- if (L(m, "submit", e, { capture: !0 }), L(m, "change", e, { capture: !0 }), L(m, "click", e, { capture: !0 }), this.C.capture_copied_text) {
887
- var t = (i) => {
888
- i = i || (d == null ? void 0 : d.event), this.F(i, gi);
889
- };
890
- L(m, "copy", t, { capture: !0 }), L(m, "cut", t, { capture: !0 });
891
- }
892
- }
893
- } else Lr.info("Disabling Automatic Event Collection because this browser is not supported");
894
- }
895
- startIfEnabled() {
896
- this.isEnabled && !this.P && (this.O(), this.P = !0);
897
- }
898
- onRemoteConfig(e) {
899
- e.elementsChainAsString && (this.I = e.elementsChainAsString), this.instance.persistence && this.instance.persistence.register({ [Cr]: !!e.autocapture_opt_out }), this.T = !!e.autocapture_opt_out, this.startIfEnabled();
900
- }
901
- setElementSelectors(e) {
902
- this.R = e;
903
- }
904
- getElementSelectors(e) {
905
- var t, i = [];
906
- return (t = this.R) == null || t.forEach(((s) => {
907
- var n = m == null ? void 0 : m.querySelectorAll(s);
908
- n == null || n.forEach(((a) => {
909
- e === a && i.push(s);
910
- }));
911
- })), i;
912
- }
913
- get isEnabled() {
914
- var e, t, i = (e = this.instance.persistence) == null ? void 0 : e.props[Cr], s = this.T;
915
- if (Ee(s) && !Oe(i) && !this.instance.M()) return !1;
916
- var n = (t = this.T) !== null && t !== void 0 ? t : !!i;
917
- return !!this.instance.config.autocapture && !n;
918
- }
919
- F(e, t) {
920
- if (t === void 0 && (t = "$autocapture"), this.isEnabled) {
921
- var i, s = Rs(e);
922
- Fs(s) && (s = s.parentNode || null), t === "$autocapture" && e.type === "click" && e instanceof MouseEvent && this.instance.config.rageclick && (i = this.rageclicks) != null && i.isRageClick(e.clientX, e.clientY, e.timeStamp || (/* @__PURE__ */ new Date()).getTime()) && ba(s, this.instance.config.rageclick) && this.F(e, "$rageclick");
923
- var n = t === gi;
924
- if (s && wa(s, e, this.C, n, n ? ["copy", "cut"] : void 0)) {
925
- var { props: a, explicitNoCapture: o } = Ta(s, { e, maskAllElementAttributes: this.instance.config.mask_all_element_attributes, maskAllText: this.instance.config.mask_all_text, elementAttributeIgnoreList: this.C.element_attribute_ignorelist, elementsChainAsString: this.I });
926
- if (o) return !1;
927
- var l = this.getElementSelectors(s);
928
- if (l && l.length > 0 && (a.$element_selectors = l), t === gi) {
929
- var c, u = Os(d == null || (c = d.getSelection()) == null ? void 0 : c.toString()), h = e.type || "clipboard";
930
- if (!u) return !1;
931
- a.$selected_content = u, a.$copy_type = h;
932
- }
933
- return this.instance.capture(t, a), !0;
934
- }
935
- }
936
- }
937
- isBrowserSupported() {
938
- return Te(m == null ? void 0 : m.querySelectorAll);
939
- }
940
- }
941
- Math.trunc || (Math.trunc = function(r) {
942
- return r < 0 ? Math.ceil(r) : Math.floor(r);
943
- }), Number.isInteger || (Number.isInteger = function(r) {
944
- return fe(r) && isFinite(r) && Math.floor(r) === r;
945
- });
946
- var Nr = "0123456789abcdef";
947
- class ei {
948
- constructor(e) {
949
- if (this.bytes = e, e.length !== 16) throw new TypeError("not 128-bit length");
950
- }
951
- static fromFieldsV7(e, t, i, s) {
952
- if (!Number.isInteger(e) || !Number.isInteger(t) || !Number.isInteger(i) || !Number.isInteger(s) || e < 0 || t < 0 || i < 0 || s < 0 || e > 281474976710655 || t > 4095 || i > 1073741823 || s > 4294967295) throw new RangeError("invalid field value");
953
- var n = new Uint8Array(16);
954
- return n[0] = e / Math.pow(2, 40), n[1] = e / Math.pow(2, 32), n[2] = e / Math.pow(2, 24), n[3] = e / Math.pow(2, 16), n[4] = e / Math.pow(2, 8), n[5] = e, n[6] = 112 | t >>> 8, n[7] = t, n[8] = 128 | i >>> 24, n[9] = i >>> 16, n[10] = i >>> 8, n[11] = i, n[12] = s >>> 24, n[13] = s >>> 16, n[14] = s >>> 8, n[15] = s, new ei(n);
955
- }
956
- toString() {
957
- for (var e = "", t = 0; t < this.bytes.length; t++) e = e + Nr.charAt(this.bytes[t] >>> 4) + Nr.charAt(15 & this.bytes[t]), t !== 3 && t !== 5 && t !== 7 && t !== 9 || (e += "-");
958
- if (e.length !== 36) throw new Error("Invalid UUIDv7 was generated");
959
- return e;
960
- }
961
- clone() {
962
- return new ei(this.bytes.slice(0));
963
- }
964
- equals(e) {
965
- return this.compareTo(e) === 0;
966
- }
967
- compareTo(e) {
968
- for (var t = 0; t < 16; t++) {
969
- var i = this.bytes[t] - e.bytes[t];
970
- if (i !== 0) return Math.sign(i);
971
- }
972
- return 0;
973
- }
974
- }
975
- class Ra {
976
- constructor() {
977
- this.A = 0, this.D = 0, this.j = new Da();
978
- }
979
- generate() {
980
- var e = this.generateOrAbort();
981
- if (v(e)) {
982
- this.A = 0;
983
- var t = this.generateOrAbort();
984
- if (v(t)) throw new Error("Could not generate UUID after timestamp reset");
985
- return t;
986
- }
987
- return e;
988
- }
989
- generateOrAbort() {
990
- var e = Date.now();
991
- if (e > this.A) this.A = e, this.L();
992
- else {
993
- if (!(e + 1e4 > this.A)) return;
994
- this.D++, this.D > 4398046511103 && (this.A++, this.L());
995
- }
996
- return ei.fromFieldsV7(this.A, Math.trunc(this.D / Math.pow(2, 30)), this.D & Math.pow(2, 30) - 1, this.j.nextUint32());
997
- }
998
- L() {
999
- this.D = 1024 * this.j.nextUint32() + (1023 & this.j.nextUint32());
1000
- }
1001
- }
1002
- var Ur, Hs = (r) => {
1003
- if (typeof UUIDV7_DENY_WEAK_RNG < "u" && UUIDV7_DENY_WEAK_RNG) throw new Error("no cryptographically strong RNG available");
1004
- for (var e = 0; e < r.length; e++) r[e] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());
1005
- return r;
1006
- };
1007
- d && !v(d.crypto) && crypto.getRandomValues && (Hs = (r) => crypto.getRandomValues(r));
1008
- class Da {
1009
- constructor() {
1010
- this.N = new Uint32Array(8), this.U = 1 / 0;
1011
- }
1012
- nextUint32() {
1013
- return this.U >= this.N.length && (Hs(this.N), this.U = 0), this.N[this.U++];
1014
- }
1015
- }
1016
- var Fe = () => Ma().toString(), Ma = () => (Ur || (Ur = new Ra())).generate(), lt = "", Aa = /[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;
1017
- function La(r, e) {
1018
- if (e) {
1019
- var t = (function(s, n) {
1020
- if (n === void 0 && (n = m), lt) return lt;
1021
- if (!n || ["localhost", "127.0.0.1"].includes(s)) return "";
1022
- for (var a = s.split("."), o = Math.min(a.length, 8), l = "dmn_chk_" + Fe(); !lt && o--; ) {
1023
- var c = a.slice(o).join("."), u = l + "=1;domain=." + c + ";path=/";
1024
- n.cookie = u + ";max-age=3", n.cookie.includes(l) && (n.cookie = u + ";max-age=0", lt = c);
1025
- }
1026
- return lt;
1027
- })(r);
1028
- if (!t) {
1029
- var i = ((s) => {
1030
- var n = s.match(Aa);
1031
- return n ? n[0] : "";
1032
- })(r);
1033
- i !== t && y.info("Warning: cookie subdomain discovery mismatch", i, t), t = i;
1034
- }
1035
- return t ? "; domain=." + t : "";
1036
- }
1037
- return "";
1038
- }
1039
- var ge = { H: () => !!m, B: function(r) {
1040
- y.error("cookieStore error: " + r);
1041
- }, q: function(r) {
1042
- if (m) {
1043
- try {
1044
- for (var e = r + "=", t = m.cookie.split(";").filter(((n) => n.length)), i = 0; i < t.length; i++) {
1045
- for (var s = t[i]; s.charAt(0) == " "; ) s = s.substring(1, s.length);
1046
- if (s.indexOf(e) === 0) return decodeURIComponent(s.substring(e.length, s.length));
1047
- }
1048
- } catch {
1049
- }
1050
- return null;
1051
- }
1052
- }, W: function(r) {
1053
- var e;
1054
- try {
1055
- e = JSON.parse(ge.q(r)) || {};
1056
- } catch {
1057
- }
1058
- return e;
1059
- }, G: function(r, e, t, i, s) {
1060
- if (m) try {
1061
- var n = "", a = "", o = La(m.location.hostname, i);
1062
- if (t) {
1063
- var l = /* @__PURE__ */ new Date();
1064
- l.setTime(l.getTime() + 24 * t * 60 * 60 * 1e3), n = "; expires=" + l.toUTCString();
1065
- }
1066
- s && (a = "; secure");
1067
- var c = r + "=" + encodeURIComponent(JSON.stringify(e)) + n + "; SameSite=Lax; path=/" + o + a;
1068
- return c.length > 3686.4 && y.warn("cookieStore warning: large cookie, len=" + c.length), m.cookie = c, c;
1069
- } catch {
1070
- return;
1071
- }
1072
- }, V: function(r, e) {
1073
- if (m != null && m.cookie) try {
1074
- ge.G(r, "", -1, e);
1075
- } catch {
1076
- return;
1077
- }
1078
- } }, _i = null, D = { H: function() {
1079
- if (!Ee(_i)) return _i;
1080
- var r = !0;
1081
- if (v(d)) r = !1;
1082
- else try {
1083
- var e = "__mplssupport__";
1084
- D.G(e, "xyz"), D.q(e) !== '"xyz"' && (r = !1), D.V(e);
1085
- } catch {
1086
- r = !1;
1087
- }
1088
- return r || y.error("localStorage unsupported; falling back to cookie store"), _i = r, r;
1089
- }, B: function(r) {
1090
- y.error("localStorage error: " + r);
1091
- }, q: function(r) {
1092
- try {
1093
- return d == null ? void 0 : d.localStorage.getItem(r);
1094
- } catch (e) {
1095
- D.B(e);
1096
- }
1097
- return null;
1098
- }, W: function(r) {
1099
- try {
1100
- return JSON.parse(D.q(r)) || {};
1101
- } catch {
1102
- }
1103
- return null;
1104
- }, G: function(r, e) {
1105
- try {
1106
- d == null || d.localStorage.setItem(r, JSON.stringify(e));
1107
- } catch (t) {
1108
- D.B(t);
1109
- }
1110
- }, V: function(r) {
1111
- try {
1112
- d == null || d.localStorage.removeItem(r);
1113
- } catch (e) {
1114
- D.B(e);
1115
- }
1116
- } }, Na = ["distinct_id", Wt, $s, Xt, Yt], Dt = w({}, D, { W: function(r) {
1117
- try {
1118
- var e = {};
1119
- try {
1120
- e = ge.W(r) || {};
1121
- } catch {
1122
- }
1123
- var t = A(e, JSON.parse(D.q(r) || "{}"));
1124
- return D.G(r, t), t;
1125
- } catch {
1126
- }
1127
- return null;
1128
- }, G: function(r, e, t, i, s, n) {
1129
- try {
1130
- D.G(r, e, void 0, void 0, n);
1131
- var a = {};
1132
- Na.forEach(((o) => {
1133
- e[o] && (a[o] = e[o]);
1134
- })), Object.keys(a).length && ge.G(r, a, t, i, s, n);
1135
- } catch (o) {
1136
- D.B(o);
1137
- }
1138
- }, V: function(r, e) {
1139
- try {
1140
- d == null || d.localStorage.removeItem(r), ge.V(r, e);
1141
- } catch (t) {
1142
- D.B(t);
1143
- }
1144
- } }), Mt = {}, Ua = { H: function() {
1145
- return !0;
1146
- }, B: function(r) {
1147
- y.error("memoryStorage error: " + r);
1148
- }, q: function(r) {
1149
- return Mt[r] || null;
1150
- }, W: function(r) {
1151
- return Mt[r] || null;
1152
- }, G: function(r, e) {
1153
- Mt[r] = e;
1154
- }, V: function(r) {
1155
- delete Mt[r];
1156
- } }, Ne = null, q = { H: function() {
1157
- if (!Ee(Ne)) return Ne;
1158
- if (Ne = !0, v(d)) Ne = !1;
1159
- else try {
1160
- var r = "__support__";
1161
- q.G(r, "xyz"), q.q(r) !== '"xyz"' && (Ne = !1), q.V(r);
1162
- } catch {
1163
- Ne = !1;
1164
- }
1165
- return Ne;
1166
- }, B: function(r) {
1167
- y.error("sessionStorage error: ", r);
1168
- }, q: function(r) {
1169
- try {
1170
- return d == null ? void 0 : d.sessionStorage.getItem(r);
1171
- } catch (e) {
1172
- q.B(e);
1173
- }
1174
- return null;
1175
- }, W: function(r) {
1176
- try {
1177
- return JSON.parse(q.q(r)) || null;
1178
- } catch {
1179
- }
1180
- return null;
1181
- }, G: function(r, e) {
1182
- try {
1183
- d == null || d.sessionStorage.setItem(r, JSON.stringify(e));
1184
- } catch (t) {
1185
- q.B(t);
1186
- }
1187
- }, V: function(r) {
1188
- try {
1189
- d == null || d.sessionStorage.removeItem(r);
1190
- } catch (e) {
1191
- q.B(e);
1192
- }
1193
- } }, be = (function(r) {
1194
- return r[r.PENDING = -1] = "PENDING", r[r.DENIED = 0] = "DENIED", r[r.GRANTED = 1] = "GRANTED", r;
1195
- })({});
1196
- class qa {
1197
- constructor(e) {
1198
- this._instance = e;
1199
- }
1200
- get C() {
1201
- return this._instance.config;
1202
- }
1203
- get consent() {
1204
- return this.J() ? be.DENIED : this.K;
1205
- }
1206
- isOptedOut() {
1207
- return this.C.cookieless_mode === "always" || this.consent === be.DENIED || this.consent === be.PENDING && (this.C.opt_out_capturing_by_default || this.C.cookieless_mode === "on_reject");
1208
- }
1209
- isOptedIn() {
1210
- return !this.isOptedOut();
1211
- }
1212
- isExplicitlyOptedOut() {
1213
- return this.consent === be.DENIED;
1214
- }
1215
- optInOut(e) {
1216
- this.Y.G(this.X, e ? 1 : 0, this.C.cookie_expiration, this.C.cross_subdomain_cookie, this.C.secure_cookie);
1217
- }
1218
- reset() {
1219
- this.Y.V(this.X, this.C.cross_subdomain_cookie);
1220
- }
1221
- get X() {
1222
- var { token: e, opt_out_capturing_cookie_prefix: t, consent_persistence_name: i } = this._instance.config;
1223
- return i || (t ? t + e : "__ph_opt_in_out_" + e);
1224
- }
1225
- get K() {
1226
- var e = this.Y.q(this.X);
1227
- return hi(e) ? be.GRANTED : S(Vn, e) ? be.DENIED : be.PENDING;
1228
- }
1229
- get Y() {
1230
- if (!this.Z) {
1231
- var e = this.C.opt_out_capturing_persistence_type;
1232
- this.Z = e === "localStorage" ? D : ge;
1233
- var t = e === "localStorage" ? ge : D;
1234
- t.q(this.X) && (this.Z.q(this.X) || this.optInOut(hi(t.q(this.X))), t.V(this.X, this.C.cross_subdomain_cookie));
1235
- }
1236
- return this.Z;
1237
- }
1238
- J() {
1239
- return !!this.C.respect_dnt && !!Ss([Q == null ? void 0 : Q.doNotTrack, Q == null ? void 0 : Q.msDoNotTrack, k.doNotTrack], ((e) => hi(e)));
1240
- }
1241
- }
1242
- var At = U("[Dead Clicks]"), ja = () => !0, Ba = (r) => {
1243
- var e, t = !((e = r.instance.persistence) == null || !e.get_property(Cs)), i = r.instance.config.capture_dead_clicks;
1244
- return Oe(i) ? i : t;
1245
- };
1246
- class Vs {
1247
- get lazyLoadedDeadClicksAutocapture() {
1248
- return this.tt;
1249
- }
1250
- constructor(e, t, i) {
1251
- this.instance = e, this.isEnabled = t, this.onCapture = i, this.startIfEnabled();
1252
- }
1253
- onRemoteConfig(e) {
1254
- this.instance.persistence && this.instance.persistence.register({ [Cs]: e == null ? void 0 : e.captureDeadClicks }), this.startIfEnabled();
1255
- }
1256
- startIfEnabled() {
1257
- this.isEnabled(this) && this.it((() => {
1258
- this.et();
1259
- }));
1260
- }
1261
- it(e) {
1262
- var t, i;
1263
- (t = k.__PosthogExtensions__) != null && t.initDeadClicksAutocapture && e(), (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this.instance, "dead-clicks-autocapture", ((s) => {
1264
- s ? At.error("failed to load script", s) : e();
1265
- }));
1266
- }
1267
- et() {
1268
- var e;
1269
- if (m) {
1270
- if (!this.tt && (e = k.__PosthogExtensions__) != null && e.initDeadClicksAutocapture) {
1271
- var t = j(this.instance.config.capture_dead_clicks) ? this.instance.config.capture_dead_clicks : {};
1272
- t.__onCapture = this.onCapture, this.tt = k.__PosthogExtensions__.initDeadClicksAutocapture(this.instance, t), this.tt.start(m), At.info("starting...");
1273
- }
1274
- } else At.error("`document` not found. Cannot start.");
1275
- }
1276
- stop() {
1277
- this.tt && (this.tt.stop(), this.tt = void 0, At.info("stopping..."));
1278
- }
1279
- }
1280
- var ct = U("[ExceptionAutocapture]");
1281
- class Ha {
1282
- constructor(e) {
1283
- var t, i, s;
1284
- this.rt = () => {
1285
- var n;
1286
- if (d && this.isEnabled && (n = k.__PosthogExtensions__) != null && n.errorWrappingFunctions) {
1287
- var a = k.__PosthogExtensions__.errorWrappingFunctions.wrapOnError, o = k.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection, l = k.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;
1288
- try {
1289
- !this.st && this.C.capture_unhandled_errors && (this.st = a(this.captureException.bind(this))), !this.nt && this.C.capture_unhandled_rejections && (this.nt = o(this.captureException.bind(this))), !this.ot && this.C.capture_console_errors && (this.ot = l(this.captureException.bind(this)));
1290
- } catch (c) {
1291
- ct.error("failed to start", c), this.lt();
1292
- }
1293
- }
1294
- }, this._instance = e, this.ut = !((t = this._instance.persistence) == null || !t.props[$r]), this.C = this.ht(), this.dt = new Gn({ refillRate: (i = this._instance.config.error_tracking.__exceptionRateLimiterRefillRate) !== null && i !== void 0 ? i : 1, bucketSize: (s = this._instance.config.error_tracking.__exceptionRateLimiterBucketSize) !== null && s !== void 0 ? s : 10, refillInterval: 1e4, h: ct }), this.startIfEnabled();
1295
- }
1296
- ht() {
1297
- var e = this._instance.config.capture_exceptions, t = { capture_unhandled_errors: !1, capture_unhandled_rejections: !1, capture_console_errors: !1 };
1298
- return j(e) ? t = w({}, t, e) : (v(e) ? this.ut : e) && (t = w({}, t, { capture_unhandled_errors: !0, capture_unhandled_rejections: !0 })), t;
1299
- }
1300
- get isEnabled() {
1301
- return this.C.capture_console_errors || this.C.capture_unhandled_errors || this.C.capture_unhandled_rejections;
1302
- }
1303
- startIfEnabled() {
1304
- this.isEnabled && (ct.info("enabled"), this.it(this.rt));
1305
- }
1306
- it(e) {
1307
- var t, i;
1308
- (t = k.__PosthogExtensions__) != null && t.errorWrappingFunctions && e(), (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this._instance, "exception-autocapture", ((s) => {
1309
- if (s) return ct.error("failed to load script", s);
1310
- e();
1311
- }));
1312
- }
1313
- lt() {
1314
- var e, t, i;
1315
- (e = this.st) == null || e.call(this), this.st = void 0, (t = this.nt) == null || t.call(this), this.nt = void 0, (i = this.ot) == null || i.call(this), this.ot = void 0;
1316
- }
1317
- onRemoteConfig(e) {
1318
- var t = e.autocaptureExceptions;
1319
- this.ut = !!t || !1, this.C = this.ht(), this._instance.persistence && this._instance.persistence.register({ [$r]: this.ut }), this.startIfEnabled();
1320
- }
1321
- captureException(e) {
1322
- var t, i, s = (t = e == null || (i = e.$exception_list) == null || (i = i[0]) == null ? void 0 : i.type) !== null && t !== void 0 ? t : "Exception";
1323
- this.dt.consumeRateLimit(s) ? ct.info("Skipping exception capture because of client rate limiting.", { exception: s }) : this._instance.exceptions.sendExceptionEvent(e);
1324
- }
1325
- }
1326
- function qr(r, e, t) {
1327
- try {
1328
- if (!(e in r)) return () => {
1329
- };
1330
- var i = r[e], s = t(i);
1331
- return Te(s) && (s.prototype = s.prototype || {}, Object.defineProperties(s, { __posthog_wrapped__: { enumerable: !1, value: !0 } })), r[e] = s, () => {
1332
- r[e] = i;
1333
- };
1334
- } catch {
1335
- return () => {
1336
- };
1337
- }
1338
- }
1339
- class Va {
1340
- constructor(e) {
1341
- var t;
1342
- this._instance = e, this.vt = (d == null || (t = d.location) == null ? void 0 : t.pathname) || "";
1343
- }
1344
- get isEnabled() {
1345
- return this._instance.config.capture_pageview === "history_change";
1346
- }
1347
- startIfEnabled() {
1348
- this.isEnabled && (y.info("History API monitoring enabled, starting..."), this.monitorHistoryChanges());
1349
- }
1350
- stop() {
1351
- this.ct && this.ct(), this.ct = void 0, y.info("History API monitoring stopped");
1352
- }
1353
- monitorHistoryChanges() {
1354
- var e, t;
1355
- if (d && d.history) {
1356
- var i = this;
1357
- (e = d.history.pushState) != null && e.__posthog_wrapped__ || qr(d.history, "pushState", ((s) => function(n, a, o) {
1358
- s.call(this, n, a, o), i.ft("pushState");
1359
- })), (t = d.history.replaceState) != null && t.__posthog_wrapped__ || qr(d.history, "replaceState", ((s) => function(n, a, o) {
1360
- s.call(this, n, a, o), i.ft("replaceState");
1361
- })), this.gt();
1362
- }
1363
- }
1364
- ft(e) {
1365
- try {
1366
- var t, i = d == null || (t = d.location) == null ? void 0 : t.pathname;
1367
- if (!i) return;
1368
- i !== this.vt && this.isEnabled && this._instance.capture("$pageview", { navigation_type: e }), this.vt = i;
1369
- } catch (s) {
1370
- y.error("Error capturing " + e + " pageview", s);
1371
- }
1372
- }
1373
- gt() {
1374
- if (!this.ct) {
1375
- var e = () => {
1376
- this.ft("popstate");
1377
- };
1378
- L(d, "popstate", e), this.ct = () => {
1379
- d && d.removeEventListener("popstate", e);
1380
- };
1381
- }
1382
- }
1383
- }
1384
- var vi = U("[SegmentIntegration]");
1385
- function Ga(r, e) {
1386
- var t = r.config.segment;
1387
- if (!t) return e();
1388
- (function(i, s) {
1389
- var n = i.config.segment;
1390
- if (!n) return s();
1391
- var a = (l) => {
1392
- var c = () => l.anonymousId() || Fe();
1393
- i.config.get_device_id = c, l.id() && (i.register({ distinct_id: l.id(), $device_id: c() }), i.persistence.set_property(ye, "identified")), s();
1394
- }, o = n.user();
1395
- "then" in o && Te(o.then) ? o.then(((l) => a(l))) : a(o);
1396
- })(r, (() => {
1397
- t.register(((i) => {
1398
- Promise && Promise.resolve || vi.warn("This browser does not have Promise support, and can not use the segment integration");
1399
- var s = (n, a) => {
1400
- if (!a) return n;
1401
- n.event.userId || n.event.anonymousId === i.get_distinct_id() || (vi.info("No userId set, resetting PostHog"), i.reset()), n.event.userId && n.event.userId !== i.get_distinct_id() && (vi.info("UserId set, identifying with PostHog"), i.identify(n.event.userId));
1402
- var o = i.calculateEventProperties(a, n.event.properties);
1403
- return n.event.properties = Object.assign({}, o, n.event.properties), n;
1404
- };
1405
- return { name: "PostHog JS", type: "enrichment", version: "1.0.0", isLoaded: () => !0, load: () => Promise.resolve(), track: (n) => s(n, n.event.event), page: (n) => s(n, "$pageview"), identify: (n) => s(n, "$identify"), screen: (n) => s(n, "$screen") };
1406
- })(r)).then((() => {
1407
- e();
1408
- }));
1409
- }));
1410
- }
1411
- var Gs = "posthog-js";
1412
- function Ws(r, e) {
1413
- var { organization: t, projectId: i, prefix: s, severityAllowList: n = ["error"], sendExceptionsToPostHog: a = !0 } = e === void 0 ? {} : e;
1414
- return (o) => {
1415
- var l, c, u, h, g;
1416
- if (!(n === "*" || n.includes(o.level)) || !r.__loaded) return o;
1417
- o.tags || (o.tags = {});
1418
- var p = r.requestRouter.endpointFor("ui", "/project/" + r.config.token + "/person/" + r.get_distinct_id());
1419
- o.tags["PostHog Person URL"] = p, r.sessionRecordingStarted() && (o.tags["PostHog Recording URL"] = r.get_session_replay_url({ withTimestamp: !0 }));
1420
- var f = ((l = o.exception) == null ? void 0 : l.values) || [], _ = f.map(((E) => w({}, E, { stacktrace: E.stacktrace ? w({}, E.stacktrace, { type: "raw", frames: (E.stacktrace.frames || []).map(((x) => w({}, x, { platform: "web:javascript" }))) }) : void 0 }))), b = { $exception_message: ((c = f[0]) == null ? void 0 : c.value) || o.message, $exception_type: (u = f[0]) == null ? void 0 : u.type, $exception_level: o.level, $exception_list: _, $sentry_event_id: o.event_id, $sentry_exception: o.exception, $sentry_exception_message: ((h = f[0]) == null ? void 0 : h.value) || o.message, $sentry_exception_type: (g = f[0]) == null ? void 0 : g.type, $sentry_tags: o.tags };
1421
- return t && i && (b.$sentry_url = (s || "https://sentry.io/organizations/") + t + "/issues/?project=" + i + "&query=" + o.event_id), a && r.exceptions.sendExceptionEvent(b), o;
1422
- };
1423
- }
1424
- class Wa {
1425
- constructor(e, t, i, s, n, a) {
1426
- this.name = Gs, this.setupOnce = function(o) {
1427
- o(Ws(e, { organization: t, projectId: i, prefix: s, severityAllowList: n, sendExceptionsToPostHog: a == null || a }));
1428
- };
1429
- }
1430
- }
1431
- var za = d != null && d.location ? Qt(d.location.hash, "__posthog") || Qt(location.hash, "state") : null, jr = "_postHogToolbarParams", Br = U("[Toolbar]"), Ie = (function(r) {
1432
- return r[r.UNINITIALIZED = 0] = "UNINITIALIZED", r[r.LOADING = 1] = "LOADING", r[r.LOADED = 2] = "LOADED", r;
1433
- })(Ie || {});
1434
- class Ya {
1435
- constructor(e) {
1436
- this.instance = e;
1437
- }
1438
- _t(e) {
1439
- k.ph_toolbar_state = e;
1440
- }
1441
- yt() {
1442
- var e;
1443
- return (e = k.ph_toolbar_state) !== null && e !== void 0 ? e : Ie.UNINITIALIZED;
1444
- }
1445
- maybeLoadToolbar(e, t, i) {
1446
- if (e === void 0 && (e = void 0), t === void 0 && (t = void 0), i === void 0 && (i = void 0), !d || !m) return !1;
1447
- e = e ?? d.location, i = i ?? d.history;
1448
- try {
1449
- if (!t) {
1450
- try {
1451
- d.localStorage.setItem("test", "test"), d.localStorage.removeItem("test");
1452
- } catch {
1453
- return !1;
1454
- }
1455
- t = d == null ? void 0 : d.localStorage;
1456
- }
1457
- var s, n = za || Qt(e.hash, "__posthog") || Qt(e.hash, "state"), a = n ? Pr((() => JSON.parse(atob(decodeURIComponent(n))))) || Pr((() => JSON.parse(decodeURIComponent(n)))) : null;
1458
- return a && a.action === "ph_authorize" ? ((s = a).source = "url", s && Object.keys(s).length > 0 && (a.desiredHash ? e.hash = a.desiredHash : i ? i.replaceState(i.state, "", e.pathname + e.search) : e.hash = "")) : ((s = JSON.parse(t.getItem(jr) || "{}")).source = "localstorage", delete s.userIntent), !(!s.token || this.instance.config.token !== s.token) && (this.loadToolbar(s), !0);
1459
- } catch {
1460
- return !1;
1461
- }
1462
- }
1463
- bt(e) {
1464
- var t = k.ph_load_toolbar || k.ph_load_editor;
1465
- !O(t) && Te(t) ? t(e, this.instance) : Br.warn("No toolbar load function found");
1466
- }
1467
- loadToolbar(e) {
1468
- var t = !(m == null || !m.getElementById(Is));
1469
- if (!d || t) return !1;
1470
- var i = this.instance.requestRouter.region === "custom" && this.instance.config.advanced_disable_toolbar_metrics, s = w({ token: this.instance.config.token }, e, { apiURL: this.instance.requestRouter.endpointFor("ui") }, i ? { instrument: !1 } : {});
1471
- if (d.localStorage.setItem(jr, JSON.stringify(w({}, s, { source: void 0 }))), this.yt() === Ie.LOADED) this.bt(s);
1472
- else if (this.yt() === Ie.UNINITIALIZED) {
1473
- var n;
1474
- this._t(Ie.LOADING), (n = k.__PosthogExtensions__) == null || n.loadExternalDependency == null || n.loadExternalDependency(this.instance, "toolbar", ((a) => {
1475
- if (a) return Br.error("[Toolbar] Failed to load", a), void this._t(Ie.UNINITIALIZED);
1476
- this._t(Ie.LOADED), this.bt(s);
1477
- })), L(d, "turbolinks:load", (() => {
1478
- this._t(Ie.UNINITIALIZED), this.loadToolbar(s);
1479
- }));
1480
- }
1481
- return !0;
1482
- }
1483
- wt(e) {
1484
- return this.loadToolbar(e);
1485
- }
1486
- maybeLoadEditor(e, t, i) {
1487
- return e === void 0 && (e = void 0), t === void 0 && (t = void 0), i === void 0 && (i = void 0), this.maybeLoadToolbar(e, t, i);
1488
- }
1489
- }
1490
- var Xa = U("[TracingHeaders]");
1491
- class Ka {
1492
- constructor(e) {
1493
- this.xt = void 0, this.$t = void 0, this.rt = () => {
1494
- var t, i;
1495
- v(this.xt) && ((t = k.__PosthogExtensions__) == null || (t = t.tracingHeadersPatchFns) == null || t._patchXHR(this._instance.config.__add_tracing_headers || [], this._instance.get_distinct_id(), this._instance.sessionManager)), v(this.$t) && ((i = k.__PosthogExtensions__) == null || (i = i.tracingHeadersPatchFns) == null || i._patchFetch(this._instance.config.__add_tracing_headers || [], this._instance.get_distinct_id(), this._instance.sessionManager));
1496
- }, this._instance = e;
1497
- }
1498
- it(e) {
1499
- var t, i;
1500
- (t = k.__PosthogExtensions__) != null && t.tracingHeadersPatchFns && e(), (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this._instance, "tracing-headers", ((s) => {
1501
- if (s) return Xa.error("failed to load script", s);
1502
- e();
1503
- }));
1504
- }
1505
- startIfEnabledOrStop() {
1506
- var e, t;
1507
- this._instance.config.__add_tracing_headers ? this.it(this.rt) : ((e = this.xt) == null || e.call(this), (t = this.$t) == null || t.call(this), this.xt = void 0, this.$t = void 0);
1508
- }
1509
- }
1510
- var re = "Mobile", ti = "iOS", pe = "Android", St = "Tablet", zs = pe + " " + St, Ys = "iPad", Xs = "Apple", Ks = Xs + " Watch", Pt = "Safari", tt = "BlackBerry", Js = "Samsung", Zs = Js + "Browser", Qs = Js + " Internet", He = "Chrome", Ja = He + " OS", en = He + " " + ti, rr = "Internet Explorer", tn = rr + " " + re, sr = "Opera", Za = sr + " Mini", nr = "Edge", rn = "Microsoft " + nr, Ze = "Firefox", sn = Ze + " " + ti, Ct = "Nintendo", $t = "PlayStation", Qe = "Xbox", nn = pe + " " + re, an = re + " " + Pt, mt = "Windows", Hi = mt + " Phone", Hr = "Nokia", Vi = "Ouya", on = "Generic", Qa = on + " " + re.toLowerCase(), ln = on + " " + St.toLowerCase(), Gi = "Konqueror", G = "(\\d+(\\.\\d+)?)", mi = new RegExp("Version/" + G), eo = new RegExp(Qe, "i"), to = new RegExp($t + " \\w+", "i"), io = new RegExp(Ct + " \\w+", "i"), ar = new RegExp(tt + "|PlayBook|BB10", "i"), ro = { "NT3.51": "NT 3.11", "NT4.0": "NT 4.0", "5.0": "2000", 5.1: "XP", 5.2: "XP", "6.0": "Vista", 6.1: "7", 6.2: "8", 6.3: "8.1", 6.4: "10", "10.0": "10" }, so = (r, e) => e && S(e, Xs) || (function(t) {
1511
- return S(t, Pt) && !S(t, He) && !S(t, pe);
1512
- })(r), cn = function(r, e) {
1513
- return e = e || "", S(r, " OPR/") && S(r, "Mini") ? Za : S(r, " OPR/") ? sr : ar.test(r) ? tt : S(r, "IE" + re) || S(r, "WPDesktop") ? tn : S(r, Zs) ? Qs : S(r, nr) || S(r, "Edg/") ? rn : S(r, "FBIOS") ? "Facebook " + re : S(r, "UCWEB") || S(r, "UCBrowser") ? "UC Browser" : S(r, "CriOS") ? en : S(r, "CrMo") || S(r, He) ? He : S(r, pe) && S(r, Pt) ? nn : S(r, "FxiOS") ? sn : S(r.toLowerCase(), Gi.toLowerCase()) ? Gi : so(r, e) ? S(r, re) ? an : Pt : S(r, Ze) ? Ze : S(r, "MSIE") || S(r, "Trident/") ? rr : S(r, "Gecko") ? Ze : "";
1514
- }, no = { [tn]: [new RegExp("rv:" + G)], [rn]: [new RegExp(nr + "?\\/" + G)], [He]: [new RegExp("(" + He + "|CrMo)\\/" + G)], [en]: [new RegExp("CriOS\\/" + G)], "UC Browser": [new RegExp("(UCBrowser|UCWEB)\\/" + G)], [Pt]: [mi], [an]: [mi], [sr]: [new RegExp("(Opera|OPR)\\/" + G)], [Ze]: [new RegExp(Ze + "\\/" + G)], [sn]: [new RegExp("FxiOS\\/" + G)], [Gi]: [new RegExp("Konqueror[:/]?" + G, "i")], [tt]: [new RegExp(tt + " " + G), mi], [nn]: [new RegExp("android\\s" + G, "i")], [Qs]: [new RegExp(Zs + "\\/" + G)], [rr]: [new RegExp("(rv:|MSIE )" + G)], Mozilla: [new RegExp("rv:" + G)] }, ao = function(r, e) {
1515
- var t = cn(r, e), i = no[t];
1516
- if (v(i)) return null;
1517
- for (var s = 0; s < i.length; s++) {
1518
- var n = i[s], a = r.match(n);
1519
- if (a) return parseFloat(a[a.length - 2]);
1520
- }
1521
- return null;
1522
- }, Vr = [[new RegExp(Qe + "; " + Qe + " (.*?)[);]", "i"), (r) => [Qe, r && r[1] || ""]], [new RegExp(Ct, "i"), [Ct, ""]], [new RegExp($t, "i"), [$t, ""]], [ar, [tt, ""]], [new RegExp(mt, "i"), (r, e) => {
1523
- if (/Phone/.test(e) || /WPDesktop/.test(e)) return [Hi, ""];
1524
- if (new RegExp(re).test(e) && !/IEMobile\b/.test(e)) return [mt + " " + re, ""];
1525
- var t = /Windows NT ([0-9.]+)/i.exec(e);
1526
- if (t && t[1]) {
1527
- var i = t[1], s = ro[i] || "";
1528
- return /arm/i.test(e) && (s = "RT"), [mt, s];
1529
- }
1530
- return [mt, ""];
1531
- }], [/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/, (r) => {
1532
- if (r && r[3]) {
1533
- var e = [r[3], r[4], r[5] || "0"];
1534
- return [ti, e.join(".")];
1535
- }
1536
- return [ti, ""];
1537
- }], [/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i, (r) => {
1538
- var e = "";
1539
- return r && r.length >= 3 && (e = v(r[2]) ? r[3] : r[2]), ["watchOS", e];
1540
- }], [new RegExp("(" + pe + " (\\d+)\\.(\\d+)\\.?(\\d+)?|" + pe + ")", "i"), (r) => {
1541
- if (r && r[2]) {
1542
- var e = [r[2], r[3], r[4] || "0"];
1543
- return [pe, e.join(".")];
1544
- }
1545
- return [pe, ""];
1546
- }], [/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i, (r) => {
1547
- var e = ["Mac OS X", ""];
1548
- if (r && r[1]) {
1549
- var t = [r[1], r[2], r[3] || "0"];
1550
- e[1] = t.join(".");
1551
- }
1552
- return e;
1553
- }], [/Mac/i, ["Mac OS X", ""]], [/CrOS/, [Ja, ""]], [/Linux|debian/i, ["Linux", ""]]], Gr = function(r) {
1554
- return io.test(r) ? Ct : to.test(r) ? $t : eo.test(r) ? Qe : new RegExp(Vi, "i").test(r) ? Vi : new RegExp("(" + Hi + "|WPDesktop)", "i").test(r) ? Hi : /iPad/.test(r) ? Ys : /iPod/.test(r) ? "iPod Touch" : /iPhone/.test(r) ? "iPhone" : /(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r) ? Ks : ar.test(r) ? tt : /(kobo)\s(ereader|touch)/i.test(r) ? "Kobo" : new RegExp(Hr, "i").test(r) ? Hr : /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r) || /(kf[a-z]+)( bui|\)).+silk\//i.test(r) ? "Kindle Fire" : /(Android|ZTE)/i.test(r) ? !new RegExp(re).test(r) || /(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r) ? /pixel[\daxl ]{1,6}/i.test(r) && !/pixel c/i.test(r) || /(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r) || /lmy47v/i.test(r) && !/QTAQZ3/i.test(r) ? pe : zs : pe : new RegExp("(pda|" + re + ")", "i").test(r) ? Qa : new RegExp(St, "i").test(r) && !new RegExp(St + " pc", "i").test(r) ? ln : "";
1555
- }, Lt = "https?://(.*)", nt = ["gclid", "gclsrc", "dclid", "gbraid", "wbraid", "fbclid", "msclkid", "twclid", "li_fat_id", "igshid", "ttclid", "rdt_cid", "epik", "qclid", "sccid", "irclid", "_kx"], oo = st(["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term", "gad_source", "mc_cid"], nt), Tt = "<masked>", lo = ["li_fat_id"];
1556
- function un(r, e, t) {
1557
- if (!m) return {};
1558
- var i, s = e ? st([], nt, t || []) : [], n = hn(Ft(m.URL, s, Tt), r), a = (i = {}, F(lo, (function(o) {
1559
- var l = ge.q(o);
1560
- i[o] = l || null;
1561
- })), i);
1562
- return A(a, n);
1563
- }
1564
- function hn(r, e) {
1565
- var t = oo.concat(e || []), i = {};
1566
- return F(t, (function(s) {
1567
- var n = Zt(r, s);
1568
- i[s] = n || null;
1569
- })), i;
1570
- }
1571
- function dn(r) {
1572
- var e = (function(n) {
1573
- return n ? n.search(Lt + "google.([^/?]*)") === 0 ? "google" : n.search(Lt + "bing.com") === 0 ? "bing" : n.search(Lt + "yahoo.com") === 0 ? "yahoo" : n.search(Lt + "duckduckgo.com") === 0 ? "duckduckgo" : null : null;
1574
- })(r), t = e != "yahoo" ? "q" : "p", i = {};
1575
- if (!Ee(e)) {
1576
- i.$search_engine = e;
1577
- var s = m ? Zt(m.referrer, t) : "";
1578
- s.length && (i.ph_keyword = s);
1579
- }
1580
- return i;
1581
- }
1582
- function Wr() {
1583
- return navigator.language || navigator.userLanguage;
1584
- }
1585
- function pn() {
1586
- return (m == null ? void 0 : m.referrer) || "$direct";
1587
- }
1588
- function gn(r, e) {
1589
- var t = r ? st([], nt, e || []) : [], i = z == null ? void 0 : z.href.substring(0, 1e3);
1590
- return { r: pn().substring(0, 1e3), u: i ? Ft(i, t, Tt) : void 0 };
1591
- }
1592
- function fn(r) {
1593
- var e, { r: t, u: i } = r, s = { $referrer: t, $referring_domain: t == null ? void 0 : t == "$direct" ? "$direct" : (e = Jt(t)) == null ? void 0 : e.host };
1594
- if (i) {
1595
- s.$current_url = i;
1596
- var n = Jt(i);
1597
- s.$host = n == null ? void 0 : n.host, s.$pathname = n == null ? void 0 : n.pathname;
1598
- var a = hn(i);
1599
- A(s, a);
1600
- }
1601
- if (t) {
1602
- var o = dn(t);
1603
- A(s, o);
1604
- }
1605
- return s;
1606
- }
1607
- function _n() {
1608
- try {
1609
- return Intl.DateTimeFormat().resolvedOptions().timeZone;
1610
- } catch {
1611
- return;
1612
- }
1613
- }
1614
- function co() {
1615
- try {
1616
- return (/* @__PURE__ */ new Date()).getTimezoneOffset();
1617
- } catch {
1618
- return;
1619
- }
1620
- }
1621
- function uo(r, e) {
1622
- if (!W) return {};
1623
- var t, i, s, n = r ? st([], nt, e || []) : [], [a, o] = (function(l) {
1624
- for (var c = 0; c < Vr.length; c++) {
1625
- var [u, h] = Vr[c], g = u.exec(l), p = g && (Te(h) ? h(g, l) : h);
1626
- if (p) return p;
1627
- }
1628
- return ["", ""];
1629
- })(W);
1630
- return A(Qi({ $os: a, $os_version: o, $browser: cn(W, navigator.vendor), $device: Gr(W), $device_type: (i = W, s = Gr(i), s === Ys || s === zs || s === "Kobo" || s === "Kindle Fire" || s === ln ? St : s === Ct || s === Qe || s === $t || s === Vi ? "Console" : s === Ks ? "Wearable" : s ? re : "Desktop"), $timezone: _n(), $timezone_offset: co() }), { $current_url: Ft(z == null ? void 0 : z.href, n, Tt), $host: z == null ? void 0 : z.host, $pathname: z == null ? void 0 : z.pathname, $raw_user_agent: W.length > 1e3 ? W.substring(0, 997) + "..." : W, $browser_version: ao(W, navigator.vendor), $browser_language: Wr(), $browser_language_prefix: (t = Wr(), typeof t == "string" ? t.split("-")[0] : void 0), $screen_height: d == null ? void 0 : d.screen.height, $screen_width: d == null ? void 0 : d.screen.width, $viewport_height: d == null ? void 0 : d.innerHeight, $viewport_width: d == null ? void 0 : d.innerWidth, $lib: "web", $lib_version: me.LIB_VERSION, $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10), $time: Date.now() / 1e3 });
1631
- }
1632
- var Ce = U("[Web Vitals]"), zr = 9e5;
1633
- class ho {
1634
- constructor(e) {
1635
- var t;
1636
- this.St = !1, this.P = !1, this.N = { url: void 0, metrics: [], firstMetricTimestamp: void 0 }, this.Et = () => {
1637
- clearTimeout(this.kt), this.N.metrics.length !== 0 && (this._instance.capture("$web_vitals", this.N.metrics.reduce(((i, s) => w({}, i, { ["$web_vitals_" + s.name + "_event"]: w({}, s), ["$web_vitals_" + s.name + "_value"]: s.value })), {})), this.N = { url: void 0, metrics: [], firstMetricTimestamp: void 0 });
1638
- }, this.Pt = (i) => {
1639
- var s, n = (s = this._instance.sessionManager) == null ? void 0 : s.checkAndGetSessionAndWindowId(!0);
1640
- if (v(n)) Ce.error("Could not read session ID. Dropping metrics!");
1641
- else {
1642
- this.N = this.N || { url: void 0, metrics: [], firstMetricTimestamp: void 0 };
1643
- var a = this.Tt();
1644
- v(a) || (O(i == null ? void 0 : i.name) || O(i == null ? void 0 : i.value) ? Ce.error("Invalid metric received", i) : this.It && i.value >= this.It ? Ce.error("Ignoring metric with value >= " + this.It, i) : (this.N.url !== a && (this.Et(), this.kt = setTimeout(this.Et, this.flushToCaptureTimeoutMs)), v(this.N.url) && (this.N.url = a), this.N.firstMetricTimestamp = v(this.N.firstMetricTimestamp) ? Date.now() : this.N.firstMetricTimestamp, i.attribution && i.attribution.interactionTargetElement && (i.attribution.interactionTargetElement = void 0), this.N.metrics.push(w({}, i, { $current_url: a, $session_id: n.sessionId, $window_id: n.windowId, timestamp: Date.now() })), this.N.metrics.length === this.allowedMetrics.length && this.Et()));
1645
- }
1646
- }, this.rt = () => {
1647
- var i, s, n, a, o = k.__PosthogExtensions__;
1648
- v(o) || v(o.postHogWebVitalsCallbacks) || ({ onLCP: i, onCLS: s, onFCP: n, onINP: a } = o.postHogWebVitalsCallbacks), i && s && n && a ? (this.allowedMetrics.indexOf("LCP") > -1 && i(this.Pt.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && s(this.Pt.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && n(this.Pt.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && a(this.Pt.bind(this)), this.P = !0) : Ce.error("web vitals callbacks not loaded - not starting");
1649
- }, this._instance = e, this.St = !((t = this._instance.persistence) == null || !t.props[Fr]), this.startIfEnabled();
1650
- }
1651
- get allowedMetrics() {
1652
- var e, t, i = j(this._instance.config.capture_performance) ? (e = this._instance.config.capture_performance) == null ? void 0 : e.web_vitals_allowed_metrics : void 0;
1653
- return v(i) ? ((t = this._instance.persistence) == null ? void 0 : t.props[Tr]) || ["CLS", "FCP", "INP", "LCP"] : i;
1654
- }
1655
- get flushToCaptureTimeoutMs() {
1656
- return (j(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals_delayed_flush_ms : void 0) || 5e3;
1657
- }
1658
- get It() {
1659
- var e = j(this._instance.config.capture_performance) && fe(this._instance.config.capture_performance.__web_vitals_max_value) ? this._instance.config.capture_performance.__web_vitals_max_value : zr;
1660
- return 0 < e && e <= 6e4 ? zr : e;
1661
- }
1662
- get isEnabled() {
1663
- var e = z == null ? void 0 : z.protocol;
1664
- if (e !== "http:" && e !== "https:") return Ce.info("Web Vitals are disabled on non-http/https protocols"), !1;
1665
- var t = j(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals : Oe(this._instance.config.capture_performance) ? this._instance.config.capture_performance : void 0;
1666
- return Oe(t) ? t : this.St;
1667
- }
1668
- startIfEnabled() {
1669
- this.isEnabled && !this.P && (Ce.info("enabled, starting..."), this.it(this.rt));
1670
- }
1671
- onRemoteConfig(e) {
1672
- var t = j(e.capturePerformance) && !!e.capturePerformance.web_vitals, i = j(e.capturePerformance) ? e.capturePerformance.web_vitals_allowed_metrics : void 0;
1673
- this._instance.persistence && (this._instance.persistence.register({ [Fr]: t }), this._instance.persistence.register({ [Tr]: i })), this.St = t, this.startIfEnabled();
1674
- }
1675
- it(e) {
1676
- var t, i;
1677
- (t = k.__PosthogExtensions__) != null && t.postHogWebVitalsCallbacks && e(), (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this._instance, "web-vitals", ((s) => {
1678
- s ? Ce.error("failed to load script", s) : e();
1679
- }));
1680
- }
1681
- Tt() {
1682
- var e = d ? d.location.href : void 0;
1683
- if (e) {
1684
- var t = this._instance.config.mask_personal_data_properties, i = this._instance.config.custom_personal_data_properties, s = t ? st([], nt, i || []) : [];
1685
- return Ft(e, s, Tt);
1686
- }
1687
- Ce.error("Could not determine current URL");
1688
- }
1689
- }
1690
- var po = U("[Heatmaps]");
1691
- function Yr(r) {
1692
- return j(r) && "clientX" in r && "clientY" in r && fe(r.clientX) && fe(r.clientY);
1693
- }
1694
- class go {
1695
- constructor(e) {
1696
- var t;
1697
- this.St = !1, this.P = !1, this.Rt = null, this.instance = e, this.St = !((t = this.instance.persistence) == null || !t.props[Di]), this.rageclicks = new Bs(e.config.rageclick);
1698
- }
1699
- get flushIntervalMilliseconds() {
1700
- var e = 5e3;
1701
- return j(this.instance.config.capture_heatmaps) && this.instance.config.capture_heatmaps.flush_interval_milliseconds && (e = this.instance.config.capture_heatmaps.flush_interval_milliseconds), e;
1702
- }
1703
- get isEnabled() {
1704
- return v(this.instance.config.capture_heatmaps) ? v(this.instance.config.enable_heatmaps) ? this.St : this.instance.config.enable_heatmaps : this.instance.config.capture_heatmaps !== !1;
1705
- }
1706
- startIfEnabled() {
1707
- if (this.isEnabled) {
1708
- if (this.P) return;
1709
- po.info("starting..."), this.Ct(), this.Ot();
1710
- } else {
1711
- var e;
1712
- clearInterval((e = this.Rt) !== null && e !== void 0 ? e : void 0), this.Ft(), this.getAndClearBuffer();
1713
- }
1714
- }
1715
- onRemoteConfig(e) {
1716
- var t = !!e.heatmaps;
1717
- this.instance.persistence && this.instance.persistence.register({ [Di]: t }), this.St = t, this.startIfEnabled();
1718
- }
1719
- getAndClearBuffer() {
1720
- var e = this.N;
1721
- return this.N = void 0, e;
1722
- }
1723
- Mt(e) {
1724
- this.At(e.originalEvent, "deadclick");
1725
- }
1726
- Ot() {
1727
- this.Rt && clearInterval(this.Rt), this.Rt = (function(e) {
1728
- return (e == null ? void 0 : e.visibilityState) === "visible";
1729
- })(m) ? setInterval(this.Dt.bind(this), this.flushIntervalMilliseconds) : null;
1730
- }
1731
- Ct() {
1732
- d && m && (this.jt = this.Dt.bind(this), L(d, "beforeunload", this.jt), this.Lt = (e) => this.At(e || (d == null ? void 0 : d.event)), L(m, "click", this.Lt, { capture: !0 }), this.Nt = (e) => this.Ut(e || (d == null ? void 0 : d.event)), L(m, "mousemove", this.Nt, { capture: !0 }), this.zt = new Vs(this.instance, ja, this.Mt.bind(this)), this.zt.startIfEnabled(), this.Ht = this.Ot.bind(this), L(m, "visibilitychange", this.Ht), this.P = !0);
1733
- }
1734
- Ft() {
1735
- var e;
1736
- d && m && (this.jt && d.removeEventListener("beforeunload", this.jt), this.Lt && m.removeEventListener("click", this.Lt, { capture: !0 }), this.Nt && m.removeEventListener("mousemove", this.Nt, { capture: !0 }), this.Ht && m.removeEventListener("visibilitychange", this.Ht), clearTimeout(this.Bt), (e = this.zt) == null || e.stop(), this.P = !1);
1737
- }
1738
- qt(e, t) {
1739
- var i = this.instance.scrollManager.scrollY(), s = this.instance.scrollManager.scrollX(), n = this.instance.scrollManager.scrollElement(), a = (function(o, l, c) {
1740
- for (var u = o; u && ai(u) && !De(u, "body"); ) {
1741
- if (u === c) return !1;
1742
- if (S(l, d == null ? void 0 : d.getComputedStyle(u).position)) return !0;
1743
- u = Ms(u);
1744
- }
1745
- return !1;
1746
- })(Rs(e), ["fixed", "sticky"], n);
1747
- return { x: e.clientX + (a ? 0 : s), y: e.clientY + (a ? 0 : i), target_fixed: a, type: t };
1748
- }
1749
- At(e, t) {
1750
- var i;
1751
- if (t === void 0 && (t = "click"), !Or(e.target) && Yr(e)) {
1752
- var s = this.qt(e, t);
1753
- (i = this.rageclicks) != null && i.isRageClick(e.clientX, e.clientY, (/* @__PURE__ */ new Date()).getTime()) && this.Wt(w({}, s, { type: "rageclick" })), this.Wt(s);
1754
- }
1755
- }
1756
- Ut(e) {
1757
- !Or(e.target) && Yr(e) && (clearTimeout(this.Bt), this.Bt = setTimeout((() => {
1758
- this.Wt(this.qt(e, "mousemove"));
1759
- }), 500));
1760
- }
1761
- Wt(e) {
1762
- if (d) {
1763
- var t = d.location.href, i = this.instance.config.mask_personal_data_properties, s = this.instance.config.custom_personal_data_properties, n = i ? st([], nt, s || []) : [], a = Ft(t, n, Tt);
1764
- this.N = this.N || {}, this.N[a] || (this.N[a] = []), this.N[a].push(e);
1765
- }
1766
- }
1767
- Dt() {
1768
- this.N && !Ke(this.N) && this.instance.capture("$$heatmap", { $heatmap_data: this.getAndClearBuffer() });
1769
- }
1770
- }
1771
- class fo {
1772
- constructor(e) {
1773
- this._instance = e;
1774
- }
1775
- doPageView(e, t) {
1776
- var i, s = this.Gt(e, t);
1777
- return this.Vt = { pathname: (i = d == null ? void 0 : d.location.pathname) !== null && i !== void 0 ? i : "", pageViewId: t, timestamp: e }, this._instance.scrollManager.resetContext(), s;
1778
- }
1779
- doPageLeave(e) {
1780
- var t;
1781
- return this.Gt(e, (t = this.Vt) == null ? void 0 : t.pageViewId);
1782
- }
1783
- doEvent() {
1784
- var e;
1785
- return { $pageview_id: (e = this.Vt) == null ? void 0 : e.pageViewId };
1786
- }
1787
- Gt(e, t) {
1788
- var i = this.Vt;
1789
- if (!i) return { $pageview_id: t };
1790
- var s = { $pageview_id: t, $prev_pageview_id: i.pageViewId }, n = this._instance.scrollManager.getContext();
1791
- if (n && !this._instance.config.disable_scroll_properties) {
1792
- var { maxScrollHeight: a, lastScrollY: o, maxScrollY: l, maxContentHeight: c, lastContentY: u, maxContentY: h } = n;
1793
- if (!(v(a) || v(o) || v(l) || v(c) || v(u) || v(h))) {
1794
- a = Math.ceil(a), o = Math.ceil(o), l = Math.ceil(l), c = Math.ceil(c), u = Math.ceil(u), h = Math.ceil(h);
1795
- var g = a <= 1 ? 1 : de(o / a, 0, 1, y), p = a <= 1 ? 1 : de(l / a, 0, 1, y), f = c <= 1 ? 1 : de(u / c, 0, 1, y), _ = c <= 1 ? 1 : de(h / c, 0, 1, y);
1796
- s = A(s, { $prev_pageview_last_scroll: o, $prev_pageview_last_scroll_percentage: g, $prev_pageview_max_scroll: l, $prev_pageview_max_scroll_percentage: p, $prev_pageview_last_content: u, $prev_pageview_last_content_percentage: f, $prev_pageview_max_content: h, $prev_pageview_max_content_percentage: _ });
1797
- }
1798
- }
1799
- return i.pathname && (s.$prev_pageview_pathname = i.pathname), i.timestamp && (s.$prev_pageview_duration = (e.getTime() - i.timestamp.getTime()) / 1e3), s;
1800
- }
1801
- }
1802
- var se = Uint8Array, X = Uint16Array, it = Uint32Array, or = new se([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]), lr = new se([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]), Xr = new se([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), vn = function(r, e) {
1803
- for (var t = new X(31), i = 0; i < 31; ++i) t[i] = e += 1 << r[i - 1];
1804
- var s = new it(t[30]);
1805
- for (i = 1; i < 30; ++i) for (var n = t[i]; n < t[i + 1]; ++n) s[n] = n - t[i] << 5 | i;
1806
- return [t, s];
1807
- }, mn = vn(or, 2), _o = mn[0], Wi = mn[1];
1808
- _o[28] = 258, Wi[258] = 28;
1809
- for (var Kr = vn(lr, 0)[1], yn = new X(32768), R = 0; R < 32768; ++R) {
1810
- var Ue = (43690 & R) >>> 1 | (21845 & R) << 1;
1811
- Ue = (61680 & (Ue = (52428 & Ue) >>> 2 | (13107 & Ue) << 2)) >>> 4 | (3855 & Ue) << 4, yn[R] = ((65280 & Ue) >>> 8 | (255 & Ue) << 8) >>> 1;
1812
- }
1813
- var Et = function(r, e, t) {
1814
- for (var i = r.length, s = 0, n = new X(e); s < i; ++s) ++n[r[s] - 1];
1815
- var a, o = new X(e);
1816
- for (s = 0; s < e; ++s) o[s] = o[s - 1] + n[s - 1] << 1;
1817
- for (a = new X(i), s = 0; s < i; ++s) a[s] = yn[o[r[s] - 1]++] >>> 15 - r[s];
1818
- return a;
1819
- }, Ve = new se(288);
1820
- for (R = 0; R < 144; ++R) Ve[R] = 8;
1821
- for (R = 144; R < 256; ++R) Ve[R] = 9;
1822
- for (R = 256; R < 280; ++R) Ve[R] = 7;
1823
- for (R = 280; R < 288; ++R) Ve[R] = 8;
1824
- var ii = new se(32);
1825
- for (R = 0; R < 32; ++R) ii[R] = 5;
1826
- var vo = Et(Ve, 9), mo = Et(ii, 5), bn = function(r) {
1827
- return (r / 8 >> 0) + (7 & r && 1);
1828
- }, wn = function(r, e, t) {
1829
- (t == null || t > r.length) && (t = r.length);
1830
- var i = new (r instanceof X ? X : r instanceof it ? it : se)(t - e);
1831
- return i.set(r.subarray(e, t)), i;
1832
- }, ve = function(r, e, t) {
1833
- t <<= 7 & e;
1834
- var i = e / 8 >> 0;
1835
- r[i] |= t, r[i + 1] |= t >>> 8;
1836
- }, ut = function(r, e, t) {
1837
- t <<= 7 & e;
1838
- var i = e / 8 >> 0;
1839
- r[i] |= t, r[i + 1] |= t >>> 8, r[i + 2] |= t >>> 16;
1840
- }, yi = function(r, e) {
1841
- for (var t = [], i = 0; i < r.length; ++i) r[i] && t.push({ s: i, f: r[i] });
1842
- var s = t.length, n = t.slice();
1843
- if (!s) return [new se(0), 0];
1844
- if (s == 1) {
1845
- var a = new se(t[0].s + 1);
1846
- return a[t[0].s] = 1, [a, 1];
1847
- }
1848
- t.sort((function(M, ne) {
1849
- return M.f - ne.f;
1850
- })), t.push({ s: -1, f: 25001 });
1851
- var o = t[0], l = t[1], c = 0, u = 1, h = 2;
1852
- for (t[0] = { s: -1, f: o.f + l.f, l: o, r: l }; u != s - 1; ) o = t[t[c].f < t[h].f ? c++ : h++], l = t[c != u && t[c].f < t[h].f ? c++ : h++], t[u++] = { s: -1, f: o.f + l.f, l: o, r: l };
1853
- var g = n[0].s;
1854
- for (i = 1; i < s; ++i) n[i].s > g && (g = n[i].s);
1855
- var p = new X(g + 1), f = zi(t[u - 1], p, 0);
1856
- if (f > e) {
1857
- i = 0;
1858
- var _ = 0, b = f - e, E = 1 << b;
1859
- for (n.sort((function(M, ne) {
1860
- return p[ne.s] - p[M.s] || M.f - ne.f;
1861
- })); i < s; ++i) {
1862
- var x = n[i].s;
1863
- if (!(p[x] > e)) break;
1864
- _ += E - (1 << f - p[x]), p[x] = e;
1865
- }
1866
- for (_ >>>= b; _ > 0; ) {
1867
- var $ = n[i].s;
1868
- p[$] < e ? _ -= 1 << e - p[$]++ - 1 : ++i;
1869
- }
1870
- for (; i >= 0 && _; --i) {
1871
- var P = n[i].s;
1872
- p[P] == e && (--p[P], ++_);
1873
- }
1874
- f = e;
1875
- }
1876
- return [new se(p), f];
1877
- }, zi = function(r, e, t) {
1878
- return r.s == -1 ? Math.max(zi(r.l, e, t + 1), zi(r.r, e, t + 1)) : e[r.s] = t;
1879
- }, Jr = function(r) {
1880
- for (var e = r.length; e && !r[--e]; ) ;
1881
- for (var t = new X(++e), i = 0, s = r[0], n = 1, a = function(l) {
1882
- t[i++] = l;
1883
- }, o = 1; o <= e; ++o) if (r[o] == s && o != e) ++n;
1884
- else {
1885
- if (!s && n > 2) {
1886
- for (; n > 138; n -= 138) a(32754);
1887
- n > 2 && (a(n > 10 ? n - 11 << 5 | 28690 : n - 3 << 5 | 12305), n = 0);
1888
- } else if (n > 3) {
1889
- for (a(s), --n; n > 6; n -= 6) a(8304);
1890
- n > 2 && (a(n - 3 << 5 | 8208), n = 0);
1891
- }
1892
- for (; n--; ) a(s);
1893
- n = 1, s = r[o];
1894
- }
1895
- return [t.subarray(0, i), e];
1896
- }, ht = function(r, e) {
1897
- for (var t = 0, i = 0; i < e.length; ++i) t += r[i] * e[i];
1898
- return t;
1899
- }, Yi = function(r, e, t) {
1900
- var i = t.length, s = bn(e + 2);
1901
- r[s] = 255 & i, r[s + 1] = i >>> 8, r[s + 2] = 255 ^ r[s], r[s + 3] = 255 ^ r[s + 1];
1902
- for (var n = 0; n < i; ++n) r[s + n + 4] = t[n];
1903
- return 8 * (s + 4 + i);
1904
- }, Zr = function(r, e, t, i, s, n, a, o, l, c, u) {
1905
- ve(e, u++, t), ++s[256];
1906
- for (var h = yi(s, 15), g = h[0], p = h[1], f = yi(n, 15), _ = f[0], b = f[1], E = Jr(g), x = E[0], $ = E[1], P = Jr(_), M = P[0], ne = P[1], K = new X(19), C = 0; C < x.length; ++C) K[31 & x[C]]++;
1907
- for (C = 0; C < M.length; ++C) K[31 & M[C]]++;
1908
- for (var le = yi(K, 7), J = le[0], ae = le[1], ee = 19; ee > 4 && !J[Xr[ee - 1]]; --ee) ;
1909
- var _e, ce, ue, Ge, ke = c + 5 << 3, Le = ht(s, Ve) + ht(n, ii) + a, he = ht(s, g) + ht(n, _) + a + 14 + 3 * ee + ht(K, J) + (2 * K[16] + 3 * K[17] + 7 * K[18]);
1910
- if (ke <= Le && ke <= he) return Yi(e, u, r.subarray(l, l + c));
1911
- if (ve(e, u, 1 + (he < Le)), u += 2, he < Le) {
1912
- _e = Et(g, p), ce = g, ue = Et(_, b), Ge = _;
1913
- var xe = Et(J, ae);
1914
- for (ve(e, u, $ - 257), ve(e, u + 5, ne - 1), ve(e, u + 10, ee - 4), u += 14, C = 0; C < ee; ++C) ve(e, u + 3 * C, J[Xr[C]]);
1915
- u += 3 * ee;
1916
- for (var We = [x, M], V = 0; V < 2; ++V) {
1917
- var te = We[V];
1918
- for (C = 0; C < te.length; ++C) {
1919
- var Z = 31 & te[C];
1920
- ve(e, u, xe[Z]), u += J[Z], Z > 15 && (ve(e, u, te[C] >>> 5 & 127), u += te[C] >>> 12);
1921
- }
1922
- }
1923
- } else _e = vo, ce = Ve, ue = mo, Ge = ii;
1924
- for (C = 0; C < o; ++C) if (i[C] > 255) {
1925
- Z = i[C] >>> 18 & 31, ut(e, u, _e[Z + 257]), u += ce[Z + 257], Z > 7 && (ve(e, u, i[C] >>> 23 & 31), u += or[Z]);
1926
- var ze = 31 & i[C];
1927
- ut(e, u, ue[ze]), u += Ge[ze], ze > 3 && (ut(e, u, i[C] >>> 5 & 8191), u += lr[ze]);
1928
- } else ut(e, u, _e[i[C]]), u += ce[i[C]];
1929
- return ut(e, u, _e[256]), u + ce[256];
1930
- }, yo = new it([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]), bo = (function() {
1931
- for (var r = new it(256), e = 0; e < 256; ++e) {
1932
- for (var t = e, i = 9; --i; ) t = (1 & t && 3988292384) ^ t >>> 1;
1933
- r[e] = t;
1934
- }
1935
- return r;
1936
- })(), wo = function(r, e, t, i, s) {
1937
- return (function(n, a, o, l, c, u) {
1938
- var h = n.length, g = new se(l + h + 5 * (1 + Math.floor(h / 7e3)) + c), p = g.subarray(l, g.length - c), f = 0;
1939
- if (!a || h < 8) for (var _ = 0; _ <= h; _ += 65535) {
1940
- var b = _ + 65535;
1941
- b < h ? f = Yi(p, f, n.subarray(_, b)) : (p[_] = u, f = Yi(p, f, n.subarray(_, h)));
1942
- }
1943
- else {
1944
- for (var E = yo[a - 1], x = E >>> 13, $ = 8191 & E, P = (1 << o) - 1, M = new X(32768), ne = new X(P + 1), K = Math.ceil(o / 3), C = 2 * K, le = function(ci) {
1945
- return (n[ci] ^ n[ci + 1] << K ^ n[ci + 2] << C) & P;
1946
- }, J = new it(25e3), ae = new X(288), ee = new X(32), _e = 0, ce = 0, ue = (_ = 0, 0), Ge = 0, ke = 0; _ < h; ++_) {
1947
- var Le = le(_), he = 32767 & _, xe = ne[Le];
1948
- if (M[he] = xe, ne[Le] = he, Ge <= _) {
1949
- var We = h - _;
1950
- if ((_e > 7e3 || ue > 24576) && We > 423) {
1951
- f = Zr(n, p, 0, J, ae, ee, ce, ue, ke, _ - ke, f), ue = _e = ce = 0, ke = _;
1952
- for (var V = 0; V < 286; ++V) ae[V] = 0;
1953
- for (V = 0; V < 30; ++V) ee[V] = 0;
1954
- }
1955
- var te = 2, Z = 0, ze = $, Se = he - xe & 32767;
1956
- if (We > 2 && Le == le(_ - Se)) for (var Pn = Math.min(x, We) - 1, Cn = Math.min(32767, _), $n = Math.min(258, We); Se <= Cn && --ze && he != xe; ) {
1957
- if (n[_ + te] == n[_ + te - Se]) {
1958
- for (var Pe = 0; Pe < $n && n[_ + Pe] == n[_ + Pe - Se]; ++Pe) ;
1959
- if (Pe > te) {
1960
- if (te = Pe, Z = Se, Pe > Pn) break;
1961
- var In = Math.min(Se, Pe - 2), ur = 0;
1962
- for (V = 0; V < In; ++V) {
1963
- var li = _ - Se + V + 32768 & 32767, hr = li - M[li] + 32768 & 32767;
1964
- hr > ur && (ur = hr, xe = li);
1965
- }
1966
- }
1967
- }
1968
- Se += (he = xe) - (xe = M[he]) + 32768 & 32767;
1969
- }
1970
- if (Z) {
1971
- J[ue++] = 268435456 | Wi[te] << 18 | Kr[Z];
1972
- var dr = 31 & Wi[te], pr = 31 & Kr[Z];
1973
- ce += or[dr] + lr[pr], ++ae[257 + dr], ++ee[pr], Ge = _ + te, ++_e;
1974
- } else J[ue++] = n[_], ++ae[n[_]];
1975
- }
1976
- }
1977
- f = Zr(n, p, u, J, ae, ee, ce, ue, ke, _ - ke, f);
1978
- }
1979
- return wn(g, 0, l + bn(f) + c);
1980
- })(r, e.level == null ? 6 : e.level, e.mem == null ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(r.length)))) : 12 + e.mem, t, i, !0);
1981
- }, bi = function(r, e, t) {
1982
- for (; t; ++e) r[e] = t, t >>>= 8;
1983
- };
1984
- function Eo(r, e) {
1985
- e === void 0 && (e = {});
1986
- var t = /* @__PURE__ */ (function() {
1987
- var o = 4294967295;
1988
- return { p: function(l) {
1989
- for (var c = o, u = 0; u < l.length; ++u) c = bo[255 & c ^ l[u]] ^ c >>> 8;
1990
- o = c;
1991
- }, d: function() {
1992
- return 4294967295 ^ o;
1993
- } };
1994
- })(), i = r.length;
1995
- t.p(r);
1996
- var s, n = wo(r, e, 10 + ((s = e).filename && s.filename.length + 1 || 0), 8), a = n.length;
1997
- return (function(o, l) {
1998
- var c = l.filename;
1999
- if (o[0] = 31, o[1] = 139, o[2] = 8, o[8] = l.level < 2 ? 4 : l.level == 9 ? 2 : 0, o[9] = 3, l.mtime != 0 && bi(o, 4, Math.floor(new Date(l.mtime || Date.now()) / 1e3)), c) {
2000
- o[3] = 8;
2001
- for (var u = 0; u <= c.length; ++u) o[u + 10] = c.charCodeAt(u);
2002
- }
2003
- })(n, e), bi(n, a - 8, t.d()), bi(n, a - 4, i), n;
2004
- }
2005
- var ko = function(r) {
2006
- var e, t, i, s, n = "";
2007
- for (e = t = 0, i = (r = (r + "").replace(/\r\n/g, `
2008
- `).replace(/\r/g, `
2009
- `)).length, s = 0; s < i; s++) {
2010
- var a = r.charCodeAt(s), o = null;
2011
- a < 128 ? t++ : o = a > 127 && a < 2048 ? String.fromCharCode(a >> 6 | 192, 63 & a | 128) : String.fromCharCode(a >> 12 | 224, a >> 6 & 63 | 128, 63 & a | 128), Ee(o) || (t > e && (n += r.substring(e, t)), n += o, e = t = s + 1);
2012
- }
2013
- return t > e && (n += r.substring(e, r.length)), n;
2014
- }, xo = !!Ii || !!$i, Qr = "text/plain", ri = function(r, e, t) {
2015
- var i;
2016
- t === void 0 && (t = !0);
2017
- var [s, n] = r.split("?"), a = w({}, e), o = (i = n == null ? void 0 : n.split("&").map(((c) => {
2018
- var u, [h, g] = c.split("="), p = t && (u = a[h]) !== null && u !== void 0 ? u : g;
2019
- return delete a[h], h + "=" + p;
2020
- }))) !== null && i !== void 0 ? i : [], l = $a(a);
2021
- return l && o.push(l), s + "?" + o.join("&");
2022
- }, yt = (r, e) => JSON.stringify(r, ((t, i) => typeof i == "bigint" ? i.toString() : i), e), wi = (r) => {
2023
- var { data: e, compression: t } = r;
2024
- if (e) {
2025
- if (t === we.GZipJS) {
2026
- var i = Eo((function(l, c) {
2027
- var u = l.length;
2028
- if (typeof TextEncoder < "u") return new TextEncoder().encode(l);
2029
- for (var h = new se(l.length + (l.length >>> 1)), g = 0, p = function(E) {
2030
- h[g++] = E;
2031
- }, f = 0; f < u; ++f) {
2032
- if (g + 5 > h.length) {
2033
- var _ = new se(g + 8 + (u - f << 1));
2034
- _.set(h), h = _;
2035
- }
2036
- var b = l.charCodeAt(f);
2037
- b < 128 || c ? p(b) : b < 2048 ? (p(192 | b >>> 6), p(128 | 63 & b)) : b > 55295 && b < 57344 ? (p(240 | (b = 65536 + (1047552 & b) | 1023 & l.charCodeAt(++f)) >>> 18), p(128 | b >>> 12 & 63), p(128 | b >>> 6 & 63), p(128 | 63 & b)) : (p(224 | b >>> 12), p(128 | b >>> 6 & 63), p(128 | 63 & b));
2038
- }
2039
- return wn(h, 0, g);
2040
- })(yt(e)), { mtime: 0 }), s = new Blob([i], { type: Qr });
2041
- return { contentType: Qr, body: s, estimatedSize: s.size };
2042
- }
2043
- if (t === we.Base64) {
2044
- var n = (function(l) {
2045
- var c, u, h, g, p, f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", _ = 0, b = 0, E = "", x = [];
2046
- if (!l) return l;
2047
- l = ko(l);
2048
- do
2049
- c = (p = l.charCodeAt(_++) << 16 | l.charCodeAt(_++) << 8 | l.charCodeAt(_++)) >> 18 & 63, u = p >> 12 & 63, h = p >> 6 & 63, g = 63 & p, x[b++] = f.charAt(c) + f.charAt(u) + f.charAt(h) + f.charAt(g);
2050
- while (_ < l.length);
2051
- switch (E = x.join(""), l.length % 3) {
2052
- case 1:
2053
- E = E.slice(0, -2) + "==";
2054
- break;
2055
- case 2:
2056
- E = E.slice(0, -1) + "=";
2057
- }
2058
- return E;
2059
- })(yt(e)), a = ((l) => "data=" + encodeURIComponent(typeof l == "string" ? l : yt(l)))(n);
2060
- return { contentType: "application/x-www-form-urlencoded", body: a, estimatedSize: new Blob([a]).size };
2061
- }
2062
- var o = yt(e);
2063
- return { contentType: "application/json", body: o, estimatedSize: new Blob([o]).size };
2064
- }
2065
- }, qt = [];
2066
- $i && qt.push({ transport: "fetch", method: (r) => {
2067
- var e, t, { contentType: i, body: s, estimatedSize: n } = (e = wi(r)) !== null && e !== void 0 ? e : {}, a = new Headers();
2068
- F(r.headers, (function(u, h) {
2069
- a.append(h, u);
2070
- })), i && a.append("Content-Type", i);
2071
- var o = r.url, l = null;
2072
- if (mr) {
2073
- var c = new mr();
2074
- l = { signal: c.signal, timeout: setTimeout((() => c.abort()), r.timeout) };
2075
- }
2076
- $i(o, w({ method: (r == null ? void 0 : r.method) || "GET", headers: a, keepalive: r.method === "POST" && (n || 0) < 52428.8, body: s, signal: (t = l) == null ? void 0 : t.signal }, r.fetchOptions)).then(((u) => u.text().then(((h) => {
2077
- var g = { statusCode: u.status, text: h };
2078
- if (u.status === 200) try {
2079
- g.json = JSON.parse(h);
2080
- } catch (p) {
2081
- y.error(p);
2082
- }
2083
- r.callback == null || r.callback(g);
2084
- })))).catch(((u) => {
2085
- y.error(u), r.callback == null || r.callback({ statusCode: 0, text: u });
2086
- })).finally((() => l ? clearTimeout(l.timeout) : null));
2087
- } }), Ii && qt.push({ transport: "XHR", method: (r) => {
2088
- var e, t = new Ii();
2089
- t.open(r.method || "GET", r.url, !0);
2090
- var { contentType: i, body: s } = (e = wi(r)) !== null && e !== void 0 ? e : {};
2091
- F(r.headers, (function(n, a) {
2092
- t.setRequestHeader(a, n);
2093
- })), i && t.setRequestHeader("Content-Type", i), r.timeout && (t.timeout = r.timeout), r.disableXHRCredentials || (t.withCredentials = !0), t.onreadystatechange = () => {
2094
- if (t.readyState === 4) {
2095
- var n = { statusCode: t.status, text: t.responseText };
2096
- if (t.status === 200) try {
2097
- n.json = JSON.parse(t.responseText);
2098
- } catch {
2099
- }
2100
- r.callback == null || r.callback(n);
2101
- }
2102
- }, t.send(s);
2103
- } }), Q != null && Q.sendBeacon && qt.push({ transport: "sendBeacon", method: (r) => {
2104
- var e = ri(r.url, { beacon: "1" });
2105
- try {
2106
- var t, { contentType: i, body: s } = (t = wi(r)) !== null && t !== void 0 ? t : {}, n = typeof s == "string" ? new Blob([s], { type: i }) : s;
2107
- Q.sendBeacon(e, n);
2108
- } catch {
2109
- }
2110
- } });
2111
- var rt = function(r, e) {
2112
- if (!(function(t) {
2113
- try {
2114
- new RegExp(t);
2115
- } catch {
2116
- return !1;
2117
- }
2118
- return !0;
2119
- })(e)) return !1;
2120
- try {
2121
- return new RegExp(e).test(r);
2122
- } catch {
2123
- return !1;
2124
- }
2125
- };
2126
- function es(r, e, t) {
2127
- return yt({ distinct_id: r, userPropertiesToSet: e, userPropertiesToSetOnce: t });
2128
- }
2129
- var En = { exact: (r, e) => e.some(((t) => r.some(((i) => t === i)))), is_not: (r, e) => e.every(((t) => r.every(((i) => t !== i)))), regex: (r, e) => e.some(((t) => r.some(((i) => rt(t, i))))), not_regex: (r, e) => e.every(((t) => r.every(((i) => !rt(t, i))))), icontains: (r, e) => e.map(Nt).some(((t) => r.map(Nt).some(((i) => t.includes(i))))), not_icontains: (r, e) => e.map(Nt).every(((t) => r.map(Nt).every(((i) => !t.includes(i))))) }, Nt = (r) => r.toLowerCase(), Ei = U("[Error tracking]");
2130
- class So {
2131
- constructor(e) {
2132
- var t, i;
2133
- this.Jt = [], this.Kt = new ia([new ra(), new da(), new na(), new sa(), new ua(), new ca(), new oa(), new ha()], [Jn, ea]), this._instance = e, this.Jt = (t = (i = this._instance.persistence) == null ? void 0 : i.get_property(Mi)) !== null && t !== void 0 ? t : [];
2134
- }
2135
- onRemoteConfig(e) {
2136
- var t, i, s, n = (t = (i = e.errorTracking) == null ? void 0 : i.suppressionRules) !== null && t !== void 0 ? t : [], a = (s = e.errorTracking) == null ? void 0 : s.captureExtensionExceptions;
2137
- this.Jt = n, this._instance.persistence && this._instance.persistence.register({ [Mi]: this.Jt, [Ir]: a });
2138
- }
2139
- get Yt() {
2140
- var e, t = !!this._instance.get_property(Ir), i = this._instance.config.error_tracking.captureExtensionExceptions;
2141
- return (e = i ?? t) !== null && e !== void 0 && e;
2142
- }
2143
- buildProperties(e, t) {
2144
- return this.Kt.buildFromUnknown(e, { syntheticException: t == null ? void 0 : t.syntheticException, mechanism: { handled: t == null ? void 0 : t.handled } });
2145
- }
2146
- sendExceptionEvent(e) {
2147
- var t = e.$exception_list;
2148
- if (this.Xt(t)) {
2149
- if (this.Qt(t)) return void Ei.info("Skipping exception capture because a suppression rule matched");
2150
- if (!this.Yt && this.Zt(t)) return void Ei.info("Skipping exception capture because it was thrown by an extension");
2151
- if (!this._instance.config.error_tracking.__capturePostHogExceptions && this.ti(t)) return void Ei.info("Skipping exception capture because it was thrown by the PostHog SDK");
2152
- }
2153
- return this._instance.capture("$exception", e, { _noTruncate: !0, _batchKey: "exceptionEvent" });
2154
- }
2155
- Qt(e) {
2156
- if (e.length === 0) return !1;
2157
- var t = e.reduce(((i, s) => {
2158
- var { type: n, value: a } = s;
2159
- return N(n) && n.length > 0 && i.$exception_types.push(n), N(a) && a.length > 0 && i.$exception_values.push(a), i;
2160
- }), { $exception_types: [], $exception_values: [] });
2161
- return this.Jt.some(((i) => {
2162
- var s = i.values.map(((n) => {
2163
- var a, o = En[n.operator], l = T(n.value) ? n.value : [n.value], c = (a = t[n.key]) !== null && a !== void 0 ? a : [];
2164
- return l.length > 0 && o(l, c);
2165
- }));
2166
- return i.type === "OR" ? s.some(Boolean) : s.every(Boolean);
2167
- }));
2168
- }
2169
- Zt(e) {
2170
- return e.flatMap(((t) => {
2171
- var i, s;
2172
- return (i = (s = t.stacktrace) == null ? void 0 : s.frames) !== null && i !== void 0 ? i : [];
2173
- })).some(((t) => t.filename && t.filename.startsWith("chrome-extension://")));
2174
- }
2175
- ti(e) {
2176
- if (e.length > 0) {
2177
- var t, i, s, n, a = (t = (i = e[0].stacktrace) == null ? void 0 : i.frames) !== null && t !== void 0 ? t : [], o = a[a.length - 1];
2178
- return (s = o == null || (n = o.filename) == null ? void 0 : n.includes("posthog.com/static")) !== null && s !== void 0 && s;
2179
- }
2180
- return !1;
2181
- }
2182
- Xt(e) {
2183
- return !O(e) && T(e);
2184
- }
2185
- }
2186
- var oe = U("[FeatureFlags]"), ki = "$active_feature_flags", Ye = "$override_feature_flags", ts = "$feature_flag_payloads", dt = "$override_feature_flag_payloads", is = "$feature_flag_request_id", rs = (r) => {
2187
- var e = {};
2188
- for (var [t, i] of Ut(r || {})) i && (e[t] = i);
2189
- return e;
2190
- }, Po = (r) => {
2191
- var e = r.flags;
2192
- return e ? (r.featureFlags = Object.fromEntries(Object.keys(e).map(((t) => {
2193
- var i;
2194
- return [t, (i = e[t].variant) !== null && i !== void 0 ? i : e[t].enabled];
2195
- }))), r.featureFlagPayloads = Object.fromEntries(Object.keys(e).filter(((t) => e[t].enabled)).filter(((t) => {
2196
- var i;
2197
- return (i = e[t].metadata) == null ? void 0 : i.payload;
2198
- })).map(((t) => {
2199
- var i;
2200
- return [t, (i = e[t].metadata) == null ? void 0 : i.payload];
2201
- })))) : oe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"), r;
2202
- }, Co = (function(r) {
2203
- return r.FeatureFlags = "feature_flags", r.Recordings = "recordings", r;
2204
- })({});
2205
- class $o {
2206
- constructor(e) {
2207
- this.ii = !1, this.ei = !1, this.ri = !1, this.si = !1, this.ni = !1, this.oi = !1, this.ai = !1, this._instance = e, this.featureFlagEventHandlers = [];
2208
- }
2209
- li() {
2210
- var e = this._instance.config.evaluation_environments;
2211
- return e != null && e.length ? e.filter(((t) => {
2212
- var i = t && typeof t == "string" && t.trim().length > 0;
2213
- return i || oe.error("Invalid evaluation environment found:", t, "Expected non-empty string"), i;
2214
- })) : [];
2215
- }
2216
- ui() {
2217
- return this.li().length > 0;
2218
- }
2219
- flags() {
2220
- if (this._instance.config.__preview_remote_config) this.oi = !0;
2221
- else {
2222
- var e = !this.hi && (this._instance.config.advanced_disable_feature_flags || this._instance.config.advanced_disable_feature_flags_on_first_load);
2223
- this.di({ disableFlags: e });
2224
- }
2225
- }
2226
- get hasLoadedFlags() {
2227
- return this.ei;
2228
- }
2229
- getFlags() {
2230
- return Object.keys(this.getFlagVariants());
2231
- }
2232
- getFlagsWithDetails() {
2233
- var e = this._instance.get_property(Ai), t = this._instance.get_property(Ye), i = this._instance.get_property(dt);
2234
- if (!i && !t) return e || {};
2235
- var s = A({}, e || {}), n = [.../* @__PURE__ */ new Set([...Object.keys(i || {}), ...Object.keys(t || {})])];
2236
- for (var a of n) {
2237
- var o, l, c = s[a], u = t == null ? void 0 : t[a], h = v(u) ? (o = c == null ? void 0 : c.enabled) !== null && o !== void 0 && o : !!u, g = v(u) ? c.variant : typeof u == "string" ? u : void 0, p = i == null ? void 0 : i[a], f = w({}, c, { enabled: h, variant: h ? g ?? (c == null ? void 0 : c.variant) : void 0 });
2238
- h !== (c == null ? void 0 : c.enabled) && (f.original_enabled = c == null ? void 0 : c.enabled), g !== (c == null ? void 0 : c.variant) && (f.original_variant = c == null ? void 0 : c.variant), p && (f.metadata = w({}, c == null ? void 0 : c.metadata, { payload: p, original_payload: c == null || (l = c.metadata) == null ? void 0 : l.payload })), s[a] = f;
2239
- }
2240
- return this.ii || (oe.warn(" Overriding feature flag details!", { flagDetails: e, overriddenPayloads: i, finalDetails: s }), this.ii = !0), s;
2241
- }
2242
- getFlagVariants() {
2243
- var e = this._instance.get_property(Je), t = this._instance.get_property(Ye);
2244
- if (!t) return e || {};
2245
- for (var i = A({}, e), s = Object.keys(t), n = 0; n < s.length; n++) i[s[n]] = t[s[n]];
2246
- return this.ii || (oe.warn(" Overriding feature flags!", { enabledFlags: e, overriddenFlags: t, finalFlags: i }), this.ii = !0), i;
2247
- }
2248
- getFlagPayloads() {
2249
- var e = this._instance.get_property(ts), t = this._instance.get_property(dt);
2250
- if (!t) return e || {};
2251
- for (var i = A({}, e || {}), s = Object.keys(t), n = 0; n < s.length; n++) i[s[n]] = t[s[n]];
2252
- return this.ii || (oe.warn(" Overriding feature flag payloads!", { flagPayloads: e, overriddenPayloads: t, finalPayloads: i }), this.ii = !0), i;
2253
- }
2254
- reloadFeatureFlags() {
2255
- this.si || this._instance.config.advanced_disable_feature_flags || this.hi || (this.hi = setTimeout((() => {
2256
- this.di();
2257
- }), 5));
2258
- }
2259
- vi() {
2260
- clearTimeout(this.hi), this.hi = void 0;
2261
- }
2262
- ensureFlagsLoaded() {
2263
- this.ei || this.ri || this.hi || this.reloadFeatureFlags();
2264
- }
2265
- setAnonymousDistinctId(e) {
2266
- this.$anon_distinct_id = e;
2267
- }
2268
- setReloadingPaused(e) {
2269
- this.si = e;
2270
- }
2271
- di(e) {
2272
- var t;
2273
- if (this.vi(), !this._instance.M()) if (this.ri) this.ni = !0;
2274
- else {
2275
- var i = { token: this._instance.config.token, distinct_id: this._instance.get_distinct_id(), groups: this._instance.getGroups(), $anon_distinct_id: this.$anon_distinct_id, person_properties: w({}, ((t = this._instance.persistence) == null ? void 0 : t.get_initial_props()) || {}, this._instance.get_property(vt) || {}), group_properties: this._instance.get_property(je) };
2276
- (e != null && e.disableFlags || this._instance.config.advanced_disable_feature_flags) && (i.disable_flags = !0), this.ui() && (i.evaluation_environments = this.li());
2277
- var s = this._instance.config.__preview_remote_config, n = s ? "/flags/?v=2" : "/flags/?v=2&config=true", a = this._instance.config.advanced_only_evaluate_survey_feature_flags ? "&only_evaluate_survey_feature_flags=true" : "", o = this._instance.requestRouter.endpointFor("flags", n + a);
2278
- s && (i.timezone = _n()), this.ri = !0, this._instance.ci({ method: "POST", url: o, data: i, compression: this._instance.config.disable_compression ? void 0 : we.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (l) => {
2279
- var c, u, h = !0;
2280
- if (l.statusCode === 200 && (this.ni || (this.$anon_distinct_id = void 0), h = !1), this.ri = !1, this.oi || (this.oi = !0, this._instance.fi((u = l.json) !== null && u !== void 0 ? u : {})), !i.disable_flags || this.ni) if (this.ai = !h, l.json && (c = l.json.quotaLimited) != null && c.includes(Co.FeatureFlags)) oe.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");
2281
- else {
2282
- var g;
2283
- i.disable_flags || this.receivedFeatureFlags((g = l.json) !== null && g !== void 0 ? g : {}, h), this.ni && (this.ni = !1, this.di());
2284
- }
2285
- } });
2286
- }
2287
- }
2288
- getFeatureFlag(e, t) {
2289
- if (t === void 0 && (t = {}), this.ei || this.getFlags() && this.getFlags().length > 0) {
2290
- var i = this.getFlagVariants()[e], s = "" + i, n = this._instance.get_property(is) || void 0, a = this._instance.get_property(zt) || {};
2291
- if ((t.send_event || !("send_event" in t)) && (!(e in a) || !a[e].includes(s))) {
2292
- var o, l, c, u, h, g, p, f, _;
2293
- T(a[e]) ? a[e].push(s) : a[e] = [s], (o = this._instance.persistence) == null || o.register({ [zt]: a });
2294
- var b = this.getFeatureFlagDetails(e), E = { $feature_flag: e, $feature_flag_response: i, $feature_flag_payload: this.getFeatureFlagPayload(e) || null, $feature_flag_request_id: n, $feature_flag_bootstrapped_response: ((l = this._instance.config.bootstrap) == null || (l = l.featureFlags) == null ? void 0 : l[e]) || null, $feature_flag_bootstrapped_payload: ((c = this._instance.config.bootstrap) == null || (c = c.featureFlagPayloads) == null ? void 0 : c[e]) || null, $used_bootstrap_value: !this.ai };
2295
- v(b == null || (u = b.metadata) == null ? void 0 : u.version) || (E.$feature_flag_version = b.metadata.version);
2296
- var x, $ = (h = b == null || (g = b.reason) == null ? void 0 : g.description) !== null && h !== void 0 ? h : b == null || (p = b.reason) == null ? void 0 : p.code;
2297
- $ && (E.$feature_flag_reason = $), b != null && (f = b.metadata) != null && f.id && (E.$feature_flag_id = b.metadata.id), v(b == null ? void 0 : b.original_variant) && v(b == null ? void 0 : b.original_enabled) || (E.$feature_flag_original_response = v(b.original_variant) ? b.original_enabled : b.original_variant), b != null && (_ = b.metadata) != null && _.original_payload && (E.$feature_flag_original_payload = b == null || (x = b.metadata) == null ? void 0 : x.original_payload), this._instance.capture("$feature_flag_called", E);
2298
- }
2299
- return i;
2300
- }
2301
- oe.warn('getFeatureFlag for key "' + e + `" failed. Feature flags didn't load in time.`);
2302
- }
2303
- getFeatureFlagDetails(e) {
2304
- return this.getFlagsWithDetails()[e];
2305
- }
2306
- getFeatureFlagPayload(e) {
2307
- return this.getFlagPayloads()[e];
2308
- }
2309
- getRemoteConfigPayload(e, t) {
2310
- var i = this._instance.config.token, s = { distinct_id: this._instance.get_distinct_id(), token: i };
2311
- this.ui() && (s.evaluation_environments = this.li()), this._instance.ci({ method: "POST", url: this._instance.requestRouter.endpointFor("flags", "/flags/?v=2&config=true"), data: s, compression: this._instance.config.disable_compression ? void 0 : we.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (n) => {
2312
- var a, o = (a = n.json) == null ? void 0 : a.featureFlagPayloads;
2313
- t((o == null ? void 0 : o[e]) || void 0);
2314
- } });
2315
- }
2316
- isFeatureEnabled(e, t) {
2317
- if (t === void 0 && (t = {}), this.ei || this.getFlags() && this.getFlags().length > 0) {
2318
- var i = this.getFeatureFlag(e, t);
2319
- return v(i) ? void 0 : !!i;
2320
- }
2321
- oe.warn('isFeatureEnabled for key "' + e + `" failed. Feature flags didn't load in time.`);
2322
- }
2323
- addFeatureFlagsHandler(e) {
2324
- this.featureFlagEventHandlers.push(e);
2325
- }
2326
- removeFeatureFlagsHandler(e) {
2327
- this.featureFlagEventHandlers = this.featureFlagEventHandlers.filter(((t) => t !== e));
2328
- }
2329
- receivedFeatureFlags(e, t) {
2330
- if (this._instance.persistence) {
2331
- this.ei = !0;
2332
- var i = this.getFlagVariants(), s = this.getFlagPayloads(), n = this.getFlagsWithDetails();
2333
- (function(a, o, l, c, u) {
2334
- l === void 0 && (l = {}), c === void 0 && (c = {}), u === void 0 && (u = {});
2335
- var h = Po(a), g = h.flags, p = h.featureFlags, f = h.featureFlagPayloads;
2336
- if (p) {
2337
- var _ = a.requestId;
2338
- if (T(p)) {
2339
- oe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");
2340
- var b = {};
2341
- if (p) for (var E = 0; E < p.length; E++) b[p[E]] = !0;
2342
- o && o.register({ [ki]: p, [Je]: b });
2343
- } else {
2344
- var x = p, $ = f, P = g;
2345
- a.errorsWhileComputingFlags && (x = w({}, l, x), $ = w({}, c, $), P = w({}, u, P)), o && o.register(w({ [ki]: Object.keys(rs(x)), [Je]: x || {}, [ts]: $ || {}, [Ai]: P || {} }, _ ? { [is]: _ } : {}));
2346
- }
2347
- }
2348
- })(e, this._instance.persistence, i, s, n), this.pi(t);
2349
- }
2350
- }
2351
- override(e, t) {
2352
- t === void 0 && (t = !1), oe.warn("override is deprecated. Please use overrideFeatureFlags instead."), this.overrideFeatureFlags({ flags: e, suppressWarning: t });
2353
- }
2354
- overrideFeatureFlags(e) {
2355
- if (!this._instance.__loaded || !this._instance.persistence) return oe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");
2356
- if (e === !1) return this._instance.persistence.unregister(Ye), this._instance.persistence.unregister(dt), void this.pi();
2357
- if (e && typeof e == "object" && ("flags" in e || "payloads" in e)) {
2358
- var t, i = e;
2359
- if (this.ii = !!((t = i.suppressWarning) !== null && t !== void 0 && t), "flags" in i) {
2360
- if (i.flags === !1) this._instance.persistence.unregister(Ye);
2361
- else if (i.flags) if (T(i.flags)) {
2362
- for (var s = {}, n = 0; n < i.flags.length; n++) s[i.flags[n]] = !0;
2363
- this._instance.persistence.register({ [Ye]: s });
2364
- } else this._instance.persistence.register({ [Ye]: i.flags });
2365
- }
2366
- return "payloads" in i && (i.payloads === !1 ? this._instance.persistence.unregister(dt) : i.payloads && this._instance.persistence.register({ [dt]: i.payloads })), void this.pi();
2367
- }
2368
- this.pi();
2369
- }
2370
- onFeatureFlags(e) {
2371
- if (this.addFeatureFlagsHandler(e), this.ei) {
2372
- var { flags: t, flagVariants: i } = this.gi();
2373
- e(t, i);
2374
- }
2375
- return () => this.removeFeatureFlagsHandler(e);
2376
- }
2377
- updateEarlyAccessFeatureEnrollment(e, t, i) {
2378
- var s, n = (this._instance.get_property(_t) || []).find(((c) => c.flagKey === e)), a = { ["$feature_enrollment/" + e]: t }, o = { $feature_flag: e, $feature_enrollment: t, $set: a };
2379
- n && (o.$early_access_feature_name = n.name), i && (o.$feature_enrollment_stage = i), this._instance.capture("$feature_enrollment_update", o), this.setPersonPropertiesForFlags(a, !1);
2380
- var l = w({}, this.getFlagVariants(), { [e]: t });
2381
- (s = this._instance.persistence) == null || s.register({ [ki]: Object.keys(rs(l)), [Je]: l }), this.pi();
2382
- }
2383
- getEarlyAccessFeatures(e, t, i) {
2384
- t === void 0 && (t = !1);
2385
- var s = this._instance.get_property(_t), n = i ? "&" + i.map(((a) => "stage=" + a)).join("&") : "";
2386
- if (s && !t) return e(s);
2387
- this._instance.ci({ url: this._instance.requestRouter.endpointFor("api", "/api/early_access_features/?token=" + this._instance.config.token + n), method: "GET", callback: (a) => {
2388
- var o, l;
2389
- if (a.json) {
2390
- var c = a.json.earlyAccessFeatures;
2391
- return (o = this._instance.persistence) == null || o.unregister(_t), (l = this._instance.persistence) == null || l.register({ [_t]: c }), e(c);
2392
- }
2393
- } });
2394
- }
2395
- gi() {
2396
- var e = this.getFlags(), t = this.getFlagVariants();
2397
- return { flags: e.filter(((i) => t[i])), flagVariants: Object.keys(t).filter(((i) => t[i])).reduce(((i, s) => (i[s] = t[s], i)), {}) };
2398
- }
2399
- pi(e) {
2400
- var { flags: t, flagVariants: i } = this.gi();
2401
- this.featureFlagEventHandlers.forEach(((s) => s(t, i, { errorsLoading: e })));
2402
- }
2403
- setPersonPropertiesForFlags(e, t) {
2404
- t === void 0 && (t = !0);
2405
- var i = this._instance.get_property(vt) || {};
2406
- this._instance.register({ [vt]: w({}, i, e) }), t && this._instance.reloadFeatureFlags();
2407
- }
2408
- resetPersonPropertiesForFlags() {
2409
- this._instance.unregister(vt);
2410
- }
2411
- setGroupPropertiesForFlags(e, t) {
2412
- t === void 0 && (t = !0);
2413
- var i = this._instance.get_property(je) || {};
2414
- Object.keys(i).length !== 0 && Object.keys(i).forEach(((s) => {
2415
- i[s] = w({}, i[s], e[s]), delete e[s];
2416
- })), this._instance.register({ [je]: w({}, i, e) }), t && this._instance.reloadFeatureFlags();
2417
- }
2418
- resetGroupPropertiesForFlags(e) {
2419
- if (e) {
2420
- var t = this._instance.get_property(je) || {};
2421
- this._instance.register({ [je]: w({}, t, { [e]: {} }) });
2422
- } else this._instance.unregister(je);
2423
- }
2424
- reset() {
2425
- this.ei = !1, this.ri = !1, this.si = !1, this.ni = !1, this.oi = !1, this.ai = !1, this.$anon_distinct_id = void 0, this.vi(), this.ii = !1;
2426
- }
2427
- }
2428
- var Io = ["cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory"];
2429
- class xi {
2430
- constructor(e, t) {
2431
- this.C = e, this.props = {}, this.mi = !1, this.yi = ((i) => {
2432
- var s = "";
2433
- return i.token && (s = i.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")), i.persistence_name ? "ph_" + i.persistence_name : "ph_" + s + "_posthog";
2434
- })(e), this.Y = this.bi(e), this.load(), e.debug && y.info("Persistence loaded", e.persistence, w({}, this.props)), this.update_config(e, e, t), this.save();
2435
- }
2436
- isDisabled() {
2437
- return !!this.wi;
2438
- }
2439
- bi(e) {
2440
- Io.indexOf(e.persistence.toLowerCase()) === -1 && (y.critical("Unknown persistence type " + e.persistence + "; falling back to localStorage+cookie"), e.persistence = "localStorage+cookie");
2441
- var t = e.persistence.toLowerCase();
2442
- return t === "localstorage" && D.H() ? D : t === "localstorage+cookie" && Dt.H() ? Dt : t === "sessionstorage" && q.H() ? q : t === "memory" ? Ua : t === "cookie" ? ge : Dt.H() ? Dt : ge;
2443
- }
2444
- properties() {
2445
- var e = {};
2446
- return F(this.props, (function(t, i) {
2447
- if (i === Je && j(t)) for (var s = Object.keys(t), n = 0; n < s.length; n++) e["$feature/" + s[n]] = t[s[n]];
2448
- else o = i, l = !1, (Ee(a = ma) ? l : vr && a.indexOf === vr ? a.indexOf(o) != -1 : (F(a, (function(c) {
2449
- if (l || (l = c === o)) return Gt;
2450
- })), l)) || (e[i] = t);
2451
- var a, o, l;
2452
- })), e;
2453
- }
2454
- load() {
2455
- if (!this.wi) {
2456
- var e = this.Y.W(this.yi);
2457
- e && (this.props = A({}, e));
2458
- }
2459
- }
2460
- save() {
2461
- this.wi || this.Y.G(this.yi, this.props, this.xi, this.$i, this.Si, this.C.debug);
2462
- }
2463
- remove() {
2464
- this.Y.V(this.yi, !1), this.Y.V(this.yi, !0);
2465
- }
2466
- clear() {
2467
- this.remove(), this.props = {};
2468
- }
2469
- register_once(e, t, i) {
2470
- if (j(e)) {
2471
- v(t) && (t = "None"), this.xi = v(i) ? this.Ei : i;
2472
- var s = !1;
2473
- if (F(e, ((n, a) => {
2474
- this.props.hasOwnProperty(a) && this.props[a] !== t || (this.props[a] = n, s = !0);
2475
- })), s) return this.save(), !0;
2476
- }
2477
- return !1;
2478
- }
2479
- register(e, t) {
2480
- if (j(e)) {
2481
- this.xi = v(t) ? this.Ei : t;
2482
- var i = !1;
2483
- if (F(e, ((s, n) => {
2484
- e.hasOwnProperty(n) && this.props[n] !== s && (this.props[n] = s, i = !0);
2485
- })), i) return this.save(), !0;
2486
- }
2487
- return !1;
2488
- }
2489
- unregister(e) {
2490
- e in this.props && (delete this.props[e], this.save());
2491
- }
2492
- update_campaign_params() {
2493
- if (!this.mi) {
2494
- var e = un(this.C.custom_campaign_params, this.C.mask_personal_data_properties, this.C.custom_personal_data_properties);
2495
- Ke(Qi(e)) || this.register(e), this.mi = !0;
2496
- }
2497
- }
2498
- update_search_keyword() {
2499
- var e;
2500
- this.register((e = m == null ? void 0 : m.referrer) ? dn(e) : {});
2501
- }
2502
- update_referrer_info() {
2503
- var e;
2504
- this.register_once({ $referrer: pn(), $referring_domain: m != null && m.referrer && ((e = Jt(m.referrer)) == null ? void 0 : e.host) || "$direct" }, void 0);
2505
- }
2506
- set_initial_person_info() {
2507
- this.props[qi] || this.props[ji] || this.register_once({ [Yt]: gn(this.C.mask_personal_data_properties, this.C.custom_personal_data_properties) }, void 0);
2508
- }
2509
- get_initial_props() {
2510
- var e = {};
2511
- F([ji, qi], ((a) => {
2512
- var o = this.props[a];
2513
- o && F(o, (function(l, c) {
2514
- e["$initial_" + Fi(c)] = l;
2515
- }));
2516
- }));
2517
- var t, i, s = this.props[Yt];
2518
- if (s) {
2519
- var n = (t = fn(s), i = {}, F(t, (function(a, o) {
2520
- i["$initial_" + Fi(o)] = a;
2521
- })), i);
2522
- A(e, n);
2523
- }
2524
- return e;
2525
- }
2526
- safe_merge(e) {
2527
- return F(this.props, (function(t, i) {
2528
- i in e || (e[i] = t);
2529
- })), e;
2530
- }
2531
- update_config(e, t, i) {
2532
- if (this.Ei = this.xi = e.cookie_expiration, this.set_disabled(e.disable_persistence || !!i), this.set_cross_subdomain(e.cross_subdomain_cookie), this.set_secure(e.secure_cookie), e.persistence !== t.persistence) {
2533
- var s = this.bi(e), n = this.props;
2534
- this.clear(), this.Y = s, this.props = n, this.save();
2535
- }
2536
- }
2537
- set_disabled(e) {
2538
- this.wi = e, this.wi ? this.remove() : this.save();
2539
- }
2540
- set_cross_subdomain(e) {
2541
- e !== this.$i && (this.$i = e, this.remove(), this.save());
2542
- }
2543
- set_secure(e) {
2544
- e !== this.Si && (this.Si = e, this.remove(), this.save());
2545
- }
2546
- set_event_timer(e, t) {
2547
- var i = this.props[ft] || {};
2548
- i[e] = t, this.props[ft] = i, this.save();
2549
- }
2550
- remove_event_timer(e) {
2551
- var t = (this.props[ft] || {})[e];
2552
- return v(t) || (delete this.props[ft][e], this.save()), t;
2553
- }
2554
- get_property(e) {
2555
- return this.props[e];
2556
- }
2557
- set_property(e, t) {
2558
- this.props[e] = t, this.save();
2559
- }
2560
- }
2561
- (function(r) {
2562
- return r.Button = "button", r.Tab = "tab", r.Selector = "selector", r;
2563
- })({});
2564
- (function(r) {
2565
- return r.TopLeft = "top_left", r.TopRight = "top_right", r.TopCenter = "top_center", r.MiddleLeft = "middle_left", r.MiddleRight = "middle_right", r.MiddleCenter = "middle_center", r.Left = "left", r.Center = "center", r.Right = "right", r.NextToTrigger = "next_to_trigger", r;
2566
- })({});
2567
- var Si = (function(r) {
2568
- return r.Popover = "popover", r.API = "api", r.Widget = "widget", r.ExternalSurvey = "external_survey", r;
2569
- })({});
2570
- (function(r) {
2571
- return r.Open = "open", r.MultipleChoice = "multiple_choice", r.SingleChoice = "single_choice", r.Rating = "rating", r.Link = "link", r;
2572
- })({});
2573
- (function(r) {
2574
- return r.NextQuestion = "next_question", r.End = "end", r.ResponseBased = "response_based", r.SpecificQuestion = "specific_question", r;
2575
- })({});
2576
- (function(r) {
2577
- return r.Once = "once", r.Recurring = "recurring", r.Always = "always", r;
2578
- })({});
2579
- var jt = (function(r) {
2580
- return r.SHOWN = "survey shown", r.DISMISSED = "survey dismissed", r.SENT = "survey sent", r;
2581
- })({}), ss = (function(r) {
2582
- return r.SURVEY_ID = "$survey_id", r.SURVEY_NAME = "$survey_name", r.SURVEY_RESPONSE = "$survey_response", r.SURVEY_ITERATION = "$survey_iteration", r.SURVEY_ITERATION_START_DATE = "$survey_iteration_start_date", r.SURVEY_PARTIALLY_COMPLETED = "$survey_partially_completed", r.SURVEY_SUBMISSION_ID = "$survey_submission_id", r.SURVEY_QUESTIONS = "$survey_questions", r.SURVEY_COMPLETED = "$survey_completed", r;
2583
- })({}), kn = (function(r) {
2584
- return r.Popover = "popover", r.Inline = "inline", r;
2585
- })({});
2586
- class cr {
2587
- constructor() {
2588
- this.ki = {}, this.ki = {};
2589
- }
2590
- on(e, t) {
2591
- return this.ki[e] || (this.ki[e] = []), this.ki[e].push(t), () => {
2592
- this.ki[e] = this.ki[e].filter(((i) => i !== t));
2593
- };
2594
- }
2595
- emit(e, t) {
2596
- for (var i of this.ki[e] || []) i(t);
2597
- for (var s of this.ki["*"] || []) s(e, t);
2598
- }
2599
- }
2600
- class Be {
2601
- constructor(e) {
2602
- this.Pi = new cr(), this.Ti = (t, i) => this.Ii(t, i) && this.Ri(t, i) && this.Ci(t, i), this.Ii = (t, i) => i == null || !i.event || (t == null ? void 0 : t.event) === (i == null ? void 0 : i.event), this._instance = e, this.Oi = /* @__PURE__ */ new Set(), this.Fi = /* @__PURE__ */ new Set();
2603
- }
2604
- init() {
2605
- var e;
2606
- if (!v((e = this._instance) == null ? void 0 : e.Mi)) {
2607
- var t;
2608
- (t = this._instance) == null || t.Mi(((i, s) => {
2609
- this.on(i, s);
2610
- }));
2611
- }
2612
- }
2613
- register(e) {
2614
- var t, i;
2615
- if (!v((t = this._instance) == null ? void 0 : t.Mi) && (e.forEach(((a) => {
2616
- var o, l;
2617
- (o = this.Fi) == null || o.add(a), (l = a.steps) == null || l.forEach(((c) => {
2618
- var u;
2619
- (u = this.Oi) == null || u.add((c == null ? void 0 : c.event) || "");
2620
- }));
2621
- })), (i = this._instance) != null && i.autocapture)) {
2622
- var s, n = /* @__PURE__ */ new Set();
2623
- e.forEach(((a) => {
2624
- var o;
2625
- (o = a.steps) == null || o.forEach(((l) => {
2626
- l != null && l.selector && n.add(l == null ? void 0 : l.selector);
2627
- }));
2628
- })), (s = this._instance) == null || s.autocapture.setElementSelectors(n);
2629
- }
2630
- }
2631
- on(e, t) {
2632
- var i;
2633
- t != null && e.length != 0 && (this.Oi.has(e) || this.Oi.has(t == null ? void 0 : t.event)) && this.Fi && ((i = this.Fi) == null ? void 0 : i.size) > 0 && this.Fi.forEach(((s) => {
2634
- this.Ai(t, s) && this.Pi.emit("actionCaptured", s.name);
2635
- }));
2636
- }
2637
- Di(e) {
2638
- this.onAction("actionCaptured", ((t) => e(t)));
2639
- }
2640
- Ai(e, t) {
2641
- if ((t == null ? void 0 : t.steps) == null) return !1;
2642
- for (var i of t.steps) if (this.Ti(e, i)) return !0;
2643
- return !1;
2644
- }
2645
- onAction(e, t) {
2646
- return this.Pi.on(e, t);
2647
- }
2648
- Ri(e, t) {
2649
- if (t != null && t.url) {
2650
- var i, s = e == null || (i = e.properties) == null ? void 0 : i.$current_url;
2651
- if (!s || typeof s != "string" || !Be.ji(s, t == null ? void 0 : t.url, (t == null ? void 0 : t.url_matching) || "contains")) return !1;
2652
- }
2653
- return !0;
2654
- }
2655
- static ji(e, t, i) {
2656
- switch (i) {
2657
- case "regex":
2658
- return !!d && rt(e, t);
2659
- case "exact":
2660
- return t === e;
2661
- case "contains":
2662
- var s = Be.Li(t).replace(/_/g, ".").replace(/%/g, ".*");
2663
- return rt(e, s);
2664
- default:
2665
- return !1;
2666
- }
2667
- }
2668
- static Li(e) {
2669
- return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2670
- }
2671
- Ci(e, t) {
2672
- if ((t != null && t.href || t != null && t.tag_name || t != null && t.text) && !this.Ni(e).some(((n) => !(t != null && t.href && !Be.ji(n.href || "", t == null ? void 0 : t.href, (t == null ? void 0 : t.href_matching) || "exact")) && (t == null || !t.tag_name || n.tag_name === (t == null ? void 0 : t.tag_name)) && !(t != null && t.text && !Be.ji(n.text || "", t == null ? void 0 : t.text, (t == null ? void 0 : t.text_matching) || "exact") && !Be.ji(n.$el_text || "", t == null ? void 0 : t.text, (t == null ? void 0 : t.text_matching) || "exact"))))) return !1;
2673
- if (t != null && t.selector) {
2674
- var i, s = e == null || (i = e.properties) == null ? void 0 : i.$element_selectors;
2675
- if (!s || !s.includes(t == null ? void 0 : t.selector)) return !1;
2676
- }
2677
- return !0;
2678
- }
2679
- Ni(e) {
2680
- return (e == null ? void 0 : e.properties.$elements) == null ? [] : e == null ? void 0 : e.properties.$elements;
2681
- }
2682
- }
2683
- var I = U("[Surveys]"), Xi = "seenSurvey_", Fo = (r, e) => {
2684
- var t = "$survey_" + e + "/" + r.id;
2685
- return r.current_iteration && r.current_iteration > 0 && (t = "$survey_" + e + "/" + r.id + "/" + r.current_iteration), t;
2686
- }, ns = (r) => {
2687
- var e = "" + Xi + r.id;
2688
- return r.current_iteration && r.current_iteration > 0 && (e = "" + Xi + r.id + "_" + r.current_iteration), e;
2689
- }, To = [Si.Popover, Si.Widget, Si.API], Oo = { ignoreConditions: !1, ignoreDelay: !1, displayType: kn.Popover };
2690
- class Ro {
2691
- constructor(e) {
2692
- this._instance = e, this.Ui = /* @__PURE__ */ new Map(), this.zi = /* @__PURE__ */ new Map();
2693
- }
2694
- register(e) {
2695
- var t;
2696
- v((t = this._instance) == null ? void 0 : t.Mi) || (this.Hi(e), this.Bi(e));
2697
- }
2698
- Bi(e) {
2699
- var t = e.filter(((i) => {
2700
- var s, n;
2701
- return ((s = i.conditions) == null ? void 0 : s.actions) && ((n = i.conditions) == null || (n = n.actions) == null || (n = n.values) == null ? void 0 : n.length) > 0;
2702
- }));
2703
- t.length !== 0 && (this.qi == null && (this.qi = new Be(this._instance), this.qi.init(), this.qi.Di(((i) => {
2704
- this.onAction(i);
2705
- }))), t.forEach(((i) => {
2706
- var s, n, a, o, l;
2707
- i.conditions && (s = i.conditions) != null && s.actions && (n = i.conditions) != null && (n = n.actions) != null && n.values && ((a = i.conditions) == null || (a = a.actions) == null || (a = a.values) == null ? void 0 : a.length) > 0 && ((o = this.qi) == null || o.register(i.conditions.actions.values), (l = i.conditions) == null || (l = l.actions) == null || (l = l.values) == null || l.forEach(((c) => {
2708
- if (c && c.name) {
2709
- var u = this.zi.get(c.name);
2710
- u && u.push(i.id), this.zi.set(c.name, u || [i.id]);
2711
- }
2712
- })));
2713
- })));
2714
- }
2715
- Hi(e) {
2716
- var t;
2717
- e.filter(((i) => {
2718
- var s, n;
2719
- return ((s = i.conditions) == null ? void 0 : s.events) && ((n = i.conditions) == null || (n = n.events) == null || (n = n.values) == null ? void 0 : n.length) > 0;
2720
- })).length !== 0 && ((t = this._instance) == null || t.Mi(((i, s) => {
2721
- this.onEvent(i, s);
2722
- })), e.forEach(((i) => {
2723
- var s;
2724
- (s = i.conditions) == null || (s = s.events) == null || (s = s.values) == null || s.forEach(((n) => {
2725
- if (n && n.name) {
2726
- var a = this.Ui.get(n.name);
2727
- a && a.push(i.id), this.Ui.set(n.name, a || [i.id]);
2728
- }
2729
- }));
2730
- })));
2731
- }
2732
- onEvent(e, t) {
2733
- var i, s, n = ((i = this._instance) == null || (i = i.persistence) == null ? void 0 : i.props[Rt]) || [];
2734
- if (jt.SHOWN === e && t && n.length > 0) {
2735
- var a;
2736
- I.info("survey event matched, removing survey from activated surveys", { event: e, eventPayload: t, existingActivatedSurveys: n });
2737
- var o = t == null || (a = t.properties) == null ? void 0 : a.$survey_id;
2738
- if (o) {
2739
- var l = n.indexOf(o);
2740
- l >= 0 && (n.splice(l, 1), this.Wi(n));
2741
- }
2742
- } else if (this.Ui.has(e)) {
2743
- I.info("survey event name matched", { event: e, eventPayload: t, surveys: this.Ui.get(e) });
2744
- var c = [];
2745
- (s = this._instance) == null || s.getSurveys(((h) => {
2746
- c = h.filter(((g) => {
2747
- var p;
2748
- return (p = this.Ui.get(e)) == null ? void 0 : p.includes(g.id);
2749
- }));
2750
- }));
2751
- var u = c.filter(((h) => {
2752
- var g, p = (g = h.conditions) == null || (g = g.events) == null || (g = g.values) == null ? void 0 : g.find(((f) => f.name === e));
2753
- return !!p && (!p.propertyFilters || Object.entries(p.propertyFilters).every(((f) => {
2754
- var _, [b, E] = f, x = t == null || (_ = t.properties) == null ? void 0 : _[b];
2755
- if (v(x) || Ee(x)) return !1;
2756
- var $ = [String(x)], P = En[E.operator];
2757
- return P ? P(E.values, $) : (I.warn("Unknown property comparison operator: " + E.operator), !1);
2758
- })));
2759
- }));
2760
- this.Wi(n.concat(u.map(((h) => h.id)) || []));
2761
- }
2762
- }
2763
- onAction(e) {
2764
- var t, i = ((t = this._instance) == null || (t = t.persistence) == null ? void 0 : t.props[Rt]) || [];
2765
- this.zi.has(e) && this.Wi(i.concat(this.zi.get(e) || []));
2766
- }
2767
- Wi(e) {
2768
- var t;
2769
- I.info("updating activated surveys", { activatedSurveys: e }), (t = this._instance) == null || (t = t.persistence) == null || t.register({ [Rt]: [...new Set(e)] });
2770
- }
2771
- getSurveys() {
2772
- var e, t = (e = this._instance) == null || (e = e.persistence) == null ? void 0 : e.props[Rt];
2773
- return t || [];
2774
- }
2775
- getEventToSurveys() {
2776
- return this.Ui;
2777
- }
2778
- Gi() {
2779
- return this.qi;
2780
- }
2781
- }
2782
- class Do {
2783
- constructor(e) {
2784
- this.Vi = void 0, this._surveyManager = null, this.Ji = !1, this.Ki = !1, this.Yi = [], this._instance = e, this._surveyEventReceiver = null;
2785
- }
2786
- onRemoteConfig(e) {
2787
- if (!this._instance.config.disable_surveys) {
2788
- var t = e.surveys;
2789
- if (O(t)) return I.warn("Flags not loaded yet. Not loading surveys.");
2790
- var i = T(t);
2791
- this.Vi = i ? t.length > 0 : t, I.info("flags response received, isSurveysEnabled: " + this.Vi), this.loadIfEnabled();
2792
- }
2793
- }
2794
- reset() {
2795
- localStorage.removeItem("lastSeenSurveyDate");
2796
- for (var e = [], t = 0; t < localStorage.length; t++) {
2797
- var i = localStorage.key(t);
2798
- (i != null && i.startsWith(Xi) || i != null && i.startsWith("inProgressSurvey_")) && e.push(i);
2799
- }
2800
- e.forEach(((s) => localStorage.removeItem(s)));
2801
- }
2802
- loadIfEnabled() {
2803
- if (!this._surveyManager) if (this.Ki) I.info("Already initializing surveys, skipping...");
2804
- else if (this._instance.config.disable_surveys) I.info("Disabled. Not loading surveys.");
2805
- else if (this._instance.config.cookieless_mode && this._instance.consent.isOptedOut()) I.info("Not loading surveys in cookieless mode without consent.");
2806
- else {
2807
- var e = k == null ? void 0 : k.__PosthogExtensions__;
2808
- if (e) {
2809
- if (!v(this.Vi) || this._instance.config.advanced_enable_surveys) {
2810
- var t = this.Vi || this._instance.config.advanced_enable_surveys;
2811
- this.Ki = !0;
2812
- try {
2813
- var i = e.generateSurveys;
2814
- if (i) return void this.Xi(i, t);
2815
- var s = e.loadExternalDependency;
2816
- if (!s) return void this.Qi("PostHog loadExternalDependency extension not found.");
2817
- s(this._instance, "surveys", ((n) => {
2818
- n || !e.generateSurveys ? this.Qi("Could not load surveys script", n) : this.Xi(e.generateSurveys, t);
2819
- }));
2820
- } catch (n) {
2821
- throw this.Qi("Error initializing surveys", n), n;
2822
- } finally {
2823
- this.Ki = !1;
2824
- }
2825
- }
2826
- } else I.error("PostHog Extensions not found.");
2827
- }
2828
- }
2829
- Xi(e, t) {
2830
- this._surveyManager = e(this._instance, t), this._surveyEventReceiver = new Ro(this._instance), I.info("Surveys loaded successfully"), this.Zi({ isLoaded: !0 });
2831
- }
2832
- Qi(e, t) {
2833
- I.error(e, t), this.Zi({ isLoaded: !1, error: e });
2834
- }
2835
- onSurveysLoaded(e) {
2836
- return this.Yi.push(e), this._surveyManager && this.Zi({ isLoaded: !0 }), () => {
2837
- this.Yi = this.Yi.filter(((t) => t !== e));
2838
- };
2839
- }
2840
- getSurveys(e, t) {
2841
- if (t === void 0 && (t = !1), this._instance.config.disable_surveys) return I.info("Disabled. Not loading surveys."), e([]);
2842
- var i = this._instance.get_property(Li);
2843
- if (i && !t) return e(i, { isLoaded: !0 });
2844
- if (this.Ji) return e([], { isLoaded: !1, error: "Surveys are already being loaded" });
2845
- try {
2846
- this.Ji = !0, this._instance.ci({ url: this._instance.requestRouter.endpointFor("api", "/api/surveys/?token=" + this._instance.config.token), method: "GET", timeout: this._instance.config.surveys_request_timeout_ms, callback: (s) => {
2847
- var n;
2848
- this.Ji = !1;
2849
- var a = s.statusCode;
2850
- if (a !== 200 || !s.json) {
2851
- var o = "Surveys API could not be loaded, status: " + a;
2852
- return I.error(o), e([], { isLoaded: !1, error: o });
2853
- }
2854
- var l, c = s.json.surveys || [], u = c.filter(((h) => (function(g) {
2855
- return !(!g.start_date || g.end_date);
2856
- })(h) && ((function(g) {
2857
- var p;
2858
- return !((p = g.conditions) == null || (p = p.events) == null || (p = p.values) == null || !p.length);
2859
- })(h) || (function(g) {
2860
- var p;
2861
- return !((p = g.conditions) == null || (p = p.actions) == null || (p = p.values) == null || !p.length);
2862
- })(h))));
2863
- return u.length > 0 && ((l = this._surveyEventReceiver) == null || l.register(u)), (n = this._instance.persistence) == null || n.register({ [Li]: c }), e(c, { isLoaded: !0 });
2864
- } });
2865
- } catch (s) {
2866
- throw this.Ji = !1, s;
2867
- }
2868
- }
2869
- Zi(e) {
2870
- for (var t of this.Yi) try {
2871
- if (!e.isLoaded) return t([], e);
2872
- this.getSurveys(t);
2873
- } catch (i) {
2874
- I.error("Error in survey callback", i);
2875
- }
2876
- }
2877
- getActiveMatchingSurveys(e, t) {
2878
- if (t === void 0 && (t = !1), !O(this._surveyManager)) return this._surveyManager.getActiveMatchingSurveys(e, t);
2879
- I.warn("init was not called");
2880
- }
2881
- te(e) {
2882
- var t = null;
2883
- return this.getSurveys(((i) => {
2884
- var s;
2885
- t = (s = i.find(((n) => n.id === e))) !== null && s !== void 0 ? s : null;
2886
- })), t;
2887
- }
2888
- ie(e) {
2889
- if (O(this._surveyManager)) return { eligible: !1, reason: "SDK is not enabled or survey functionality is not yet loaded" };
2890
- var t = typeof e == "string" ? this.te(e) : e;
2891
- return t ? this._surveyManager.checkSurveyEligibility(t) : { eligible: !1, reason: "Survey not found" };
2892
- }
2893
- canRenderSurvey(e) {
2894
- if (O(this._surveyManager)) return I.warn("init was not called"), { visible: !1, disabledReason: "SDK is not enabled or survey functionality is not yet loaded" };
2895
- var t = this.ie(e);
2896
- return { visible: t.eligible, disabledReason: t.reason };
2897
- }
2898
- canRenderSurveyAsync(e, t) {
2899
- return O(this._surveyManager) ? (I.warn("init was not called"), Promise.resolve({ visible: !1, disabledReason: "SDK is not enabled or survey functionality is not yet loaded" })) : new Promise(((i) => {
2900
- this.getSurveys(((s) => {
2901
- var n, a = (n = s.find(((l) => l.id === e))) !== null && n !== void 0 ? n : null;
2902
- if (a) {
2903
- var o = this.ie(a);
2904
- i({ visible: o.eligible, disabledReason: o.reason });
2905
- } else i({ visible: !1, disabledReason: "Survey not found" });
2906
- }), t);
2907
- }));
2908
- }
2909
- renderSurvey(e, t) {
2910
- var i;
2911
- if (O(this._surveyManager)) I.warn("init was not called");
2912
- else {
2913
- var s = typeof e == "string" ? this.te(e) : e;
2914
- if (s != null && s.id) if (To.includes(s.type)) {
2915
- var n = m == null ? void 0 : m.querySelector(t);
2916
- if (n) return (i = s.appearance) != null && i.surveyPopupDelaySeconds ? (I.info("Rendering survey " + s.id + " with delay of " + s.appearance.surveyPopupDelaySeconds + " seconds"), void setTimeout((() => {
2917
- var a, o;
2918
- I.info("Rendering survey " + s.id + " with delay of " + ((a = s.appearance) == null ? void 0 : a.surveyPopupDelaySeconds) + " seconds"), (o = this._surveyManager) == null || o.renderSurvey(s, n), I.info("Survey " + s.id + " rendered");
2919
- }), 1e3 * s.appearance.surveyPopupDelaySeconds)) : void this._surveyManager.renderSurvey(s, n);
2920
- I.warn("Survey element not found");
2921
- } else I.warn("Surveys of type " + s.type + " cannot be rendered in the app");
2922
- else I.warn("Survey not found");
2923
- }
2924
- }
2925
- displaySurvey(e, t) {
2926
- var i;
2927
- if (O(this._surveyManager)) I.warn("init was not called");
2928
- else {
2929
- var s = this.te(e);
2930
- if (s) {
2931
- var n = s;
2932
- if ((i = s.appearance) != null && i.surveyPopupDelaySeconds && t.ignoreDelay && (n = w({}, s, { appearance: w({}, s.appearance, { surveyPopupDelaySeconds: 0 }) })), t.ignoreConditions === !1) {
2933
- var a = this.canRenderSurvey(s);
2934
- if (!a.visible) return void I.warn("Survey is not eligible to be displayed: ", a.disabledReason);
2935
- }
2936
- t.displayType !== kn.Inline ? this._surveyManager.handlePopoverSurvey(n) : this.renderSurvey(n, t.selector);
2937
- } else I.warn("Survey not found");
2938
- }
2939
- }
2940
- }
2941
- var as = U("[RateLimiter]");
2942
- class Mo {
2943
- constructor(e) {
2944
- var t, i;
2945
- this.serverLimits = {}, this.lastEventRateLimited = !1, this.checkForLimiting = (s) => {
2946
- var n = s.text;
2947
- if (n && n.length) try {
2948
- (JSON.parse(n).quota_limited || []).forEach(((a) => {
2949
- as.info((a || "events") + " is quota limited."), this.serverLimits[a] = (/* @__PURE__ */ new Date()).getTime() + 6e4;
2950
- }));
2951
- } catch (a) {
2952
- return void as.warn('could not rate limit - continuing. Error: "' + (a == null ? void 0 : a.message) + '"', { text: n });
2953
- }
2954
- }, this.instance = e, this.captureEventsPerSecond = ((t = e.config.rate_limiting) == null ? void 0 : t.events_per_second) || 10, this.captureEventsBurstLimit = Math.max(((i = e.config.rate_limiting) == null ? void 0 : i.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(!0).isRateLimited;
2955
- }
2956
- clientRateLimitContext(e) {
2957
- var t, i, s;
2958
- e === void 0 && (e = !1);
2959
- var n = (/* @__PURE__ */ new Date()).getTime(), a = (t = (i = this.instance.persistence) == null ? void 0 : i.get_property(Ui)) !== null && t !== void 0 ? t : { tokens: this.captureEventsBurstLimit, last: n };
2960
- a.tokens += (n - a.last) / 1e3 * this.captureEventsPerSecond, a.last = n, a.tokens > this.captureEventsBurstLimit && (a.tokens = this.captureEventsBurstLimit);
2961
- var o = a.tokens < 1;
2962
- return o || e || (a.tokens = Math.max(0, a.tokens - 1)), !o || this.lastEventRateLimited || e || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to " + this.captureEventsPerSecond + " events per second and " + this.captureEventsBurstLimit + " events burst limit." }, { skip_client_rate_limiting: !0 }), this.lastEventRateLimited = o, (s = this.instance.persistence) == null || s.set_property(Ui, a), { isRateLimited: o, remainingTokens: a.tokens };
2963
- }
2964
- isServerRateLimited(e) {
2965
- var t = this.serverLimits[e || "events"] || !1;
2966
- return t !== !1 && (/* @__PURE__ */ new Date()).getTime() < t;
2967
- }
2968
- }
2969
- var qe = U("[RemoteConfig]");
2970
- class Ao {
2971
- constructor(e) {
2972
- this._instance = e;
2973
- }
2974
- get remoteConfig() {
2975
- var e;
2976
- return (e = k._POSTHOG_REMOTE_CONFIG) == null || (e = e[this._instance.config.token]) == null ? void 0 : e.config;
2977
- }
2978
- ee(e) {
2979
- var t, i;
2980
- (t = k.__PosthogExtensions__) != null && t.loadExternalDependency ? (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this._instance, "remote-config", (() => e(this.remoteConfig))) : (qe.error("PostHog Extensions not found. Cannot load remote config."), e());
2981
- }
2982
- re(e) {
2983
- this._instance.ci({ method: "GET", url: this._instance.requestRouter.endpointFor("assets", "/array/" + this._instance.config.token + "/config"), callback: (t) => {
2984
- e(t.json);
2985
- } });
2986
- }
2987
- load() {
2988
- try {
2989
- if (this.remoteConfig) return qe.info("Using preloaded remote config", this.remoteConfig), void this.fi(this.remoteConfig);
2990
- if (this._instance.M()) return void qe.warn("Remote config is disabled. Falling back to local config.");
2991
- this.ee(((e) => {
2992
- if (!e) return qe.info("No config found after loading remote JS config. Falling back to JSON."), void this.re(((t) => {
2993
- this.fi(t);
2994
- }));
2995
- this.fi(e);
2996
- }));
2997
- } catch (e) {
2998
- qe.error("Error loading remote config", e);
2999
- }
3000
- }
3001
- fi(e) {
3002
- e ? this._instance.config.__preview_remote_config ? (this._instance.fi(e), e.hasFeatureFlags !== !1 && this._instance.featureFlags.ensureFlagsLoaded()) : qe.info("__preview_remote_config is disabled. Logging config instead", e) : qe.error("Failed to fetch remote config from PostHog.");
3003
- }
3004
- }
3005
- var Ki = 3e3;
3006
- class Lo {
3007
- constructor(e, t) {
3008
- this.se = !0, this.ne = [], this.oe = de((t == null ? void 0 : t.flush_interval_ms) || Ki, 250, 5e3, y.createLogger("flush interval"), Ki), this.ae = e;
3009
- }
3010
- enqueue(e) {
3011
- this.ne.push(e), this.le || this.ue();
3012
- }
3013
- unload() {
3014
- this.he();
3015
- var e = this.ne.length > 0 ? this.de() : {}, t = Object.values(e);
3016
- [...t.filter(((i) => i.url.indexOf("/e") === 0)), ...t.filter(((i) => i.url.indexOf("/e") !== 0))].map(((i) => {
3017
- this.ae(w({}, i, { transport: "sendBeacon" }));
3018
- }));
3019
- }
3020
- enable() {
3021
- this.se = !1, this.ue();
3022
- }
3023
- ue() {
3024
- var e = this;
3025
- this.se || (this.le = setTimeout((() => {
3026
- if (this.he(), this.ne.length > 0) {
3027
- var t = this.de(), i = function() {
3028
- var n = t[s], a = (/* @__PURE__ */ new Date()).getTime();
3029
- n.data && T(n.data) && F(n.data, ((o) => {
3030
- o.offset = Math.abs(o.timestamp - a), delete o.timestamp;
3031
- })), e.ae(n);
3032
- };
3033
- for (var s in t) i();
3034
- }
3035
- }), this.oe));
3036
- }
3037
- he() {
3038
- clearTimeout(this.le), this.le = void 0;
3039
- }
3040
- de() {
3041
- var e = {};
3042
- return F(this.ne, ((t) => {
3043
- var i, s = t, n = (s ? s.batchKey : null) || s.url;
3044
- v(e[n]) && (e[n] = w({}, s, { data: [] })), (i = e[n].data) == null || i.push(s.data);
3045
- })), this.ne = [], e;
3046
- }
3047
- }
3048
- var No = ["retriesPerformedSoFar"];
3049
- class Uo {
3050
- constructor(e) {
3051
- this.ve = !1, this.ce = 3e3, this.ne = [], this._instance = e, this.ne = [], this.fe = !0, !v(d) && "onLine" in d.navigator && (this.fe = d.navigator.onLine, this.pe = () => {
3052
- this.fe = !0, this.Dt();
3053
- }, this.ge = () => {
3054
- this.fe = !1;
3055
- }, L(d, "online", this.pe), L(d, "offline", this.ge));
3056
- }
3057
- get length() {
3058
- return this.ne.length;
3059
- }
3060
- retriableRequest(e) {
3061
- var { retriesPerformedSoFar: t } = e, i = ms(e, No);
3062
- fe(t) && t > 0 && (i.url = ri(i.url, { retry_count: t })), this._instance.ci(w({}, i, { callback: (s) => {
3063
- s.statusCode !== 200 && (s.statusCode < 400 || s.statusCode >= 500) && (t ?? 0) < 10 ? this._e(w({ retriesPerformedSoFar: t }, i)) : i.callback == null || i.callback(s);
3064
- } }));
3065
- }
3066
- _e(e) {
3067
- var t = e.retriesPerformedSoFar || 0;
3068
- e.retriesPerformedSoFar = t + 1;
3069
- var i = (function(a) {
3070
- var o = 3e3 * Math.pow(2, a), l = o / 2, c = Math.min(18e5, o), u = (Math.random() - 0.5) * (c - l);
3071
- return Math.ceil(c + u);
3072
- })(t), s = Date.now() + i;
3073
- this.ne.push({ retryAt: s, requestOptions: e });
3074
- var n = "Enqueued failed request for retry in " + i;
3075
- navigator.onLine || (n += " (Browser is offline)"), y.warn(n), this.ve || (this.ve = !0, this.me());
3076
- }
3077
- me() {
3078
- if (this.ye && clearTimeout(this.ye), this.ne.length === 0) return this.ve = !1, void (this.ye = void 0);
3079
- this.ye = setTimeout((() => {
3080
- this.fe && this.ne.length > 0 && this.Dt(), this.me();
3081
- }), this.ce);
3082
- }
3083
- Dt() {
3084
- var e = Date.now(), t = [], i = this.ne.filter(((n) => n.retryAt < e || (t.push(n), !1)));
3085
- if (this.ne = t, i.length > 0) for (var { requestOptions: s } of i) this.retriableRequest(s);
3086
- }
3087
- unload() {
3088
- for (var { requestOptions: e } of (this.ye && (clearTimeout(this.ye), this.ye = void 0), this.ve = !1, v(d) || (this.pe && (d.removeEventListener("online", this.pe), this.pe = void 0), this.ge && (d.removeEventListener("offline", this.ge), this.ge = void 0)), this.ne)) try {
3089
- this._instance.ci(w({}, e, { transport: "sendBeacon" }));
3090
- } catch (t) {
3091
- y.error(t);
3092
- }
3093
- this.ne = [];
3094
- }
3095
- }
3096
- class qo {
3097
- constructor(e) {
3098
- this.be = () => {
3099
- var t, i, s, n;
3100
- this.we || (this.we = {});
3101
- var a = this.scrollElement(), o = this.scrollY(), l = a ? Math.max(0, a.scrollHeight - a.clientHeight) : 0, c = o + ((a == null ? void 0 : a.clientHeight) || 0), u = (a == null ? void 0 : a.scrollHeight) || 0;
3102
- this.we.lastScrollY = Math.ceil(o), this.we.maxScrollY = Math.max(o, (t = this.we.maxScrollY) !== null && t !== void 0 ? t : 0), this.we.maxScrollHeight = Math.max(l, (i = this.we.maxScrollHeight) !== null && i !== void 0 ? i : 0), this.we.lastContentY = c, this.we.maxContentY = Math.max(c, (s = this.we.maxContentY) !== null && s !== void 0 ? s : 0), this.we.maxContentHeight = Math.max(u, (n = this.we.maxContentHeight) !== null && n !== void 0 ? n : 0);
3103
- }, this._instance = e;
3104
- }
3105
- getContext() {
3106
- return this.we;
3107
- }
3108
- resetContext() {
3109
- var e = this.we;
3110
- return setTimeout(this.be, 0), e;
3111
- }
3112
- startMeasuringScrollPosition() {
3113
- L(d, "scroll", this.be, { capture: !0 }), L(d, "scrollend", this.be, { capture: !0 }), L(d, "resize", this.be);
3114
- }
3115
- scrollElement() {
3116
- if (!this._instance.config.scroll_root_selector) return d == null ? void 0 : d.document.documentElement;
3117
- var e = T(this._instance.config.scroll_root_selector) ? this._instance.config.scroll_root_selector : [this._instance.config.scroll_root_selector];
3118
- for (var t of e) {
3119
- var i = d == null ? void 0 : d.document.querySelector(t);
3120
- if (i) return i;
3121
- }
3122
- }
3123
- scrollY() {
3124
- if (this._instance.config.scroll_root_selector) {
3125
- var e = this.scrollElement();
3126
- return e && e.scrollTop || 0;
3127
- }
3128
- return d && (d.scrollY || d.pageYOffset || d.document.documentElement.scrollTop) || 0;
3129
- }
3130
- scrollX() {
3131
- if (this._instance.config.scroll_root_selector) {
3132
- var e = this.scrollElement();
3133
- return e && e.scrollLeft || 0;
3134
- }
3135
- return d && (d.scrollX || d.pageXOffset || d.document.documentElement.scrollLeft) || 0;
3136
- }
3137
- }
3138
- var jo = (r) => gn(r == null ? void 0 : r.config.mask_personal_data_properties, r == null ? void 0 : r.config.custom_personal_data_properties);
3139
- class os {
3140
- constructor(e, t, i, s) {
3141
- this.xe = (n) => {
3142
- var a = this.$e();
3143
- if (!a || a.sessionId !== n) {
3144
- var o = { sessionId: n, props: this.Se(this._instance) };
3145
- this.Ee.register({ [Ni]: o });
3146
- }
3147
- }, this._instance = e, this.ke = t, this.Ee = i, this.Se = s || jo, this.ke.onSessionId(this.xe);
3148
- }
3149
- $e() {
3150
- return this.Ee.props[Ni];
3151
- }
3152
- getSetOnceProps() {
3153
- var e, t = (e = this.$e()) == null ? void 0 : e.props;
3154
- return t ? "r" in t ? fn(t) : { $referring_domain: t.referringDomain, $pathname: t.initialPathName, utm_source: t.utm_source, utm_campaign: t.utm_campaign, utm_medium: t.utm_medium, utm_content: t.utm_content, utm_term: t.utm_term } : {};
3155
- }
3156
- getSessionProps() {
3157
- var e = {};
3158
- return F(Qi(this.getSetOnceProps()), ((t, i) => {
3159
- i === "$current_url" && (i = "url"), e["$session_entry_" + Fi(i)] = t;
3160
- })), e;
3161
- }
3162
- }
3163
- var Pi = U("[SessionId]");
3164
- class ls {
3165
- on(e, t) {
3166
- return this.Pe.on(e, t);
3167
- }
3168
- constructor(e, t, i) {
3169
- var s;
3170
- if (this.Te = [], this.Ie = void 0, this.Pe = new cr(), this.Re = (u, h) => Math.abs(u - h) > this.sessionTimeoutMs, !e.persistence) throw new Error("SessionIdManager requires a PostHogPersistence instance");
3171
- if (e.config.cookieless_mode === "always") throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');
3172
- this.C = e.config, this.Ee = e.persistence, this.Ce = void 0, this.Oe = void 0, this._sessionStartTimestamp = null, this._sessionActivityTimestamp = null, this.Fe = t || Fe, this.Me = i || Fe;
3173
- var n = this.C.persistence_name || this.C.token, a = this.C.session_idle_timeout_seconds || 1800;
3174
- if (this._sessionTimeoutMs = 1e3 * de(a, 60, 36e3, Pi.createLogger("session_idle_timeout_seconds"), 1800), e.register({ $configured_session_timeout_ms: this._sessionTimeoutMs }), this.Ae(), this.De = "ph_" + n + "_window_id", this.je = "ph_" + n + "_primary_window_exists", this.Le()) {
3175
- var o = q.W(this.De), l = q.W(this.je);
3176
- o && !l ? this.Ce = o : q.V(this.De), q.G(this.je, !0);
3177
- }
3178
- if ((s = this.C.bootstrap) != null && s.sessionID) try {
3179
- var c = ((u) => {
3180
- var h = u.replace(/-/g, "");
3181
- if (h.length !== 32) throw new Error("Not a valid UUID");
3182
- if (h[12] !== "7") throw new Error("Not a UUIDv7");
3183
- return parseInt(h.substring(0, 12), 16);
3184
- })(this.C.bootstrap.sessionID);
3185
- this.Ne(this.C.bootstrap.sessionID, (/* @__PURE__ */ new Date()).getTime(), c);
3186
- } catch (u) {
3187
- Pi.error("Invalid sessionID in bootstrap", u);
3188
- }
3189
- this.Ue();
3190
- }
3191
- get sessionTimeoutMs() {
3192
- return this._sessionTimeoutMs;
3193
- }
3194
- onSessionId(e) {
3195
- return v(this.Te) && (this.Te = []), this.Te.push(e), this.Oe && e(this.Oe, this.Ce), () => {
3196
- this.Te = this.Te.filter(((t) => t !== e));
3197
- };
3198
- }
3199
- Le() {
3200
- return this.C.persistence !== "memory" && !this.Ee.wi && q.H();
3201
- }
3202
- ze(e) {
3203
- e !== this.Ce && (this.Ce = e, this.Le() && q.G(this.De, e));
3204
- }
3205
- He() {
3206
- return this.Ce ? this.Ce : this.Le() ? q.W(this.De) : null;
3207
- }
3208
- Ne(e, t, i) {
3209
- e === this.Oe && t === this._sessionActivityTimestamp && i === this._sessionStartTimestamp || (this._sessionStartTimestamp = i, this._sessionActivityTimestamp = t, this.Oe = e, this.Ee.register({ [Wt]: [t, e, i] }));
3210
- }
3211
- Be() {
3212
- if (this.Oe && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [this._sessionActivityTimestamp, this.Oe, this._sessionStartTimestamp];
3213
- var e = this.Ee.props[Wt];
3214
- return T(e) && e.length === 2 && e.push(e[0]), e || [0, null, 0];
3215
- }
3216
- resetSessionId() {
3217
- this.Ne(null, null, null);
3218
- }
3219
- destroy() {
3220
- clearTimeout(this.qe), this.qe = void 0, this.Ie && d && (d.removeEventListener("beforeunload", this.Ie, { capture: !1 }), this.Ie = void 0), this.Te = [];
3221
- }
3222
- Ue() {
3223
- this.Ie = () => {
3224
- this.Le() && q.V(this.je);
3225
- }, L(d, "beforeunload", this.Ie, { capture: !1 });
3226
- }
3227
- checkAndGetSessionAndWindowId(e, t) {
3228
- if (e === void 0 && (e = !1), t === void 0 && (t = null), this.C.cookieless_mode === "always") throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');
3229
- var i = t || (/* @__PURE__ */ new Date()).getTime(), [s, n, a] = this.Be(), o = this.He(), l = fe(a) && a > 0 && Math.abs(i - a) > 864e5, c = !1, u = !n, h = !u && !e && this.Re(i, s);
3230
- u || h || l ? (n = this.Fe(), o = this.Me(), Pi.info("new session ID generated", { sessionId: n, windowId: o, changeReason: { noSessionId: u, activityTimeout: h, sessionPastMaximumLength: l } }), a = i, c = !0) : o || (o = this.Me(), c = !0);
3231
- var g = s === 0 || !e || l ? i : s, p = a === 0 ? (/* @__PURE__ */ new Date()).getTime() : a;
3232
- return this.ze(o), this.Ne(n, g, p), e || this.Ae(), c && this.Te.forEach(((f) => f(n, o, c ? { noSessionId: u, activityTimeout: h, sessionPastMaximumLength: l } : void 0))), { sessionId: n, windowId: o, sessionStartTimestamp: p, changeReason: c ? { noSessionId: u, activityTimeout: h, sessionPastMaximumLength: l } : void 0, lastActivityTimestamp: s };
3233
- }
3234
- Ae() {
3235
- clearTimeout(this.qe), this.qe = setTimeout((() => {
3236
- var [e] = this.Be();
3237
- if (this.Re((/* @__PURE__ */ new Date()).getTime(), e)) {
3238
- var t = this.Oe;
3239
- this.resetSessionId(), this.Pe.emit("forcedIdleReset", { idleSessionId: t });
3240
- }
3241
- }), 1.1 * this.sessionTimeoutMs);
3242
- }
3243
- }
3244
- var Bo = ["$set_once", "$set"], $e = U("[SiteApps]");
3245
- class Ho {
3246
- constructor(e) {
3247
- this._instance = e, this.We = [], this.apps = {};
3248
- }
3249
- get isEnabled() {
3250
- return !!this._instance.config.opt_in_site_apps;
3251
- }
3252
- Ge(e, t) {
3253
- if (t) {
3254
- var i = this.globalsForEvent(t);
3255
- this.We.push(i), this.We.length > 1e3 && (this.We = this.We.slice(10));
3256
- }
3257
- }
3258
- get siteAppLoaders() {
3259
- var e;
3260
- return (e = k._POSTHOG_REMOTE_CONFIG) == null || (e = e[this._instance.config.token]) == null ? void 0 : e.siteApps;
3261
- }
3262
- init() {
3263
- if (this.isEnabled) {
3264
- var e = this._instance.Mi(this.Ge.bind(this));
3265
- this.Ve = () => {
3266
- e(), this.We = [], this.Ve = void 0;
3267
- };
3268
- }
3269
- }
3270
- globalsForEvent(e) {
3271
- var t, i, s, n, a, o, l;
3272
- if (!e) throw new Error("Event payload is required");
3273
- var c = {}, u = this._instance.get_property("$groups") || [], h = this._instance.get_property("$stored_group_properties") || {};
3274
- for (var [g, p] of Object.entries(h)) c[g] = { id: u[g], type: g, properties: p };
3275
- var { $set_once: f, $set: _ } = e;
3276
- return { event: w({}, ms(e, Bo), { properties: w({}, e.properties, _ ? { $set: w({}, (t = (i = e.properties) == null ? void 0 : i.$set) !== null && t !== void 0 ? t : {}, _) } : {}, f ? { $set_once: w({}, (s = (n = e.properties) == null ? void 0 : n.$set_once) !== null && s !== void 0 ? s : {}, f) } : {}), elements_chain: (a = (o = e.properties) == null ? void 0 : o.$elements_chain) !== null && a !== void 0 ? a : "", distinct_id: (l = e.properties) == null ? void 0 : l.distinct_id }), person: { properties: this._instance.get_property("$stored_person_properties") }, groups: c };
3277
- }
3278
- setupSiteApp(e) {
3279
- var t = this.apps[e.id], i = () => {
3280
- var o;
3281
- !t.errored && this.We.length && ($e.info("Processing " + this.We.length + " events for site app with id " + e.id), this.We.forEach(((l) => t.processEvent == null ? void 0 : t.processEvent(l))), t.processedBuffer = !0), Object.values(this.apps).every(((l) => l.processedBuffer || l.errored)) && ((o = this.Ve) == null || o.call(this));
3282
- }, s = !1, n = (o) => {
3283
- t.errored = !o, t.loaded = !0, $e.info("Site app with id " + e.id + " " + (o ? "loaded" : "errored")), s && i();
3284
- };
3285
- try {
3286
- var { processEvent: a } = e.init({ posthog: this._instance, callback: (o) => {
3287
- n(o);
3288
- } });
3289
- a && (t.processEvent = a), s = !0;
3290
- } catch (o) {
3291
- $e.error("Error while initializing PostHog app with config id " + e.id, o), n(!1);
3292
- }
3293
- if (s && t.loaded) try {
3294
- i();
3295
- } catch (o) {
3296
- $e.error("Error while processing buffered events PostHog app with config id " + e.id, o), t.errored = !0;
3297
- }
3298
- }
3299
- Je() {
3300
- var e = this.siteAppLoaders || [];
3301
- for (var t of e) this.apps[t.id] = { id: t.id, loaded: !1, errored: !1, processedBuffer: !1 };
3302
- for (var i of e) this.setupSiteApp(i);
3303
- }
3304
- Ke(e) {
3305
- if (Object.keys(this.apps).length !== 0) {
3306
- var t = this.globalsForEvent(e);
3307
- for (var i of Object.values(this.apps)) try {
3308
- i.processEvent == null || i.processEvent(t);
3309
- } catch (s) {
3310
- $e.error("Error while processing event " + e.event + " for site app " + i.id, s);
3311
- }
3312
- }
3313
- }
3314
- onRemoteConfig(e) {
3315
- var t, i, s, n = this;
3316
- if ((t = this.siteAppLoaders) != null && t.length) return this.isEnabled ? (this.Je(), void this._instance.on("eventCaptured", ((c) => this.Ke(c)))) : void $e.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
3317
- if ((i = this.Ve) == null || i.call(this), (s = e.siteApps) != null && s.length) if (this.isEnabled) {
3318
- var a = function(c) {
3319
- var u;
3320
- k["__$$ph_site_app_" + c] = n._instance, (u = k.__PosthogExtensions__) == null || u.loadSiteApp == null || u.loadSiteApp(n._instance, l, ((h) => {
3321
- if (h) return $e.error("Error while initializing PostHog app with config id " + c, h);
3322
- }));
3323
- };
3324
- for (var { id: o, url: l } of e.siteApps) a(o);
3325
- } else $e.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');
3326
- }
3327
- }
3328
- var xn = function(r, e) {
3329
- if (!r) return !1;
3330
- var t = r.userAgent;
3331
- if (t && wr(t, e)) return !0;
3332
- try {
3333
- var i = r == null ? void 0 : r.userAgentData;
3334
- if (i != null && i.brands && i.brands.some(((s) => wr(s == null ? void 0 : s.brand, e)))) return !0;
3335
- } catch {
3336
- }
3337
- return !!r.webdriver;
3338
- }, bt = (function(r) {
3339
- return r.US = "us", r.EU = "eu", r.CUSTOM = "custom", r;
3340
- })({}), cs = "i.posthog.com";
3341
- class Vo {
3342
- constructor(e) {
3343
- this.Ye = {}, this.instance = e;
3344
- }
3345
- get apiHost() {
3346
- var e = this.instance.config.api_host.trim().replace(/\/$/, "");
3347
- return e === "https://app.posthog.com" ? "https://us.i.posthog.com" : e;
3348
- }
3349
- get flagsApiHost() {
3350
- var e = this.instance.config.flags_api_host;
3351
- return e ? e.trim().replace(/\/$/, "") : this.apiHost;
3352
- }
3353
- get uiHost() {
3354
- var e, t = (e = this.instance.config.ui_host) == null ? void 0 : e.replace(/\/$/, "");
3355
- return t || (t = this.apiHost.replace("." + cs, ".posthog.com")), t === "https://app.posthog.com" ? "https://us.posthog.com" : t;
3356
- }
3357
- get region() {
3358
- return this.Ye[this.apiHost] || (/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this.Ye[this.apiHost] = bt.US : /https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost) ? this.Ye[this.apiHost] = bt.EU : this.Ye[this.apiHost] = bt.CUSTOM), this.Ye[this.apiHost];
3359
- }
3360
- endpointFor(e, t) {
3361
- if (t === void 0 && (t = ""), t && (t = t[0] === "/" ? t : "/" + t), e === "ui") return this.uiHost + t;
3362
- if (e === "flags") return this.flagsApiHost + t;
3363
- if (this.region === bt.CUSTOM) return this.apiHost + t;
3364
- var i = cs + t;
3365
- switch (e) {
3366
- case "assets":
3367
- return "https://" + this.region + "-assets." + i;
3368
- case "api":
3369
- return "https://" + this.region + "." + i;
3370
- }
3371
- }
3372
- }
3373
- var Go = { icontains: (r, e) => !!d && e.href.toLowerCase().indexOf(r.toLowerCase()) > -1, not_icontains: (r, e) => !!d && e.href.toLowerCase().indexOf(r.toLowerCase()) === -1, regex: (r, e) => !!d && rt(e.href, r), not_regex: (r, e) => !!d && !rt(e.href, r), exact: (r, e) => e.href === r, is_not: (r, e) => e.href !== r };
3374
- class B {
3375
- constructor(e) {
3376
- var t = this;
3377
- this.getWebExperimentsAndEvaluateDisplayLogic = function(i) {
3378
- i === void 0 && (i = !1), t.getWebExperiments(((s) => {
3379
- B.Xe("retrieved web experiments from the server"), t.Qe = /* @__PURE__ */ new Map(), s.forEach(((n) => {
3380
- if (n.feature_flag_key) {
3381
- var a;
3382
- t.Qe && (B.Xe("setting flag key ", n.feature_flag_key, " to web experiment ", n), (a = t.Qe) == null || a.set(n.feature_flag_key, n));
3383
- var o = t._instance.getFeatureFlag(n.feature_flag_key);
3384
- N(o) && n.variants[o] && t.Ze(n.name, o, n.variants[o].transforms);
3385
- } else if (n.variants) for (var l in n.variants) {
3386
- var c = n.variants[l];
3387
- B.tr(c) && t.Ze(n.name, l, c.transforms);
3388
- }
3389
- }));
3390
- }), i);
3391
- }, this._instance = e, this._instance.onFeatureFlags(((i) => {
3392
- this.onFeatureFlags(i);
3393
- }));
3394
- }
3395
- onFeatureFlags(e) {
3396
- if (this._is_bot()) B.Xe("Refusing to render web experiment since the viewer is a likely bot");
3397
- else if (!this._instance.config.disable_web_experiments) {
3398
- if (O(this.Qe)) return this.Qe = /* @__PURE__ */ new Map(), this.loadIfEnabled(), void this.previewWebExperiment();
3399
- B.Xe("applying feature flags", e), e.forEach(((t) => {
3400
- var i;
3401
- if (this.Qe && (i = this.Qe) != null && i.has(t)) {
3402
- var s, n = this._instance.getFeatureFlag(t), a = (s = this.Qe) == null ? void 0 : s.get(t);
3403
- n && a != null && a.variants[n] && this.Ze(a.name, n, a.variants[n].transforms);
3404
- }
3405
- }));
3406
- }
3407
- }
3408
- previewWebExperiment() {
3409
- var e = B.getWindowLocation();
3410
- if (e != null && e.search) {
3411
- var t = Zt(e == null ? void 0 : e.search, "__experiment_id"), i = Zt(e == null ? void 0 : e.search, "__experiment_variant");
3412
- t && i && (B.Xe("previewing web experiments " + t + " && " + i), this.getWebExperiments(((s) => {
3413
- this.ir(parseInt(t), i, s);
3414
- }), !1, !0));
3415
- }
3416
- }
3417
- loadIfEnabled() {
3418
- this._instance.config.disable_web_experiments || this.getWebExperimentsAndEvaluateDisplayLogic();
3419
- }
3420
- getWebExperiments(e, t, i) {
3421
- if (this._instance.config.disable_web_experiments && !i) return e([]);
3422
- var s = this._instance.get_property("$web_experiments");
3423
- if (s && !t) return e(s);
3424
- this._instance.ci({ url: this._instance.requestRouter.endpointFor("api", "/api/web_experiments/?token=" + this._instance.config.token), method: "GET", callback: (n) => {
3425
- if (n.statusCode !== 200 || !n.json) return e([]);
3426
- var a = n.json.experiments || [];
3427
- return e(a);
3428
- } });
3429
- }
3430
- ir(e, t, i) {
3431
- var s = i.filter(((n) => n.id === e));
3432
- s && s.length > 0 && (B.Xe("Previewing web experiment [" + s[0].name + "] with variant [" + t + "]"), this.Ze(s[0].name, t, s[0].variants[t].transforms));
3433
- }
3434
- static tr(e) {
3435
- return !O(e.conditions) && B.er(e) && B.rr(e);
3436
- }
3437
- static er(e) {
3438
- var t;
3439
- if (O(e.conditions) || O((t = e.conditions) == null ? void 0 : t.url)) return !0;
3440
- var i, s, n, a = B.getWindowLocation();
3441
- return !!a && ((i = e.conditions) == null || !i.url || Go[(s = (n = e.conditions) == null ? void 0 : n.urlMatchType) !== null && s !== void 0 ? s : "icontains"](e.conditions.url, a));
3442
- }
3443
- static getWindowLocation() {
3444
- return d == null ? void 0 : d.location;
3445
- }
3446
- static rr(e) {
3447
- var t;
3448
- if (O(e.conditions) || O((t = e.conditions) == null ? void 0 : t.utm)) return !0;
3449
- var i = un();
3450
- if (i.utm_source) {
3451
- var s, n, a, o, l, c, u, h, g = (s = e.conditions) == null || (s = s.utm) == null || !s.utm_campaign || ((n = e.conditions) == null || (n = n.utm) == null ? void 0 : n.utm_campaign) == i.utm_campaign, p = (a = e.conditions) == null || (a = a.utm) == null || !a.utm_source || ((o = e.conditions) == null || (o = o.utm) == null ? void 0 : o.utm_source) == i.utm_source, f = (l = e.conditions) == null || (l = l.utm) == null || !l.utm_medium || ((c = e.conditions) == null || (c = c.utm) == null ? void 0 : c.utm_medium) == i.utm_medium, _ = (u = e.conditions) == null || (u = u.utm) == null || !u.utm_term || ((h = e.conditions) == null || (h = h.utm) == null ? void 0 : h.utm_term) == i.utm_term;
3452
- return g && f && _ && p;
3453
- }
3454
- return !1;
3455
- }
3456
- static Xe(e) {
3457
- for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++) i[s - 1] = arguments[s];
3458
- y.info("[WebExperiments] " + e, i);
3459
- }
3460
- Ze(e, t, i) {
3461
- this._is_bot() ? B.Xe("Refusing to render web experiment since the viewer is a likely bot") : t !== "control" ? i.forEach(((s) => {
3462
- if (s.selector) {
3463
- var n;
3464
- B.Xe("applying transform of variant " + t + " for experiment " + e + " ", s);
3465
- var a = (n = document) == null ? void 0 : n.querySelectorAll(s.selector);
3466
- a == null || a.forEach(((o) => {
3467
- var l = o;
3468
- s.html && (l.innerHTML = s.html), s.css && l.setAttribute("style", s.css);
3469
- }));
3470
- }
3471
- })) : B.Xe("Control variants leave the page unmodified.");
3472
- }
3473
- _is_bot() {
3474
- return Q && this._instance ? xn(Q, this._instance.config.custom_blocked_useragents) : void 0;
3475
- }
3476
- }
3477
- var Wo = U("[PostHog ExternalIntegrations]"), zo = { intercom: "intercom-integration", crispChat: "crisp-chat-integration" };
3478
- class Yo {
3479
- constructor(e) {
3480
- this._instance = e;
3481
- }
3482
- it(e, t) {
3483
- var i;
3484
- (i = k.__PosthogExtensions__) == null || i.loadExternalDependency == null || i.loadExternalDependency(this._instance, e, ((s) => {
3485
- if (s) return Wo.error("failed to load script", s);
3486
- t();
3487
- }));
3488
- }
3489
- startIfEnabledOrStop() {
3490
- var e = this, t = function(a) {
3491
- var o, l, c;
3492
- !s || (o = k.__PosthogExtensions__) != null && (o = o.integrations) != null && o[a] || e.it(zo[a], (() => {
3493
- var u;
3494
- (u = k.__PosthogExtensions__) == null || (u = u.integrations) == null || (u = u[a]) == null || u.start(e._instance);
3495
- })), !s && (l = k.__PosthogExtensions__) != null && (l = l.integrations) != null && l[a] && ((c = k.__PosthogExtensions__) == null || (c = c.integrations) == null || (c = c[a]) == null || c.stop());
3496
- };
3497
- for (var [i, s] of Object.entries((n = this._instance.config.integrations) !== null && n !== void 0 ? n : {})) {
3498
- var n;
3499
- t(i);
3500
- }
3501
- }
3502
- }
3503
- var Ji = "[SessionRecording]", pt = U(Ji);
3504
- class us {
3505
- get started() {
3506
- var e;
3507
- return !((e = this.sr) == null || !e.isStarted);
3508
- }
3509
- get status() {
3510
- return this.sr ? this.sr.status : this.nr && !this.ar ? "disabled" : "lazy_loading";
3511
- }
3512
- constructor(e) {
3513
- if (this._forceAllowLocalhostNetworkCapture = !1, this.nr = !1, this.lr = void 0, this._instance = e, !this._instance.sessionManager) throw pt.error("started without valid sessionManager"), new Error(Ji + " started without valid sessionManager. This is a bug.");
3514
- if (this._instance.config.cookieless_mode === "always") throw new Error(Ji + ' cannot be used with cookieless_mode="always"');
3515
- }
3516
- get ar() {
3517
- var e, t = !((e = this._instance.get_property(pi)) == null || !e.enabled), i = !this._instance.config.disable_session_recording, s = this._instance.config.disable_session_recording || this._instance.consent.isOptedOut();
3518
- return d && t && i && !s;
3519
- }
3520
- startIfEnabledOrStop(e) {
3521
- var t;
3522
- if (!this.ar || (t = this.sr) == null || !t.isStarted) {
3523
- var i = !v(Object.assign) && !v(Array.from);
3524
- this.ar && i ? (this.ur(e), pt.info("starting")) : this.stopRecording();
3525
- }
3526
- }
3527
- ur(e) {
3528
- var t, i, s;
3529
- this.ar && (k != null && (t = k.__PosthogExtensions__) != null && (t = t.rrweb) != null && t.record && (i = k.__PosthogExtensions__) != null && i.initSessionRecording ? this.hr(e) : (s = k.__PosthogExtensions__) == null || s.loadExternalDependency == null || s.loadExternalDependency(this._instance, this.dr, ((n) => {
3530
- if (n) return pt.error("could not load recorder", n);
3531
- this.hr(e);
3532
- })));
3533
- }
3534
- stopRecording() {
3535
- var e, t;
3536
- (e = this.lr) == null || e.call(this), this.lr = void 0, (t = this.sr) == null || t.stop();
3537
- }
3538
- vr() {
3539
- var e;
3540
- (e = this._instance.persistence) == null || e.unregister($s);
3541
- }
3542
- cr(e) {
3543
- if (this._instance.persistence) {
3544
- var t, i, s = this._instance.persistence, n = () => {
3545
- var a = e.sessionRecording === !1 ? void 0 : e.sessionRecording, o = a == null ? void 0 : a.sampleRate, l = O(o) ? null : parseFloat(o);
3546
- O(l) && this.vr();
3547
- var c = a == null ? void 0 : a.minimumDurationMilliseconds;
3548
- s.register({ [pi]: w({ enabled: !!a }, a, { networkPayloadCapture: w({ capturePerformance: e.capturePerformance }, a == null ? void 0 : a.networkPayloadCapture), canvasRecording: { enabled: a == null ? void 0 : a.recordCanvas, fps: a == null ? void 0 : a.canvasFps, quality: a == null ? void 0 : a.canvasQuality }, sampleRate: l, minimumDurationMilliseconds: v(c) ? null : c, endpoint: a == null ? void 0 : a.endpoint, triggerMatchType: a == null ? void 0 : a.triggerMatchType, masking: a == null ? void 0 : a.masking, urlTriggers: a == null ? void 0 : a.urlTriggers }) });
3549
- };
3550
- n(), (t = this.lr) == null || t.call(this), this.lr = (i = this._instance.sessionManager) == null ? void 0 : i.onSessionId(n);
3551
- }
3552
- }
3553
- onRemoteConfig(e) {
3554
- "sessionRecording" in e ? e.sessionRecording !== !1 ? (this.cr(e), this.nr = !0, this.startIfEnabledOrStop()) : this.nr = !0 : pt.info("skipping remote config with no sessionRecording", e);
3555
- }
3556
- log(e, t) {
3557
- var i;
3558
- t === void 0 && (t = "log"), (i = this.sr) != null && i.log ? this.sr.log(e, t) : pt.warn("log called before recorder was ready");
3559
- }
3560
- get dr() {
3561
- var e, t, i = (e = this._instance) == null || (e = e.persistence) == null ? void 0 : e.get_property(pi);
3562
- return (i == null || (t = i.scriptConfig) == null ? void 0 : t.script) || "lazy-recorder";
3563
- }
3564
- hr(e) {
3565
- var t, i;
3566
- if ((t = k.__PosthogExtensions__) == null || !t.initSessionRecording) throw Error("Called on script loaded before session recording is available");
3567
- this.sr || (this.sr = (i = k.__PosthogExtensions__) == null ? void 0 : i.initSessionRecording(this._instance), this.sr._forceAllowLocalhostNetworkCapture = this._forceAllowLocalhostNetworkCapture), this.sr.start(e);
3568
- }
3569
- onRRwebEmit(e) {
3570
- var t;
3571
- (t = this.sr) == null || t.onRRwebEmit == null || t.onRRwebEmit(e);
3572
- }
3573
- overrideLinkedFlag() {
3574
- var e, t;
3575
- this.sr || (t = this._instance.persistence) == null || t.register({ $replay_override_linked_flag: !0 }), (e = this.sr) == null || e.overrideLinkedFlag();
3576
- }
3577
- overrideSampling() {
3578
- var e, t;
3579
- this.sr || (t = this._instance.persistence) == null || t.register({ $replay_override_sampling: !0 }), (e = this.sr) == null || e.overrideSampling();
3580
- }
3581
- overrideTrigger(e) {
3582
- var t, i;
3583
- this.sr || (i = this._instance.persistence) == null || i.register({ [e === "url" ? "$replay_override_url_trigger" : "$replay_override_event_trigger"]: !0 }), (t = this.sr) == null || t.overrideTrigger(e);
3584
- }
3585
- get sdkDebugProperties() {
3586
- var e;
3587
- return ((e = this.sr) == null ? void 0 : e.sdkDebugProperties) || { $recording_status: this.status };
3588
- }
3589
- tryAddCustomEvent(e, t) {
3590
- var i;
3591
- return !((i = this.sr) == null || !i.tryAddCustomEvent(e, t));
3592
- }
3593
- }
3594
- var kt = {}, Zi = () => {
3595
- }, Xe = "posthog", Sn = !xo && (W == null ? void 0 : W.indexOf("MSIE")) === -1 && (W == null ? void 0 : W.indexOf("Mozilla")) === -1, hs = (r) => {
3596
- var e;
3597
- return w({ api_host: "https://us.i.posthog.com", flags_api_host: null, ui_host: null, token: "", autocapture: !0, cross_subdomain_cookie: va(m == null ? void 0 : m.location), persistence: "localStorage+cookie", persistence_name: "", loaded: Zi, save_campaign_params: !0, custom_campaign_params: [], custom_blocked_useragents: [], save_referrer: !0, capture_pageleave: "if_capture_pageview", defaults: r ?? "unset", __preview_deferred_init_extensions: !1, debug: z && N(z == null ? void 0 : z.search) && z.search.indexOf("__posthog_debug=true") !== -1 || !1, cookie_expiration: 365, upgrade: !1, disable_session_recording: !1, disable_persistence: !1, disable_web_experiments: !0, disable_surveys: !1, disable_surveys_automatic_display: !1, disable_external_dependency_loading: !1, enable_recording_console_log: void 0, secure_cookie: (d == null || (e = d.location) == null ? void 0 : e.protocol) === "https:", ip: !1, opt_out_capturing_by_default: !1, opt_out_persistence_by_default: !1, opt_out_useragent_filter: !1, opt_out_capturing_persistence_type: "localStorage", consent_persistence_name: null, opt_out_capturing_cookie_prefix: null, opt_in_site_apps: !1, property_denylist: [], respect_dnt: !1, sanitize_properties: null, request_headers: {}, request_batching: !0, properties_string_max_length: 65535, mask_all_element_attributes: !1, mask_all_text: !1, mask_personal_data_properties: !1, custom_personal_data_properties: [], advanced_disable_flags: !1, advanced_disable_decide: !1, advanced_disable_feature_flags: !1, advanced_disable_feature_flags_on_first_load: !1, advanced_only_evaluate_survey_feature_flags: !1, advanced_enable_surveys: !1, advanced_disable_toolbar_metrics: !1, feature_flag_request_timeout_ms: 3e3, surveys_request_timeout_ms: 1e4, on_request_error: (t) => {
3598
- var i = "Bad HTTP status: " + t.statusCode + " " + t.text;
3599
- y.error(i);
3600
- }, get_device_id: (t) => t, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: !1, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: Ki }, error_tracking: {}, _onCapture: Zi, __preview_eager_load_replay: !1 }, ((t) => ({ rageclick: !(t && t >= "2025-11-30") || { content_ignorelist: !0 }, capture_pageview: !(t && t >= "2025-05-24") || "history_change", session_recording: t && t >= "2025-11-30" ? { strictMinimumDuration: !0 } : {} }))(r));
3601
- }, ds = (r) => {
3602
- var e = {};
3603
- v(r.process_person) || (e.person_profiles = r.process_person), v(r.xhr_headers) || (e.request_headers = r.xhr_headers), v(r.cookie_name) || (e.persistence_name = r.cookie_name), v(r.disable_cookie) || (e.disable_persistence = r.disable_cookie), v(r.store_google) || (e.save_campaign_params = r.store_google), v(r.verbose) || (e.debug = r.verbose);
3604
- var t = A({}, e, r);
3605
- return T(r.property_blacklist) && (v(r.property_denylist) ? t.property_denylist = r.property_blacklist : T(r.property_denylist) ? t.property_denylist = [...r.property_blacklist, ...r.property_denylist] : y.error("Invalid value for property_denylist config: " + r.property_denylist)), t;
3606
- };
3607
- class Xo {
3608
- constructor() {
3609
- this.__forceAllowLocalhost = !1;
3610
- }
3611
- get pr() {
3612
- return this.__forceAllowLocalhost;
3613
- }
3614
- set pr(e) {
3615
- y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"), this.__forceAllowLocalhost = e;
3616
- }
3617
- }
3618
- class oi {
3619
- get decideEndpointWasHit() {
3620
- var e, t;
3621
- return (e = (t = this.featureFlags) == null ? void 0 : t.hasLoadedFlags) !== null && e !== void 0 && e;
3622
- }
3623
- get flagsEndpointWasHit() {
3624
- var e, t;
3625
- return (e = (t = this.featureFlags) == null ? void 0 : t.hasLoadedFlags) !== null && e !== void 0 && e;
3626
- }
3627
- constructor() {
3628
- this.webPerformance = new Xo(), this.gr = !1, this.version = me.LIB_VERSION, this._r = new cr(), this._calculate_event_properties = this.calculateEventProperties.bind(this), this.config = hs(), this.SentryIntegration = Wa, this.sentryIntegration = (e) => (function(t, i) {
3629
- var s = Ws(t, i);
3630
- return { name: Gs, processEvent: (n) => s(n) };
3631
- })(this, e), this.__request_queue = [], this.__loaded = !1, this.analyticsDefaultEndpoint = "/e/", this.mr = !1, this.yr = null, this.br = null, this.wr = null, this.featureFlags = new $o(this), this.toolbar = new Ya(this), this.scrollManager = new qo(this), this.pageViewManager = new fo(this), this.surveys = new Do(this), this.experiments = new B(this), this.exceptions = new So(this), this.rateLimiter = new Mo(this), this.requestRouter = new Vo(this), this.consent = new qa(this), this.externalIntegrations = new Yo(this), this.people = { set: (e, t, i) => {
3632
- var s = N(e) ? { [e]: t } : e;
3633
- this.setPersonProperties(s), i == null || i({});
3634
- }, set_once: (e, t, i) => {
3635
- var s = N(e) ? { [e]: t } : e;
3636
- this.setPersonProperties(void 0, s), i == null || i({});
3637
- } }, this.on("eventCaptured", ((e) => y.info('send "' + (e == null ? void 0 : e.event) + '"', e)));
3638
- }
3639
- init(e, t, i) {
3640
- if (i && i !== Xe) {
3641
- var s, n = (s = kt[i]) !== null && s !== void 0 ? s : new oi();
3642
- return n._init(e, t, i), kt[i] = n, kt[Xe][i] = n, n;
3643
- }
3644
- return this._init(e, t, i);
3645
- }
3646
- _init(e, t, i) {
3647
- var s;
3648
- if (t === void 0 && (t = {}), v(e) || Ti(e)) return y.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"), this;
3649
- if (this.__loaded) return console.warn("[PostHog.js]", "You have already initialized PostHog! Re-initializing is a no-op"), this;
3650
- this.__loaded = !0, this.config = {}, t.debug = this.$r(t.debug), this.Sr = t, this.Er = [], t.person_profiles && (this.br = t.person_profiles), this.set_config(A({}, hs(t.defaults), ds(t), { name: i, token: e })), this.config.on_xhr_error && y.error("on_xhr_error is deprecated. Use on_request_error instead"), this.compression = t.disable_compression ? void 0 : we.GZipJS;
3651
- var n = this.kr();
3652
- this.persistence = new xi(this.config, n), this.sessionPersistence = this.config.persistence === "sessionStorage" || this.config.persistence === "memory" ? this.persistence : new xi(w({}, this.config, { persistence: "sessionStorage" }), n);
3653
- var a = w({}, this.persistence.props), o = w({}, this.sessionPersistence.props);
3654
- this.register({ $initialization_time: (/* @__PURE__ */ new Date()).toISOString() }), this.Pr = new Lo(((x) => this.Tr(x)), this.config.request_queue_config), this.Ir = new Uo(this), this.__request_queue = [];
3655
- var l = this.config.cookieless_mode === "always" || this.config.cookieless_mode === "on_reject" && this.consent.isExplicitlyOptedOut();
3656
- if (l || (this.sessionManager = new ls(this), this.sessionPropsManager = new os(this, this.sessionManager, this.persistence)), this.config.__preview_deferred_init_extensions ? (y.info("Deferring extension initialization to improve startup performance"), setTimeout((() => {
3657
- this.Rr(l);
3658
- }), 0)) : (y.info("Initializing extensions synchronously"), this.Rr(l)), me.DEBUG = me.DEBUG || this.config.debug, me.DEBUG && y.info("Starting in debug mode", { this: this, config: t, thisC: w({}, this.config), p: a, s: o }), ((s = t.bootstrap) == null ? void 0 : s.distinctID) !== void 0) {
3659
- var c, u, h = this.config.get_device_id(Fe()), g = (c = t.bootstrap) != null && c.isIdentifiedID ? h : t.bootstrap.distinctID;
3660
- this.persistence.set_property(ye, (u = t.bootstrap) != null && u.isIdentifiedID ? "identified" : "anonymous"), this.register({ distinct_id: t.bootstrap.distinctID, $device_id: g });
3661
- }
3662
- if (this.Cr()) {
3663
- var p, f, _ = Object.keys(((p = t.bootstrap) == null ? void 0 : p.featureFlags) || {}).filter(((x) => {
3664
- var $;
3665
- return !(($ = t.bootstrap) == null || ($ = $.featureFlags) == null || !$[x]);
3666
- })).reduce(((x, $) => {
3667
- var P;
3668
- return x[$] = ((P = t.bootstrap) == null || (P = P.featureFlags) == null ? void 0 : P[$]) || !1, x;
3669
- }), {}), b = Object.keys(((f = t.bootstrap) == null ? void 0 : f.featureFlagPayloads) || {}).filter(((x) => _[x])).reduce(((x, $) => {
3670
- var P, M;
3671
- return (P = t.bootstrap) != null && (P = P.featureFlagPayloads) != null && P[$] && (x[$] = (M = t.bootstrap) == null || (M = M.featureFlagPayloads) == null ? void 0 : M[$]), x;
3672
- }), {});
3673
- this.featureFlags.receivedFeatureFlags({ featureFlags: _, featureFlagPayloads: b });
3674
- }
3675
- if (l) this.register_once({ distinct_id: ot, $device_id: null }, "");
3676
- else if (!this.get_distinct_id()) {
3677
- var E = this.config.get_device_id(Fe());
3678
- this.register_once({ distinct_id: E, $device_id: E }, ""), this.persistence.set_property(ye, "anonymous");
3679
- }
3680
- return L(d, "onpagehide" in self ? "pagehide" : "unload", this._handle_unload.bind(this), { passive: !1 }), this.toolbar.maybeLoadToolbar(), t.segment ? Ga(this, (() => this.Or())) : this.Or(), Te(this.config._onCapture) && this.config._onCapture !== Zi && (y.warn("onCapture is deprecated. Please use `before_send` instead"), this.on("eventCaptured", ((x) => this.config._onCapture(x.event, x)))), this.config.ip && y.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'), this;
3681
- }
3682
- Rr(e) {
3683
- var t = performance.now();
3684
- this.historyAutocapture = new Va(this), this.historyAutocapture.startIfEnabled();
3685
- var i = [];
3686
- i.push((() => {
3687
- new Ka(this).startIfEnabledOrStop();
3688
- })), i.push((() => {
3689
- var s;
3690
- this.siteApps = new Ho(this), (s = this.siteApps) == null || s.init();
3691
- })), e || i.push((() => {
3692
- this.sessionRecording = new us(this), this.sessionRecording.startIfEnabledOrStop();
3693
- })), this.config.disable_scroll_properties || i.push((() => {
3694
- this.scrollManager.startMeasuringScrollPosition();
3695
- })), i.push((() => {
3696
- this.autocapture = new Oa(this), this.autocapture.startIfEnabled();
3697
- })), i.push((() => {
3698
- this.surveys.loadIfEnabled();
3699
- })), i.push((() => {
3700
- this.heatmaps = new go(this), this.heatmaps.startIfEnabled();
3701
- })), i.push((() => {
3702
- this.webVitalsAutocapture = new ho(this);
3703
- })), i.push((() => {
3704
- this.exceptionObserver = new Ha(this), this.exceptionObserver.startIfEnabled();
3705
- })), i.push((() => {
3706
- this.deadClicksAutocapture = new Vs(this, Ba), this.deadClicksAutocapture.startIfEnabled();
3707
- })), i.push((() => {
3708
- if (this.Fr) {
3709
- var s = this.Fr;
3710
- this.Fr = void 0, this.fi(s);
3711
- }
3712
- })), this.Mr(i, t);
3713
- }
3714
- Mr(e, t) {
3715
- for (; e.length > 0; ) {
3716
- if (this.config.__preview_deferred_init_extensions && performance.now() - t >= 30 && e.length > 0) return void setTimeout((() => {
3717
- this.Mr(e, t);
3718
- }), 0);
3719
- var i = e.shift();
3720
- if (i) try {
3721
- i();
3722
- } catch (n) {
3723
- y.error("Error initializing extension:", n);
3724
- }
3725
- }
3726
- var s = Math.round(performance.now() - t);
3727
- this.register_for_session({ $sdk_debug_extensions_init_method: this.config.__preview_deferred_init_extensions ? "deferred" : "synchronous", $sdk_debug_extensions_init_time_ms: s }), this.config.__preview_deferred_init_extensions && y.info("PostHog extensions initialized (" + s + "ms)");
3728
- }
3729
- fi(e) {
3730
- var t, i, s, n, a, o, l, c;
3731
- if (!m || !m.body) return y.info("document not ready yet, trying again in 500 milliseconds..."), void setTimeout((() => {
3732
- this.fi(e);
3733
- }), 500);
3734
- this.config.__preview_deferred_init_extensions && (this.Fr = e), this.compression = void 0, e.supportedCompression && !this.config.disable_compression && (this.compression = S(e.supportedCompression, we.GZipJS) ? we.GZipJS : S(e.supportedCompression, we.Base64) ? we.Base64 : void 0), (t = e.analytics) != null && t.endpoint && (this.analyticsDefaultEndpoint = e.analytics.endpoint), this.set_config({ person_profiles: this.br ? this.br : "identified_only" }), (i = this.siteApps) == null || i.onRemoteConfig(e), (s = this.sessionRecording) == null || s.onRemoteConfig(e), (n = this.autocapture) == null || n.onRemoteConfig(e), (a = this.heatmaps) == null || a.onRemoteConfig(e), this.surveys.onRemoteConfig(e), (o = this.webVitalsAutocapture) == null || o.onRemoteConfig(e), (l = this.exceptionObserver) == null || l.onRemoteConfig(e), this.exceptions.onRemoteConfig(e), (c = this.deadClicksAutocapture) == null || c.onRemoteConfig(e);
3735
- }
3736
- Or() {
3737
- try {
3738
- this.config.loaded(this);
3739
- } catch (e) {
3740
- y.critical("`loaded` function failed", e);
3741
- }
3742
- this.Ar(), this.config.capture_pageview && setTimeout((() => {
3743
- (this.consent.isOptedIn() || this.config.cookieless_mode === "always") && this.Dr();
3744
- }), 1), new Ao(this).load(), this.featureFlags.flags();
3745
- }
3746
- Ar() {
3747
- var e;
3748
- this.is_capturing() && this.config.request_batching && ((e = this.Pr) == null || e.enable());
3749
- }
3750
- _dom_loaded() {
3751
- this.is_capturing() && Re(this.__request_queue, ((e) => this.Tr(e))), this.__request_queue = [], this.Ar();
3752
- }
3753
- _handle_unload() {
3754
- var e, t;
3755
- this.config.request_batching ? (this.jr() && this.capture("$pageleave"), (e = this.Pr) == null || e.unload(), (t = this.Ir) == null || t.unload()) : this.jr() && this.capture("$pageleave", null, { transport: "sendBeacon" });
3756
- }
3757
- ci(e) {
3758
- this.__loaded && (Sn ? this.__request_queue.push(e) : this.rateLimiter.isServerRateLimited(e.batchKey) || (e.transport = e.transport || this.config.api_transport, e.url = ri(e.url, { ip: this.config.ip ? 1 : 0 }), e.headers = w({}, this.config.request_headers), e.compression = e.compression === "best-available" ? this.compression : e.compression, e.disableXHRCredentials = this.config.__preview_disable_xhr_credentials, this.config.__preview_disable_beacon && (e.disableTransport = ["sendBeacon"]), e.fetchOptions = e.fetchOptions || this.config.fetch_options, ((t) => {
3759
- var i, s, n, a = w({}, t);
3760
- a.timeout = a.timeout || 6e4, a.url = ri(a.url, { _: (/* @__PURE__ */ new Date()).getTime().toString(), ver: me.LIB_VERSION, compression: a.compression });
3761
- var o = (i = a.transport) !== null && i !== void 0 ? i : "fetch", l = qt.filter(((u) => !a.disableTransport || !u.transport || !a.disableTransport.includes(u.transport))), c = (s = (n = Ss(l, ((u) => u.transport === o))) == null ? void 0 : n.method) !== null && s !== void 0 ? s : l[0].method;
3762
- if (!c) throw new Error("No available transport method");
3763
- c(a);
3764
- })(w({}, e, { callback: (t) => {
3765
- var i, s;
3766
- this.rateLimiter.checkForLimiting(t), t.statusCode >= 400 && ((i = (s = this.config).on_request_error) == null || i.call(s, t)), e.callback == null || e.callback(t);
3767
- } }))));
3768
- }
3769
- Tr(e) {
3770
- this.Ir ? this.Ir.retriableRequest(e) : this.ci(e);
3771
- }
3772
- _execute_array(e) {
3773
- var t, i = [], s = [], n = [];
3774
- Re(e, ((o) => {
3775
- o && (t = o[0], T(t) ? n.push(o) : Te(o) ? o.call(this) : T(o) && t === "alias" ? i.push(o) : T(o) && t.indexOf("capture") !== -1 && Te(this[t]) ? n.push(o) : s.push(o));
3776
- }));
3777
- var a = function(o, l) {
3778
- Re(o, (function(c) {
3779
- if (T(c[0])) {
3780
- var u = l;
3781
- F(c, (function(h) {
3782
- u = u[h[0]].apply(u, h.slice(1));
3783
- }));
3784
- } else this[c[0]].apply(this, c.slice(1));
3785
- }), l);
3786
- };
3787
- a(i, this), a(s, this), a(n, this);
3788
- }
3789
- Cr() {
3790
- var e, t;
3791
- return ((e = this.config.bootstrap) == null ? void 0 : e.featureFlags) && Object.keys((t = this.config.bootstrap) == null ? void 0 : t.featureFlags).length > 0 || !1;
3792
- }
3793
- push(e) {
3794
- this._execute_array([e]);
3795
- }
3796
- capture(e, t, i) {
3797
- var s;
3798
- if (this.__loaded && this.persistence && this.sessionPersistence && this.Pr) {
3799
- if (this.is_capturing()) if (!v(e) && N(e)) {
3800
- var n = !this.config.opt_out_useragent_filter && this._is_bot();
3801
- if (!(n && !this.config.__preview_capture_bot_pageviews)) {
3802
- var a = i != null && i.skip_client_rate_limiting ? void 0 : this.rateLimiter.clientRateLimitContext();
3803
- if (a == null || !a.isRateLimited) {
3804
- t != null && t.$current_url && !N(t == null ? void 0 : t.$current_url) && (y.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."), t == null || delete t.$current_url), this.sessionPersistence.update_search_keyword(), this.config.save_campaign_params && this.sessionPersistence.update_campaign_params(), this.config.save_referrer && this.sessionPersistence.update_referrer_info(), (this.config.save_campaign_params || this.config.save_referrer) && this.persistence.set_initial_person_info();
3805
- var o = /* @__PURE__ */ new Date(), l = (i == null ? void 0 : i.timestamp) || o, c = Fe(), u = { uuid: c, event: e, properties: this.calculateEventProperties(e, t || {}, l, c) };
3806
- e === "$pageview" && this.config.__preview_capture_bot_pageviews && n && (u.event = "$bot_pageview", u.properties.$browser_type = "bot"), a && (u.properties.$lib_rate_limit_remaining_tokens = a.remainingTokens), i != null && i.$set && (u.$set = i == null ? void 0 : i.$set);
3807
- var h, g = this.Lr(i == null ? void 0 : i.$set_once);
3808
- if (g && (u.$set_once = g), (u = fa(u, i != null && i._noTruncate ? null : this.config.properties_string_max_length)).timestamp = l, v(i == null ? void 0 : i.timestamp) || (u.properties.$event_time_override_provided = !0, u.properties.$event_time_override_system_time = o), e === jt.DISMISSED || e === jt.SENT) {
3809
- var p = t == null ? void 0 : t[ss.SURVEY_ID], f = t == null ? void 0 : t[ss.SURVEY_ITERATION];
3810
- h = { id: p, current_iteration: f }, localStorage.getItem(ns(h)) || localStorage.setItem(ns(h), "true"), u.$set = w({}, u.$set, { [Fo({ id: p, current_iteration: f }, e === jt.SENT ? "responded" : "dismissed")]: !0 });
3811
- }
3812
- var _ = w({}, u.properties.$set, u.$set);
3813
- if (Ke(_) || this.setPersonPropertiesForFlags(_), !O(this.config.before_send)) {
3814
- var b = this.Nr(u);
3815
- if (!b) return;
3816
- u = b;
3817
- }
3818
- this._r.emit("eventCaptured", u);
3819
- var E = { method: "POST", url: (s = i == null ? void 0 : i._url) !== null && s !== void 0 ? s : this.requestRouter.endpointFor("api", this.analyticsDefaultEndpoint), data: u, compression: "best-available", batchKey: i == null ? void 0 : i._batchKey };
3820
- return !this.config.request_batching || i && (i == null || !i._batchKey) || i != null && i.send_instantly ? this.Tr(E) : this.Pr.enqueue(E), u;
3821
- }
3822
- y.critical("This capture call is ignored due to client rate limiting.");
3823
- }
3824
- } else y.error("No event name provided to posthog.capture");
3825
- } else y.uninitializedWarning("posthog.capture");
3826
- }
3827
- Mi(e) {
3828
- return this.on("eventCaptured", ((t) => e(t.event, t)));
3829
- }
3830
- calculateEventProperties(e, t, i, s, n) {
3831
- if (i = i || /* @__PURE__ */ new Date(), !this.persistence || !this.sessionPersistence) return t;
3832
- var a = n ? void 0 : this.persistence.remove_event_timer(e), o = w({}, t);
3833
- if (o.token = this.config.token, o.$config_defaults = this.config.defaults, (this.config.cookieless_mode == "always" || this.config.cookieless_mode == "on_reject" && this.consent.isExplicitlyOptedOut()) && (o.$cookieless_mode = !0), e === "$snapshot") {
3834
- var l = w({}, this.persistence.properties(), this.sessionPersistence.properties());
3835
- return o.distinct_id = l.distinct_id, (!N(o.distinct_id) && !fe(o.distinct_id) || Ti(o.distinct_id)) && y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"), o;
3836
- }
3837
- var c, u = uo(this.config.mask_personal_data_properties, this.config.custom_personal_data_properties);
3838
- if (this.sessionManager) {
3839
- var { sessionId: h, windowId: g } = this.sessionManager.checkAndGetSessionAndWindowId(n, i.getTime());
3840
- o.$session_id = h, o.$window_id = g;
3841
- }
3842
- this.sessionPropsManager && A(o, this.sessionPropsManager.getSessionProps());
3843
- try {
3844
- var p;
3845
- this.sessionRecording && A(o, this.sessionRecording.sdkDebugProperties), o.$sdk_debug_retry_queue_size = (p = this.Ir) == null ? void 0 : p.length;
3846
- } catch (E) {
3847
- o.$sdk_debug_error_capturing_properties = String(E);
3848
- }
3849
- if (this.requestRouter.region === bt.CUSTOM && (o.$lib_custom_api_host = this.config.api_host), c = e !== "$pageview" || n ? e !== "$pageleave" || n ? this.pageViewManager.doEvent() : this.pageViewManager.doPageLeave(i) : this.pageViewManager.doPageView(i, s), o = A(o, c), e === "$pageview" && m && (o.title = m.title), !v(a)) {
3850
- var f = i.getTime() - a;
3851
- o.$duration = parseFloat((f / 1e3).toFixed(3));
3852
- }
3853
- W && this.config.opt_out_useragent_filter && (o.$browser_type = this._is_bot() ? "bot" : "browser"), (o = A({}, u, this.persistence.properties(), this.sessionPersistence.properties(), o)).$is_identified = this._isIdentified(), T(this.config.property_denylist) ? F(this.config.property_denylist, (function(E) {
3854
- delete o[E];
3855
- })) : y.error("Invalid value for property_denylist config: " + this.config.property_denylist + " or property_blacklist config: " + this.config.property_blacklist);
3856
- var _ = this.config.sanitize_properties;
3857
- _ && (y.error("sanitize_properties is deprecated. Use before_send instead"), o = _(o, e));
3858
- var b = this.Ur();
3859
- return o.$process_person_profile = b, b && !n && this.zr("_calculate_event_properties"), o;
3860
- }
3861
- Lr(e) {
3862
- var t;
3863
- if (!this.persistence || !this.Ur() || this.gr) return e;
3864
- var i = this.persistence.get_initial_props(), s = (t = this.sessionPropsManager) == null ? void 0 : t.getSetOnceProps(), n = A({}, i, s || {}, e || {}), a = this.config.sanitize_properties;
3865
- return a && (y.error("sanitize_properties is deprecated. Use before_send instead"), n = a(n, "$set_once")), this.gr = !0, Ke(n) ? void 0 : n;
3866
- }
3867
- register(e, t) {
3868
- var i;
3869
- (i = this.persistence) == null || i.register(e, t);
3870
- }
3871
- register_once(e, t, i) {
3872
- var s;
3873
- (s = this.persistence) == null || s.register_once(e, t, i);
3874
- }
3875
- register_for_session(e) {
3876
- var t;
3877
- (t = this.sessionPersistence) == null || t.register(e);
3878
- }
3879
- unregister(e) {
3880
- var t;
3881
- (t = this.persistence) == null || t.unregister(e);
3882
- }
3883
- unregister_for_session(e) {
3884
- var t;
3885
- (t = this.sessionPersistence) == null || t.unregister(e);
3886
- }
3887
- Hr(e, t) {
3888
- this.register({ [e]: t });
3889
- }
3890
- getFeatureFlag(e, t) {
3891
- return this.featureFlags.getFeatureFlag(e, t);
3892
- }
3893
- getFeatureFlagPayload(e) {
3894
- var t = this.featureFlags.getFeatureFlagPayload(e);
3895
- try {
3896
- return JSON.parse(t);
3897
- } catch {
3898
- return t;
3899
- }
3900
- }
3901
- isFeatureEnabled(e, t) {
3902
- return this.featureFlags.isFeatureEnabled(e, t);
3903
- }
3904
- reloadFeatureFlags() {
3905
- this.featureFlags.reloadFeatureFlags();
3906
- }
3907
- updateEarlyAccessFeatureEnrollment(e, t, i) {
3908
- this.featureFlags.updateEarlyAccessFeatureEnrollment(e, t, i);
3909
- }
3910
- getEarlyAccessFeatures(e, t, i) {
3911
- return t === void 0 && (t = !1), this.featureFlags.getEarlyAccessFeatures(e, t, i);
3912
- }
3913
- on(e, t) {
3914
- return this._r.on(e, t);
3915
- }
3916
- onFeatureFlags(e) {
3917
- return this.featureFlags.onFeatureFlags(e);
3918
- }
3919
- onSurveysLoaded(e) {
3920
- return this.surveys.onSurveysLoaded(e);
3921
- }
3922
- onSessionId(e) {
3923
- var t, i;
3924
- return (t = (i = this.sessionManager) == null ? void 0 : i.onSessionId(e)) !== null && t !== void 0 ? t : () => {
3925
- };
3926
- }
3927
- getSurveys(e, t) {
3928
- t === void 0 && (t = !1), this.surveys.getSurveys(e, t);
3929
- }
3930
- getActiveMatchingSurveys(e, t) {
3931
- t === void 0 && (t = !1), this.surveys.getActiveMatchingSurveys(e, t);
3932
- }
3933
- renderSurvey(e, t) {
3934
- this.surveys.renderSurvey(e, t);
3935
- }
3936
- displaySurvey(e, t) {
3937
- t === void 0 && (t = Oo), this.surveys.displaySurvey(e, t);
3938
- }
3939
- canRenderSurvey(e) {
3940
- return this.surveys.canRenderSurvey(e);
3941
- }
3942
- canRenderSurveyAsync(e, t) {
3943
- return t === void 0 && (t = !1), this.surveys.canRenderSurveyAsync(e, t);
3944
- }
3945
- identify(e, t, i) {
3946
- if (!this.__loaded || !this.persistence) return y.uninitializedWarning("posthog.identify");
3947
- if (fe(e) && (e = e.toString(), y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")), e) if (["distinct_id", "distinctid"].includes(e.toLowerCase())) y.critical('The string "' + e + '" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');
3948
- else if (e !== ot) {
3949
- if (this.zr("posthog.identify")) {
3950
- var s = this.get_distinct_id();
3951
- if (this.register({ $user_id: e }), !this.get_property("$device_id")) {
3952
- var n = s;
3953
- this.register_once({ $had_persisted_distinct_id: !0, $device_id: n }, "");
3954
- }
3955
- e !== s && e !== this.get_property(gt) && (this.unregister(gt), this.register({ distinct_id: e }));
3956
- var a = (this.persistence.get_property(ye) || "anonymous") === "anonymous";
3957
- e !== s && a ? (this.persistence.set_property(ye, "identified"), this.setPersonPropertiesForFlags(w({}, i || {}, t || {}), !1), this.capture("$identify", { distinct_id: e, $anon_distinct_id: s }, { $set: t || {}, $set_once: i || {} }), this.wr = es(e, t, i), this.featureFlags.setAnonymousDistinctId(s)) : (t || i) && this.setPersonProperties(t, i), e !== s && (this.reloadFeatureFlags(), this.unregister(zt));
3958
- }
3959
- } else y.critical('The string "' + ot + '" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');
3960
- else y.error("Unique user id has not been set in posthog.identify");
3961
- }
3962
- setPersonProperties(e, t) {
3963
- if ((e || t) && this.zr("posthog.setPersonProperties")) {
3964
- var i = es(this.get_distinct_id(), e, t);
3965
- this.wr !== i ? (this.setPersonPropertiesForFlags(w({}, t || {}, e || {})), this.capture("$set", { $set: e || {}, $set_once: t || {} }), this.wr = i) : y.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.");
3966
- }
3967
- }
3968
- group(e, t, i) {
3969
- if (e && t) {
3970
- if (this.zr("posthog.group")) {
3971
- var s = this.getGroups();
3972
- s[e] !== t && this.resetGroupPropertiesForFlags(e), this.register({ $groups: w({}, s, { [e]: t }) }), i && (this.capture("$groupidentify", { $group_type: e, $group_key: t, $group_set: i }), this.setGroupPropertiesForFlags({ [e]: i })), s[e] === t || i || this.reloadFeatureFlags();
3973
- }
3974
- } else y.error("posthog.group requires a group type and group key");
3975
- }
3976
- resetGroups() {
3977
- this.register({ $groups: {} }), this.resetGroupPropertiesForFlags(), this.reloadFeatureFlags();
3978
- }
3979
- setPersonPropertiesForFlags(e, t) {
3980
- t === void 0 && (t = !0), this.featureFlags.setPersonPropertiesForFlags(e, t);
3981
- }
3982
- resetPersonPropertiesForFlags() {
3983
- this.featureFlags.resetPersonPropertiesForFlags();
3984
- }
3985
- setGroupPropertiesForFlags(e, t) {
3986
- t === void 0 && (t = !0), this.zr("posthog.setGroupPropertiesForFlags") && this.featureFlags.setGroupPropertiesForFlags(e, t);
3987
- }
3988
- resetGroupPropertiesForFlags(e) {
3989
- this.featureFlags.resetGroupPropertiesForFlags(e);
3990
- }
3991
- reset(e) {
3992
- var t, i, s, n;
3993
- if (y.info("reset"), !this.__loaded) return y.uninitializedWarning("posthog.reset");
3994
- var a = this.get_property("$device_id");
3995
- if (this.consent.reset(), (t = this.persistence) == null || t.clear(), (i = this.sessionPersistence) == null || i.clear(), this.surveys.reset(), this.featureFlags.reset(), (s = this.persistence) == null || s.set_property(ye, "anonymous"), (n = this.sessionManager) == null || n.resetSessionId(), this.wr = null, this.config.cookieless_mode === "always") this.register_once({ distinct_id: ot, $device_id: null }, "");
3996
- else {
3997
- var o = this.config.get_device_id(Fe());
3998
- this.register_once({ distinct_id: o, $device_id: e ? o : a }, "");
3999
- }
4000
- this.register({ $last_posthog_reset: (/* @__PURE__ */ new Date()).toISOString() }, 1);
4001
- }
4002
- get_distinct_id() {
4003
- return this.get_property("distinct_id");
4004
- }
4005
- getGroups() {
4006
- return this.get_property("$groups") || {};
4007
- }
4008
- get_session_id() {
4009
- var e, t;
4010
- return (e = (t = this.sessionManager) == null ? void 0 : t.checkAndGetSessionAndWindowId(!0).sessionId) !== null && e !== void 0 ? e : "";
4011
- }
4012
- get_session_replay_url(e) {
4013
- if (!this.sessionManager) return "";
4014
- var { sessionId: t, sessionStartTimestamp: i } = this.sessionManager.checkAndGetSessionAndWindowId(!0), s = this.requestRouter.endpointFor("ui", "/project/" + this.config.token + "/replay/" + t);
4015
- if (e != null && e.withTimestamp && i) {
4016
- var n, a = (n = e.timestampLookBack) !== null && n !== void 0 ? n : 10;
4017
- if (!i) return s;
4018
- s += "?t=" + Math.max(Math.floor(((/* @__PURE__ */ new Date()).getTime() - i) / 1e3) - a, 0);
4019
- }
4020
- return s;
4021
- }
4022
- alias(e, t) {
4023
- return e === this.get_property(Ps) ? (y.critical("Attempting to create alias for existing People user - aborting."), -2) : this.zr("posthog.alias") ? (v(t) && (t = this.get_distinct_id()), e !== t ? (this.Hr(gt, e), this.capture("$create_alias", { alias: e, distinct_id: t })) : (y.warn("alias matches current distinct_id - skipping api call."), this.identify(e), -1)) : void 0;
4024
- }
4025
- set_config(e) {
4026
- var t = w({}, this.config);
4027
- if (j(e)) {
4028
- var i, s, n, a, o;
4029
- A(this.config, ds(e));
4030
- var l = this.kr();
4031
- (i = this.persistence) == null || i.update_config(this.config, t, l), this.sessionPersistence = this.config.persistence === "sessionStorage" || this.config.persistence === "memory" ? this.persistence : new xi(w({}, this.config, { persistence: "sessionStorage" }), l);
4032
- var c = this.$r(this.config.debug);
4033
- Oe(c) && (this.config.debug = c), Oe(this.config.debug) && (this.config.debug ? (me.DEBUG = !0, D.H() && D.G("ph_debug", "true"), y.info("set_config", { config: e, oldConfig: t, newConfig: w({}, this.config) })) : (me.DEBUG = !1, D.H() && D.V("ph_debug"))), (s = this.sessionRecording) == null || s.startIfEnabledOrStop(), (n = this.autocapture) == null || n.startIfEnabled(), (a = this.heatmaps) == null || a.startIfEnabled(), this.surveys.loadIfEnabled(), this.Br(), (o = this.externalIntegrations) == null || o.startIfEnabledOrStop();
4034
- }
4035
- }
4036
- startSessionRecording(e) {
4037
- var t = e === !0, i = { sampling: t || !(e == null || !e.sampling), linked_flag: t || !(e == null || !e.linked_flag), url_trigger: t || !(e == null || !e.url_trigger), event_trigger: t || !(e == null || !e.event_trigger) };
4038
- if (Object.values(i).some(Boolean)) {
4039
- var s, n, a, o, l;
4040
- (s = this.sessionManager) == null || s.checkAndGetSessionAndWindowId(), i.sampling && ((n = this.sessionRecording) == null || n.overrideSampling()), i.linked_flag && ((a = this.sessionRecording) == null || a.overrideLinkedFlag()), i.url_trigger && ((o = this.sessionRecording) == null || o.overrideTrigger("url")), i.event_trigger && ((l = this.sessionRecording) == null || l.overrideTrigger("event"));
4041
- }
4042
- this.set_config({ disable_session_recording: !1 });
4043
- }
4044
- stopSessionRecording() {
4045
- this.set_config({ disable_session_recording: !0 });
4046
- }
4047
- sessionRecordingStarted() {
4048
- var e;
4049
- return !((e = this.sessionRecording) == null || !e.started);
4050
- }
4051
- captureException(e, t) {
4052
- var i = new Error("PostHog syntheticException"), s = this.exceptions.buildProperties(e, { handled: !0, syntheticException: i });
4053
- return this.exceptions.sendExceptionEvent(w({}, s, t));
4054
- }
4055
- loadToolbar(e) {
4056
- return this.toolbar.loadToolbar(e);
4057
- }
4058
- get_property(e) {
4059
- var t;
4060
- return (t = this.persistence) == null ? void 0 : t.props[e];
4061
- }
4062
- getSessionProperty(e) {
4063
- var t;
4064
- return (t = this.sessionPersistence) == null ? void 0 : t.props[e];
4065
- }
4066
- toString() {
4067
- var e, t = (e = this.config.name) !== null && e !== void 0 ? e : Xe;
4068
- return t !== Xe && (t = Xe + "." + t), t;
4069
- }
4070
- _isIdentified() {
4071
- var e, t;
4072
- return ((e = this.persistence) == null ? void 0 : e.get_property(ye)) === "identified" || ((t = this.sessionPersistence) == null ? void 0 : t.get_property(ye)) === "identified";
4073
- }
4074
- Ur() {
4075
- var e, t;
4076
- return !(this.config.person_profiles === "never" || this.config.person_profiles === "identified_only" && !this._isIdentified() && Ke(this.getGroups()) && ((e = this.persistence) == null || (e = e.props) == null || !e[gt]) && ((t = this.persistence) == null || (t = t.props) == null || !t[Xt]));
4077
- }
4078
- jr() {
4079
- return this.config.capture_pageleave === !0 || this.config.capture_pageleave === "if_capture_pageview" && (this.config.capture_pageview === !0 || this.config.capture_pageview === "history_change");
4080
- }
4081
- createPersonProfile() {
4082
- this.Ur() || this.zr("posthog.createPersonProfile") && this.setPersonProperties({}, {});
4083
- }
4084
- zr(e) {
4085
- return this.config.person_profiles === "never" ? (y.error(e + ' was called, but process_person is set to "never". This call will be ignored.'), !1) : (this.Hr(Xt, !0), !0);
4086
- }
4087
- kr() {
4088
- if (this.config.cookieless_mode === "always") return !0;
4089
- var e = this.consent.isOptedOut(), t = this.config.opt_out_persistence_by_default || this.config.cookieless_mode === "on_reject";
4090
- return this.config.disable_persistence || e && !!t;
4091
- }
4092
- Br() {
4093
- var e, t, i, s, n = this.kr();
4094
- return ((e = this.persistence) == null ? void 0 : e.wi) !== n && ((i = this.persistence) == null || i.set_disabled(n)), ((t = this.sessionPersistence) == null ? void 0 : t.wi) !== n && ((s = this.sessionPersistence) == null || s.set_disabled(n)), n;
4095
- }
4096
- opt_in_capturing(e) {
4097
- if (this.config.cookieless_mode !== "always") {
4098
- var t, i;
4099
- this.config.cookieless_mode === "on_reject" && this.consent.isExplicitlyOptedOut() && (this.reset(!0), (t = this.sessionManager) == null || t.destroy(), this.sessionManager = new ls(this), this.persistence && (this.sessionPropsManager = new os(this, this.sessionManager, this.persistence)), this.sessionRecording = new us(this), this.sessionRecording.startIfEnabledOrStop()), this.consent.optInOut(!0), this.Br(), this.Ar(), this.config.cookieless_mode == "on_reject" && this.surveys.loadIfEnabled(), (v(e == null ? void 0 : e.captureEventName) || e != null && e.captureEventName) && this.capture((i = e == null ? void 0 : e.captureEventName) !== null && i !== void 0 ? i : "$opt_in", e == null ? void 0 : e.captureProperties, { send_instantly: !0 }), this.config.capture_pageview && this.Dr();
4100
- } else y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored');
4101
- }
4102
- opt_out_capturing() {
4103
- var e, t;
4104
- this.config.cookieless_mode !== "always" ? (this.config.cookieless_mode === "on_reject" && this.consent.isOptedIn() && this.reset(!0), this.consent.optInOut(!1), this.Br(), this.config.cookieless_mode === "on_reject" && (this.register({ distinct_id: ot, $device_id: null }), (e = this.sessionManager) == null || e.destroy(), this.sessionManager = void 0, this.sessionPropsManager = void 0, (t = this.sessionRecording) == null || t.stopRecording(), this.sessionRecording = void 0, this.Dr())) : y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored');
4105
- }
4106
- has_opted_in_capturing() {
4107
- return this.consent.isOptedIn();
4108
- }
4109
- has_opted_out_capturing() {
4110
- return this.consent.isOptedOut();
4111
- }
4112
- get_explicit_consent_status() {
4113
- var e = this.consent.consent;
4114
- return e === be.GRANTED ? "granted" : e === be.DENIED ? "denied" : "pending";
4115
- }
4116
- is_capturing() {
4117
- return this.config.cookieless_mode === "always" || (this.config.cookieless_mode === "on_reject" ? this.consent.isExplicitlyOptedOut() || this.consent.isOptedIn() : !this.has_opted_out_capturing());
4118
- }
4119
- clear_opt_in_out_capturing() {
4120
- this.consent.reset(), this.Br();
4121
- }
4122
- _is_bot() {
4123
- return Q ? xn(Q, this.config.custom_blocked_useragents) : void 0;
4124
- }
4125
- Dr() {
4126
- m && (m.visibilityState === "visible" ? this.mr || (this.mr = !0, this.capture("$pageview", { title: m.title }, { send_instantly: !0 }), this.yr && (m.removeEventListener("visibilitychange", this.yr), this.yr = null)) : this.yr || (this.yr = this.Dr.bind(this), L(m, "visibilitychange", this.yr)));
4127
- }
4128
- debug(e) {
4129
- e === !1 ? (d == null || d.console.log("You've disabled debug mode."), this.set_config({ debug: !1 })) : (d == null || 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)`."), this.set_config({ debug: !0 }));
4130
- }
4131
- M() {
4132
- var e, t, i, s, n, a, o, l = this.Sr || {};
4133
- return "advanced_disable_flags" in l ? !!l.advanced_disable_flags : this.config.advanced_disable_flags !== !1 ? !!this.config.advanced_disable_flags : this.config.advanced_disable_decide === !0 ? (y.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."), !0) : (i = "advanced_disable_decide", s = !1, n = y, a = (t = "advanced_disable_flags") in (e = l) && !v(e[t]), o = i in e && !v(e[i]), a ? e[t] : o ? (n && n.warn("Config field '" + i + "' is deprecated. Please use '" + t + "' instead. The old field will be removed in a future major version."), e[i]) : s);
4134
- }
4135
- Nr(e) {
4136
- if (O(this.config.before_send)) return e;
4137
- var t = T(this.config.before_send) ? this.config.before_send : [this.config.before_send], i = e;
4138
- for (var s of t) {
4139
- if (i = s(i), O(i)) {
4140
- var n = "Event '" + e.event + "' was rejected in beforeSend function";
4141
- return Bn(e.event) ? y.warn(n + ". This can cause unexpected behavior.") : y.info(n), null;
4142
- }
4143
- i.properties && !Ke(i.properties) || y.warn("Event '" + e.event + "' has no properties after beforeSend function, this is likely an error.");
4144
- }
4145
- return i;
4146
- }
4147
- getPageViewId() {
4148
- var e;
4149
- return (e = this.pageViewManager.Vt) == null ? void 0 : e.pageViewId;
4150
- }
4151
- captureTraceFeedback(e, t) {
4152
- this.capture("$ai_feedback", { $ai_trace_id: String(e), $ai_feedback_text: t });
4153
- }
4154
- captureTraceMetric(e, t, i) {
4155
- this.capture("$ai_metric", { $ai_trace_id: String(e), $ai_metric_name: t, $ai_metric_value: String(i) });
4156
- }
4157
- $r(e) {
4158
- var t = Oe(e) && !e, i = D.H() && D.q("ph_debug") === "true";
4159
- return !t && (!!i || e);
4160
- }
4161
- }
4162
- (function(r, e) {
4163
- for (var t = 0; t < e.length; t++) r.prototype[e[t]] = ga(r.prototype[e[t]]);
4164
- })(oi, ["identify"]);
4165
- var ps;
4166
- ps = kt[Xe] = new oi(), (function() {
4167
- function r() {
4168
- r.done || (r.done = !0, Sn = !1, F(kt, (function(e) {
4169
- e._dom_loaded();
4170
- })));
4171
- }
4172
- m != null && m.addEventListener ? m.readyState === "complete" ? r() : L(m, "DOMContentLoaded", r, { capture: !1 }) : d && y.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized");
4173
- })();
4174
- var gs;
4175
- (function(r) {
4176
- r.USER_ADDED_TO_CART = "user_added_to_cart", r.USER_SUBMITTED_CHECKOUT = "user_submitted_checkout";
4177
- })(gs || (gs = {}));
4178
- const Ko = { class: "dialog-block-header-container" }, Jo = { class: "dialog-block-title" }, Zo = { class: "dialog-block-description" }, Qo = /* @__PURE__ */ Ae({
1
+ import { defineComponent as p, createElementBlock as u, openBlock as d, createElementVNode as c, toDisplayString as I, Fragment as b, renderList as A, createVNode as m, createBlock as S, ref as k, withDirectives as R, withKeys as N, vModelText as O, onMounted as w, watch as E, renderSlot as $, computed as v, withCtx as L, createCommentVNode as B } from "vue";
2
+ var f;
3
+ (function(t) {
4
+ t.OPEN_ASSISTANT = "open_assistant", t.CLOSE_ASSISTANT = "close_assistant", t.SEND_MESSAGE = "PRODUCT_QUESTION", t.SEND_GENERIC_QUESTION = "GENERIC_QUESTION", t.TRACK_ADD_TO_CART = "TRACK_ADD_TO_CART", t.TRACK_SUBMIT_CHECKOUT = "TRACK_SUBMIT_CHECKOUT";
5
+ })(f || (f = {}));
6
+ var T;
7
+ (function(t) {
8
+ t.USER_OPENED_ASSISTANT = "userOpenedAssistant", t.USER_CLOSED_ASSISTANT = "userClosedAssistant", t.USER_SENT_MESSAGE = "userSentMessage", t.USER_CLICKED_ON_PRODUCT_CARD = "userClickedOnProductCard", t.USER_OPENED_RECOMMENDATION = "userOpenedRecommendation", t.USER_ADDED_TO_CART = "userAddedToCart", t.USER_SEND_POSITIVE_FEEDBACK = "userSendPositiveFeedback", t.USER_SEND_NEGATIVE_FEEDBACK = "userSendNegativeFeedback";
9
+ })(T || (T = {}));
10
+ f.TRACK_ADD_TO_CART, f.TRACK_SUBMIT_CHECKOUT;
11
+ const U = { class: "dialog-block-header-container" }, V = { class: "dialog-block-title" }, x = { class: "dialog-block-description" }, P = /* @__PURE__ */ p({
4179
12
  __name: "DialogBlockHeader",
4180
13
  props: {
4181
14
  title: {},
4182
15
  description: {}
4183
16
  },
4184
- setup(r) {
4185
- const e = r;
4186
- return (t, i) => (ie(), Me("div", Ko, [
4187
- H("div", Jo, Ci(e.title ?? "Your expert"), 1),
4188
- H("div", Zo, Ci(e.description ?? "A question about this product?"), 1)
17
+ setup(t) {
18
+ const e = t;
19
+ return (s, o) => (d(), u("div", U, [
20
+ c("div", V, I(e.title ?? "Your expert"), 1),
21
+ c("div", x, I(e.description ?? "A question about this product?"), 1)
4189
22
  ]));
4190
23
  }
4191
- }), at = (r, e) => {
4192
- const t = r.__vccOpts || r;
4193
- for (const [i, s] of e)
4194
- t[i] = s;
4195
- return t;
4196
- }, el = /* @__PURE__ */ at(Qo, [["__scopeId", "data-v-28e6dda7"]]), tl = {
24
+ }), C = (t, e) => {
25
+ const s = t.__vccOpts || t;
26
+ for (const [o, a] of e)
27
+ s[o] = a;
28
+ return s;
29
+ }, K = /* @__PURE__ */ C(P, [["__scopeId", "data-v-28e6dda7"]]), M = {
4197
30
  width: "20",
4198
31
  height: "20",
4199
32
  viewBox: "0 0 20 20",
4200
33
  fill: "none",
4201
34
  xmlns: "http://www.w3.org/2000/svg"
4202
- }, il = { "clip-path": "url(#clip0_466_934)" }, rl = ["stroke"], sl = ["stroke"], nl = /* @__PURE__ */ Ae({
35
+ }, q = { "clip-path": "url(#clip0_466_934)" }, F = ["stroke"], j = ["stroke"], Q = /* @__PURE__ */ p({
4203
36
  __name: "AiStarsIcon",
4204
37
  props: {
4205
38
  color: {}
4206
39
  },
4207
- setup(r) {
4208
- const e = r;
4209
- return (t, i) => (ie(), Me("svg", tl, [
4210
- H("g", il, [
4211
- H("path", {
40
+ setup(t) {
41
+ const e = t;
42
+ return (s, o) => (d(), u("svg", M, [
43
+ c("g", q, [
44
+ c("path", {
4212
45
  d: `M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
4213
46
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
4214
47
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
@@ -4223,8 +56,8 @@ const Ko = { class: "dialog-block-header-container" }, Jo = { class: "dialog-blo
4223
56
  "stroke-width": "1.5",
4224
57
  "stroke-linecap": "round",
4225
58
  "stroke-linejoin": "round"
4226
- }, null, 8, rl),
4227
- H("path", {
59
+ }, null, 8, F),
60
+ c("path", {
4228
61
  d: `M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
4229
62
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
4230
63
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
@@ -4239,11 +72,11 @@ const Ko = { class: "dialog-block-header-container" }, Jo = { class: "dialog-blo
4239
72
  "stroke-width": "1.5",
4240
73
  "stroke-linecap": "round",
4241
74
  "stroke-linejoin": "round"
4242
- }, null, 8, sl)
75
+ }, null, 8, j)
4243
76
  ]),
4244
- i[0] || (i[0] = H("defs", null, [
4245
- H("clipPath", { id: "clip0_466_934" }, [
4246
- H("rect", {
77
+ o[0] || (o[0] = c("defs", null, [
78
+ c("clipPath", { id: "clip0_466_934" }, [
79
+ c("rect", {
4247
80
  width: "20",
4248
81
  height: "20",
4249
82
  fill: "white"
@@ -4252,7 +85,7 @@ const Ko = { class: "dialog-block-header-container" }, Jo = { class: "dialog-blo
4252
85
  ], -1))
4253
86
  ]));
4254
87
  }
4255
- }), al = ["onClick"], ol = { class: "dialog-block-suggestions-item-label" }, ll = /* @__PURE__ */ Ae({
88
+ }), G = ["onClick"], H = { class: "dialog-block-suggestions-item-label" }, Z = /* @__PURE__ */ p({
4256
89
  __name: "DialogBlockSuggestions",
4257
90
  props: {
4258
91
  client: {},
@@ -4261,37 +94,37 @@ const Ko = { class: "dialog-block-header-container" }, Jo = { class: "dialog-blo
4261
94
  productTitle: {},
4262
95
  selectedVariantId: {}
4263
96
  },
4264
- setup(r) {
4265
- const e = r, t = (i) => {
97
+ setup(t) {
98
+ const e = t, s = (o) => {
4266
99
  e.client.sendProductMessage({
4267
100
  productId: e.productId,
4268
101
  productTitle: e.productTitle,
4269
102
  selectedVariantId: e.selectedVariantId,
4270
- question: i,
103
+ question: o,
4271
104
  fromQuestionSuggestion: !0
4272
105
  });
4273
106
  };
4274
- return (i, s) => (ie(!0), Me(fs, null, Fn(e.questions, (n) => (ie(), Me("button", {
107
+ return (o, a) => (d(!0), u(b, null, A(e.questions, (n) => (d(), u("button", {
4275
108
  key: n.question,
4276
109
  class: "dialog-block-suggestions-item",
4277
- onClick: (a) => t(n.question)
110
+ onClick: (l) => s(n.question)
4278
111
  }, [
4279
- Bt(nl, {
112
+ m(Q, {
4280
113
  class: "dialog-block-suggestions-item-icon",
4281
114
  color: e.client.theme.primaryColor
4282
115
  }, null, 8, ["color"]),
4283
- H("span", ol, Ci(n.question), 1)
4284
- ], 8, al))), 128));
4285
- }
4286
- }), cl = /* @__PURE__ */ at(ll, [["__scopeId", "data-v-fb1910ce"]]), ul = {};
4287
- function hl(r, e) {
4288
- return ie(), Me(fs, null, [
4289
- e[0] || (e[0] = H("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
4290
- e[1] || (e[1] = H("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
4291
- e[2] || (e[2] = H("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
116
+ c("span", H, I(n.question), 1)
117
+ ], 8, G))), 128));
118
+ }
119
+ }), Y = /* @__PURE__ */ C(Z, [["__scopeId", "data-v-fb1910ce"]]), z = {};
120
+ function J(t, e) {
121
+ return d(), u(b, null, [
122
+ e[0] || (e[0] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
123
+ e[1] || (e[1] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1)),
124
+ e[2] || (e[2] = c("div", { class: "dialog-block-suggestions-skeleton-item" }, null, -1))
4292
125
  ], 64);
4293
126
  }
4294
- const dl = /* @__PURE__ */ at(ul, [["render", hl], ["__scopeId", "data-v-26a64b58"]]), pl = { class: "dialog-block-suggestions-container" }, gl = /* @__PURE__ */ Ae({
127
+ const W = /* @__PURE__ */ C(z, [["render", J], ["__scopeId", "data-v-26a64b58"]]), X = { class: "dialog-block-suggestions-container" }, ee = /* @__PURE__ */ p({
4295
128
  __name: "DialogBlockSuggestionsContainer",
4296
129
  props: {
4297
130
  client: {},
@@ -4301,10 +134,10 @@ const dl = /* @__PURE__ */ at(ul, [["render", hl], ["__scopeId", "data-v-26a64b5
4301
134
  productTitle: {},
4302
135
  selectedVariantId: {}
4303
136
  },
4304
- setup(r) {
4305
- const e = r;
4306
- return (t, i) => (ie(), Me("div", pl, [
4307
- e.isLoading || !e.questions ? (ie(), Ht(dl, { key: 0 })) : (ie(), Ht(cl, {
137
+ setup(t) {
138
+ const e = t;
139
+ return (s, o) => (d(), u("div", X, [
140
+ e.isLoading || !e.questions ? (d(), S(W, { key: 0 })) : (d(), S(Y, {
4308
141
  key: 1,
4309
142
  client: e.client,
4310
143
  questions: e.questions,
@@ -4314,30 +147,30 @@ const dl = /* @__PURE__ */ at(ul, [["render", hl], ["__scopeId", "data-v-26a64b5
4314
147
  }, null, 8, ["client", "questions", "product-id", "product-title", "selected-variant-id"]))
4315
148
  ]));
4316
149
  }
4317
- }), fl = /* @__PURE__ */ at(gl, [["__scopeId", "data-v-18c9e78b"]]), _l = {
150
+ }), te = /* @__PURE__ */ C(ee, [["__scopeId", "data-v-18c9e78b"]]), oe = {
4318
151
  width: "20",
4319
152
  height: "20",
4320
153
  viewBox: "0 0 20 20",
4321
154
  fill: "none",
4322
155
  xmlns: "http://www.w3.org/2000/svg"
4323
- }, vl = ["stroke"], ml = /* @__PURE__ */ Ae({
156
+ }, ne = ["stroke"], se = /* @__PURE__ */ p({
4324
157
  __name: "ArrowIcon",
4325
158
  props: {
4326
159
  color: {}
4327
160
  },
4328
- setup(r) {
4329
- const e = r;
4330
- return (t, i) => (ie(), Me("svg", _l, [
4331
- H("path", {
161
+ setup(t) {
162
+ const e = t;
163
+ return (s, o) => (d(), u("svg", oe, [
164
+ c("path", {
4332
165
  d: "M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",
4333
166
  stroke: e.color || "#ffffff",
4334
167
  "stroke-width": "1.5",
4335
168
  "stroke-linecap": "round",
4336
169
  "stroke-linejoin": "round"
4337
- }, null, 8, vl)
170
+ }, null, 8, ne)
4338
171
  ]));
4339
172
  }
4340
- }), yl = ["placeholder"], bl = ["disabled"], wl = /* @__PURE__ */ Ae({
173
+ }), ie = ["placeholder"], ce = ["disabled"], le = /* @__PURE__ */ p({
4341
174
  __name: "DialogInput",
4342
175
  props: {
4343
176
  client: {},
@@ -4346,97 +179,97 @@ const dl = /* @__PURE__ */ at(ul, [["render", hl], ["__scopeId", "data-v-26a64b5
4346
179
  productTitle: {},
4347
180
  selectedVariantId: {}
4348
181
  },
4349
- setup(r) {
4350
- const e = r, t = wt(), i = wt(""), s = () => {
4351
- var a;
4352
- (a = t.value) == null || a.focus();
182
+ setup(t) {
183
+ const e = t, s = k(), o = k(""), a = () => {
184
+ var l;
185
+ (l = s.value) == null || l.focus();
4353
186
  }, n = () => {
4354
- const a = i.value;
4355
- a.trim() && (e.client.sendProductMessage({
187
+ const l = o.value;
188
+ l.trim() && (e.client.sendProductMessage({
4356
189
  productId: e.productId,
4357
190
  productTitle: e.productTitle,
4358
191
  selectedVariantId: e.selectedVariantId,
4359
- question: a,
192
+ question: l,
4360
193
  fromQuestionSuggestion: !0
4361
- }), i.value = "");
194
+ }), o.value = "");
4362
195
  };
4363
- return (a, o) => (ie(), Me("div", {
196
+ return (l, r) => (d(), u("div", {
4364
197
  class: "dialog-input-wrapper",
4365
- onClick: s
198
+ onClick: a
4366
199
  }, [
4367
- Tn(H("input", {
200
+ R(c("input", {
4368
201
  id: "dialog-ask-anything-input-ai-input",
4369
202
  ref_key: "inputRef",
4370
- ref: t,
4371
- "onUpdate:modelValue": o[0] || (o[0] = (l) => i.value = l),
203
+ ref: s,
204
+ "onUpdate:modelValue": r[0] || (r[0] = (_) => o.value = _),
4372
205
  class: "dialog-ask-anything-input-ai-input",
4373
206
  placeholder: e.placeholder ?? "Ask anything...",
4374
- onKeydown: On(n, ["enter"])
4375
- }, null, 40, yl), [
4376
- [Rn, i.value]
207
+ onKeydown: N(n, ["enter"])
208
+ }, null, 40, ie), [
209
+ [O, o.value]
4377
210
  ]),
4378
- H("button", {
211
+ c("button", {
4379
212
  id: "send-message-button-ai-input",
4380
213
  class: "dialog-input-submit",
4381
- disabled: !i.value.trim(),
214
+ disabled: !o.value.trim(),
4382
215
  onClick: n
4383
216
  }, [
4384
- Bt(ml, {
217
+ m(se, {
4385
218
  color: e.client.theme.ctaTextColor
4386
219
  }, null, 8, ["color"])
4387
- ], 8, bl)
220
+ ], 8, ce)
4388
221
  ]));
4389
222
  }
4390
- }), El = /* @__PURE__ */ at(wl, [["__scopeId", "data-v-7649af7c"]]), kl = /* @__PURE__ */ Ae({
223
+ }), re = /* @__PURE__ */ C(le, [["__scopeId", "data-v-7649af7c"]]), de = /* @__PURE__ */ p({
4391
224
  __name: "ThemeProvider",
4392
225
  props: {
4393
226
  theme: {}
4394
227
  },
4395
- setup(r) {
4396
- const e = r, t = document.body, i = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), s = (n) => {
4397
- n && Object.keys(n).forEach((a) => {
4398
- const o = a, l = i(a);
4399
- if (n[o] !== void 0) {
4400
- if (typeof n[o] == "object") {
4401
- Object.keys(n[o]).forEach((c) => {
228
+ setup(t) {
229
+ const e = t, s = document.body, o = (n) => n.replace(/([A-Z])/g, "-$1").toLowerCase(), a = (n) => {
230
+ n && Object.keys(n).forEach((l) => {
231
+ const r = l, _ = o(l);
232
+ if (n[r] !== void 0) {
233
+ if (typeof n[r] == "object") {
234
+ Object.keys(n[r]).forEach((i) => {
4402
235
  var h;
4403
- const u = c;
4404
- if (u !== void 0) {
4405
- const g = i(c), p = n[o];
4406
- t.style.setProperty(
4407
- `--dialog-theme-${l}-${g}`,
4408
- (h = p[u]) == null ? void 0 : h.toString()
236
+ const g = i;
237
+ if (g !== void 0) {
238
+ const y = o(i), D = n[r];
239
+ s.style.setProperty(
240
+ `--dialog-theme-${_}-${y}`,
241
+ (h = D[g]) == null ? void 0 : h.toString()
4409
242
  );
4410
243
  }
4411
244
  });
4412
245
  return;
4413
246
  }
4414
- if (o === "ctaBorderType") {
4415
- const c = n[o] === "rounded" ? "24px" : "0";
4416
- t.style.setProperty(`--dialog-theme-${l}`, c);
247
+ if (r === "ctaBorderType") {
248
+ const i = n[r] === "rounded" ? "24px" : "0";
249
+ s.style.setProperty(`--dialog-theme-${_}`, i);
4417
250
  return;
4418
251
  }
4419
- t.style.setProperty(
4420
- `--dialog-theme-${l}`,
4421
- n[o].toString()
252
+ s.style.setProperty(
253
+ `--dialog-theme-${_}`,
254
+ n[r].toString()
4422
255
  );
4423
256
  }
4424
257
  });
4425
258
  };
4426
- return Dn(() => {
4427
- e.theme && s(e.theme);
4428
- }), _s(
259
+ return w(() => {
260
+ e.theme && a(e.theme);
261
+ }), E(
4429
262
  () => e.theme,
4430
263
  (n) => {
4431
- n && s(n);
264
+ n && a(n);
4432
265
  },
4433
266
  { deep: !0 }
4434
- ), (n, a) => Mn(n.$slots, "default");
267
+ ), (n, l) => $(n.$slots, "default");
4435
268
  }
4436
- }), xl = {
269
+ }), ae = {
4437
270
  id: "dialog-instant",
4438
271
  class: "dialog-block-container"
4439
- }, Sl = /* @__PURE__ */ Ae({
272
+ }, ue = /* @__PURE__ */ p({
4440
273
  __name: "DialogProductBlock",
4441
274
  props: {
4442
275
  client: {},
@@ -4445,69 +278,69 @@ const dl = /* @__PURE__ */ at(ul, [["render", hl], ["__scopeId", "data-v-26a64b5
4445
278
  selectedVariantId: { default: void 0 },
4446
279
  enableInput: { type: Boolean, default: !0 }
4447
280
  },
4448
- setup(r) {
4449
- const e = r, t = wt(!0), i = wt(void 0), s = wt(0), n = ui(() => {
4450
- var c;
4451
- return t.value ? "" : (c = i.value) == null ? void 0 : c.assistantName;
4452
- }), a = ui(() => {
4453
- var c;
4454
- return t.value ? "" : (c = i.value) == null ? void 0 : c.description;
4455
- }), o = ui(() => {
4456
- var c;
4457
- return t.value ? "" : (c = i.value) == null ? void 0 : c.inputPlaceholder;
4458
- }), l = async () => {
4459
- const c = ++s.value;
4460
- t.value = !0, i.value = void 0;
281
+ setup(t) {
282
+ const e = t, s = k(!0), o = k(void 0), a = k(0), n = v(() => {
283
+ var i;
284
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.assistantName;
285
+ }), l = v(() => {
286
+ var i;
287
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.description;
288
+ }), r = v(() => {
289
+ var i;
290
+ return s.value ? "" : (i = o.value) == null ? void 0 : i.inputPlaceholder;
291
+ }), _ = async () => {
292
+ const i = ++a.value;
293
+ s.value = !0, o.value = void 0;
4461
294
  try {
4462
- const u = await e.client.getSuggestions(e.productId);
4463
- c === s.value && (i.value = u);
4464
- } catch (u) {
4465
- console.error("error", u);
295
+ const g = await e.client.getSuggestions(e.productId);
296
+ i === a.value && (o.value = g);
297
+ } catch (g) {
298
+ console.error("error", g);
4466
299
  } finally {
4467
- c === s.value && (t.value = !1);
300
+ i === a.value && (s.value = !1);
4468
301
  }
4469
302
  };
4470
- return _s(
303
+ return E(
4471
304
  () => [e.client, e.productId],
4472
305
  () => {
4473
- l();
306
+ _();
4474
307
  },
4475
308
  { immediate: !0 }
4476
- ), (c, u) => (ie(), Ht(kl, {
309
+ ), (i, g) => (d(), S(de, {
4477
310
  theme: e.client.theme
4478
311
  }, {
4479
- default: An(() => {
312
+ default: L(() => {
4480
313
  var h;
4481
314
  return [
4482
- H("div", xl, [
4483
- Bt(el, {
315
+ c("div", ae, [
316
+ m(K, {
4484
317
  title: n.value,
4485
- description: a.value
318
+ description: l.value
4486
319
  }, null, 8, ["title", "description"]),
4487
- Bt(fl, {
320
+ m(te, {
4488
321
  client: e.client,
4489
- questions: (h = i.value) == null ? void 0 : h.questions,
4490
- "is-loading": t.value,
322
+ questions: (h = o.value) == null ? void 0 : h.questions,
323
+ "is-loading": s.value,
4491
324
  "product-id": e.productId,
4492
325
  "product-title": e.productTitle,
4493
326
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
4494
327
  }, null, 8, ["client", "questions", "is-loading", "product-id", "product-title", "selected-variant-id"]),
4495
- e.enableInput ? (ie(), Ht(El, {
328
+ e.enableInput ? (d(), S(re, {
4496
329
  key: 0,
4497
330
  client: e.client,
4498
- placeholder: o.value,
331
+ placeholder: r.value,
4499
332
  "product-id": e.productId,
4500
333
  "product-title": e.productTitle,
4501
334
  "selected-variant-id": e == null ? void 0 : e.selectedVariantId
4502
- }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : Ln("", !0)
335
+ }, null, 8, ["client", "placeholder", "product-id", "product-title", "selected-variant-id"])) : B("", !0)
4503
336
  ])
4504
337
  ];
4505
338
  }),
4506
339
  _: 1
4507
340
  }, 8, ["theme"]));
4508
341
  }
4509
- }), Cl = /* @__PURE__ */ at(Sl, [["__scopeId", "data-v-651875ac"]]);
342
+ }), _e = /* @__PURE__ */ C(ue, [["__scopeId", "data-v-651875ac"]]);
4510
343
  export {
4511
- El as DialogInput,
4512
- Cl as DialogProductBlock
344
+ re as DialogInput,
345
+ _e as DialogProductBlock
4513
346
  };