PageSourceSearch

https://payd.io/_app/immutable/chunks/DmpkbjTf.js

js payd.io collected 2026-10-08 10:34:06 UTC 237,548 bytes, 4,656 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.