@cartbot/vehicle-search-beta 3.0.35 → 3.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -328,7 +328,7 @@ function ne({
328
328
  )
329
329
  ] });
330
330
  }
331
- const Jt = "3.0.35";
331
+ const Jt = "3.0.36";
332
332
  console.info(
333
333
  `Vehicle Search v${Jt} powered by Partbot https://mmyvs.partbot.io`
334
334
  );
@@ -572,7 +572,7 @@ function Xt({
572
572
  }
573
573
  t();
574
574
  }, [e, C, g]);
575
- const Xe = (t) => K ? `${K}${t}` : t, At = (t) => K ? t.replace(new RegExp(`^${K}`), "") : t, Et = V(() => {
575
+ const Xe = (t) => K ? `${K}${t}` : t, At = (t) => K ? t.replace(new RegExp(`^${K}`), "") : t, ht = V(() => {
576
576
  const t = new URL(window.location.href).searchParams, r = [
577
577
  "make",
578
578
  "model",
@@ -654,7 +654,7 @@ function Xt({
654
654
  const d = window.location.pathname + "?" + o.toString();
655
655
  window.history.pushState(null, "", d);
656
656
  }
657
- }, []), jt = V(() => {
657
+ }, []), Et = V(() => {
658
658
  var n;
659
659
  const t = {
660
660
  vehicle_ids: we,
@@ -667,7 +667,7 @@ function Xt({
667
667
  window.dispatchEvent(r), document.dispatchEvent(r), setTimeout(() => {
668
668
  We(!1);
669
669
  }, 900);
670
- }, [we, de]), ht = V(() => {
670
+ }, [we, de]), ft = V(() => {
671
671
  var n, o, d, i, s, l, f, k, b;
672
672
  const t = {
673
673
  vehicle_ids: we,
@@ -697,8 +697,8 @@ function Xt({
697
697
  We(!1);
698
698
  }, 900);
699
699
  }, [we, S]), ge = He(
700
- () => Kt(ht, 100),
701
- [ht]
700
+ () => Kt(ft, 100),
701
+ [ft]
702
702
  );
703
703
  j(() => {
704
704
  ge();
@@ -740,8 +740,8 @@ function Xt({
740
740
  document.removeEventListener("partbot-clear-vehicle", t);
741
741
  };
742
742
  }, [ge]), j(() => {
743
- me.searchKey && (M || bt(), Et());
744
- }, [me.searchKey, M, bt]), j(() => {
743
+ me.searchKey && (M || Vt(), ht());
744
+ }, [me.searchKey, M, ht]), j(() => {
745
745
  M && C.current && ke.length === 0 && !e.year && C.current.search("", {
746
746
  attributesToRetrieve: ["year_from", "year_to"],
747
747
  limit: 1e4
@@ -757,7 +757,7 @@ function Xt({
757
757
  }, [M, me.searchKey, ke.length, e.year]), j(() => {
758
758
  typeof document > "u" || ut();
759
759
  }, [ut]);
760
- const ft = V(
760
+ const mt = V(
761
761
  (t) => {
762
762
  U.current = !0, he([]), !M && !g && $e([]), Ie([]), Ve([]), Le([]), Fe([]), De([]), q((r) => ({
763
763
  make: t,
@@ -784,7 +784,7 @@ function Xt({
784
784
  }), t || Ae([]);
785
785
  },
786
786
  [L, M, g]
787
- ), mt = V(
787
+ ), gt = V(
788
788
  (t) => {
789
789
  U.current = !0, q((r) => ({
790
790
  ...r,
@@ -810,7 +810,7 @@ function Xt({
810
810
  });
811
811
  },
812
812
  [L, M, g]
813
- ), gt = V(
813
+ ), bt = V(
814
814
  (t) => {
815
815
  U.current = !0, M ? (Qe([]), he([]), q({
816
816
  year: t !== "" ? t : null
@@ -840,7 +840,7 @@ function Xt({
840
840
  }), !g && (!t || t === "") && Ae([]);
841
841
  },
842
842
  [L, M, g]
843
- ), Nt = V(
843
+ ), jt = V(
844
844
  (t) => {
845
845
  U.current = !0, q((r) => ({
846
846
  ...r,
@@ -851,7 +851,7 @@ function Xt({
851
851
  });
852
852
  },
853
853
  [L]
854
- ), Bt = V(
854
+ ), Nt = V(
855
855
  (t) => {
856
856
  U.current = !0, q((r) => ({
857
857
  ...r,
@@ -862,7 +862,7 @@ function Xt({
862
862
  });
863
863
  },
864
864
  [L]
865
- ), Pt = V(
865
+ ), Bt = V(
866
866
  (t) => {
867
867
  U.current = !0, q((r) => ({
868
868
  ...r,
@@ -873,7 +873,7 @@ function Xt({
873
873
  });
874
874
  },
875
875
  [L]
876
- ), It = V(
876
+ ), Pt = V(
877
877
  (t) => {
878
878
  U.current = !0, q((r) => ({
879
879
  ...r,
@@ -884,7 +884,7 @@ function Xt({
884
884
  });
885
885
  },
886
886
  [L]
887
- ), Vt = V(
887
+ ), It = V(
888
888
  (t) => {
889
889
  U.current = !0, q((r) => ({
890
890
  ...r,
@@ -931,7 +931,7 @@ function Xt({
931
931
  }
932
932
  })();
933
933
  }, [M, e.year, ie, Ce]);
934
- const bt = V(() => {
934
+ const Vt = V(() => {
935
935
  (async () => {
936
936
  let r = [];
937
937
  if (xe.current && xe.current.length)
@@ -1309,7 +1309,7 @@ function Xt({
1309
1309
  {
1310
1310
  label: "Year",
1311
1311
  items: ke,
1312
- refine: gt,
1312
+ refine: bt,
1313
1313
  selected: e.year,
1314
1314
  bgDark: J,
1315
1315
  showLabel: E,
@@ -1324,7 +1324,7 @@ function Xt({
1324
1324
  {
1325
1325
  label: "Make",
1326
1326
  items: Be,
1327
- refine: ft,
1327
+ refine: mt,
1328
1328
  selected: e.make,
1329
1329
  showPopular: !0,
1330
1330
  bgDark: J,
@@ -1340,7 +1340,7 @@ function Xt({
1340
1340
  {
1341
1341
  label: "Model",
1342
1342
  items: Pe,
1343
- refine: mt,
1343
+ refine: gt,
1344
1344
  selected: e.model,
1345
1345
  showPopular: !0,
1346
1346
  bgDark: J,
@@ -1357,7 +1357,7 @@ function Xt({
1357
1357
  {
1358
1358
  label: "Make",
1359
1359
  items: Be,
1360
- refine: ft,
1360
+ refine: mt,
1361
1361
  selected: e.make,
1362
1362
  showPopular: !0,
1363
1363
  bgDark: J,
@@ -1373,7 +1373,7 @@ function Xt({
1373
1373
  {
1374
1374
  label: "Model",
1375
1375
  items: Pe,
1376
- refine: mt,
1376
+ refine: gt,
1377
1377
  selected: e.model,
1378
1378
  showPopular: !0,
1379
1379
  bgDark: J,
@@ -1389,7 +1389,7 @@ function Xt({
1389
1389
  {
1390
1390
  label: "Year",
1391
1391
  items: ke,
1392
- refine: gt,
1392
+ refine: bt,
1393
1393
  selected: e.year,
1394
1394
  bgDark: J,
1395
1395
  showLabel: E,
@@ -1409,7 +1409,7 @@ function Xt({
1409
1409
  {
1410
1410
  label: "Body",
1411
1411
  items: nt,
1412
- refine: Nt,
1412
+ refine: jt,
1413
1413
  selected: e.body,
1414
1414
  bgDark: J,
1415
1415
  showLabel: E,
@@ -1426,7 +1426,7 @@ function Xt({
1426
1426
  {
1427
1427
  label: "Series",
1428
1428
  items: it,
1429
- refine: Bt,
1429
+ refine: Nt,
1430
1430
  selected: e.series,
1431
1431
  bgDark: J,
1432
1432
  showLabel: E,
@@ -1443,7 +1443,7 @@ function Xt({
1443
1443
  {
1444
1444
  label: "Variant",
1445
1445
  items: st,
1446
- refine: Pt,
1446
+ refine: Bt,
1447
1447
  selected: e.variant,
1448
1448
  bgDark: J,
1449
1449
  showLabel: E,
@@ -1460,7 +1460,7 @@ function Xt({
1460
1460
  {
1461
1461
  label: "Engine Capacity",
1462
1462
  items: ct,
1463
- refine: Vt,
1463
+ refine: It,
1464
1464
  selected: e.engine_capacity,
1465
1465
  bgDark: J,
1466
1466
  showLabel: E,
@@ -1477,7 +1477,7 @@ function Xt({
1477
1477
  {
1478
1478
  label: "Engine",
1479
1479
  items: lt,
1480
- refine: It,
1480
+ refine: Pt,
1481
1481
  selected: e.engine,
1482
1482
  bgDark: J,
1483
1483
  showLabel: E,
@@ -1496,7 +1496,7 @@ function Xt({
1496
1496
  {
1497
1497
  className: "vehicle-search-btn",
1498
1498
  onClick: () => {
1499
- We(!0), W && !de ? window.location.href = W + window.location.search : jt();
1499
+ We(!0), W && !de ? window.location.href = W + window.location.search : Et();
1500
1500
  },
1501
1501
  children: [
1502
1502
  /* @__PURE__ */ a("span", { children: ue }),
@@ -58,4 +58,4 @@ Hint: It might not be working because maybe you're not up to date with the Meili
58
58
  ${i.stack}.`,Promise.reject(i)}}function Uy(t){return Buffer.from(JSON.stringify(t)).toString("base64")}async function uC(t,e,n){const{createHmac:r}=await Promise.resolve().then(()=>pP);return r("sha256",t).update(`${e}.${n}`).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function cC(){return Uy({alg:"HS256",typ:"JWT"}).replace(/=/g,"")}function dC(t){const{searchRules:e,uid:n,apiKey:r,expiresAt:i}=t;if(i)if(i instanceof Date){if(i.getTime()<Date.now())throw new ft("Meilisearch: The expiresAt field must be a date in the future.")}else throw new ft("Meilisearch: The expiredAt field must be an instance of Date.");if(e&&!(typeof e=="object"||Array.isArray(e)))throw new ft("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!r||typeof r!="string")throw new ft("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||typeof n!="string")throw new ft("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!rC(n))throw new ft("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}function fC(t){const{searchRules:e,uid:n,expiresAt:r}=t,i={searchRules:e,apiKeyUid:n,exp:r?Math.floor(r.getTime()/1e3):void 0};return Uy(i).replace(/=/g,"")}class hC{constructor(e){oe(this,"config");this.config=e}async generateTenantToken(e,n,r){const i=(r==null?void 0:r.apiKey)||this.config.apiKey||"",s=e||"",o=r==null?void 0:r.expiresAt;dC({apiKey:i,uid:s,expiresAt:o,searchRules:n});const a=cC(),l=fC({searchRules:n,uid:s,expiresAt:o}),u=await uC(i,a,l);return`${a}.${l}.${u}`}}class By extends lC{constructor(n){super(n);oe(this,"tokens");this.tokens=new hC(n)}async generateTenantToken(n,r,i){return typeof window>"u"?await this.tokens.generateTenantToken(n,r,i):await super.generateTenantToken(n,r,i)}}function pC(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var qy=pC,gC=typeof In=="object"&&In&&In.Object===Object&&In,vC=gC,mC=vC,yC=typeof self=="object"&&self&&self.Object===Object&&self,_C=mC||yC||Function("return this")(),Vy=_C,wC=Vy,bC=function(){return wC.Date.now()},xC=bC,kC=/\s/;function SC(t){for(var e=t.length;e--&&kC.test(t.charAt(e)););return e}var EC=SC,$C=EC,CC=/^\s+/;function RC(t){return t&&t.slice(0,$C(t)+1).replace(CC,"")}var TC=RC,PC=Vy,MC=PC.Symbol,Wy=MC,Gy=Wy,Ky=Object.prototype,OC=Ky.hasOwnProperty,AC=Ky.toString,Xo=Gy?Gy.toStringTag:void 0;function IC(t){var e=OC.call(t,Xo),n=t[Xo];try{t[Xo]=void 0;var r=!0}catch{}var i=AC.call(t);return r&&(e?t[Xo]=n:delete t[Xo]),i}var FC=IC,LC=Object.prototype,DC=LC.toString;function NC(t){return DC.call(t)}var jC=NC,Yy=Wy,zC=FC,HC=jC,UC="[object Null]",BC="[object Undefined]",Qy=Yy?Yy.toStringTag:void 0;function qC(t){return t==null?t===void 0?BC:UC:Qy&&Qy in Object(t)?zC(t):HC(t)}var VC=qC;function WC(t){return t!=null&&typeof t=="object"}var GC=WC,KC=VC,YC=GC,QC="[object Symbol]";function XC(t){return typeof t=="symbol"||YC(t)&&KC(t)==QC}var ZC=XC,JC=TC,Xy=qy,e3=ZC,Zy=NaN,t3=/^[-+]0x[0-9a-f]+$/i,n3=/^0b[01]+$/i,r3=/^0o[0-7]+$/i,i3=parseInt;function s3(t){if(typeof t=="number")return t;if(e3(t))return Zy;if(Xy(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Xy(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=JC(t);var n=n3.test(t);return n||r3.test(t)?i3(t.slice(2),n?2:8):t3.test(t)?Zy:+t}var o3=s3,a3=qy,Xf=xC,Jy=o3,l3="Expected a function",u3=Math.max,c3=Math.min;function d3(t,e,n){var r,i,s,o,a,l,u=0,c=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(l3);e=Jy(e)||0,a3(n)&&(c=!!n.leading,f="maxWait"in n,s=f?u3(Jy(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d);function h(k){var $=r,C=i;return r=i=void 0,u=k,o=t.apply(C,$),o}function p(k){return u=k,a=setTimeout(m,e),c?h(k):o}function g(k){var $=k-l,C=k-u,q=e-$;return f?c3(q,s-C):q}function w(k){var $=k-l,C=k-u;return l===void 0||$>=e||$<0||f&&C>=s}function m(){var k=Xf();if(w(k))return v(k);a=setTimeout(m,g(k))}function v(k){return a=void 0,d&&r?h(k):(r=i=void 0,o)}function y(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function b(){return a===void 0?o:v(Xf())}function x(){var k=Xf(),$=w(k);if(r=arguments,i=this,l=k,$){if(a===void 0)return p(l);if(f)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return x.cancel=y,x.flush=b,x}var f3=d3;const h3=Us(f3);function ou(t){"@babel/helpers - typeof";return ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ou(t)}var p3=/^\s+/,g3=/\s+$/;function J(t,e){if(t=t||"",e=e||{},t instanceof J)return t;if(!(this instanceof J))return new J(t,e);var n=v3(t);this._originalInput=t,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||n.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}J.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),n,r,i,s,o,a;return n=e.r/255,r=e.g/255,i=e.b/255,n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=s_(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=t_(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=t_(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=e_(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=e_(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return n_(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return w3(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ae(this._r,255)*100)+"%",g:Math.round(Ae(this._g,255)*100)+"%",b:Math.round(Ae(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%)":"rgba("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:O3[n_(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var n="#"+r_(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(e){var s=J(e);r="#"+r_(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(e){var n=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0,s=!n&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return J(this.toString())},_applyModification:function(e,n){var r=e.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(S3,arguments)},brighten:function(){return this._applyModification(E3,arguments)},darken:function(){return this._applyModification($3,arguments)},desaturate:function(){return this._applyModification(b3,arguments)},saturate:function(){return this._applyModification(x3,arguments)},greyscale:function(){return this._applyModification(k3,arguments)},spin:function(){return this._applyModification(C3,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(P3,arguments)},complement:function(){return this._applyCombination(R3,arguments)},monochromatic:function(){return this._applyCombination(M3,arguments)},splitcomplement:function(){return this._applyCombination(T3,arguments)},triad:function(){return this._applyCombination(i_,[3])},tetrad:function(){return this._applyCombination(i_,[4])}},J.fromRatio=function(t,e){if(ou(t)=="object"){var n={};for(var r in t)t.hasOwnProperty(r)&&(r==="a"?n[r]=t[r]:n[r]=Zo(t[r]));t=n}return J(t,e)};function v3(t){var e={r:0,g:0,b:0},n=1,r=null,i=null,s=null,o=!1,a=!1;return typeof t=="string"&&(t=L3(t)),ou(t)=="object"&&(hr(t.r)&&hr(t.g)&&hr(t.b)?(e=m3(t.r,t.g,t.b),o=!0,a=String(t.r).substr(-1)==="%"?"prgb":"rgb"):hr(t.h)&&hr(t.s)&&hr(t.v)?(r=Zo(t.s),i=Zo(t.v),e=_3(t.h,r,i),o=!0,a="hsv"):hr(t.h)&&hr(t.s)&&hr(t.l)&&(r=Zo(t.s),s=Zo(t.l),e=y3(t.h,r,s),o=!0,a="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=s_(n),{ok:o,format:t.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function m3(t,e,n){return{r:Ae(t,255)*255,g:Ae(e,255)*255,b:Ae(n,255)*255}}function e_(t,e,n){t=Ae(t,255),e=Ae(e,255),n=Ae(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function y3(t,e,n){var r,i,s;t=Ae(t,360),e=Ae(e,100),n=Ae(n,100);function o(u,c,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?u+(c-u)*6*f:f<1/2?c:f<2/3?u+(c-u)*(2/3-f)*6:u}if(e===0)r=i=s=n;else{var a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=o(l,a,t+1/3),i=o(l,a,t),s=o(l,a,t-1/3)}return{r:r*255,g:i*255,b:s*255}}function t_(t,e,n){t=Ae(t,255),e=Ae(e,255),n=Ae(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function _3(t,e,n){t=Ae(t,360)*6,e=Ae(e,100),n=Ae(n,100);var r=Math.floor(t),i=t-r,s=n*(1-e),o=n*(1-i*e),a=n*(1-(1-i)*e),l=r%6,u=[n,o,s,s,a,n][l],c=[a,n,n,o,s,s][l],f=[s,s,a,n,n,o][l];return{r:u*255,g:c*255,b:f*255}}function n_(t,e,n,r){var i=[En(Math.round(t).toString(16)),En(Math.round(e).toString(16)),En(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function w3(t,e,n,r,i){var s=[En(Math.round(t).toString(16)),En(Math.round(e).toString(16)),En(Math.round(n).toString(16)),En(o_(r))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function r_(t,e,n,r){var i=[En(o_(r)),En(Math.round(t).toString(16)),En(Math.round(e).toString(16)),En(Math.round(n).toString(16))];return i.join("")}J.equals=function(t,e){return!t||!e?!1:J(t).toRgbString()==J(e).toRgbString()},J.random=function(){return J.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function b3(t,e){e=e===0?0:e||10;var n=J(t).toHsl();return n.s-=e/100,n.s=au(n.s),J(n)}function x3(t,e){e=e===0?0:e||10;var n=J(t).toHsl();return n.s+=e/100,n.s=au(n.s),J(n)}function k3(t){return J(t).desaturate(100)}function S3(t,e){e=e===0?0:e||10;var n=J(t).toHsl();return n.l+=e/100,n.l=au(n.l),J(n)}function E3(t,e){e=e===0?0:e||10;var n=J(t).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(e/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(e/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(e/100)))),J(n)}function $3(t,e){e=e===0?0:e||10;var n=J(t).toHsl();return n.l-=e/100,n.l=au(n.l),J(n)}function C3(t,e){var n=J(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,J(n)}function R3(t){var e=J(t).toHsl();return e.h=(e.h+180)%360,J(e)}function i_(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var n=J(t).toHsl(),r=[J(t)],i=360/e,s=1;s<e;s++)r.push(J({h:(n.h+s*i)%360,s:n.s,l:n.l}));return r}function T3(t){var e=J(t).toHsl(),n=e.h;return[J(t),J({h:(n+72)%360,s:e.s,l:e.l}),J({h:(n+216)%360,s:e.s,l:e.l})]}function P3(t,e,n){e=e||6,n=n||30;var r=J(t).toHsl(),i=360/n,s=[J(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(J(r));return s}function M3(t,e){e=e||6;for(var n=J(t).toHsv(),r=n.h,i=n.s,s=n.v,o=[],a=1/e;e--;)o.push(J({h:r,s:i,v:s})),s=(s+a)%1;return o}J.mix=function(t,e,n){n=n===0?0:n||50;var r=J(t).toRgb(),i=J(e).toRgb(),s=n/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return J(o)},J.readability=function(t,e){var n=J(t),r=J(e);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},J.isReadable=function(t,e,n){var r=J.readability(t,e),i,s;switch(s=!1,i=D3(n),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s},J.mostReadable=function(t,e,n){var r=null,i=0,s,o,a,l;n=n||{},o=n.includeFallbackColors,a=n.level,l=n.size;for(var u=0;u<e.length;u++)s=J.readability(t,e[u]),s>i&&(i=s,r=J(e[u]));return J.isReadable(t,r,{level:a,size:l})||!o?r:(n.includeFallbackColors=!1,J.mostReadable(t,["#fff","#000"],n))};var Zf=J.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},O3=J.hexNames=A3(Zf);function A3(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function s_(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Ae(t,e){I3(t)&&(t="100%");var n=F3(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function au(t){return Math.min(1,Math.max(0,t))}function Yt(t){return parseInt(t,16)}function I3(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function F3(t){return typeof t=="string"&&t.indexOf("%")!=-1}function En(t){return t.length==1?"0"+t:""+t}function Zo(t){return t<=1&&(t=t*100+"%"),t}function o_(t){return Math.round(parseFloat(t)*255).toString(16)}function a_(t){return Yt(t)/255}var $n=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function hr(t){return!!$n.CSS_UNIT.exec(t)}function L3(t){t=t.replace(p3,"").replace(g3,"").toLowerCase();var e=!1;if(Zf[t])t=Zf[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=$n.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=$n.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=$n.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=$n.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=$n.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=$n.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=$n.hex8.exec(t))?{r:Yt(n[1]),g:Yt(n[2]),b:Yt(n[3]),a:a_(n[4]),format:e?"name":"hex8"}:(n=$n.hex6.exec(t))?{r:Yt(n[1]),g:Yt(n[2]),b:Yt(n[3]),format:e?"name":"hex"}:(n=$n.hex4.exec(t))?{r:Yt(n[1]+""+n[1]),g:Yt(n[2]+""+n[2]),b:Yt(n[3]+""+n[3]),a:a_(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=$n.hex3.exec(t))?{r:Yt(n[1]+""+n[1]),g:Yt(n[2]+""+n[2]),b:Yt(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function D3(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var E=typeof window<"u"?window:void 0,Ft=typeof globalThis<"u"?globalThis:E,l_=Array.prototype,u_=l_.forEach,c_=l_.indexOf,Qt=Ft==null?void 0:Ft.navigator,B=Ft==null?void 0:Ft.document,Lt=Ft==null?void 0:Ft.location,Jf=Ft==null?void 0:Ft.fetch,eh=Ft!=null&&Ft.XMLHttpRequest&&"withCredentials"in new Ft.XMLHttpRequest?Ft.XMLHttpRequest:void 0,d_=Ft==null?void 0:Ft.AbortController,Dt=Qt==null?void 0:Qt.userAgent,ee=E??{},pr={DEBUG:!1,LIB_VERSION:"1.270.1"};function f_(t,e,n,r,i,s,o){try{var a=t[s](o),l=a.value}catch(u){return void n(u)}a.done?e(l):Promise.resolve(l).then(r,i)}function h_(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(l){f_(s,r,i,o,a,"next",l)}function a(l){f_(s,r,i,o,a,"throw",l)}o(void 0)})}}function j(){return j=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},j.apply(null,arguments)}function p_(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var N3=["$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"];function ue(t,e){return t.indexOf(e)!==-1}var lu=function(t){return t.trim()},th=function(t){return t.replace(/^\$/,"")},j3=Array.isArray,g_=Object.prototype,v_=g_.hasOwnProperty,uu=g_.toString,$e=j3||function(t){return uu.call(t)==="[object Array]"},ln=t=>typeof t=="function",ze=t=>t===Object(t)&&!$e(t),$s=t=>{if(ze(t)){for(var e in t)if(v_.call(t,e))return!1;return!0}return!1},D=t=>t===void 0,He=t=>uu.call(t)=="[object String]",nh=t=>He(t)&&t.trim().length===0,gr=t=>t===null,ge=t=>D(t)||gr(t),ht=t=>uu.call(t)=="[object Number]",Cn=t=>uu.call(t)==="[object Boolean]",z3=t=>t instanceof FormData,H3=t=>ue(N3,t);function rh(t){return t===null||typeof t!="object"}function cu(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function m_(t){return!D(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var U3=[!0,"true",1,"1","yes"],ih=t=>ue(U3,t),B3=[!1,"false",0,"0","no"];function Xt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),ht(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Xt(i||n,e,n,r))}class y_{constructor(e){this.t=e,this.i={},this.o=()=>{Object.keys(this.i).forEach(n=>{var r=this.h(n)+this.m;r>=this.S?delete this.i[n]:this.k(n,r)})},this.h=n=>this.i[String(n)],this.k=(n,r)=>{this.i[String(n)]=r},this.consumeRateLimit=n=>{var r,i,s=(r=this.h(n))!==null&&r!==void 0?r:this.S;if((s=Math.max(s-1,0))===0)return!0;this.k(n,s);var o=s===0;return o&&((i=this.$)==null||i.call(this,n)),o},this.$=this.t.$,this.S=Xt(this.t.bucketSize,0,100,this.t.R),this.m=Xt(this.t.refillRate,0,this.S,this.t.R),this.I=Xt(this.t.refillInterval,0,864e5,this.t.R),this.P=setInterval(()=>{this.o()},this.I)}stop(){this.P&&(clearInterval(this.P),this.P=void 0)}}var du,__,sh,q3=t=>t instanceof Error;function V3(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return sh&&n.length===__||(__=n.length,sh=n.reduce((r,i)=>{du||(du={});var s=du[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,c=e[i];if(u&&c){r[u]=c,du[i]=[u,c];break}}return r},{})),sh}}var Cs="?";function oh(t,e,n,r){var i={platform:"web:javascript",filename:t,function:e==="<anonymous>"?Cs:e,in_app:!0};return D(n)||(i.lineno=n),D(r)||(i.colno=r),i}var w_=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Cs,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},W3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,G3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,K3=/\((\S*)(?::(\d+))(?::(\d+))\)/,Y3=t=>{var e=W3.exec(t);if(e){var[,n,r,i]=e;return oh(n,Cs,+r,+i)}var s=G3.exec(t);if(s){if(s[2]&&s[2].indexOf("eval")===0){var o=K3.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}var[a,l]=w_(s[1]||Cs,s[2]);return oh(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Q3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,X3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Z3=t=>{var e=Q3.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=X3.exec(e[3]);n&&(e[1]=e[1]||"eval",e[3]=n[1],e[4]=n[2],e[5]="")}var r=e[3],i=e[1]||Cs;return[i,r]=w_(i,r),oh(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},b_=/\(error: (.*)\)/,x_=50;function J3(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r,i){i===void 0&&(i=0);for(var s=[],o=r.split(`
59
59
  `),a=i;a<o.length;a++){var l=o[a];if(!(l.length>1024)){var u=b_.test(l)?l.replace(b_,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of e){var f=c(u);if(f){s.push(f);break}}if(s.length>=x_)break}}}return function(d){if(!d.length)return[];var h=Array.from(d);return h.reverse(),h.slice(0,x_).map(p=>{return j({},p,{filename:p.filename||(g=h,g[g.length-1]||{}).filename,function:p.function||Cs});var g})}(s)}}class eR{constructor(e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r=[]),this.coercers=e,this.modifiers=r,this.stackParser=J3(...n)}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return h_(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&$e(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),n.chunkIdMap)),j({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return h_(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,j({},n,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:V3(this.stackParser)}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return j({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}class tR{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=He(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return cu(e,"DOMException")}isDOMError(e){return cu(e,"DOMError")}}class nR{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}class rR{constructor(){}match(e){return cu(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r,i=n.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var iR=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class sR{match(e){return typeof e=="string"}coerce(e,n){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(iR);return i&&(n=i[1],r=i[2]),[n,r]}}var oR=["fatal","error","warning","log","info","debug"];function k_(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>e))return r===n.length||i.length<=e?i:i.slice(0,e)+"..."}return""}class aR{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return m_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+k_(e)}isSeverityLevel(e){return He(e)&&!nh(e)&&oR.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(q3(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class lR{match(e){return m_(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+k_(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class uR{match(e){return rh(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class cR{match(e){return cu(e,"PromiseRejectionEvent")}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return rh(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){if(rh(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var S_=t=>{var e={T:function(n){if(E&&(pr.DEBUG||ee.POSTHOG_DEBUG)&&!D(E.console)&&E.console){for(var r=("__rrweb_original__"in E.console[n])?E.console[n].__rrweb_original__:E.console[n],i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];r(t,...s)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning:n=>{e.error("You must initialize PostHog before calling "+n)},createLogger:n=>S_(t+" "+n)};return e},U=S_("[PostHog.js]"),Ye=U.createLogger,dR=Ye("[ExternalScriptsLoader]"),E_=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return dR.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=B==null?void 0:B.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:n()}:(l.addEventListener("load",u=>{l.__posthog_loading_callback_fired=!0,n(void 0,u)}),l.onerror=u=>n(u),{v:void 0})}},o=0;o<r.length;o++)if(i=s())return i.v}var a=()=>{if(!B)return n("document not found");var l=B.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=f=>{l.__posthog_loading_callback_fired=!0,n(void 0,f)},l.onerror=f=>n(f),t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return n("prepare_external_dependency_script returned null");var u,c=B.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):B.body.appendChild(l)};B!=null&&B.body?a():B==null||B.addEventListener("DOMContentLoaded",a)};ee.__PosthogExtensions__=ee.__PosthogExtensions__||{},ee.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var i=3e5;r=r+"&t="+Math.floor(Date.now()/i)*i}var s=t.requestRouter.endpointFor("assets",r);E_(t,s,n)},ee.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);E_(t,r,n)};var fu={};function Gr(t,e,n){if($e(t)){if(u_&&t.forEach===u_)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===fu)return}}}function ke(t,e,n){if(!ge(t)){if($e(t))return Gr(t,e,n);if(z3(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===fu)return}else for(var i in t)if(v_.call(t,i)&&e.call(n,t[i],i)===fu)return}}var qe=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Gr(n,function(i){for(var s in i)i[s]!==void 0&&(t[s]=i[s])}),t},hu=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Gr(n,function(i){Gr(i,function(s){t.push(s)})}),t};function pu(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var $_=function(t){try{return t()}catch{return}},fR=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){U.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),U.critical(i)}}},ah=function(t){var e={};return ke(t,function(n,r){(He(n)&&n.length>0||ht(n))&&(e[r]=n)}),e};function hR(t,e){return n=t,r=s=>He(s)&&!gr(e)?s.slice(0,e):s,i=new Set,function s(o,a){return o!==Object(o)?r?r(o,a):o:i.has(o)?void 0:(i.add(o),$e(o)?(l=[],Gr(o,u=>{l.push(s(u))})):(l={},ke(o,(u,c)=>{i.has(u)||(l[c]=s(u,c))})),l);var l}(n);var n,r,i}var pR=["herokuapp.com","vercel.app","netlify.app"];function gR(t){var e=t==null?void 0:t.hostname;if(!He(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of pR)if(n===r)return!1;return!0}function C_(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Ne(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t==null||t.addEventListener(e,n,{capture:i,passive:s})}var R_="$people_distinct_id",Jo="__alias",ea="__timers",T_="$autocapture_disabled_server_side",lh="$heatmaps_enabled_server_side",P_="$exception_capture_enabled_server_side",uh="$error_tracking_suppression_rules",M_="$error_tracking_capture_extension_exceptions",O_="$web_vitals_enabled_server_side",A_="$dead_clicks_enabled_server_side",I_="$web_vitals_allowed_metrics",ch="$session_recording_remote_config",dh="$session_recording_enabled_server_side",F_="$console_log_recording_enabled_server_side",L_="$session_recording_network_payload_capture",D_="$session_recording_masking",N_="$session_recording_canvas_recording",j_="$replay_sample_rate",z_="$replay_minimum_duration",H_="$replay_script_config",gu="$sesid",Rs="$session_is_sampled",fh="$session_recording_url_trigger_activated_session",hh="$session_recording_event_trigger_activated_session",Ts="$enabled_feature_flags",ta="$early_access_features",ph="$feature_flag_details",na="$stored_person_properties",Pi="$stored_group_properties",gh="$surveys",vu="$surveys_activated",mu="$flag_call_reported",vr="$user_state",vh="$client_session_props",mh="$capture_rate_limit",yh="$initial_campaign_params",_h="$initial_referrer_info",yu="$initial_person_info",_u="$epp",U_="__POSTHOG_TOOLBAR__",ra="$posthog_cookieless",vR=[R_,Jo,"__cmpns",ea,dh,lh,gu,Ts,uh,vr,ta,ph,Pi,na,gh,mu,vh,mh,yh,_h,_u,yu];function B_(t){return t instanceof Element&&(t.id===U_||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function wu(t){return!!t&&t.nodeType===1}function Kr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function q_(t){return!!t&&t.nodeType===3}function V_(t){return!!t&&t.nodeType===11}function wh(t){return t?lu(t).split(/\s+/):[]}function W_(t){var e=E==null?void 0:E.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function bu(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return wh(e)}function G_(t){return ge(t)?null:lu(t).split(/(\s+)/).filter(e=>Ps(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xu(t){var e="";return kh(t)&&!J_(t)&&t.childNodes&&t.childNodes.length&&ke(t.childNodes,function(n){var r;q_(n)&&n.textContent&&(e+=(r=G_(n.textContent))!==null&&r!==void 0?r:"")}),lu(e)}function K_(t){return D(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var bh=["a","button","form","input","select","textarea","label"];function Y_(t,e){if(D(e))return!0;var n,r=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function Q_(t){var e=t.parentNode;return!(!e||!wu(e))&&e}var X_=[".ph-no-rageclick",".ph-no-capture"],xh=t=>!t||Kr(t,"html")||!wu(t),Z_=(t,e)=>{if(!E||xh(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Kr(i,"body");)if(V_(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=Q_(i);if(!s)break;if(e||bh.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function mR(t,e,n,r,i){var s,o,a,l;if(n===void 0&&(n=void 0),!E||xh(t)||(s=n)!=null&&s.url_allowlist&&!W_(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&W_(n.url_ignorelist))return!1;if((a=n)!=null&&a.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(p=>e.type===p))return!1}var{parentIsUsefulElement:c,targetElementList:f}=Z_(t,r);if(!function(p,g){var w=g==null?void 0:g.element_allowlist;if(D(w))return!0;var m,v=function(b){if(w.some(x=>b.tagName.toLowerCase()===x))return{v:!0}};for(var y of p)if(m=v(y))return m.v;return!1}(f,n)||!Y_(f,(l=n)==null?void 0:l.css_selector_allowlist))return!1;var d=E.getComputedStyle(t);if(d&&d.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return c?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(bh.indexOf(h)>-1||t.getAttribute("contenteditable")==="true")}}function kh(t){for(var e=t;e.parentNode&&!Kr(e,"body");e=e.parentNode){var n=bu(e);if(ue(n,"ph-sensitive")||ue(n,"ph-no-capture"))return!1}if(ue(bu(t),"ph-include"))return!0;var r=t.type||"";if(He(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!(He(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function J_(t){return!!(Kr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Kr(t,"select")||Kr(t,"textarea")||t.getAttribute("contenteditable")==="true")}var ew="(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})",yR=new RegExp("^(?:"+ew+")$"),_R=new RegExp(ew),tw="\\d{3}-?\\d{2}-?\\d{4}",wR=new RegExp("^("+tw+")$"),bR=new RegExp("("+tw+")");function Ps(t,e){return e===void 0&&(e=!0),!(ge(t)||He(t)&&(t=lu(t),(e?yR:_R).test((t||"").replace(/[- ]/g,""))||(e?wR:bR).test(t)))}function nw(t){var e=xu(t);return Ps(e=(e+" "+rw(t)).trim())?e:""}function rw(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ke(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=xu(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+rw(n)).trim())}catch(s){U.error("[AutoCapture]",s)}}),e}function xR(t){return function(e){var n=e.map(r=>{var i,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+="."+a.replace(/"/g,"");var l=j({},r.text?{text:r.text}:{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return pu(l).sort((c,f)=>{var[d]=c,[h]=f;return d.localeCompare(h)}).forEach(c=>{var[f,d]=c;return u[iw(f.toString())]=iw(d.toString())}),o+=":",o+=pu(u).map(c=>{var[f,d]=c;return f+'="'+d+'"'}).join("")});return n.join(";")}(function(e){return e.map(n=>{var r,i,s={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)==null?void 0:i.slice(0,2048),attr_class:kR(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return pu(n).filter(o=>{var[a]=o;return a.indexOf("attr__")===0}).forEach(o=>{var[a,l]=o;return s.attributes[a]=l}),s})}(t))}function iw(t){return t.replace(/"|\\"/g,'\\"')}function kR(t){var e=t.attr__class;return e?$e(e)?e:wh(e):void 0}class sw{constructor(){this.clicks=[]}isRageClick(e,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var Sh="$copy_autocapture",mr=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),SR=["localhost","127.0.0.1"],Ms=t=>{var e=B==null?void 0:B.createElement("a");return D(e)?null:(e.href=t,e)},ER=function(t,e){var n,r;e===void 0&&(e="&");var i=[];return ke(t,function(s,o){D(s)||D(o)||o==="undefined"||(n=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(o),i[i.length]=r+"="+n)}),i.join(e)},ku=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!$e(n)||n.length<2)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{U.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Eh=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[0]||"",s=r[1],o=i.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],f=0;f<u.length;f++){var d=u[f].split("=");$e(d)&&(e.includes(d[0])?c.push(d[0]+"="+n):c.push(u[f]))}var h=l;return a!=null&&(h+="?"+c.join("&")),s!=null&&(h+="#"+s),h},Su=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},ow=Ye("[AutoCapture]");function $h(t,e){return e.length>t?e.slice(0,t)+"...":e}function $R(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!wu(e));return e}function CR(t,e,n,r){var i=t.tagName.toLowerCase(),s={tag_name:i};bh.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=$h(1024,nw(t)):s.$el_text=$h(1024,xu(t)));var o=bu(t);o.length>0&&(s.classes=o.filter(function(c){return c!==""})),ke(t.attributes,function(c){var f;if((!J_(t)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(r==null||!r.includes(c.name))&&!e&&Ps(c.value)&&(f=c.name,!He(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var d=c.value;c.name==="class"&&(d=wh(d).join(" ")),s["attr__"+c.name]=$h(1024,d)}});for(var a=1,l=1,u=t;u=$R(u);)a++,u.tagName===t.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function RR(t,e){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[t],c=t;c.parentNode&&!Kr(c,"body");)V_(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var f,d=[],h={},p=!1,g=!1;if(ke(u,b=>{var x=kh(b);b.tagName.toLowerCase()==="a"&&(p=b.getAttribute("href"),p=x&&p&&Ps(p)&&p),ue(bu(b),"ph-no-capture")&&(g=!0),d.push(CR(b,s,o,a));var k=function($){if(!kh($))return{};var C={};return ke($.attributes,function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var F=q.name.replace("data-ph-capture-attribute-",""),I=q.value;F&&I&&Ps(I)&&(C[F]=I)}}),C}(b);qe(h,k)}),g)return{props:{},explicitNoCapture:g};if(o||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?d[0].$el_text=nw(t):d[0].$el_text=xu(t)),p){var w,m;d[0].attr__href=p;var v=(w=Ms(p))==null?void 0:w.host,y=E==null||(m=E.location)==null?void 0:m.host;v&&y&&v!==y&&(f=p)}return{props:qe({$event_type:i.type,$ce_version:1},l?{}:{$elements:d},{$elements_chain:xR(d)},(n=d[0])!=null&&n.$el_text?{$el_text:(r=d[0])==null?void 0:r.$el_text}:{},f&&i.type==="click"?{$external_click_url:f}:{},h)}}class TR{constructor(e){this.C=!1,this.M=null,this.rageclicks=new sw,this.O=!1,this.instance=e,this.F=null}get A(){var e,n,r=ze(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)==null?void 0:n.map(i=>new RegExp(i)),r}D(){if(this.isBrowserSupported()){if(E&&B){var e=r=>{r=r||(E==null?void 0:E.event);try{this.j(r)}catch(i){ow.error("Failed to capture event",i)}};if(Ne(B,"submit",e,{capture:!0}),Ne(B,"change",e,{capture:!0}),Ne(B,"click",e,{capture:!0}),this.A.capture_copied_text){var n=r=>{r=r||(E==null?void 0:E.event),this.j(r,Sh)};Ne(B,"copy",n,{capture:!0}),Ne(B,"cut",n,{capture:!0})}}}else ow.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.O=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[T_]:!!e.autocapture_opt_out}),this.M=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.F=e}getElementSelectors(e){var n,r=[];return(n=this.F)==null||n.forEach(i=>{var s=B==null?void 0:B.querySelectorAll(i);s==null||s.forEach(o=>{e===o&&r.push(i)})}),r}get isEnabled(){var e,n,r=(e=this.instance.persistence)==null?void 0:e.props[T_],i=this.M;if(gr(i)&&!Cn(r)&&!this.instance.L())return!1;var s=(n=this.M)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!s}j(e,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r,i=K_(e);q_(i)&&(i=i.parentNode||null),n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&function(d,h){if(!E||xh(d))return!1;var p,g;if((p=Cn(h)?!!h&&X_:(g=h==null?void 0:h.css_selector_ignorelist)!==null&&g!==void 0?g:X_)===!1)return!1;var{targetElementList:w}=Z_(d,!1);return!Y_(w,p)}(i,this.instance.config.rageclick)&&this.j(e,"$rageclick");var s=n===Sh;if(i&&mR(i,e,this.A,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=RR(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),n===Sh){var u,c=G_(E==null||(u=E.getSelection())==null?void 0:u.toString()),f=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=f}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return ln(B==null?void 0:B.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ht(t)&&isFinite(t)&&Math.floor(t)===t});var aw="0123456789abcdef";class Eu{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||n<0||r<0||i<0||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new Eu(s)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+aw.charAt(this.bytes[n]>>>4)+aw.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Eu(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class PR{constructor(){this.N=0,this.U=0,this.B=new MR}generate(){var e=this.generateOrAbort();if(D(e)){this.N=0;var n=this.generateOrAbort();if(D(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.q();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.q())}return Eu.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.B.nextUint32())}q(){this.U=1024*this.B.nextUint32()+(1023&this.B.nextUint32())}}var lw,uw=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};E&&!D(E.crypto)&&crypto.getRandomValues&&(uw=t=>crypto.getRandomValues(t));class MR{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(uw(this.H),this.W=0),this.H[this.W++]}}var Yr=()=>OR().toString(),OR=()=>(lw||(lw=new PR)).generate(),ia="",AR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function IR(t,e){if(e){var n=function(i,s){if(s===void 0&&(s=B),ia)return ia;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Yr();!ia&&a--;){var u=o.slice(a).join("."),c=l+"=1;domain=."+u+";path=/";s.cookie=c+";max-age=3",s.cookie.includes(l)&&(s.cookie=c+";max-age=0",ia=u)}return ia}(t);if(!n){var r=(i=>{var s=i.match(AR);return s?s[0]:""})(t);r!==n&&U.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Wn={G:()=>!!B,V:function(t){U.error("cookieStore error: "+t)},J:function(t){if(B){try{for(var e=t+"=",n=B.cookie.split(";").filter(s=>s.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},K:function(t){var e;try{e=JSON.parse(Wn.J(t))||{}}catch{}return e},Y:function(t,e,n,r,i){if(B)try{var s="",o="",a=IR(B.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&U.warn("cookieStore warning: large cookie, len="+u.length),B.cookie=u,u}catch{return}},X:function(t,e){if(B!=null&&B.cookie)try{Wn.Y(t,"",-1,e)}catch{return}}},Ch=null,Qe={G:function(){if(!gr(Ch))return Ch;var t=!0;if(D(E))t=!1;else try{var e="__mplssupport__";Qe.Y(e,"xyz"),Qe.J(e)!=='"xyz"'&&(t=!1),Qe.X(e)}catch{t=!1}return t||U.error("localStorage unsupported; falling back to cookie store"),Ch=t,t},V:function(t){U.error("localStorage error: "+t)},J:function(t){try{return E==null?void 0:E.localStorage.getItem(t)}catch(e){Qe.V(e)}return null},K:function(t){try{return JSON.parse(Qe.J(t))||{}}catch{}return null},Y:function(t,e){try{E==null||E.localStorage.setItem(t,JSON.stringify(e))}catch(n){Qe.V(n)}},X:function(t){try{E==null||E.localStorage.removeItem(t)}catch(e){Qe.V(e)}}},FR=["distinct_id",gu,Rs,_u,yu],$u=j({},Qe,{K:function(t){try{var e={};try{e=Wn.K(t)||{}}catch{}var n=qe(e,JSON.parse(Qe.J(t)||"{}"));return Qe.Y(t,n),n}catch{}return null},Y:function(t,e,n,r,i,s){try{Qe.Y(t,e,void 0,void 0,s);var o={};FR.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&Wn.Y(t,o,n,r,i,s)}catch(a){Qe.V(a)}},X:function(t,e){try{E==null||E.localStorage.removeItem(t),Wn.X(t,e)}catch(n){Qe.V(n)}}}),Cu={},LR={G:function(){return!0},V:function(t){U.error("memoryStorage error: "+t)},J:function(t){return Cu[t]||null},K:function(t){return Cu[t]||null},Y:function(t,e){Cu[t]=e},X:function(t){delete Cu[t]}},Mi=null,st={G:function(){if(!gr(Mi))return Mi;if(Mi=!0,D(E))Mi=!1;else try{var t="__support__";st.Y(t,"xyz"),st.J(t)!=='"xyz"'&&(Mi=!1),st.X(t)}catch{Mi=!1}return Mi},V:function(t){U.error("sessionStorage error: ",t)},J:function(t){try{return E==null?void 0:E.sessionStorage.getItem(t)}catch(e){st.V(e)}return null},K:function(t){try{return JSON.parse(st.J(t))||null}catch{}return null},Y:function(t,e){try{E==null||E.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){st.V(n)}},X:function(t){try{E==null||E.sessionStorage.removeItem(t)}catch(e){st.V(e)}}},yr=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class DR{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?yr.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===yr.DENIED||this.consent===yr.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===yr.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.J(this.et);return ih(e)?yr.GRANTED:ue(B3,e)?yr.DENIED:yr.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?Qe:Wn;var n=e==="localStorage"?Wn:Qe;n.J(this.et)&&(this.rt.J(this.et)||this.optInOut(ih(n.J(this.et))),n.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!C_([Qt==null?void 0:Qt.doNotTrack,Qt==null?void 0:Qt.msDoNotTrack,ee.doNotTrack],e=>ih(e))}}var Ru=Ye("[Dead Clicks]"),NR=()=>!0,jR=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(A_)),r=t.instance.config.capture_dead_clicks;return Cn(r)?r:n};class cw{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[A_]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt(()=>{this.ot()})}nt(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Ru.error("failed to load script",i):e()})}ot(){var e;if(B){if(!this.st&&(e=ee.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=ze(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.st=ee.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.st.start(B),Ru.info("starting...")}}else Ru.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Ru.info("stopping..."))}}var sa=Ye("[ExceptionAutocapture]");class zR{constructor(e){var n,r,i;this.lt=()=>{var s;if(E&&this.isEnabled&&(s=ee.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=ee.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=ee.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=ee.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ut&&this.A.capture_unhandled_errors&&(this.ut=o(this.captureException.bind(this))),!this.ht&&this.A.capture_unhandled_rejections&&(this.ht=a(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=l(this.captureException.bind(this)))}catch(u){sa.error("failed to start",u),this.vt()}}},this._instance=e,this.ct=!((n=this._instance.persistence)==null||!n.props[P_]),this.A=this.ft(),this.gt=new y_({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,R:sa}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ze(e)?n=j({},n,e):(D(e)?this.ct:e)&&(n=j({},n,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(sa.info("enabled"),this.nt(this.lt))}nt(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&e(),(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return sa.error("failed to load script",i);e()})}vt(){var e,n,r;(e=this.ut)==null||e.call(this),this.ut=void 0,(n=this.ht)==null||n.call(this),this.ht=void 0,(r=this.dt)==null||r.call(this),this.dt=void 0}onRemoteConfig(e){var n=e.autocaptureExceptions;this.ct=!!n||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[P_]:this.ct}),this.startIfEnabled()}captureException(e){var n,r,i=(n=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&n!==void 0?n:"Exception";this.gt.consumeRateLimit(i)?sa.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}}function dw(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return ln(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}class HR{constructor(e){var n;this._instance=e,this._t=(E==null||(n=E.location)==null?void 0:n.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(U.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,U.info("History API monitoring stopped")}monitorHistoryChanges(){var e,n;if(E&&E.history){var r=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||dw(E.history,"pushState",i=>function(s,o,a){i.call(this,s,o,a),r.bt("pushState")}),(n=E.history.replaceState)!=null&&n.__posthog_wrapped__||dw(E.history,"replaceState",i=>function(s,o,a){i.call(this,s,o,a),r.bt("replaceState")}),this.wt()}}bt(e){try{var n,r=E==null||(n=E.location)==null?void 0:n.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=r}catch(i){U.error("Error capturing "+e+" pageview",i)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};Ne(E,"popstate",e),this.yt=()=>{E&&E.removeEventListener("popstate",e)}}}}function Tu(t){var e,n;return((e=JSON.stringify(t,(n=[],function(r,i){if(ze(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))==null?void 0:e.length)||0}function Rh(t,e){if(e===void 0&&(e=66060288e-1),t.size>=e&&t.data.length>1){var n=Math.floor(t.data.length/2),r=t.data.slice(0,n),i=t.data.slice(n);return[Rh({size:Tu(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),Rh({size:Tu(i),data:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(s=>s)}return[t]}var Gn=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Gn||{}),Rn=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(Rn||{}),Th="[SessionRecording]",Ph="redacted",Pu={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},UR=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],BR=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],qR=["/s/","/e/","/i/"];function fw(t,e,n,r){if(ge(t))return t;var i=(e==null?void 0:e["content-length"])||function(s){return new Blob([s]).size}(t);return He(i)&&(i=parseInt(i)),i>n?Th+" "+r+" body too large to record ("+i+" bytes)":t}function hw(t,e){if(ge(t))return t;var n=t;return Ps(n,!1)||(n=Th+" "+e+" body "+Ph),ke(BR,r=>{var i,s;(i=n)!=null&&i.length&&((s=n)==null?void 0:s.indexOf(r))!==-1&&(n=Th+" "+e+" body "+Ph+" as might contain: "+r)}),n}var VR=(t,e)=>{var n,r,i,s={payloadSizeLimitBytes:Pu.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Pu.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Pu.payloadHostDenyList]},o=t.session_recording.recordHeaders!==!1&&e.recordHeaders,a=t.session_recording.recordBody!==!1&&e.recordBody,l=t.capture_performance!==!1&&e.recordPerformance,u=(n=s,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),d=>(d!=null&&d.requestBody&&(d.requestBody=fw(d.requestBody,d.requestHeaders,i,"Request")),d!=null&&d.responseBody&&(d.responseBody=fw(d.responseBody,d.responseHeaders,i,"Response")),d)),c=d=>{return u(((g,w)=>{var m,v=Ms(g.name),y=w.indexOf("http")===0?(m=Ms(w))==null?void 0:m.pathname:w;y==="/"&&(y="");var b=v==null?void 0:v.pathname.replace(y||"","");if(!(v&&b&&qR.some(x=>b.indexOf(x)===0)))return g})((p=(h=d).requestHeaders,ge(p)||ke(Object.keys(p??{}),g=>{UR.includes(g.toLowerCase())&&(p[g]=Ph)}),h),t.api_host));var h,p},f=ln(t.session_recording.maskNetworkRequestFn);return f&&ln(t.session_recording.maskCapturedNetworkRequestFn)&&U.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(t.session_recording.maskCapturedNetworkRequestFn=d=>{var h=t.session_recording.maskNetworkRequestFn({url:d.name});return j({},d,{name:h==null?void 0:h.url})}),s.maskRequestFn=ln(t.session_recording.maskCapturedNetworkRequestFn)?d=>{var h,p=c(d);return p&&(h=t.session_recording.maskCapturedNetworkRequestFn==null?void 0:t.session_recording.maskCapturedNetworkRequestFn(p))!==null&&h!==void 0?h:void 0}:d=>function(h){if(!D(h))return h.requestBody=hw(h.requestBody,"Request"),h.responseBody=hw(h.responseBody,"Response"),h}(c(d)),j({},Pu,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class WR{constructor(e,n){var r,i;n===void 0&&(n={}),this.St={},this.kt=s=>{if(!this.St[s]){var o,a;this.St[s]=!0;var l=this.$t(s);(o=(a=this.t).onBlockedNode)==null||o.call(a,s,l)}},this.xt=s=>{var o=this.$t(s);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var a=o.closest("svg");if(a)return[this._rrweb.mirror.getId(a),a]}return[s,o]},this.$t=s=>this._rrweb.mirror.getNode(s),this.Et=s=>{var o,a,l,u,c,f,d,h;return((o=(a=s.removes)==null?void 0:a.length)!==null&&o!==void 0?o:0)+((l=(u=s.attributes)==null?void 0:u.length)!==null&&l!==void 0?l:0)+((c=(f=s.texts)==null?void 0:f.length)!==null&&c!==void 0?c:0)+((d=(h=s.adds)==null?void 0:h.length)!==null&&d!==void 0?d:0)},this.throttleMutations=s=>{if(s.type!==3||s.data.source!==0)return s;var o=s.data,a=this.Et(o);o.attributes&&(o.attributes=o.attributes.filter(u=>{var[c]=this.xt(u.id);return!this.gt.consumeRateLimit(c)&&u}));var l=this.Et(o);return l!==0||a===l?s:void 0},this._rrweb=e,this.t=n,this.gt=new y_({bucketSize:(r=this.t.bucketSize)!==null&&r!==void 0?r:100,refillRate:(i=this.t.refillRate)!==null&&i!==void 0?i:10,refillInterval:1e3,$:this.kt,R:U})}}var un=Uint8Array,Nt=Uint16Array,Os=Uint32Array,Mh=new un([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oh=new un([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pw=new un([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gw=function(t,e){for(var n=new Nt(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new Os(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},vw=gw(Mh,2),GR=vw[0],Ah=vw[1];GR[28]=258,Ah[258]=28;for(var mw=gw(Oh,0)[1],yw=new Nt(32768),Pe=0;Pe<32768;++Pe){var Oi=(43690&Pe)>>>1|(21845&Pe)<<1;Oi=(61680&(Oi=(52428&Oi)>>>2|(13107&Oi)<<2))>>>4|(3855&Oi)<<4,yw[Pe]=((65280&Oi)>>>8|(255&Oi)<<8)>>>1}var oa=function(t,e,n){for(var r=t.length,i=0,s=new Nt(e);i<r;++i)++s[t[i]-1];var o,a=new Nt(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new Nt(r),i=0;i<r;++i)o[i]=yw[a[t[i]-1]++]>>>15-t[i];return o},Ai=new un(288);for(Pe=0;Pe<144;++Pe)Ai[Pe]=8;for(Pe=144;Pe<256;++Pe)Ai[Pe]=9;for(Pe=256;Pe<280;++Pe)Ai[Pe]=7;for(Pe=280;Pe<288;++Pe)Ai[Pe]=8;var Mu=new un(32);for(Pe=0;Pe<32;++Pe)Mu[Pe]=5;var KR=oa(Ai,9),YR=oa(Mu,5),_w=function(t){return(t/8>>0)+(7&t&&1)},ww=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Nt?Nt:t instanceof Os?Os:un)(n-e);return r.set(t.subarray(e,n)),r},_r=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},aa=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},Ih=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new un(0),0];if(i==1){var o=new un(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(x,k){return x.f-k.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,f=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=i-1;)a=n[n[u].f<n[f].f?u++:f++],l=n[u!=c&&n[u].f<n[f].f?u++:f++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(r=1;r<i;++r)s[r].s>d&&(d=s[r].s);var h=new Nt(d+1),p=Fh(n[c-1],h,0);if(p>e){r=0;var g=0,w=p-e,m=1<<w;for(s.sort(function(x,k){return h[k.s]-h[x.s]||x.f-k.f});r<i;++r){var v=s[r].s;if(!(h[v]>e))break;g+=m-(1<<p-h[v]),h[v]=e}for(g>>>=w;g>0;){var y=s[r].s;h[y]<e?g-=1<<e-h[y]++-1:++r}for(;r>=0&&g;--r){var b=s[r].s;h[b]==e&&(--h[b],++g)}p=e}return[new un(h),p]},Fh=function(t,e,n){return t.s==-1?Math.max(Fh(t.l,e,n+1),Fh(t.r,e,n+1)):e[t.s]=n},bw=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Nt(++e),r=0,i=t[0],s=1,o=function(l){n[r++]=l},a=1;a<=e;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},la=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Lh=function(t,e,n){var r=n.length,i=_w(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<r;++s)t[i+s+4]=n[s];return 8*(i+4+r)},xw=function(t,e,n,r,i,s,o,a,l,u,c){_r(e,c++,n),++i[256];for(var f=Ih(i,15),d=f[0],h=f[1],p=Ih(s,15),g=p[0],w=p[1],m=bw(d),v=m[0],y=m[1],b=bw(g),x=b[0],k=b[1],$=new Nt(19),C=0;C<v.length;++C)$[31&v[C]]++;for(C=0;C<x.length;++C)$[31&x[C]]++;for(var q=Ih($,7),F=q[0],I=q[1],N=19;N>4&&!F[pw[N-1]];--N);var K,Z,H,re,ne=u+5<<3,R=la(i,Ai)+la(s,Mu)+o,L=la(i,d)+la(s,g)+o+14+3*N+la($,F)+(2*$[16]+3*$[17]+7*$[18]);if(ne<=R&&ne<=L)return Lh(e,c,t.subarray(l,l+u));if(_r(e,c,1+(L<R)),c+=2,L<R){K=oa(d,h),Z=d,H=oa(g,w),re=g;var z=oa(F,I);for(_r(e,c,y-257),_r(e,c+5,k-1),_r(e,c+10,N-4),c+=14,C=0;C<N;++C)_r(e,c+3*C,F[pw[C]]);c+=3*N;for(var ae=[v,x],M=0;M<2;++M){var le=ae[M];for(C=0;C<le.length;++C){var te=31&le[C];_r(e,c,z[te]),c+=F[te],te>15&&(_r(e,c,le[C]>>>5&127),c+=le[C]>>>12)}}}else K=KR,Z=Ai,H=YR,re=Mu;for(C=0;C<a;++C)if(r[C]>255){te=r[C]>>>18&31,aa(e,c,K[te+257]),c+=Z[te+257],te>7&&(_r(e,c,r[C]>>>23&31),c+=Mh[te]);var be=31&r[C];aa(e,c,H[be]),c+=re[be],be>3&&(aa(e,c,r[C]>>>5&8191),c+=Oh[be])}else aa(e,c,K[r[C]]),c+=Z[r[C]];return aa(e,c,K[256]),c+Z[256]},QR=new Os([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),XR=function(){for(var t=new Os(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),ZR=function(){var t=4294967295;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=XR[255&n^e[r]]^n>>>8;t=n},d:function(){return 4294967295^t}}},JR=function(t,e,n,r,i){return function(s,o,a,l,u,c){var f=s.length,d=new un(l+f+5*(1+Math.floor(f/7e3))+u),h=d.subarray(l,d.length-u),p=0;if(!o||f<8)for(var g=0;g<=f;g+=65535){var w=g+65535;w<f?p=Lh(h,p,s.subarray(g,w)):(h[g]=c,p=Lh(h,p,s.subarray(g,f)))}else{for(var m=QR[o-1],v=m>>>13,y=8191&m,b=(1<<a)-1,x=new Nt(32768),k=new Nt(b+1),$=Math.ceil(a/3),C=2*$,q=function(wr){return(s[wr]^s[wr+1]<<$^s[wr+2]<<C)&b},F=new Os(25e3),I=new Nt(288),N=new Nt(32),K=0,Z=0,H=(g=0,0),re=0,ne=0;g<f;++g){var R=q(g),L=32767&g,z=k[R];if(x[L]=z,k[R]=L,re<=g){var ae=f-g;if((K>7e3||H>24576)&&ae>423){p=xw(s,h,0,F,I,N,Z,H,ne,g-ne,p),H=K=Z=0,ne=g;for(var M=0;M<286;++M)I[M]=0;for(M=0;M<30;++M)N[M]=0}var le=2,te=0,be=y,ie=L-z&32767;if(ae>2&&R==q(g-ie))for(var Me=Math.min(v,ae)-1,ye=Math.min(32767,g),dn=Math.min(258,ae);ie<=ye&&--be&&L!=z;){if(s[g+le]==s[g+le-ie]){for(var Ct=0;Ct<dn&&s[g+Ct]==s[g+Ct-ie];++Ct);if(Ct>le){if(le=Ct,te=ie,Ct>Me)break;var Ue=Math.min(ie,Ct-2),ji=0;for(M=0;M<Ue;++M){var zs=g-ie+M+32768&32767,zi=zs-x[zs]+32768&32767;zi>ji&&(ji=zi,z=zs)}}}ie+=(L=z)-(z=x[L])+32768&32767}if(te){F[H++]=268435456|Ah[le]<<18|mw[te];var qu=31&Ah[le],Xn=31&mw[te];Z+=Mh[qu]+Oh[Xn],++I[257+qu],++N[Xn],re=g+le,++K}else F[H++]=s[g],++I[s[g]]}}p=xw(s,h,c,F,I,N,Z,H,ne,g-ne,p)}return ww(d,0,l+_w(p)+u)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!0)},Dh=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},eT=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Dh(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},tT=function(t){return 10+(t.filename&&t.filename.length+1||0)};function kw(t,e){e===void 0&&(e={});var n=ZR(),r=t.length;n.p(t);var i=JR(t,e,tT(e),8),s=i.length;return eT(i,e),Dh(i,s-8,n.d()),Dh(i,s-4,r),i}function Sw(t,e){var n=t.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new un(t.length+(t.length>>>1)),i=0,s=function(u){r[i++]=u},o=0;o<n;++o){if(i+5>r.length){var a=new un(i+8+(n-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||e?s(l):l<2048?(s(192|l>>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return ww(r,0,i)}function nT(t,e){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(t)%100<Xt(100*e,0,100,U)}var Qr="disabled",Nh="sampled",Ou="active",Ii="buffering",jh="paused",zh="trigger",Kn=zh+"_activated",pt=zh+"_pending",Yn=zh+"_"+Qr;function Ew(t,e){return e.some(n=>n.matching==="regex"&&new RegExp(n.url).test(t))}class $w{constructor(e){this.Rt=e}triggerStatus(e){var n=this.Rt.map(r=>r.triggerStatus(e));return n.includes(Kn)?Kn:n.includes(pt)?pt:Yn}stop(){this.Rt.forEach(e=>e.stop())}}class Cw{constructor(e){this.Rt=e}triggerStatus(e){var n=new Set;for(var r of this.Rt)n.add(r.triggerStatus(e));switch(n.delete(Yn),n.size){case 0:return Yn;case 1:return Array.from(n)[0];default:return pt}}stop(){this.Rt.forEach(e=>e.stop())}}class rT{triggerStatus(){return pt}stop(){}}var Au=t=>"sessionRecording"in t;class iT{constructor(e){this.It=[],this.Pt=[],this.urlBlocked=!1,this._instance=e}onConfig(e){var n,r;this.It=(Au(e)?(n=e.sessionRecording)==null?void 0:n.urlTriggers:e==null?void 0:e.urlTriggers)||[],this.Pt=(Au(e)?(r=e.sessionRecording)==null?void 0:r.urlBlocklist:e==null?void 0:e.urlBlocklist)||[]}onRemoteConfig(e){this.onConfig(e)}Tt(e){var n;return this.It.length===0?Yn:((n=this._instance)==null?void 0:n.get_property(fh))===e?Kn:pt}triggerStatus(e){var n=this.Tt(e),r=n===Kn?Kn:n===pt?pt:Yn;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlTriggerConditions(e,n,r){if(E!==void 0&&E.location.href){var i=E.location.href,s=this.urlBlocked,o=Ew(i,this.Pt);s&&o||(o&&!s?e():!o&&s&&n(),Ew(i,this.It)&&r("url"))}}stop(){}}class sT{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=e}triggerStatus(){var e=pt;return ge(this.linkedFlag)&&(e=Yn),this.linkedFlagSeen&&(e=Kn),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onConfig(e,n){var r;if(this.linkedFlag=(Au(e)?(r=e.sessionRecording)==null?void 0:r.linkedFlag:e==null?void 0:e.linkedFlag)||null,!ge(this.linkedFlag)&&!this.linkedFlagSeen){var i=He(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=He(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags((o,a)=>{var l=!1;if(ze(a)&&i in a){var u=a[i];l=Cn(u)?u===!0:s?u===s:!!u}this.linkedFlagSeen=l,l&&n(i,s)})}}onRemoteConfig(e,n){this.onConfig(e,n)}stop(){this.Ct()}}class oT{constructor(e){this.Mt=[],this._instance=e}onConfig(e){var n;this.Mt=(Au(e)?(n=e.sessionRecording)==null?void 0:n.eventTriggers:e==null?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}Ot(e){var n;return this.Mt.length===0?Yn:((n=this._instance)==null?void 0:n.get_property(hh))===e?Kn:pt}triggerStatus(e){var n=this.Ot(e),r=n===Kn?Kn:n===pt?pt:Yn;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}stop(){}}function aT(t){return t.isRecordingEnabled?Ii:Qr}function lT(t){if(!t.receivedFlags)return Ii;if(!t.isRecordingEnabled)return Qr;if(t.urlTriggerMatching.urlBlocked)return jh;var e=t.isSampled===!0,n=new $w([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Nh:n===Kn?Ou:n===pt?Ii:t.isSampled===!1?Qr:Ou}function uT(t){if(!t.receivedFlags)return Ii;if(!t.isRecordingEnabled)return Qr;if(t.urlTriggerMatching.urlBlocked)return jh;var e=new Cw([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==Yn,r=Cn(t.isSampled);return n&&e===pt?Ii:n&&e===Yn||r&&!t.isSampled?Qr:t.isSampled===!0?Nh:Ou}var ua="[SessionRecording]",tt=Ye(ua);function Iu(){var t;return ee==null||(t=ee.__PosthogExtensions__)==null||(t=t.rrweb)==null?void 0:t.record}var cT=3e5,dT=[Rn.MouseMove,Rn.MouseInteraction,Rn.Scroll,Rn.ViewportResize,Rn.Input,Rn.TouchMove,Rn.MediaInteraction,Rn.Drag],Rw=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Fi(t){return function(e,n){for(var r="",i=0;i<e.length;){var s=e[i++];r+=String.fromCharCode(s)}return r}(kw(Sw(JSON.stringify(t))))}function Tw(t){return t.type===Gn.Custom&&t.data.tag==="sessionIdle"}class Pw{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(ua+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var e,n;return this.Nt.triggerStatus(this.sessionId)===pt?6e4:(e=(n=this._instance.config.session_recording)==null?void 0:n.full_snapshot_interval_millis)!==null&&e!==void 0?e:cT}get Ut(){var e=this._instance.get_property(Rs);return Cn(e)?e:null}get zt(){var e,n,r=(e=this.H)==null?void 0:e.data[((n=this.H)==null?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.jt.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get Bt(){var e=!!this._instance.get_property(dh),n=!this._instance.config.disable_session_recording;return E&&e&&n}get qt(){var e=!!this._instance.get_property(F_),n=this._instance.config.enable_recording_console_log;return n??e}get Ht(){var e,n,r,i,s,o,a=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(N_),u=(e=(n=a==null?void 0:a.recordCanvas)!==null&&n!==void 0?n:l==null?void 0:l.enabled)!==null&&e!==void 0&&e,c=(r=(i=a==null?void 0:a.canvasFps)!==null&&i!==void 0?i:l==null?void 0:l.fps)!==null&&r!==void 0?r:4,f=(s=(o=a==null?void 0:a.canvasQuality)!==null&&o!==void 0?o:l==null?void 0:l.quality)!==null&&s!==void 0?s:.4;if(typeof f=="string"){var d=parseFloat(f);f=isNaN(d)?.4:d}return{enabled:u,fps:Xt(c,0,12,tt.createLogger("canvas recording fps"),4),quality:Xt(f,0,1,tt.createLogger("canvas recording quality"),.4)}}get Wt(){var e,n,r=this._instance.get_property(L_),i={recordHeaders:(e=this._instance.config.session_recording)==null?void 0:e.recordHeaders,recordBody:(n=this._instance.config.session_recording)==null?void 0:n.recordBody},s=(i==null?void 0:i.recordHeaders)||(r==null?void 0:r.recordHeaders),o=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),a=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(Cn(a)?a:r!=null&&r.capturePerformance);return s||o||l?{recordHeaders:s,recordBody:o,recordPerformance:l}:void 0}get Gt(){var e,n,r,i,s,o,a=this._instance.get_property(D_),l={maskAllInputs:(e=this._instance.config.session_recording)==null?void 0:e.maskAllInputs,maskTextSelector:(n=this._instance.config.session_recording)==null?void 0:n.maskTextSelector,blockSelector:(r=this._instance.config.session_recording)==null?void 0:r.blockSelector},u=(i=l==null?void 0:l.maskAllInputs)!==null&&i!==void 0?i:a==null?void 0:a.maskAllInputs,c=(s=l==null?void 0:l.maskTextSelector)!==null&&s!==void 0?s:a==null?void 0:a.maskTextSelector,f=(o=l==null?void 0:l.blockSelector)!==null&&o!==void 0?o:a==null?void 0:a.blockSelector;return D(u)&&D(c)&&D(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:c,blockSelector:f}}get Vt(){var e=this._instance.get_property(j_);return ht(e)?e:null}get Jt(){var e=this._instance.get_property(z_);return ht(e)?e:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.Bt,isSampled:this.Ut,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):Ii}constructor(e){if(this.Yt=aT,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new rT,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.ui()},this.hi=()=>{this.tryAddCustomEvent("browser offline",{})},this.di=()=>{this.tryAddCustomEvent("browser online",{})},this.vi=()=>{if(B!=null&&B.visibilityState){var i="window "+B.visibilityState;this.tryAddCustomEvent(i,{})}},this._instance=e,this.Dt=!1,this.ci="/s/",this.fi=void 0,this.Kt=!1,!this._instance.sessionManager)throw tt.error("started without valid sessionManager"),new Error(ua+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(ua+' cannot be used with cookieless_mode="always"');this.Zt=new sT(this._instance),this.Xt=new iT(this._instance),this.Qt=new oT(this._instance);var{sessionId:n,windowId:r}=this.jt.checkAndGetSessionAndWindowId();this.Ft=n,this.pi=r,this.H=this.gi(),this.At>=this.jt.sessionTimeoutMs&&tt.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.Bt?(this.mi(e),Ne(E,"beforeunload",this.li),Ne(E,"offline",this.hi),Ne(E,"online",this.di),Ne(E,"visibilitychange",this.vi),this.yi(),this.bi(),ge(this.ri)&&(this.ri=this._instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this.wi(n==null?void 0:n.properties.$current_url):"";if(!r)return;this.tryAddCustomEvent("$pageview",{href:r})}}catch(i){tt.error("Could not add $pageview to rrweb session",i)}})),this.si||(this.si=this.jt.onSessionId((n,r,i)=>{var s,o;i&&(this.tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(s=this._instance)==null||(s=s.persistence)==null||s.unregister(hh),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(fh))}))):this.stopRecording()}stopRecording(){var e,n,r,i;this.Dt&&this.fi&&(this.fi(),this.fi=void 0,this.Dt=!1,E==null||E.removeEventListener("beforeunload",this.li),E==null||E.removeEventListener("offline",this.hi),E==null||E.removeEventListener("online",this.di),E==null||E.removeEventListener("visibilitychange",this.vi),this.gi(),clearInterval(this.Si),(e=this.ri)==null||e.call(this),this.ri=void 0,(n=this.ai)==null||n.call(this),this.ai=void 0,(r=this.si)==null||r.call(this),this.si=void 0,(i=this.oi)==null||i.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),tt.info("stopped"))}ki(){var e;(e=this._instance.persistence)==null||e.unregister(Rs)}$i(e){var n,r=this.Ft!==e,i=this.Vt;if(ht(i)){var s=this.Ut,o=r||!Cn(s),a=o?nT(e,i):s;o&&(a?this.xi(Nh):tt.warn("Sample rate ("+i+") has determined that this sessionId ("+e+") will not be sent to the server."),this.tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:a})),(n=this._instance.persistence)==null||n.register({[Rs]:a})}else this.ki()}onRemoteConfig(e){var n,r,i,s;this.tryAddCustomEvent("$remote_config_received",e),this.Ei(e),(n=e.sessionRecording)!=null&&n.endpoint&&(this.ci=(s=e.sessionRecording)==null?void 0:s.endpoint),this.yi(),((r=e.sessionRecording)==null?void 0:r.triggerMatchType)==="any"?(this.Yt=lT,this.Nt=new $w([this.Qt,this.Xt])):(this.Yt=uT,this.Nt=new Cw([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(i=e.sessionRecording)==null?void 0:i.triggerMatchType}),this.Xt.onConfig(e),this.Qt.onConfig(e),this.Zt.onConfig(e,(o,a)=>{this.xi("linked_flag_matched",{flag:o,variant:a})}),this.Kt=!0,this.startIfEnabledOrStop()}yi(){ht(this.Vt)&&ge(this.oi)&&(this.oi=this.jt.onSessionId(e=>{this.$i(e)}))}Ei(e){if(this._instance.persistence){var n,r=this._instance.persistence,i=()=>{var s,o,a,l,u,c,f,d,h,p=(s=e.sessionRecording)==null?void 0:s.sampleRate,g=ge(p)?null:parseFloat(p);ge(g)&&this.ki();var w=(o=e.sessionRecording)==null?void 0:o.minimumDurationMilliseconds;r.register({[dh]:!!e.sessionRecording,[F_]:(a=e.sessionRecording)==null?void 0:a.consoleLogRecordingEnabled,[L_]:j({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[D_]:(u=e.sessionRecording)==null?void 0:u.masking,[N_]:{enabled:(c=e.sessionRecording)==null?void 0:c.recordCanvas,fps:(f=e.sessionRecording)==null?void 0:f.canvasFps,quality:(d=e.sessionRecording)==null?void 0:d.canvasQuality},[j_]:g,[z_]:D(w)?null:w,[H_]:(h=e.sessionRecording)==null?void 0:h.scriptConfig})};i(),(n=this.ni)==null||n.call(this),this.ni=this.jt.onSessionId(i)}}log(e,n){var r;n===void 0&&(n="log"),(r=this._instance.sessionRecording)==null||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}mi(e){if(!D(Object.assign)&&!D(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var n;this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),Iu()?this.Ri():(n=ee.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.Ii,r=>{if(r)return tt.error("could not load recorder",r);this.Ri()}),tt.info("starting"),this.status===Ou&&this.xi(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(H_))==null?void 0:e.script)||"recorder"}Pi(e){var n;return e.type===3&&dT.indexOf((n=e.data)==null?void 0:n.source)!==-1}Ti(e){var n=this.Pi(e);n||this.ii||e.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.Si),this.tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.ui());var r=!1;if(n&&(this.ei=e.timestamp,this.ii)){var i=this.ii==="unknown";this.ii=!1,i||(this.tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!this.ii){var{windowId:s,sessionId:o}=this.jt.checkAndGetSessionAndWindowId(!n,e.timestamp),a=this.Ft!==o,l=this.pi!==s;this.pi=s,this.Ft=o,a||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this.Ci()}}Mi(e){try{return e.rrwebMethod(),!0}catch(n){return this.ti.length<10?this.ti.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):tt.warn("could not emit queued rrweb event.",n,e),!1}}tryAddCustomEvent(e,n){return this.Mi(Rw(()=>Iu().addCustomEvent(e,n)))}Oi(){return this.Mi(Rw(()=>Iu().takeFullSnapshot()))}Ri(){var e,n,r,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this._instance.config.session_recording;for(var[a,l]of Object.entries(o||{}))a in s&&(a==="maskInputOptions"?s.maskInputOptions=j({password:!0},l):s[a]=l);this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt&&(s.maskAllInputs=(n=this.Gt.maskAllInputs)===null||n===void 0||n,s.maskTextSelector=(r=this.Gt.maskTextSelector)!==null&&r!==void 0?r:void 0,s.blockSelector=(i=this.Gt.blockSelector)!==null&&i!==void 0?i:void 0);var u=Iu();if(u){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new WR(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(f,d)=>{var h="Too many mutations on node '"+f+"'. Rate limiting. This could be due to SVG animations or something similar";tt.info(h,{node:d}),this.log(ua+" "+h,"warn")}});var c=this.Ai();this.fi=u(j({emit:f=>{this.onRRwebEmit(f)},plugins:c},s)),this.ei=Date.now(),this.ii=Cn(this.ii)?this.ii:"unknown",this.tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:c.map(f=>f==null?void 0:f.name)}),this.tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else tt.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ci(){if(this.Si&&clearInterval(this.Si),this.ii!==!0){var e=this.Lt;e&&(this.Si=setInterval(()=>{this.Oi()},e))}}Ai(){var e,n,r=[],i=(e=ee.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;i&&this.qt&&r.push(i());var s=(n=ee.__PosthogExtensions__)==null||(n=n.rrwebPlugins)==null?void 0:n.getRecordNetworkPlugin;return this.Wt&&ln(s)&&(!SR.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(VR(this._instance.config,this.Wt))):tt.info("NetworkCapture not started because we are on localhost.")),r}onRRwebEmit(e){var n;if(this.Di(),e&&ze(e)){if(e.type===Gn.Meta){var r=this.wi(e.data.href);if(this.ji=r,!r)return;e.data.href=r}else this.Li();if(this.Xt.checkUrlTriggerConditions(()=>this.Ni(),()=>this.Ui(),d=>this.zi(d)),!this.Xt.urlBlocked||(i=e).type===Gn.Custom&&i.data.tag==="recording paused"){var i;e.type===Gn.FullSnapshot&&this.Ci(),e.type===Gn.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===pt&&this.Bi();var s=this.Fi?this.Fi.throttleMutations(e):e;if(s){var o=function(d){var h=d;if(h&&ze(h)&&h.type===6&&ze(h.data)&&h.data.plugin==="rrweb/console@1"){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var p=[],g=0;g<h.data.payload.payload.length;g++)h.data.payload.payload[g]&&h.data.payload.payload[g].length>2e3?p.push(h.data.payload.payload[g].slice(0,2e3)+"...[truncated]"):p.push(h.data.payload.payload[g]);return h.data.payload.payload=p,d}return d}(s);if(this.Ti(o),this.ii!==!0||Tw(o)){if(Tw(o)){var a=o.data.payload;if(a){var l=a.lastActivityTimestamp,u=a.threshold;o.timestamp=l+u}}var c=(n=this._instance.config.session_recording.compress_events)===null||n===void 0||n?function(d){try{if(d.type===Gn.FullSnapshot)return j({},d,{data:Fi(d.data),cv:"2024-10"});if(d.type===Gn.IncrementalSnapshot&&d.data.source===Rn.Mutation)return j({},d,{cv:"2024-10",data:j({},d.data,{texts:Fi(d.data.texts),attributes:Fi(d.data.attributes),removes:Fi(d.data.removes),adds:Fi(d.data.adds)})});if(d.type===Gn.IncrementalSnapshot&&d.data.source===Rn.StyleSheetRule)return j({},d,{cv:"2024-10",data:j({},d.data,{adds:d.data.adds?Fi(d.data.adds):void 0,removes:d.data.removes?Fi(d.data.removes):void 0})})}catch(h){tt.error("could not compress event - will use uncompressed event",h)}return d}(o):o,f={$snapshot_bytes:Tu(c),$snapshot_data:c,$session_id:this.Ft,$window_id:this.pi};this.status!==Qr?this.qi(f):this.gi()}}}}}Li(){if(!this._instance.config.capture_pageview&&E){var e=this.wi(E.location.href);this.ji!==e&&(this.tryAddCustomEvent("$url_changed",{href:e}),this.ji=e)}}Di(){if(this.ti.length){var e=[...this.ti];this.ti=[],e.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this.Mi(n)})}}wi(e){var n=this._instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:e};return(r=i=n.maskNetworkRequestFn(i))==null?void 0:r.url}return e}Bi(){if(!this.H||this.H.data.length===0)return this.gi();for(var e=-1,n=this.H.data.length-1;n>=0;n--)if(this.H.data[n].type===Gn.Meta){e=n;break}return e>=0?(this.H.data=this.H.data.slice(e),this.H.size=this.H.data.reduce((r,i)=>r+Tu(i),0),this.H):this.gi()}gi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.pi},this.H}ui(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var e=this.Jt,n=this.zt,r=ht(n)&&n>=0,i=ht(e)&&r&&n<e;return this.status===Ii||this.status===jh||this.status===Qr||i?(this.Hi=setTimeout(()=>{this.ui()},2e3),this.H):(this.H.data.length>0&&Rh(this.H).forEach(s=>{this.Wi({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId,$lib:"web",$lib_version:pr.LIB_VERSION})}),this.gi())}qi(e){var n,r=2+(((n=this.H)==null?void 0:n.data.length)||0);!this.ii&&(this.H.size+e.$snapshot_bytes+r>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.ui()),this.H.size+=e.$snapshot_bytes,this.H.data.push(e.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout(()=>{this.ui()},2e3))}Wi(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.ci),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(e){var n;this.Nt.triggerStatus(this.sessionId)===pt&&((n=this._instance)==null||(n=n.persistence)==null||n.register({[e==="url"?fh:hh]:this.Ft}),this.ui(),this.xi(e+"_trigger_matched"))}Ni(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.Si),tt.info("recording paused due to URL blocker"),this.tryAddCustomEvent("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Oi(),this.Ci(),this.tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),tt.info("recording resumed"))}bi(){this.Qt.Mt.length!==0&&ge(this.ai)&&(this.ai=this._instance.on("eventCaptured",e=>{try{this.Qt.Mt.includes(e.event)&&this.zi("event")}catch(n){tt.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Oi(),this.xi("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)==null||e.register({[Rs]:!0}),this.Oi(),this.xi("sampling_overridden")}overrideTrigger(e){this.zi(e)}xi(e,n){this._instance.register_for_session({$session_recording_start_reason:e}),tt.info(e.replace("_"," "),n),ue(["recording_initialized","session_id_changed"],e)||this.tryAddCustomEvent(e,n)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.zt,$sdk_debug_session_start:e}}}var Hh=Ye("[SegmentIntegration]");function fT(t,e){var n=t.config.segment;if(!n)return e();(function(r,i){var s=r.config.segment;if(!s)return i();var o=l=>{var u=()=>l.anonymousId()||Yr();r.config.get_device_id=u,l.id()&&(r.register({distinct_id:l.id(),$device_id:u()}),r.persistence.set_property(vr,"identified")),i()},a=s.user();"then"in a&&ln(a.then)?a.then(l=>o(l)):o(a)})(t,()=>{n.register((r=>{Promise&&Promise.resolve||Hh.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Hh.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Hh.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var a=r.calculateEventProperties(o,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(t)).then(()=>{e()})})}var Mw="posthog-js";function Ow(t,e){var{organization:n,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,f,d;if(!(s==="*"||s.includes(a.level))||!t.__loaded)return a;a.tags||(a.tags={});var h=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=h,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=((l=a.exception)==null?void 0:l.values)||[],g=p.map(m=>j({},m,{stacktrace:m.stacktrace?j({},m.stacktrace,{type:"raw",frames:(m.stacktrace.frames||[]).map(v=>j({},v,{platform:"web:javascript"}))}):void 0})),w={$exception_message:((u=p[0])==null?void 0:u.value)||a.message,$exception_type:(c=p[0])==null?void 0:c.type,$exception_personURL:h,$exception_level:a.level,$exception_list:g,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((f=p[0])==null?void 0:f.value)||a.message,$sentry_exception_type:(d=p[0])==null?void 0:d.type,$sentry_tags:a.tags};return n&&r&&(w.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&t.exceptions.sendExceptionEvent(w),a}}class hT{constructor(e,n,r,i,s,o){this.name=Mw,this.setupOnce=function(a){a(Ow(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}var pT=E!=null&&E.location?Su(E.location.hash,"__posthog")||Su(location.hash,"state"):null,Aw="_postHogToolbarParams",Iw=Ye("[Toolbar]"),Xr=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Xr||{});class gT{constructor(e){this.instance=e}Gi(e){ee.ph_toolbar_state=e}Vi(){var e;return(e=ee.ph_toolbar_state)!==null&&e!==void 0?e:Xr.UNINITIALIZED}maybeLoadToolbar(e,n,r){if(e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),!E||!B)return!1;e=e??E.location,r=r??E.history;try{if(!n){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}n=E==null?void 0:E.localStorage}var i,s=pT||Su(e.hash,"__posthog")||Su(e.hash,"state"),o=s?$_(()=>JSON.parse(atob(decodeURIComponent(s))))||$_(()=>JSON.parse(decodeURIComponent(s))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(n.getItem(Aw)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}Ji(e){var n=ee.ph_load_toolbar||ee.ph_load_editor;!ge(n)&&ln(n)?n(e,this.instance):Iw.warn("No toolbar load function found")}loadToolbar(e){var n=!(B==null||!B.getElementById(U_));if(!E||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=j({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(E.localStorage.setItem(Aw,JSON.stringify(j({},i,{source:void 0}))),this.Vi()===Xr.LOADED)this.Ji(i);else if(this.Vi()===Xr.UNINITIALIZED){var s;this.Gi(Xr.LOADING),(s=ee.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return Iw.error("[Toolbar] Failed to load",o),void this.Gi(Xr.UNINITIALIZED);this.Gi(Xr.LOADED),this.Ji(i)}),Ne(E,"turbolinks:load",()=>{this.Gi(Xr.UNINITIALIZED),this.loadToolbar(i)})}return!0}Ki(e){return this.loadToolbar(e)}maybeLoadEditor(e,n,r){return e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,n,r)}}var vT=Ye("[TracingHeaders]");class mT{constructor(e){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var n,r;D(this.Yi)&&((n=ee.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),D(this.Xi)&&((r=ee.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&e(),(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return vT.error("failed to load script",i);e()})}startIfEnabledOrStop(){var e,n;this._instance.config.__add_tracing_headers?this.nt(this.lt):((e=this.Yi)==null||e.call(this),(n=this.Xi)==null||n.call(this),this.Yi=void 0,this.Xi=void 0)}}var Zr=Ye("[Web Vitals]"),Fw=9e5;class yT{constructor(e){var n;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),this.H.metrics.length!==0&&(this._instance.capture("$web_vitals",this.H.metrics.reduce((r,i)=>j({},r,{["$web_vitals_"+i.name+"_event"]:j({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=r=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(D(s))Zr.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.ee();D(o)||(ge(r==null?void 0:r.name)||ge(r==null?void 0:r.value)?Zr.error("Invalid metric received",r):this.re&&r.value>=this.re?Zr.error("Ignoring metric with value >= "+this.re,r):(this.H.url!==o&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),D(this.H.url)&&(this.H.url=o),this.H.firstMetricTimestamp=D(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.H.metrics.push(j({},r,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()))}},this.lt=()=>{var r,i,s,o,a=ee.__PosthogExtensions__;D(a)||D(a.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),r&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.ie.bind(this)),this.C=!0):Zr.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Qi=!((n=this._instance.persistence)==null||!n.props[O_]),this.startIfEnabled()}get allowedMetrics(){var e,n,r=ze(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return D(r)?((n=this._instance.persistence)==null?void 0:n.props[I_])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var e=ze(this._instance.config.capture_performance)&&ht(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Fw;return 0<e&&e<=6e4?Fw:e}get isEnabled(){var e=Lt==null?void 0:Lt.protocol;if(e!=="http:"&&e!=="https:")return Zr.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=ze(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Cn(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Cn(n)?n:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Zr.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var n=ze(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=ze(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[O_]:n}),this._instance.persistence.register({[I_]:r})),this.Qi=n,this.startIfEnabled()}nt(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&e(),(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",i=>{i?Zr.error("failed to load script",i):e()})}ee(){var e=E?E.location.href:void 0;return e||Zr.error("Could not determine current URL"),e}}var _T=Ye("[Heatmaps]");function Lw(t){return ze(t)&&"clientX"in t&&"clientY"in t&&ht(t.clientX)&&ht(t.clientY)}class wT{constructor(e){var n;this.rageclicks=new sw,this.Qi=!1,this.C=!1,this.se=null,this.instance=e,this.Qi=!((n=this.instance.persistence)==null||!n.props[lh])}get flushIntervalMilliseconds(){var e=5e3;return ze(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return D(this.instance.config.capture_heatmaps)?D(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;_T.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var e,n;clearInterval((e=this.se)!==null&&e!==void 0?e:void 0),(n=this.ae)==null||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[lh]:n}),this.Qi=n,this.startIfEnabled()}getAndClearBuffer(){var e=this.H;return this.H=void 0,e}le(e){this.ue(e.originalEvent,"deadclick")}ne(){E&&B&&(Ne(E,"beforeunload",this.oe.bind(this)),Ne(B,"click",e=>this.ue(e||(E==null?void 0:E.event)),{capture:!0}),Ne(B,"mousemove",e=>this.he(e||(E==null?void 0:E.event)),{capture:!0}),this.ae=new cw(this.instance,NR,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(e,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(a,l,u){for(var c=a;c&&wu(c)&&!Kr(c,"body");){if(c===u)return!1;if(ue(l,E==null?void 0:E.getComputedStyle(c).position))return!0;c=Q_(c)}return!1}(K_(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:n}}ue(e,n){var r;if(n===void 0&&(n="click"),!B_(e.target)&&Lw(e)){var i=this.de(e,n);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.ve(j({},i,{type:"rageclick"})),this.ve(i)}}he(e){!B_(e.target)&&Lw(e)&&(clearTimeout(this.ce),this.ce=setTimeout(()=>{this.ve(this.de(e,"mousemove"))},500))}ve(e){if(E){var n=E.location.href;this.H=this.H||{},this.H[n]||(this.H[n]=[]),this.H[n].push(e)}}oe(){this.H&&!$s(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class bT{constructor(e){this._instance=e}doPageView(e,n){var r,i=this.fe(e,n);return this.pe={pathname:(r=E==null?void 0:E.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.fe(e,(n=this.pe)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.pe)==null?void 0:e.pageViewId}}fe(e,n){var r=this.pe;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:f}=s;if(!(D(o)||D(a)||D(l)||D(u)||D(c)||D(f))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),f=Math.ceil(f);var d=o<=1?1:Xt(a/o,0,1,U),h=o<=1?1:Xt(l/o,0,1,U),p=u<=1?1:Xt(c/u,0,1,U),g=u<=1?1:Xt(f/u,0,1,U);i=qe(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var xT=function(t){var e,n,r,i,s="";for(e=n=0,r=(t=(t+"").replace(/\r\n/g,`
60
60
  `).replace(/\r/g,`
61
- `)).length,i=0;i<r;i++){var o=t.charCodeAt(i),a=null;o<128?n++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),gr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},kT=!!eh||!!Jf,Dw="text/plain",Fu=(t,e)=>{var[n,r]=t.split("?"),i=j({},e);r==null||r.split("&").forEach(o=>{var[a]=o.split("=");delete i[a]});var s=ER(i);return n+"?"+(s=s?(r?r+"&":"")+s:r)},ca=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Uh=t=>{var{data:e,compression:n}=t;if(e){if(n===mr.GZipJS){var r=kw(Sw(ca(e)),{mtime:0}),i=new Blob([r],{type:Dw});return{contentType:Dw,body:i,estimatedSize:i.size}}if(n===mr.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,w=0,m="",v=[];if(!l)return l;l=xT(l);do u=(h=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,c=h>>12&63,f=h>>6&63,d=63&h,v[w++]=p.charAt(u)+p.charAt(c)+p.charAt(f)+p.charAt(d);while(g<l.length);switch(m=v.join(""),l.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"="}return m}(ca(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:ca(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ca(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Lu=[];Jf&&Lu.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=Uh(t))!==null&&e!==void 0?e:{},o=new Headers;ke(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(d_){var u=new d_;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Jf(a,j({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(f=>{var d={statusCode:c.status,text:f};if(c.status===200)try{d.json=JSON.parse(f)}catch(h){U.error(h)}t.callback==null||t.callback(d)})).catch(c=>{U.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),eh&&Lu.push({transport:"XHR",method:t=>{var e,n=new eh;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=Uh(t))!==null&&e!==void 0?e:{};ke(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),Qt!=null&&Qt.sendBeacon&&Lu.push({transport:"sendBeacon",method:t=>{var e=Fu(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=Uh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Qt.sendBeacon(e,s)}catch{}}});var As=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Nw(t,e,n){return ca({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var jw={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>As(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!As(n,r))),icontains:(t,e)=>e.map(Du).some(n=>t.map(Du).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Du).every(n=>t.map(Du).every(r=>!n.includes(r)))},Du=t=>t.toLowerCase(),zw=Ye("[Error tracking]");class ST{constructor(e){var n,r;this.ge=[],this._e=new eR([new tR,new cR,new rR,new nR,new lR,new aR,new sR,new uR],[Y3,Z3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(uh))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,i,s=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[uh]:this.ge,[M_]:o})}get me(){var e,n=!!this._instance.get_property(M_),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this._e.buildFromUnknown(e,{syntheticException:n==null?void 0:n.syntheticException,mechanism:{handled:n==null?void 0:n.handled}})}sendExceptionEvent(e){if(this.ye(e))zw.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});zw.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!$e(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return He(o)&&o.length>0&&i.$exception_types.push(o),He(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.ge.some(i=>{var s=i.values.map(o=>{var a,l=jw[o.operator],u=$e(o.value)?o.value:[o.value],c=(a=r[o.key])!==null&&a!==void 0?a:[];return u.length>0&&l(u,c)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}be(e){var n=e.$exception_list;return!(!n||!$e(n))&&n.flatMap(r=>{var i,s;return(i=(s=r.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}}var cn="Mobile",Nu="iOS",Qn="Android",da="Tablet",Hw=Qn+" "+da,Uw="iPad",Bw="Apple",qw=Bw+" Watch",fa="Safari",Is="BlackBerry",Vw="Samsung",Ww=Vw+"Browser",Gw=Vw+" Internet",Li="Chrome",ET=Li+" OS",Kw=Li+" "+Nu,Bh="Internet Explorer",Yw=Bh+" "+cn,qh="Opera",$T=qh+" Mini",Vh="Edge",Qw="Microsoft "+Vh,Fs="Firefox",Xw=Fs+" "+Nu,ha="Nintendo",pa="PlayStation",Ls="Xbox",Zw=Qn+" "+cn,Jw=cn+" "+fa,ga="Windows",Wh=ga+" Phone",e1="Nokia",Gh="Ouya",t1="Generic",CT=t1+" "+cn.toLowerCase(),n1=t1+" "+da.toLowerCase(),Kh="Konqueror",$t="(\\d+(\\.\\d+)?)",Yh=new RegExp("Version/"+$t),RT=new RegExp(Ls,"i"),TT=new RegExp(pa+" \\w+","i"),PT=new RegExp(ha+" \\w+","i"),Qh=new RegExp(Is+"|PlayBook|BB10","i"),MT={"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"},OT=(t,e)=>e&&ue(e,Bw)||function(n){return ue(n,fa)&&!ue(n,Li)&&!ue(n,Qn)}(t),r1=function(t,e){return e=e||"",ue(t," OPR/")&&ue(t,"Mini")?$T:ue(t," OPR/")?qh:Qh.test(t)?Is:ue(t,"IE"+cn)||ue(t,"WPDesktop")?Yw:ue(t,Ww)?Gw:ue(t,Vh)||ue(t,"Edg/")?Qw:ue(t,"FBIOS")?"Facebook "+cn:ue(t,"UCWEB")||ue(t,"UCBrowser")?"UC Browser":ue(t,"CriOS")?Kw:ue(t,"CrMo")||ue(t,Li)?Li:ue(t,Qn)&&ue(t,fa)?Zw:ue(t,"FxiOS")?Xw:ue(t.toLowerCase(),Kh.toLowerCase())?Kh:OT(t,e)?ue(t,cn)?Jw:fa:ue(t,Fs)?Fs:ue(t,"MSIE")||ue(t,"Trident/")?Bh:ue(t,"Gecko")?Fs:""},AT={[Yw]:[new RegExp("rv:"+$t)],[Qw]:[new RegExp(Vh+"?\\/"+$t)],[Li]:[new RegExp("("+Li+"|CrMo)\\/"+$t)],[Kw]:[new RegExp("CriOS\\/"+$t)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$t)],[fa]:[Yh],[Jw]:[Yh],[qh]:[new RegExp("(Opera|OPR)\\/"+$t)],[Fs]:[new RegExp(Fs+"\\/"+$t)],[Xw]:[new RegExp("FxiOS\\/"+$t)],[Kh]:[new RegExp("Konqueror[:/]?"+$t,"i")],[Is]:[new RegExp(Is+" "+$t),Yh],[Zw]:[new RegExp("android\\s"+$t,"i")],[Gw]:[new RegExp(Ww+"\\/"+$t)],[Bh]:[new RegExp("(rv:|MSIE )"+$t)],Mozilla:[new RegExp("rv:"+$t)]},IT=function(t,e){var n=r1(t,e),r=AT[n];if(D(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},i1=[[new RegExp(Ls+"; "+Ls+" (.*?)[);]","i"),t=>[Ls,t&&t[1]||""]],[new RegExp(ha,"i"),[ha,""]],[new RegExp(pa,"i"),[pa,""]],[Qh,[Is,""]],[new RegExp(ga,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Wh,""];if(new RegExp(cn).test(e)&&!/IEMobile\b/.test(e))return[ga+" "+cn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=MT[r]||"";return/arm/i.test(e)&&(i="RT"),[ga,i]}return[ga,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Nu,e.join(".")]}return[Nu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=D(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Qn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Qn,e.join(".")]}return[Qn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ET,""]],[/Linux|debian/i,["Linux",""]]],s1=function(t){return PT.test(t)?ha:TT.test(t)?pa:RT.test(t)?Ls:new RegExp(Gh,"i").test(t)?Gh:new RegExp("("+Wh+"|WPDesktop)","i").test(t)?Wh:/iPad/.test(t)?Uw:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?qw:Qh.test(t)?Is:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(e1,"i").test(t)?e1:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(cn).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Qn:Hw:Qn:new RegExp("(pda|"+cn+")","i").test(t)?CT:new RegExp(da,"i").test(t)&&!new RegExp(da+" pc","i").test(t)?n1:""},ju="https?://(.*)",zu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FT=hu(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],zu),Xh="<masked>",LT=["li_fat_id"];function o1(t,e,n){if(!B)return{};var r,i=e?hu([],zu,n||[]):[],s=a1(Eh(B.URL,i,Xh),t),o=(r={},ke(LT,function(a){var l=Wn.J(a);r[a]=l||null}),r);return qe(o,s)}function a1(t,e){var n=FT.concat(e||[]),r={};return ke(n,function(i){var s=ku(t,i);r[i]=s||null}),r}function l1(t){var e=function(s){return s?s.search(ju+"google.([^/?]*)")===0?"google":s.search(ju+"bing.com")===0?"bing":s.search(ju+"yahoo.com")===0?"yahoo":s.search(ju+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!gr(e)){r.$search_engine=e;var i=B?ku(B.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function u1(){return navigator.language||navigator.userLanguage}function c1(){return(B==null?void 0:B.referrer)||"$direct"}function d1(t,e){var n=t?hu([],zu,e||[]):[],r=Lt==null?void 0:Lt.href.substring(0,1e3);return{r:c1().substring(0,1e3),u:r?Eh(r,n,Xh):void 0}}function f1(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Ms(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=Ms(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=a1(r);qe(i,o)}if(n){var a=l1(n);qe(i,a)}return i}function h1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function DT(){try{return new Date().getTimezoneOffset()}catch{return}}function NT(t,e){if(!Dt)return{};var n,r,i,s=t?hu([],zu,e||[]):[],[o,a]=function(l){for(var u=0;u<i1.length;u++){var[c,f]=i1[u],d=c.exec(l),h=d&&(ln(f)?f(d,l):f);if(h)return h}return["",""]}(Dt);return qe(ah({$os:o,$os_version:a,$browser:r1(Dt,navigator.vendor),$device:s1(Dt),$device_type:(r=Dt,i=s1(r),i===Uw||i===Hw||i==="Kobo"||i==="Kindle Fire"||i===n1?da:i===ha||i===Ls||i===pa||i===Gh?"Console":i===qw?"Wearable":i?cn:"Desktop"),$timezone:h1(),$timezone_offset:DT()}),{$current_url:Eh(Lt==null?void 0:Lt.href,s,Xh),$host:Lt==null?void 0:Lt.host,$pathname:Lt==null?void 0:Lt.pathname,$raw_user_agent:Dt.length>1e3?Dt.substring(0,997)+"...":Dt,$browser_version:IT(Dt,navigator.vendor),$browser_language:u1(),$browser_language_prefix:(n=u1(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:E==null?void 0:E.screen.height,$screen_width:E==null?void 0:E.screen.width,$viewport_height:E==null?void 0:E.innerHeight,$viewport_width:E==null?void 0:E.innerWidth,$lib:"web",$lib_version:pr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Tn=Ye("[FeatureFlags]"),Zh="$active_feature_flags",Ds="$override_feature_flags",p1="$feature_flag_payloads",va="$override_feature_flag_payloads",g1="$feature_flag_request_id",v1=t=>{var e={};for(var[n,r]of pu(t||{}))r&&(e[n]=r);return e},jT=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]}))):Tn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},zT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class HT{constructor(e){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=e,this.featureFlagEventHandlers=[]}Ie(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Tn.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r}):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var e=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:e})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(ph),n=this._instance.get_property(Ds),r=this._instance.get_property(va);if(!r&&!n)return e||{};var i=qe({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of s){var a,l,u=i[o],c=n==null?void 0:n[o],f=D(c)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!c,d=D(c)?u.variant:typeof c=="string"?c:void 0,h=r==null?void 0:r[o],p=j({},u,{enabled:f,variant:f?d??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(p.original_enabled=u==null?void 0:u.enabled),d!==(u==null?void 0:u.variant)&&(p.original_variant=u==null?void 0:u.variant),h&&(p.metadata=j({},u==null?void 0:u.metadata,{payload:h,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),i[o]=p}return this.we||(Tn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(Ts),n=this._instance.get_property(Ds);if(!n)return e||{};for(var r=qe({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Tn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(p1),n=this._instance.get_property(va);if(!n)return e||{};for(var r=qe({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Tn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this.we=!0),r}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout(()=>{this.Ce()},5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Ce(e){var n;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:j({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(na)||{}),group_properties:this._instance.get_property(Pi)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Pe()&&(r.evaluation_environments=this.Ie());var i=this._instance.config.__preview_remote_config,s=i?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+o);i&&(r.timezone=h1()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:mr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,f=!0;if(l.statusCode===200&&(this.xe||(this.$anon_distinct_id=void 0),f=!1),this.ke=!1,this.Ee||(this.Ee=!0,this._instance.Fe((c=l.json)!==null&&c!==void 0?c:{})),!r.disable_flags||this.xe)if(this.Re=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(zT.FeatureFlags))Tn.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.");else{var d;r.disable_flags||this.receivedFeatureFlags((d=l.json)!==null&&d!==void 0?d:{},f),this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],i=""+r,s=this._instance.get_property(g1)||void 0,o=this._instance.get_property(mu)||{};if((n.send_event||!("send_event"in n))&&(!(e in o)||!o[e].includes(i))){var a,l,u,c,f,d,h,p,g;$e(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[mu]:o});var w=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Re};D(w==null||(c=w.metadata)==null?void 0:c.version)||(m.$feature_flag_version=w.metadata.version);var v,y=(f=w==null||(d=w.reason)==null?void 0:d.description)!==null&&f!==void 0?f:w==null||(h=w.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),w!=null&&(p=w.metadata)!=null&&p.id&&(m.$feature_flag_id=w.metadata.id),D(w==null?void 0:w.original_variant)&&D(w==null?void 0:w.original_enabled)||(m.$feature_flag_original_response=D(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(g=w.metadata)!=null&&g.original_payload&&(m.$feature_flag_original_payload=w==null||(v=w.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",m)}return r}Tn.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Pe()&&(i.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:mr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;n((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,n);return D(r)?void 0:!!r}Tn.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this._instance.persistence){this.Se=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var f=jT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var g=o.requestId;if($e(h)){Tn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(h)for(var m=0;m<h.length;m++)w[h[m]]=!0;a&&a.register({[Zh]:h,[Ts]:w})}else{var v=h,y=p,b=d;o.errorsWhileComputingFlags&&(v=j({},l,v),y=j({},u,y),b=j({},c,b)),a&&a.register(j({[Zh]:Object.keys(v1(v)),[Ts]:v||{},[p1]:y||{},[ph]:b||{}},g?{[g1]:g}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),Tn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Tn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ds),this._instance.persistence.unregister(va),void this.Ae();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.we=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Ds);else if(r.flags)if($e(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Ds]:i})}else this._instance.persistence.register({[Ds]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(va):r.payloads&&this._instance.persistence.register({[va]:r.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Se){var{flags:n,flagVariants:r}=this.De();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var i,s=(this._instance.get_property(ta)||[]).find(u=>u.flagKey===e),o={["$feature_enrollment/"+e]:n},a={$feature_flag:e,$feature_enrollment:n,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=j({},this.getFlagVariants(),{[e]:n});(i=this._instance.persistence)==null||i.register({[Zh]:Object.keys(v1(l)),[Ts]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(ta),s=r?"&"+r.map(o=>"stage="+o).join("&"):"";if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(ta),(l=this._instance.persistence)==null||l.register({[ta]:u}),e(u)}}})}De(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}Ae(e){var{flags:n,flagVariants:r}=this.De();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(na)||{};this._instance.register({[na]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(na)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Pi)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[Pi]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(Pi)||{};this._instance.register({[Pi]:j({},n,{[e]:{}})})}else this._instance.unregister(Pi)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var UT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Jh{constructor(e,n){this.A=e,this.props={},this.je=!1,this.Le=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.it=this.Ne(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){UT.indexOf(e.persistence.toLowerCase())===-1&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&Qe.G()?Qe:n==="localstorage+cookie"&&$u.G()?$u:n==="sessionstorage"&&st.G()?st:n==="memory"?LR:n==="cookie"?Wn:$u.G()?$u:Wn}properties(){var e={};return ke(this.props,function(n,r){if(r===Ts&&ze(n))for(var i=Object.keys(n),s=0;s<i.length;s++)e["$feature/"+i[s]]=n[i[s]];else a=r,l=!1,(gr(o=vR)?l:c_&&o.indexOf===c_?o.indexOf(a)!=-1:(ke(o,function(u){if(l||(l=u===a))return fu}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=qe({},e))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(ze(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(ke(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=s,i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(ze(e)){this.ze=D(n)?this.He:n;var r=!1;if(ke(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.je){var e=o1(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);$s(ah(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=B==null?void 0:B.referrer)?l1(e):{})}update_referrer_info(){var e;this.register_once({$referrer:c1(),$referring_domain:B!=null&&B.referrer&&((e=Ms(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[yh]||this.props[_h]||this.register_once({[yu]:d1(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ke([_h,yh],o=>{var a=this.props[o];a&&ke(a,function(l,u){e["$initial_"+th(u)]=l})});var n,r,i=this.props[yu];if(i){var s=(n=f1(i),r={},ke(n,function(o,a){r["$initial_"+th(a)]=o}),r);qe(e,s)}return e}safe_merge(e){return ke(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.He=this.ze=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var i=this.Ne(e),s=this.props;this.clear(),this.it=i,this.props=s,this.save()}}set_disabled(e){this.Ue=e,this.Ue?this.remove():this.save()}set_cross_subdomain(e){e!==this.Be&&(this.Be=e,this.remove(),this.save())}set_secure(e){e!==this.qe&&(this.qe=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[ea]||{};r[e]=n,this.props[ea]=r,this.save()}remove_event_timer(e){var n=(this.props[ea]||{})[e];return D(n)||(delete this.props[ea][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({}),function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({});var ep=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({}),function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({});var Hu=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),m1=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),y1=function(t){return t.Popover="popover",t.Inline="inline",t}({});class tp{constructor(){this.We={},this.We={}}on(e,n){return this.We[e]||(this.We[e]=[]),this.We[e].push(n),()=>{this.We[e]=this.We[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.We[e]||[])r(n);for(var i of this.We["*"]||[])i(e,n)}}class Di{constructor(e){this.Ge=new tp,this.Ve=(n,r)=>this.Je(n,r)&&this.Ke(n,r)&&this.Ye(n,r),this.Je=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Xe=new Set,this.Qe=new Set}init(){var e;if(!D((e=this._instance)==null?void 0:e.Ze)){var n;(n=this._instance)==null||n.Ze((r,i)=>{this.on(r,i)})}}register(e){var n,r;if(!D((n=this._instance)==null?void 0:n.Ze)&&(e.forEach(o=>{var a,l;(a=this.Qe)==null||a.add(o),(l=o.steps)==null||l.forEach(u=>{var c;(c=this.Xe)==null||c.add((u==null?void 0:u.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&s.add(l==null?void 0:l.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Xe.has(e)||this.Xe.has(n==null?void 0:n.event))&&this.Qe&&((r=this.Qe)==null?void 0:r.size)>0&&this.Qe.forEach(i=>{this.tr(n,i)&&this.Ge.emit("actionCaptured",i.name)})}ir(e){this.onAction("actionCaptured",n=>e(n))}tr(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ve(e,r))return!0;return!1}onAction(e,n){return this.Ge.on(e,n)}Ke(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Di.er(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static er(e,n,r){switch(r){case"regex":return!!E&&As(e,n);case"exact":return n===e;case"contains":var i=Di.rr(n).replace(/_/g,".").replace(/%/g,".*");return As(e,i);default:return!1}}static rr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.sr(e).some(s=>!(n!=null&&n.href&&!Di.er(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Di.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Di.er(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}sr(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Se=Ye("[Surveys]"),np="seenSurvey_",BT=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},_1=t=>{var e=""+np+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+np+t.id+"_"+t.current_iteration),e},qT=[ep.Popover,ep.Widget,ep.API],VT={ignoreConditions:!1,ignoreDelay:!1,displayType:y1.Popover};class WT{constructor(e){this._instance=e,this.nr=new Map,this.ar=new Map}register(e){var n;D((n=this._instance)==null?void 0:n.Ze)||(this.lr(e),this.ur(e))}ur(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.hr==null&&(this.hr=new Di(this._instance),this.hr.init(),this.hr.ir(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.hr)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.ar.get(u.name);c&&c.push(r.id),this.ar.set(u.name,c||[r.id])}}))}))}lr(e){var n;e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.events)&&((s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((n=this._instance)==null||n.Ze((r,i)=>{this.onEvent(r,i)}),e.forEach(r=>{var i;(i=r.conditions)==null||(i=i.events)==null||(i=i.values)==null||i.forEach(s=>{if(s&&s.name){var o=this.nr.get(s.name);o&&o.push(r.id),this.nr.set(s.name,o||[r.id])}})}))}onEvent(e,n){var r,i,s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[vu])||[];if(Hu.SHOWN===e&&n&&s.length>0){var o;Se.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:n,existingActivatedSurveys:s});var a=n==null||(o=n.properties)==null?void 0:o.$survey_id;if(a){var l=s.indexOf(a);l>=0&&(s.splice(l,1),this.dr(s))}}else if(this.nr.has(e)){Se.info("survey event name matched",{event:e,eventPayload:n,surveys:this.nr.get(e)});var u=[];(i=this._instance)==null||i.getSurveys(f=>{u=f.filter(d=>{var h;return(h=this.nr.get(e))==null?void 0:h.includes(d.id)})});var c=u.filter(f=>{var d,h=(d=f.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.find(p=>p.name===e);return!!h&&(!h.propertyFilters||Object.entries(h.propertyFilters).every(p=>{var g,[w,m]=p,v=n==null||(g=n.properties)==null?void 0:g[w];if(D(v)||gr(v))return!1;var y=[String(v)],b=jw[m.operator];return b?b(m.values,y):(Se.warn("Unknown property comparison operator: "+m.operator),!1)}))});this.dr(s.concat(c.map(f=>f.id)||[]))}}onAction(e){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[vu])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;Se.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[vu]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[vu];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class GT{constructor(e){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(ge(n))return Se.warn("Flags not loaded yet. Not loading surveys.");var r=$e(n);this.cr=r?n.length>0:n,Se.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(np)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)Se.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Se.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Se.info("Not loading surveys in cookieless mode without consent.");else{var e=ee==null?void 0:ee.__PosthogExtensions__;if(e){if(!D(this.cr)||this._instance.config.advanced_enable_surveys){var n=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var r=e.generateSurveys;if(r)return void this.mr(r,n);var i=e.loadExternalDependency;if(!i)return void this.yr("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",s=>{s||!e.generateSurveys?this.yr("Could not load surveys script",s):this.mr(e.generateSurveys,n)})}catch(s){throw this.yr("Error initializing surveys",s),s}finally{this.gr=!1}}}else Se.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new WT(this._instance),Se.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){Se.error(e,n),this.br({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._r.push(e),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter(n=>n!==e)}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Se.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(gh);if(r&&!n)return e(r,{isLoaded:!0});if(this.pr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var s;this.pr=!1;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;return Se.error(a),e([],{isLoaded:!1,error:a})}var l,u=i.json.surveys||[],c=u.filter(f=>function(d){return!(!d.start_date||d.end_date)}(f)&&(function(d){var h;return!((h=d.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(f)||function(d){var h;return!((h=d.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(f)));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(s=this._instance.persistence)==null||s.register({[gh]:u}),e(u,{isLoaded:!0})}})}catch(i){throw this.pr=!1,i}}br(e){for(var n of this._r)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){Se.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Se.warn("init was not called")}wr(e){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===e))!==null&&i!==void 0?i:null}),n}Sr(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.wr(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Se.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.Sr(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return ge(this._surveyManager)?(Se.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.Sr(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n){var r;if(ge(this._surveyManager))Se.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(qT.includes(i.type)){var s=B==null?void 0:B.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(Se.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Se.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s),Se.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);Se.warn("Survey element not found")}else Se.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Se.warn("Survey not found")}}displaySurvey(e,n){var r;if(ge(this._surveyManager))Se.warn("init was not called");else{var i=this.wr(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=j({},i,{appearance:j({},i.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Se.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==y1.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else Se.warn("Survey not found")}}}var w1=Ye("[RateLimiter]");class KT{constructor(e){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{w1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void w1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:s})}},this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var s=new Date().getTime(),o=(n=(r=this.instance.persistence)==null?void 0:r.get_property(mh))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(i=this.instance.persistence)==null||i.set_property(mh,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Ni=Ye("[RemoteConfig]");class YT{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Ni.error("PostHog Extensions not found. Cannot load remote config."),e())}$r(e){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Ni.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Ni.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return Ni.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r(n=>{this.Fe(n)});this.Fe(e)})}catch(e){Ni.error("Error loading remote config",e)}}Fe(e){e?this._instance.config.__preview_remote_config?(this._instance.Fe(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Ni.info("__preview_remote_config is disabled. Logging config instead",e):Ni.error("Failed to fetch remote config from PostHog.")}}var rp=3e3;class QT{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Xt((n==null?void 0:n.flush_interval_ms)||rp,250,5e3,U.createLogger("flush interval"),rp),this.Pr=e}enqueue(e){this.Rr.push(e),this.Tr||this.Cr()}unload(){this.Mr();var e=this.Rr.length>0?this.Or():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Pr(j({},r,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Cr()}Cr(){var e=this;this.Er||(this.Tr=setTimeout(()=>{if(this.Mr(),this.Rr.length>0){var n=this.Or(),r=function(){var s=n[i],o=new Date().getTime();s.data&&$e(s.data)&&ke(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Pr(s)};for(var i in n)r()}},this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var e={};return ke(this.Rr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;D(e[s])&&(e[s]=j({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Rr=[],e}}var XT=["retriesPerformedSoFar"];class ZT{constructor(e){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.Dr=!0,!D(E)&&"onLine"in E.navigator&&(this.Dr=E.navigator.onLine,Ne(E,"online",()=>{this.Dr=!0,this.oe()}),Ne(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=p_(e,XT);ht(n)&&n>0&&(r.url=Fu(r.url,{retry_count:n})),this._instance.Oe(j({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.jr(j({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(i)}}))}jr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)}(n),i=Date.now()+r;this.Rr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),U.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout(()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()},this.Ar)}oe(){var e=Date.now(),n=[],r=this.Rr.filter(s=>s.retryAt<e||(n.push(s),!1));if(this.Rr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(j({},e,{transport:"sendBeacon"}))}catch(n){U.error(n)}this.Rr=[]}}class JT{constructor(e){this.Ur=()=>{var n,r,i,s;this.zr||(this.zr={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(a),this.zr.maxScrollY=Math.max(a,(n=this.zr.maxScrollY)!==null&&n!==void 0?n:0),this.zr.maxScrollHeight=Math.max(l,(r=this.zr.maxScrollHeight)!==null&&r!==void 0?r:0),this.zr.lastContentY=u,this.zr.maxContentY=Math.max(u,(i=this.zr.maxContentY)!==null&&i!==void 0?i:0),this.zr.maxContentHeight=Math.max(c,(s=this.zr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.zr}resetContext(){var e=this.zr;return setTimeout(this.Ur,0),e}startMeasuringScrollPosition(){Ne(E,"scroll",this.Ur,{capture:!0}),Ne(E,"scrollend",this.Ur,{capture:!0}),Ne(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=$e(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var r=E==null?void 0:E.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var eP=t=>d1(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class b1{constructor(e,n,r,i){this.Br=s=>{var o=this.qr();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Hr(this._instance)};this.Wr.register({[vh]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||eP,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[vh]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?f1(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return ke(ah(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+th(r)]=n}),e}}var ip=Ye("[SessionId]");class x1{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new tp,this.Kr=(c,f)=>Math.abs(c-f)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.Wr=e.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=n||Yr,this.Xr=r||Yr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Xt(o,60,36e3,ip.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var a=st.K(this.Zr),l=st.K(this.ts);a&&!l?this.pi=a:st.X(this.Zr),st.Y(this.ts,!0)}if((i=this.A.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var f=c.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(c){ip.error("Invalid sessionID in bootstrap",c)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return D(this.Jr)&&(this.Jr=[]),this.Jr.push(e),this.Ft&&e(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter(n=>n!==e)}}es(){return this.A.persistence!=="memory"&&!this.Wr.Ue&&st.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&st.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?st.K(this.Zr):null}rs(e,n,r){e===this.Ft&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ft=e,this.Wr.register({[gu]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[gu];return $e(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Ne(E,"beforeunload",()=>{this.es()&&st.X(this.ts)},{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.ls(),a=this.os(),l=ht(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,c=!s,f=!e&&this.Kr(r,i);c||f||l?(s=this.Yr(),a=this.Xr(),ip.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.Xr(),u=!0);var d=i===0||!e||l?r:i,h=o===0?new Date().getTime():o;return this.ns(a),this.rs(s,d,h),e||this.Qr(),u&&this.Jr.forEach(p=>p(s,a,u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}Qr(){clearTimeout(this.us),this.us=setTimeout(()=>{var[e]=this.ls();if(this.Kr(new Date().getTime(),e)){var n=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var tP=["$set_once","$set"],Jr=Ye("[SiteApps]");class nP{constructor(e){this._instance=e,this.hs=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(e,n){if(n){var r=this.globalsForEvent(n);this.hs.push(r),this.hs.length>1e3&&(this.hs=this.hs.slice(10))}}get siteAppLoaders(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ze(this.ds.bind(this));this.vs=()=>{e(),this.hs=[],this.vs=void 0}}}globalsForEvent(e){var n,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(f))u[d]={id:c[d],type:d,properties:h};var{$set_once:p,$set:g}=e;return{event:j({},p_(e,tP),{properties:j({},e.properties,g?{$set:j({},(n=(r=e.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},g)}:{},p?{$set_once:j({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var a;!n.errored&&this.hs.length&&(Jr.info("Processing "+this.hs.length+" events for site app with id "+e.id),this.hs.forEach(l=>n.processEvent==null?void 0:n.processEvent(l)),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.vs)==null||a.call(this))},i=!1,s=a=>{n.errored=!a,n.loaded=!0,Jr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(n.processEvent=o),i=!0}catch(a){Jr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&n.loaded)try{r()}catch(a){Jr.error("Error while processing buffered events PostHog app with config id "+e.id,a),n.errored=!0}}cs(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}fs(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(i){Jr.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var n,r,i,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",u=>this.fs(u))):void Jr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.vs)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(u){var c;ee["__$$ph_site_app_"+u]=s._instance,(c=ee.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,l,f=>{if(f)return Jr.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:a,url:l}of e.siteApps)o(a)}else Jr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var rP=["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"],k1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return rP.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},S1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&k1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>k1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},ma=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),E1="i.posthog.com";class iP{constructor(e){this.ps={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+E1,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ma.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ma.EU:this.ps[this.apiHost]=ma.CUSTOM),this.ps[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(this.region===ma.CUSTOM)return this.apiHost+n;var r=E1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var sP={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&As(e.href,t),not_regex:(t,e)=>!!E&&!As(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class gt{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{gt.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(gt.gs("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n._s)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);He(a)&&s.variants[a]&&n.ys(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];gt.bs(u)&&n.ys(s.name,l,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())gt.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();gt.gs("applying feature flags",e),e.forEach(n=>{var r;if(this._s&&(r=this._s)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this._s)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.ys(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=gt.getWindowLocation();if(e!=null&&e.search){var n=ku(e==null?void 0:e.search,"__experiment_id"),r=ku(e==null?void 0:e.search,"__experiment_variant");n&&r&&(gt.gs("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.ws(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}ws(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(gt.gs("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.ys(i[0].name,n,i[0].variants[n].transforms))}static bs(e){return!ge(e.conditions)&&gt.Ss(e)&&gt.ks(e)}static Ss(e){var n;if(ge(e.conditions)||ge((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=gt.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||sP[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E==null?void 0:E.location}static ks(e){var n;if(ge(e.conditions)||ge((n=e.conditions)==null?void 0:n.utm))return!0;var r=o1();if(r.utm_source){var i,s,o,a,l,u,c,f,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,h=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,g=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return d&&p&&g&&h}return!1}static gs(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];U.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?gt.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;gt.gs("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):gt.gs("Control variants leave the page unmodified.")}_is_bot(){return Qt&&this._instance?S1(Qt,this._instance.config.custom_blocked_useragents):void 0}}var oP=Ye("[PostHog ExternalIntegrations]"),aP={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class lP{constructor(e){this._instance=e}nt(e,n){var r;(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return oP.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=ee.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(aP[o],()=>{var c;(c=ee.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=ee.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=ee.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var sp="[SessionRecording]",ya=Ye(sp);class uP{get started(){var e;return!((e=this.$s)==null||!e.isStarted)}get status(){var e;return((e=this.$s)==null?void 0:e.status)||"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ni=void 0,this._instance=e,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(sp+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(sp+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(ch))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&n&&r&&!i}startIfEnabledOrStop(e){var n;if(!this.Bt||(n=this.$s)==null||!n.isStarted){var r=!D(Object.assign)&&!D(Array.from);this.Bt&&r?(this.xs(e),ya.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(ee!=null&&(n=ee.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=ee.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=ee.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return ya.error("could not load recorder",s);this.Ri(e)}))}stopRecording(){var e;(e=this.$s)==null||e.stop()}ki(){var e;(e=this._instance.persistence)==null||e.unregister(Rs)}Ei(e){if(this._instance.persistence){var n,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording,a=o==null?void 0:o.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[ch]:j({enabled:!!o},o,{networkPayloadCapture:j({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:l,minimumDurationMilliseconds:D(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(n=this.ni)==null||n.call(this),this.ni=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?(this.Ei(e),this.startIfEnabledOrStop()):ya.info("skipping remote config with no sessionRecording",e)}log(e,n){var r;n===void 0&&(n="log"),(r=this.$s)!=null&&r.log?this.$s.log(e,n):ya.warn("log called before recorder was ready")}get Ii(){var e,n,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ch);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=ee.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=ee.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.$s.start(e)}onRRwebEmit(e){var n;(n=this.$s)==null||n.onRRwebEmit==null||n.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.$s)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.$s)==null||e.overrideSampling()}overrideTrigger(e){var n;(n=this.$s)==null||n.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.$s)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,n){var r;return!((r=this.$s)==null||!r.tryAddCustomEvent(e,n))}}var _a={},op=()=>{},Ns="posthog",$1=!kT&&(Dt==null?void 0:Dt.indexOf("MSIE"))===-1&&(Dt==null?void 0:Dt.indexOf("Mozilla"))===-1,C1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:gR(B==null?void 0:B.location),persistence:"localStorage+cookie",persistence_name:"",loaded:op,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:t!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:t??"unset",debug:Lt&&He(Lt==null?void 0:Lt.search)&&Lt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;U.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:rp},error_tracking:{},_onCapture:op,__preview_eager_load_replay:!0}},R1=t=>{var e={};D(t.process_person)||(e.person_profiles=t.process_person),D(t.xhr_headers)||(e.request_headers=t.xhr_headers),D(t.cookie_name)||(e.persistence_name=t.cookie_name),D(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),D(t.store_google)||(e.save_campaign_params=t.store_google),D(t.verbose)||(e.debug=t.verbose);var n=qe({},e,t);return $e(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:$e(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:U.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class cP{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Uu{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new cP,this.Rs=!1,this.version=pr.LIB_VERSION,this.Is=new tp,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=C1(),this.SentryIntegration=hT,this.sentryIntegration=e=>function(n,r){var i=Ow(n,r);return{name:Mw,processEvent:s=>i(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new HT(this),this.toolbar=new gT(this),this.scrollManager=new JT(this),this.pageViewManager=new bT(this),this.surveys=new GT(this),this.experiments=new gt(this),this.exceptions=new ST(this),this.rateLimiter=new KT(this),this.requestRouter=new iP(this),this.consent=new DR(this),this.externalIntegrations=new lP(this),this.people={set:(e,n,r)=>{var i=He(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=He(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>U.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==Ns){var i,s=(i=_a[r])!==null&&i!==void 0?i:new Uu;return s._init(e,n,r),_a[r]=s,_a[Ns][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||nh(e))return U.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return U.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=n,this.Fs=[],n.person_profiles&&(this.Cs=n.person_profiles),this.set_config(qe({},C1(n.defaults),R1(n),{name:r,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:mr.GZipJS;var o=this.As();this.persistence=new Jh(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Jh(j({},this.config,{persistence:"sessionStorage"}),o);var a=j({},this.persistence.props),l=j({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ds=new QT(y=>this.js(y),this.config.request_queue_config),this.Ls=new ZT(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new x1(this),this.sessionPropsManager=new b1(this,this.sessionManager,this.persistence)),new mT(this).startIfEnabledOrStop(),this.siteApps=new nP(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new Pw(this):this.sessionRecording=new uP(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new TR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new wT(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new yT(this),this.exceptionObserver=new zR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new cw(this,jR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new HR(this),this.historyAutocapture.startIfEnabled(),pr.DEBUG=pr.DEBUG||this.config.debug,pr.DEBUG&&U.info("Starting in debug mode",{this:this,config:n,thisC:j({},this.config),p:a,s:l}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,f,d=this.config.get_device_id(Yr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(vr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,g,w=Object.keys(((p=n.bootstrap)==null?void 0:p.featureFlags)||{}).filter(y=>{var b;return!((b=n.bootstrap)==null||(b=b.featureFlags)==null||!b[y])}).reduce((y,b)=>{var x;return y[b]=((x=n.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[b])||!1,y},{}),m=Object.keys(((g=n.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(y=>w[y]).reduce((y,b)=>{var x,k;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(k=n.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:w,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:ra,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Yr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(vr,"anonymous")}return Ne(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?fT(this,()=>this.Us()):this.Us(),ln(this.config._onCapture)&&this.config._onCapture!==op&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&U.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}Fe(e){var n,r,i,s,o,a,l,u;if(!B||!B.body)return U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Fe(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,mr.GZipJS)?mr.GZipJS:ue(e.supportedCompression,mr.Base64)?mr.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Us(){try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new YT(this).load(),this.featureFlags.flags()}zs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ds)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Gr(this.__request_queue,e=>this.js(e)),this.__request_queue=[],this.zs()}_handle_unload(){var e,n;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),(e=this.Ds)==null||e.unload(),(n=this.Ls)==null||n.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(e){this.__loaded&&($1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Fu(e.url,{ip:this.config.ip?1:0}),e.headers=j({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=j({},n);o.timeout=o.timeout||6e4,o.url=Fu(o.url,{_:new Date().getTime().toString(),ver:pr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=Lu.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=C_(l,c=>c.transport===a))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(j({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,n)),e.callback==null||e.callback(n)}}))))}js(e){this.Ls?this.Ls.retriableRequest(e):this.Oe(e)}_execute_array(e){var n,r=[],i=[],s=[];Gr(e,a=>{a&&(n=a[0],$e(n)?s.push(a):ln(a)?a.call(this):$e(a)&&n==="alias"?r.push(a):$e(a)&&n.indexOf("capture")!==-1&&ln(this[n])?s.push(a):i.push(a))});var o=function(a,l){Gr(a,function(u){if($e(u[0])){var c=l;ke(u,function(f){c=c[f[0]].apply(c,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(r,this),o(i,this),o(s,this)}Ns(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!D(e)&&He(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!He(n==null?void 0:n.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$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();var o=new Date,a=(r==null?void 0:r.timestamp)||o,l=Yr(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,n||{},a,l)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var c,f=this.Hs(r==null?void 0:r.$set_once);if(f&&(u.$set_once=f),(u=hR(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,D(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Hu.DISMISSED||e===Hu.SENT){var d=n==null?void 0:n[m1.SURVEY_ID],h=n==null?void 0:n[m1.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(_1(c))||localStorage.setItem(_1(c),"true"),u.$set=j({},u.$set,{[BT({id:d,current_iteration:h},e===Hu.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if($s(p)||this.setPersonPropertiesForFlags(p),!ge(this.config.before_send)){var g=this.Ws(u);if(!g)return;u=g}this.Is.emit("eventCaptured",u);var w={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.js(w):this.Ds.enqueue(w),u}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.uninitializedWarning("posthog.capture")}Ze(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=j({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=j({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!He(a.distinct_id)&&!ht(a.distinct_id)||nh(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=NT(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=f,a.$window_id=d}this.sessionPropsManager&&qe(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&qe(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this.Ls)==null?void 0:h.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===ma.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=qe(a,u),e==="$pageview"&&B&&(a.title=B.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Dt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=qe({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),$e(this.config.property_denylist)?ke(this.config.property_denylist,function(m){delete a[m]}):U.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,e));var w=this.Gs();return a.$process_person_profile=w,w&&!s&&this.Vs("_calculate_event_properties"),a}Hs(e){var n;if(!this.persistence||!this.Gs()||this.Rs)return e;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=qe({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(U.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,$s(s)?void 0:s}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Js(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Is.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=VT),this.surveys.displaySurvey(e,n)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,r){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(ht(e)&&(e=e.toString(),U.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))U.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ra){if(this.Vs("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Jo)&&(this.unregister(Jo),this.register({distinct_id:e}));var o=(this.persistence.get_property(vr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(vr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=Nw(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(mu))}}else U.critical('The string "'+ra+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=Nw(this.get_distinct_id(),e,n);this.Ms!==r?(this.setPersonPropertiesForFlags(j({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ms=r):U.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){if(this.Vs("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:j({},i,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else U.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s;if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(vr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ra,$device_id:null},"");else{var a=this.config.get_device_id(Yr());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(R_)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(D(n)&&(n=this.get_distinct_id()),e!==n?(this.Js(Jo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(ze(e)){var r,i,s,o,a;qe(this.config,R1(e));var l=this.As();(r=this.persistence)==null||r.update_config(this.config,n,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Jh(j({},this.config,{persistence:"sessionStorage"}),l),Qe.G()&&Qe.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(pr.DEBUG=!0,U.info("set_config",{config:e,oldConfig:n,newConfig:j({},this.config)})),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(j({},i,n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ns;return n!==Ns&&(n=Ns+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(vr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(vr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&$s(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Jo])&&((n=this.persistence)==null||(n=n.props)==null||!n[_u]))}qs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(e){return this.config.person_profiles==="never"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(_u,!0),!0)}As(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}Ks(){var e,n,r,i,s=this.As();return((e=this.persistence)==null?void 0:e.Ue)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Ue)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new x1(this),this.persistence&&(this.sessionPropsManager=new b1(this,this.sessionManager,this.persistence)),this.sessionRecording=new Pw(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(D(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Bs()}else U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ra,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===yr.GRANTED?"granted":e===yr.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ks()}_is_bot(){return Qt?S1(Qt,this.config.custom_blocked_useragents):void 0}Bs(){B&&(B.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Ts&&(B.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Ne(B,"visibilitychange",this.Ts)))}debug(e){e===!1?(E==null||E.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(E==null||E.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var e,n,r,i,s,o,a,l=this.Os||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(U.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=U,o=(n="advanced_disable_flags")in(e=l)&&!D(e[n]),a=r in e&&!D(e[r]),o?e[n]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):i)}Ws(e){if(ge(this.config.before_send))return e;var n=$e(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),ge(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return H3(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!$s(r.properties)||U.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=fR(t.prototype[e[n]])})(Uu,["identify"]);var T1,ap=(T1=_a[Ns]=new Uu,function(){function t(){t.done||(t.done=!0,$1=!1,ke(_a,function(e){e._dom_loaded()}))}B!=null&&B.addEventListener?B.readyState==="complete"?t():Ne(B,"DOMContentLoaded",t,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),T1);console.info("Vehicle Search v3.0.35 powered by Partbot https://mmyvs.partbot.io");function Bu(t=[],e=[]){const n=[];return t.forEach(r=>{const[i,...s]=r.split(":"),o=s.join(":");if(o.includes(" > ")){const a=o.split(" > "),l=a[a.length-1].trim();if(i!=="make"&&a.length>=2){const u=a[0].trim();n.push(`make = "${u}"`)}n.push(`${i} = "${l}"`)}else n.push(`${i} = "${o}"`)}),e.forEach(r=>{n.push(r)}),n.length>0?n.join(" AND "):null}function vt(t){return String(t||"").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toUpperCase().trim().replace(/\s+/g," ")}function js(t){return String(t||"").split(">").pop().trim()}function lp(t,e,n){return!n||n.size===0||!Array.isArray(t)||!t.some(i=>n.has(vt(e(i))))?t:t.filter(i=>n.has(vt(e(i))))}function up({apiKey:t,makes:e="",models:n="",vehicleScopeTokens:r="",yearTokens:i="",callbackUrl:s="",layout:o="row",fields:a,fieldPrefix:l="",showBranding:u=!0,showLabels:c=!1,mobileFullWidthButton:f=!0,mobileDrawer:d=!0,modifyQueryString:h=!0,onChange:p,buttonLabel:g="Search",showButton:w=!0,onSubmit:m,store:v,useStoreVehicles:y=!0,fieldOrder:b="MMY",enableFeatureFlags:x=!1,yearOptional:k=!1,mobileButtonLabel:$="Select Vehicle"}){const C=_.useRef(null),q=_.useRef(null),F=_.useRef(null),I=_.useRef(null),N=_.useRef(null),K=_.useRef(null),Z=_.useRef(null),H=_.useRef(null),re=_.useRef(null),ne=_.useRef(!1),R=b==="YMM",[L,z]=_.useState([]),[ae,M]=_.useState([]),[le,te]=_.useState([]),[be,ie]=_.useState([]),[Me,ye]=_.useState([]),[dn,Ct]=_.useState([]),[Ue,ji]=_.useState([]),[zs,zi]=_.useState([]),qu=_.useRef([]),[Xn,wr]=_.useState([]),[S,Zt]=_.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[gP,cp]=_.useState(!1),M1=_.useRef(["body","series","variant","engine","engine_capacity"]),Vu=_.useRef(a&&a.length&&M1.current?a.split(",").filter(T=>{var P;return(P=M1.current)==null?void 0:P.includes(T)}):null),[dp,Wu]=_.useState(""),[Gu,O1]=_.useState(!1),Ku=typeof r=="string"&&r.trim().length?r:typeof dp=="string"&&dp.trim().length?dp:i,Zn=_.useMemo(()=>Gu?new Set:!e||typeof e!="string"?new Set:new Set(e.trim().split(",").map(T=>vt(T)).filter(Boolean)),[e,Gu]),ei=_.useMemo(()=>{const T=new Map,P=new Map;return!Ku||typeof Ku!="string"?{byMake:T,byMakeYear:P}:(Ku.split(",").map(G=>G.trim()).filter(Boolean).forEach(G=>{const[V,se,Y]=G.split("|"),Q=vt(V),X=vt(se),ve=String(Y||"").trim();if(!(!Q||!X)&&(T.has(Q)||T.set(Q,new Set),T.get(Q).add(X),/^\d{4}$/.test(ve))){const Ie=`${Q}|${ve}`;P.has(Ie)||P.set(Ie,new Set),P.get(Ie).add(X)}}),{byMake:T,byMakeYear:P})},[Ku]),Hs=_.useMemo(()=>new Set(Array.from(ei.byMake.keys())),[ei]),[Pn,vP]=_.useState(!1);_.useEffect(()=>{const T=navigator.userAgent;vP(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(T)),ap.__loaded||ap.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://app.posthog.com",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[ti,mP]=_.useState({}),[LP,yP]=_.useState(""),A1=_.useCallback(async()=>{if(!t)return;const P=`${x?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const G=await fetch(P,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify((()=>{const fe={use_store_vehicles:y};return v&&(fe.store=v),fe})())});if(!G.ok)throw new Error(`Error: ${G.status} ${G.statusText}`);const{merchant:V,vehicle_makes:se,vehicle_models:Y,scoped_vehicle_models:Q,vehicle_scope_tokens:X,vehicle_scope_applied:ve,vehicle_scope_source:Ie,meilisearch_search_key:_e,meilisearch_index_name:Rt,algolia_search_key:hn,algolia_index_name:Mn,store_index_name:ot,store_popular_makes:Jn,store_popular_models:Ce}=await G.json(),yt=Q&&typeof Q=="object"&&!Array.isArray(Q)&&Object.keys(Q).length>0,On=se||[],An=yt?Q:Y,er=!!ve||yt,xa=String(Ie||"").trim(),Qu=er&&xa.length>0&&xa!=="store_scope_cache";q.current=V,O1(Qu),Array.isArray(X)?Wu(X.join(",")):Wu(typeof X=="string"?X:""),F.current=On.map(fe=>({...fe,refinement:fe.value})),y&&An?typeof An=="object"&&!Array.isArray(An)?I.current=An:Array.isArray(An)?I.current=An.map(fe=>fe&&fe.value?String(fe.value).trim():"").filter(Boolean):I.current=[]:I.current=[],N.current=Array.isArray(Jn)?Jn.map(fe=>String(fe).trim().toUpperCase()):null,K.current=Ce||null,mP({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(G){console.error("[VehicleSearch] Auth failed:",G),yP(G),O1(!1),Wu("")}},[t,v,y,x]);_.useEffect(()=>{A1()},[A1]),_.useEffect(()=>{if(ti.searchKey){try{Z.current=new By({host:"https://search.partbot.io",apiKey:ti.searchKey}),H.current=Z.current.index(ti.indexName);const T=new By({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:ti.searchKey});re.current=T.index("otto_v1_vehicle_mmy")}catch(T){console.error("[VehicleSearch] Failed to initialize Meilisearch:",T)}return()=>{Z.current=null}}},[ti.searchKey,t]);const[fn,_P]=_.useState(!1),I1=_.useCallback(()=>{function T(Y){if(!Y)return"rgba(0,0,0,1)";var Q=P(),X=window.getComputedStyle(Y).backgroundColor;return X!==Q?X:Y.parentElement?T(Y.parentElement):"rgba(255,255,255,1)"}function P(){var Y=document.createElement("div");document.head.appendChild(Y);var Q=window.getComputedStyle(Y).backgroundColor;return document.head.removeChild(Y),Q}const G=document.querySelector("vehicle-search");let V;G?V=T(G):V=T(C.current);const se=J(V).isDark();_P(se)},[]);_.useEffect(()=>{async function T(){if(!S.make||!H.current)return;let P=[],G=[];S.make&&P.push(`make:${S.make.refinement}`),S.model&&P.push(`model:${S.make.refinement} > ${S.model.refinement}`),S.year&&(G=[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]),S.body&&P.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&P.push(`series:${S.series.refinement}`),S.engine&&P.push(`engine:${S.engine.refinement}`),S.engine_capacity&&P.push(`engine_capacity:${S.engine_capacity.refinement}`);let se=(await H.current.search("",{filter:Bu(P,G),attributesToRetrieve:["otto_id"],limit:500})).hits.map(X=>X.otto_id);wr(se);let Q={...Object.fromEntries(Object.entries(S||{}).map(([X,ve])=>[X,ve&&ve.value||null]).filter(([X,ve])=>ve!==null)),merchant:q.current};ap.capture("vehicle select",Q)}T()},[S,H,k]);const fp=T=>l?`${l}${T}`:T,wP=T=>l?T.replace(new RegExp(`^${l}`),""):T,bP=_.useCallback(()=>{const T=new URL(window.location.href).searchParams,P=["make","model","year","body","series","engine","engine_capacity"],G=P.map(fp),V={},se=/^filter\.p\.m\.app--\d+--partbot\.vehicle_(\w+)$/;for(const[Q,X]of T.entries()){const ve=Q.match(se);if(ve){const Ie=ve[1];if(Ie==="year_tokens"&&X){const Rt=X.split("|");if(Rt.length>=3){const hn=Rt[2].trim();/^\d{4}$/.test(hn)&&(V.year=hn)}continue}let _e=Ie.replace(/s$/,"");_e==="engine_capacitie"&&(_e="engine_capacity"),_e==="bodie"&&(_e="body"),_e==="serie"&&(_e="series"),P.includes(_e)&&(V[_e]=X)}}const Y=Object.fromEntries([...T.entries()].filter(([Q])=>G.includes(Q)).map(([Q,X])=>{const ve=wP(Q);if(ve==="year"&&X&&/^\d{4}$/.test(X)){const Ie=parseInt(X,10);return[ve,{value:Ie,refinement:Ie}]}return[ve,{value:X,refinement:X}]}));for(const[Q,X]of Object.entries(V))if(X&&X!=="[object Object]"&&!Y[Q])if(Q==="year"&&/^\d{4}$/.test(X)){const ve=parseInt(X,10);Y[Q]={value:ve,refinement:ve}}else Y[Q]={value:X,refinement:X};if(Object.keys(Y).length===0)try{const Q=localStorage.getItem("partbot_selected_vehicle");if(Q){const X=JSON.parse(Q);if(X!=null&&X.vehicle){const ve=X.vehicle;for(const Ie of P){const _e=ve[Ie];if(_e&&typeof _e=="string"&&_e.trim())if(Ie==="year"&&/^\d{4}$/.test(_e)){const Rt=parseInt(_e,10);Y[Ie]={value:Rt,refinement:Rt}}else Y[Ie]={value:_e,refinement:_e};else if(_e!=null&&_e.value&&typeof _e.value=="string")if(Ie==="year"&&/^\d{4}$/.test(_e.value)){const Rt=parseInt(_e.value,10);Y[Ie]={value:Rt,refinement:Rt}}else Y[Ie]={value:_e.value,refinement:_e.value}}}}}catch{}Zt(Y)},[]),mt=_.useCallback(({query:T,value:P,remove:G})=>{if(h&&"URLSearchParams"in window){let V=new URLSearchParams(window.location.search);T=fp(T),T&&P&&V.set(T,P),T&&!P&&V.delete(T),G&&G.forEach(Y=>{Y=fp(Y),V.delete(Y)});const se=window.location.pathname+"?"+V.toString();window.history.pushState(null,"",se)}},[]),xP=_.useCallback(()=>{var G;const T={vehicle_ids:Xn,vehicle:(G=S==null?void 0:S.make)!=null&&G.value?S:{}};m&&m(T);const P=new CustomEvent("vehicle-search-submit",{detail:T});window.dispatchEvent(P),document.dispatchEvent(P),setTimeout(()=>{cp(!1)},900)},[Xn,m]),F1=_.useCallback(()=>{var G,V,se,Y,Q,X,ve,Ie,_e;const T={vehicle_ids:Xn,vehicle:(G=S==null?void 0:S.make)!=null&&G.value?S:{},userSelected:ne.current};p&&p(T);const P=new CustomEvent("vehicle-search-change",{detail:T});if(ne.current===!0){localStorage.removeItem("partbot_plate_details");const Rt=JSON.stringify({description:`${((V=S.make)==null?void 0:V.value)||""} ${((se=S.model)==null?void 0:se.value)||""} ${((Y=S.year)==null?void 0:Y.value)||""} ${((Q=S.body)==null?void 0:Q.value)||""} ${((X=S.series)==null?void 0:X.value)||""} ${((ve=S.variant)==null?void 0:ve.value)||""} ${((Ie=S.engine)==null?void 0:Ie.value)||""} ${((_e=S.engine_capacity)==null?void 0:_e.value)||""}`.trim(),vehicle_ids:Xn,vehicle:S?Object.entries(S).reduce((hn,[Mn,ot])=>(hn[Mn]=ot!=null&&ot.value?ot.value:{},hn),{}):{}});localStorage.setItem("partbot_selected_vehicle",Rt),yk.set("partbot_selected_vehicle",Rt,{secure:!0})}window.dispatchEvent(P),ne.current&&document.dispatchEvent(P),qu.current=Xn,setTimeout(()=>{cp(!1)},900)},[Xn,p]),ni=_.useMemo(()=>h3(F1,100),[F1]);_.useEffect(()=>{ni()},[Xn,ni]),_.useEffect(()=>()=>{ni.cancel()},[ni]),_.useEffect(()=>{const T=()=>{ne.current=!1,ni.cancel(),Zt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),wr([])};return window.addEventListener("plate-search-change",T),()=>{window.removeEventListener("plate-search-change",T)}},[ni]),_.useEffect(()=>{const T=()=>{ne.current=!1,ni.cancel(),Zt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),wr([])};return document.addEventListener("partbot-clear-vehicle",T),()=>{document.removeEventListener("partbot-clear-vehicle",T)}},[ni]),_.useEffect(()=>{ti.searchKey&&(R||j1(),bP())},[ti.searchKey,R,j1]),_.useEffect(()=>{R&&H.current&&le.length===0&&!S.year&&H.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:T})=>{const P=T.map(Q=>Q.year_from).filter(Boolean),G=T.map(Q=>Q.year_to).filter(Boolean),V=Math.min(...P),se=Math.max(...G),Y=Array.from({length:se-V+1},(Q,X)=>({value:V+X,refinement:V+X})).reverse();te(Y)}).catch(T=>{console.error("[VehicleSearch] Error loading year range:",T)})},[R,ti.searchKey,le.length,S.year]),_.useEffect(()=>{typeof document>"u"||I1()},[I1]);const L1=_.useCallback(T=>{ne.current=!0,M([]),!R&&!k&&te([]),ie([]),ye([]),Ct([]),zi([]),ji([]),Zt(P=>({make:T,year:R||k?P.year:null})),mt({query:"make",value:(T==null?void 0:T.value)??"",remove:R?["model","body","series","engine","variant","engine_capacity"]:k?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),T||wr([])},[mt,R,k]),D1=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,model:T!==""?T:null,year:R||k?P.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!R&&!k&&te([]),ie([]),ye([]),Ct([]),zi([]),ji([]),mt({query:"model",value:(T==null?void 0:T.value)??"",remove:R?["body","series","engine","variant","engine_capacity"]:k?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[mt,R,k]),N1=_.useCallback(T=>{ne.current=!0,R?(z([]),M([]),Zt({year:T!==""?T:null}),(!T||T==="")&&te([])):Zt(k?P=>({...P,year:T!==""?T:null}):P=>({...P,year:T!==""?T:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),k||(ie([]),ye([]),Ct([]),zi([]),ji([])),mt({query:"year",value:(T==null?void 0:T.value)??"",remove:R?["make","model","body","series","variant","engine","engine_capacity"]:k?[]:["body","series","variant","engine","engine_capacity"]}),!k&&(!T||T==="")&&wr([])},[mt,R,k]),kP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,body:T!==""?T:null})),mt({query:"body",value:(T==null?void 0:T.value)??""})},[mt]),SP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,series:T!==""?T:null})),mt({query:"series",value:(T==null?void 0:T.value)??""})},[mt]),EP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,variant:T!==""?T:null})),mt({query:"variant",value:(T==null?void 0:T.value)??""})},[mt]),$P=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,engine:T!==""?T:null})),mt({query:"engine",value:(T==null?void 0:T.value)??""})},[mt]),CP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,engine_capacity:T!==""?T:null})),mt({query:"engine_capacity",value:(T==null?void 0:T.value)??""})},[mt]);_.useEffect(()=>{R&&S.year&&H.current&&(async()=>{try{const P=await H.current.search("",{filter:`year_from <= ${S.year.value} AND year_to >= ${S.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),G=new Map;P.hits.forEach(Y=>{Y.make&&!G.has(Y.make)&&G.set(Y.make,{value:Y.make.toUpperCase(),refinement:Y.make.toUpperCase(),popularity:Y.make_popularity||0})});let V=Array.from(G.values());Zn.size>0?V=V.filter(Y=>Zn.has(vt(Y.value))):Hs.size>0&&(V=V.filter(Y=>Hs.has(vt(Y.value))));const se=new Set(N.current||[]);se.size>0?V.sort((Y,Q)=>{const X=se.has(Y.value),ve=se.has(Q.value);return X&&!ve?-1:!X&&ve?1:X&&ve?N.current.indexOf(Y.value)-N.current.indexOf(Q.value):Y.value.localeCompare(Q.value)}):V.sort((Y,Q)=>Q.popularity===Y.popularity?Y.value.localeCompare(Q.value):Q.popularity-Y.popularity),z(V)}catch(P){console.error("[VehicleSearch] Error loading makes for year:",P)}})()},[R,S.year,Zn,Hs]);const j1=_.useCallback(()=>{(async()=>{let P=[];if(F.current&&F.current.length)P=F.current;else if(H.current)try{const G=await H.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),V=new Map;G.hits.forEach(se=>{se.make&&!V.has(se.make)&&V.set(se.make,{value:se.make.toUpperCase(),refinement:se.make.toUpperCase(),popularity:se.make_popularity||0})}),P=Array.from(V.values())}catch(G){console.error("[VehicleSearch] Error loading makes:",G)}if(Zn.size>0&&P.length&&(P=P.filter(G=>Zn.has(vt(G.value)))),Zn.size===0&&Hs.size>0&&(P=P.filter(G=>Hs.has(vt(G.value)))),N.current&&N.current.length>0){const G=new Set(N.current);P.sort((V,se)=>{const Y=G.has(V.value),Q=G.has(se.value);return Y&&!Q?-1:!Y&&Q?1:Y&&Q?N.current.indexOf(V.value)-N.current.indexOf(se.value):V.value.localeCompare(se.value)})}else P.sort((G,V)=>G.popularity===V.popularity?G.value.localeCompare(V.value):V.popularity-G.popularity);z(P)})()},[Zn,Hs]);_.useEffect(()=>{var T,P;if(S.make&&S.make.refinement){const G=S.make.refinement,V=vt(G),se=Zn.size>0,Y=ei.byMake.size>0;if(se&&!Zn.has(V)){M([]);return}if(!se&&Y&&!ei.byMake.has(V)){M([]);return}const Q=String(((T=S.year)==null?void 0:T.value)||"").trim(),X=`${V}|${Q}`,ve=/^\d{4}$/.test(Q)&&ei.byMakeYear.has(X)?ei.byMakeYear.get(X):null,Ie=ei.byMake.get(V),_e=ve&&ve.size>0?ve:Ie||null,Rt=!Gu&&n?n.trim().split(",").map(Mn=>Mn.trim()).filter(Boolean):[],hn=new Set(Rt.map(Mn=>vt(Mn)));if(y&&hn.size===0&&typeof I.current=="object"&&!Array.isArray(I.current)&&I.current[G]){let ot=I.current[G].map(Ce=>({value:Ce,refinement:Ce,popularity:0}));ot=lp(ot,Ce=>Ce.value,hn),ot=lp(ot,Ce=>Ce.value,_e);const Jn=(P=K.current)==null?void 0:P[G];if(Jn&&Array.isArray(Jn)){const Ce=new Map(Jn.map((yt,On)=>[yt.toUpperCase(),Jn.length-On]));ot.sort((yt,On)=>{const An=Ce.get(yt.value.toUpperCase())||0,er=Ce.get(On.value.toUpperCase())||0;return An!==er?er-An:yt.value.localeCompare(On.value)})}else ot.sort((Ce,yt)=>Ce.value.localeCompare(yt.value));M(ot);return}if(!re.current||!t)return;re.current.search("",{filter:`make = "${S.make.refinement}"`,limit:1}).then(Mn=>{var xa,Qu;const{hits:ot}=Mn;let Jn=[];ot.length>0&&ot[0].models&&(Jn=ot[0].models);let Ce=Jn.map(fe=>({model:`${S.make.refinement} > ${fe.name}`,model_popularity:fe.popularity||0})),yt=[];Array.isArray(I.current)?yt=I.current:typeof I.current=="object"&&I.current!==null?yt=I.current[S.make.refinement]||[]:typeof I.current=="string"&&I.current.length&&(yt=I.current.split(",").map(fe=>fe.trim()).filter(Boolean));let On=yt;if(hn.size>0&&(On=yt.length?yt.filter(fe=>hn.has(vt(fe))):Rt,Ce=Ce.filter(fe=>hn.has(vt(js(fe.model))))),On&&On.length>0){const fe=new Set(On.map(br=>vt(br)));Ce.some(br=>fe.has(vt(js(br.model))))&&(Ce=Ce.filter(br=>fe.has(vt(js(br.model)))))}Ce=lp(Ce,fe=>js(fe.model),_e),Ce=Ce.filter(fe=>js(fe.model)!=="").map(fe=>{const jt=js(fe.model);return{value:jt,refinement:jt,popularity:fe.model_popularity}});const An=(xa=S.make)==null?void 0:xa.refinement,er=(Qu=K.current)==null?void 0:Qu[An];if(er&&Array.isArray(er)&&er.length>0){const fe=new Set(er.map(jt=>String(jt).trim().toUpperCase()));Ce.sort((jt,br)=>{const pp=fe.has(jt.value),gp=fe.has(br.value);if(pp&&!gp)return-1;if(!pp&&gp)return 1;if(pp&&gp){const z1=er.map(TP=>String(TP).trim().toUpperCase());return z1.indexOf(jt.value)-z1.indexOf(br.value)}return jt.value.localeCompare(br.value)})}else Ce.sort((fe,jt)=>fe.popularity===jt.popularity?fe.value.localeCompare(jt.value):jt.popularity-fe.popularity);M(Ce)}).catch(Mn=>{console.error("[VehicleSearch] Error loading models:",Mn),M([])})}else M([])},[S.make,n,t,R,S.year,y,Gu,Zn,ei]),_.useEffect(()=>{if(H.current&&S.make&&S.model){let T=[`model:${S.make.refinement} > ${S.model.refinement}`];k&&(S.body&&T.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&T.push(`series:${S.series.refinement}`),S.engine&&T.push(`engine:${S.engine.refinement}`),S.engine_capacity&&T.push(`engine_capacity:${S.engine_capacity.refinement}`)),H.current.search("",{filter:Bu(T,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:P})=>{const G=P.map(X=>X.year_from),V=Math.min(...G),se=P.map(X=>X.year_to),Y=Math.max(...se);let Q=Array.apply(null,{length:Y+1-V}).map(function(X,ve){return ve+V});Q=Q.reverse().map(X=>({value:X,refinement:X})),te(Q)}).catch(P=>{console.error("[VehicleSearch] Error fetching years:",P)})}},[S.model,S.make,R,k,S.body,S.series,S.engine,S.engine_capacity]),_.useEffect(()=>{const T=k?S.make&&S.model:S.year&&S.make&&S.model;if(H.current&&T){const P=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:Bu([`model:${S.make.refinement} > ${S.model.refinement}`],P),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:G})=>{G=[...new Map(G.map(V=>[V.body,V])).values()].map(V=>({value:V.body.match(/[^>]*$/)[0].trim(),refinement:V.body.match(/[^>]*$/)[0].trim()})).filter(V=>V.value),ie(G)})}},[S.year,S.make,S.model,k]);const ba=_.useCallback(({hits:T,attribute:P,stateCallback:G})=>{let V=[...new Map(T.map(se=>[se[P],se])).values()].map(se=>({value:se[P].match(/[^|]*$/)[0].trim(),refinement:se[P].match(/[^|]*$/)[0].trim()})).filter(se=>se.refinement);G(V)},[]),RP=_.useCallback(()=>{const T=Vu.current?Vu.current.length+3:3,P=w?T+1:T;return`vs:lg:grid-cols-${P>8?8:P}`},[w]);_.useEffect(()=>{const T=k?S.make&&S.model:S.make&&S.model&&S.year;if(H.current&&T){let P=[`make:${S.make.refinement}`,`model:${S.make.refinement} > ${S.model.refinement}`,S.body?`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`:"",S.series?`series:${S.series.refinement}`:"",S.variant?`variant:${S.variant.refinement}`:"",S.engine?`engine:${S.engine.refinement}`:"",S.engine_capacity?`engine_capacity:${S.engine_capacity.refinement}`:""].filter(V=>V);const G=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:Bu(P,G),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:V})=>{ba({hits:V,attribute:"series",stateCallback:ye}),ba({hits:V,attribute:"variant",stateCallback:Ct}),ba({hits:V,attribute:"engine",stateCallback:ji}),ba({hits:V,attribute:"engine_capacity",stateCallback:zi})})}},[S.body,S.series,S.variant,S.engine,S.engine_capacity,ba,S.make,S.model,S.year,k]);const[Yu,hp]=_.useState(!1);return _.useEffect(()=>{if(d)return Yu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Yu,d]),A.jsxs(A.Fragment,{children:[d&&A.jsx("button",{onClick:()=>hp(!0),type:"button",className:Br("vehicle-search-btn vs:md:hidden!",f?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:A.jsx("span",{children:$})}),d&&A.jsx("div",{onClick:()=>hp(!1),className:Br("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Yu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),A.jsxs("div",{className:Br("partbot-mmyvs-container",d&&Yu&&"active","w-full"),children:[d&&A.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[A.jsx("span",{children:"Select Vehicle"}),A.jsxs("button",{onClick:()=>hp(!1),type:"button",className:"vs:appearance-none vs:bg-transparent vs:border-none vs:ring-none vs:outline-none vs:hover:border-none vs:hover:ring-none vs:hover:outline-none",children:[A.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),A.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:A.jsx("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})})})]})]}),A.jsxs("div",{ref:C,className:Br("vs:grid vs:gap-3",o==="row"?`${RP()} vs:grid-cols-1 vs:md:grid-cols-3`:"vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5","vs:w-full vs:transition vs:lg:mx-auto"),children:[R?A.jsxs(A.Fragment,{children:[A.jsx(Sn,{label:"Year",items:le,refine:N1,selected:S.year,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:le.length===0,shouldBeActive:!0}),A.jsx(Sn,{label:"Make",items:L,refine:L1,selected:S.make,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.year&&L.length===0,shouldBeActive:!!S.year}),A.jsx(Sn,{label:"Model",items:ae,refine:D1,selected:S.model,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.make&&ae.length===0,shouldBeActive:!!S.make})]}):A.jsxs(A.Fragment,{children:[A.jsx(Sn,{label:"Make",items:L,refine:L1,selected:S.make,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:L.length===0,shouldBeActive:!0}),A.jsx(Sn,{label:"Model",items:ae,refine:D1,selected:S.model,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.make&&ae.length===0,shouldBeActive:!!S.make}),A.jsx(Sn,{label:"Year",items:le,refine:N1,selected:S.year,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.model&&le.length===0,shouldBeActive:!!S.model})]}),Vu.current&&Vu.current.map(T=>{let P=null;switch(T){case"body":P=A.jsx(Sn,{label:"Body",items:be,refine:kP,selected:S.body,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"body");break;case"series":P=A.jsx(Sn,{label:"Series",items:Me,refine:SP,selected:S.series,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&Me.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"series");break;case"variant":P=A.jsx(Sn,{label:"Variant",items:dn,refine:EP,selected:S.variant,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&dn.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"variant");break;case"engine_capacity":P=A.jsx(Sn,{label:"Engine Capacity",items:zs,refine:CP,selected:S.engine_capacity,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&zs.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine_capacity");break;case"engine":P=A.jsx(Sn,{label:"Engine",items:Ue,refine:$P,selected:S.engine,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&Ue.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine");break}return P}),w&&A.jsx("div",{className:"vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1",children:A.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{cp(!0),s&&!m?window.location.href=s+window.location.search:xP()},children:[A.jsx("span",{children:g}),gP&&A.jsx(Yf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),u&&A.jsx("div",{className:Br("vs:flex vs:w-full vs:justify-center vs:items-center",o==="row"?"vs:md:items-end vs:md:justify-end":"vs:md:justify-center","vs:mt-4 vs:md:mt-3 vs:md:pr-1.5"),children:A.jsxs("a",{href:`https://use.partbot.io/?ref=${typeof window<"u"?window.location.href.split("/")[2]:"unknown"}&utm_source=vehicle-select&utm_medium=referral&utm_campaign=powered-by`,target:"_blank",rel:"noreferrer",className:`${fn?"vs:text-white":"vs:text-black"} vs:flex vs:items-center vs:space-x-1.5 vs:px-1.5 vs:text-center vs:leading-normal vs:text-[10px] vs:opacity-75 vs:transition vs:hover:opacity-100 vs:font-sans vs:no-underline vs:m-0 pb-1.5`,children:[A.jsx("span",{children:"Powered by"}),A.jsx(_k,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let P1=!1,wa=!1;function dP(t){var c,f;const e=t.shadowRoot;if(!e){console.error("[ShadowDOMPatch] No shadow root found");return}const n=e.children[1];if(!n){console.error("[ShadowDOMPatch] No mount point found in shadow root");return}if(new MutationObserver(d=>{d.forEach(h=>{h.addedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.appendChild(p),wa=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(wa=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(wa=!1)})})}).observe(n,{childList:!0,subtree:!0}),P1)return;const s=(c=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"))==null?void 0:c.get;Object.defineProperty(Document.prototype,"activeElement",{get:function(){const d=s==null?void 0:s.call(this);return d===t?e.activeElement:d}});const o=(f=Object.getOwnPropertyDescriptor(Event.prototype,"target"))==null?void 0:f.get;Object.defineProperty(Event.prototype,"target",{get:function(){const d=o==null?void 0:o.call(this);return d===t?this.composedPath()[0]:d}});const a=d=>{try{return document.body&&d===document.body.style}catch{return!1}},l=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(d,h,p){if(!(a(this)&&d==="overflow"&&h==="hidden"&&wa))return l.call(this,d,h,p)};const u=Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype,"overflow");u&&Object.defineProperty(CSSStyleDeclaration.prototype,"overflow",{get:function(){return u.get.call(this)},set:function(d){if(!(a(this)&&d==="hidden"&&wa))return u.set.call(this,d)}}),P1=!0}const fP="/css/vehicle-search.css";class hP extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const I=document.createElement("link");I.id="vehicle-search-inter-font",I.rel="stylesheet",I.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(I)}let e=document.createElement("style");e.textContent=vk;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(I,N,K)=>{let Z;if(this.hasAttribute(N)){const H=this.getAttribute(N);if(/^#[0-9A-F]{6}$/i.test(H)){const re=parseInt(H.slice(1,3),16),ne=parseInt(H.slice(3,5),16),R=parseInt(H.slice(5,7),16);Z=`${re} ${ne} ${R}`}}return Z=Z||K,`:host { --${I}: ${Z}; } .partbot-mmyvs-container { --${I}: ${Z}; }`};let s=i("partbot-theme","data-button-color","0 0 0"),o=i("partbot-button-color","data-button-color","0 0 0"),a=i("partbot-button-hover-color","data-button-hover-color","0 0 0"),l=i("partbot-button-label-color","data-button-label-color","255 255 255"),u=i("partbot-button-hover-label-color","data-button-hover-label-color","255 255 255"),c=i("partbot-mobile-background-color","data-mobile-background-color","0 0 0"),f=`:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; }`,d=`:host { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; }`,h=`:host { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`,p=`:host { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; }`;const g=this.getAttribute("data-input-shadow"),w=g==="none"?"none":g||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${w}; } .partbot-mmyvs-container { --partbot-input-shadow: ${w}; }`;const v=this.getAttribute("data-input-border-color");let y="229 231 235";if(v)if(/^#[0-9A-F]{6}$/i.test(v)){const I=parseInt(v.slice(1,3),16),N=parseInt(v.slice(3,5),16),K=parseInt(v.slice(5,7),16);y=`${I} ${N} ${K}`}else/^\d+\s+\d+\s+\d+$/.test(v)&&(y=v);let b=`:host { --partbot-input-border-color: ${y}; } .partbot-mmyvs-container { --partbot-input-border-color: ${y}; }`;const x=this.getAttribute("data-input-border-width")||"1px";let k=`:host { --partbot-input-border-width: ${x}; } .partbot-mmyvs-container { --partbot-input-border-width: ${x}; }`;e.textContent+=s,e.textContent+=o,e.textContent+=a,e.textContent+=l,e.textContent+=u,e.textContent+=c,e.textContent+=f,e.textContent+=d,e.textContent+=h,e.textContent+=p,e.textContent+=m,e.textContent+=b,e.textContent+=k,r.appendChild(e),r.appendChild(n);const $=this.getAttribute("data-api-key");if(!$){console.warn("Missing attributes: "+($?"":"data-api-key "));return}const C=this.attributes,q={};for(let I=0;I<C.length;I++){const{name:N,value:K}=C[I];if(N.startsWith("data-")){const Z=N.slice(5).replace(/-([a-z])/g,H=>H[1].toUpperCase());q[Z]=K==="true"?!0:K==="false"?!1:K}}dP(this);const F=A.jsx(up,{...q});gk.render(F,n)}}customElements.define("vehicle-search",hP);const pP=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Tt.VehicleSearch=up,Tt.default=up,Tt.vehicleSearchCssUrl=fP,Object.defineProperties(Tt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
61
+ `)).length,i=0;i<r;i++){var o=t.charCodeAt(i),a=null;o<128?n++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),gr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},kT=!!eh||!!Jf,Dw="text/plain",Fu=(t,e)=>{var[n,r]=t.split("?"),i=j({},e);r==null||r.split("&").forEach(o=>{var[a]=o.split("=");delete i[a]});var s=ER(i);return n+"?"+(s=s?(r?r+"&":"")+s:r)},ca=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Uh=t=>{var{data:e,compression:n}=t;if(e){if(n===mr.GZipJS){var r=kw(Sw(ca(e)),{mtime:0}),i=new Blob([r],{type:Dw});return{contentType:Dw,body:i,estimatedSize:i.size}}if(n===mr.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,w=0,m="",v=[];if(!l)return l;l=xT(l);do u=(h=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,c=h>>12&63,f=h>>6&63,d=63&h,v[w++]=p.charAt(u)+p.charAt(c)+p.charAt(f)+p.charAt(d);while(g<l.length);switch(m=v.join(""),l.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"="}return m}(ca(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:ca(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=ca(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Lu=[];Jf&&Lu.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=Uh(t))!==null&&e!==void 0?e:{},o=new Headers;ke(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(d_){var u=new d_;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Jf(a,j({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(f=>{var d={statusCode:c.status,text:f};if(c.status===200)try{d.json=JSON.parse(f)}catch(h){U.error(h)}t.callback==null||t.callback(d)})).catch(c=>{U.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),eh&&Lu.push({transport:"XHR",method:t=>{var e,n=new eh;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=Uh(t))!==null&&e!==void 0?e:{};ke(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),Qt!=null&&Qt.sendBeacon&&Lu.push({transport:"sendBeacon",method:t=>{var e=Fu(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=Uh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Qt.sendBeacon(e,s)}catch{}}});var As=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Nw(t,e,n){return ca({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var jw={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>As(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!As(n,r))),icontains:(t,e)=>e.map(Du).some(n=>t.map(Du).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Du).every(n=>t.map(Du).every(r=>!n.includes(r)))},Du=t=>t.toLowerCase(),zw=Ye("[Error tracking]");class ST{constructor(e){var n,r;this.ge=[],this._e=new eR([new tR,new cR,new rR,new nR,new lR,new aR,new sR,new uR],[Y3,Z3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(uh))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,i,s=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[uh]:this.ge,[M_]:o})}get me(){var e,n=!!this._instance.get_property(M_),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this._e.buildFromUnknown(e,{syntheticException:n==null?void 0:n.syntheticException,mechanism:{handled:n==null?void 0:n.handled}})}sendExceptionEvent(e){if(this.ye(e))zw.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});zw.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!$e(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return He(o)&&o.length>0&&i.$exception_types.push(o),He(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.ge.some(i=>{var s=i.values.map(o=>{var a,l=jw[o.operator],u=$e(o.value)?o.value:[o.value],c=(a=r[o.key])!==null&&a!==void 0?a:[];return u.length>0&&l(u,c)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}be(e){var n=e.$exception_list;return!(!n||!$e(n))&&n.flatMap(r=>{var i,s;return(i=(s=r.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}}var cn="Mobile",Nu="iOS",Qn="Android",da="Tablet",Hw=Qn+" "+da,Uw="iPad",Bw="Apple",qw=Bw+" Watch",fa="Safari",Is="BlackBerry",Vw="Samsung",Ww=Vw+"Browser",Gw=Vw+" Internet",Li="Chrome",ET=Li+" OS",Kw=Li+" "+Nu,Bh="Internet Explorer",Yw=Bh+" "+cn,qh="Opera",$T=qh+" Mini",Vh="Edge",Qw="Microsoft "+Vh,Fs="Firefox",Xw=Fs+" "+Nu,ha="Nintendo",pa="PlayStation",Ls="Xbox",Zw=Qn+" "+cn,Jw=cn+" "+fa,ga="Windows",Wh=ga+" Phone",e1="Nokia",Gh="Ouya",t1="Generic",CT=t1+" "+cn.toLowerCase(),n1=t1+" "+da.toLowerCase(),Kh="Konqueror",$t="(\\d+(\\.\\d+)?)",Yh=new RegExp("Version/"+$t),RT=new RegExp(Ls,"i"),TT=new RegExp(pa+" \\w+","i"),PT=new RegExp(ha+" \\w+","i"),Qh=new RegExp(Is+"|PlayBook|BB10","i"),MT={"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"},OT=(t,e)=>e&&ue(e,Bw)||function(n){return ue(n,fa)&&!ue(n,Li)&&!ue(n,Qn)}(t),r1=function(t,e){return e=e||"",ue(t," OPR/")&&ue(t,"Mini")?$T:ue(t," OPR/")?qh:Qh.test(t)?Is:ue(t,"IE"+cn)||ue(t,"WPDesktop")?Yw:ue(t,Ww)?Gw:ue(t,Vh)||ue(t,"Edg/")?Qw:ue(t,"FBIOS")?"Facebook "+cn:ue(t,"UCWEB")||ue(t,"UCBrowser")?"UC Browser":ue(t,"CriOS")?Kw:ue(t,"CrMo")||ue(t,Li)?Li:ue(t,Qn)&&ue(t,fa)?Zw:ue(t,"FxiOS")?Xw:ue(t.toLowerCase(),Kh.toLowerCase())?Kh:OT(t,e)?ue(t,cn)?Jw:fa:ue(t,Fs)?Fs:ue(t,"MSIE")||ue(t,"Trident/")?Bh:ue(t,"Gecko")?Fs:""},AT={[Yw]:[new RegExp("rv:"+$t)],[Qw]:[new RegExp(Vh+"?\\/"+$t)],[Li]:[new RegExp("("+Li+"|CrMo)\\/"+$t)],[Kw]:[new RegExp("CriOS\\/"+$t)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$t)],[fa]:[Yh],[Jw]:[Yh],[qh]:[new RegExp("(Opera|OPR)\\/"+$t)],[Fs]:[new RegExp(Fs+"\\/"+$t)],[Xw]:[new RegExp("FxiOS\\/"+$t)],[Kh]:[new RegExp("Konqueror[:/]?"+$t,"i")],[Is]:[new RegExp(Is+" "+$t),Yh],[Zw]:[new RegExp("android\\s"+$t,"i")],[Gw]:[new RegExp(Ww+"\\/"+$t)],[Bh]:[new RegExp("(rv:|MSIE )"+$t)],Mozilla:[new RegExp("rv:"+$t)]},IT=function(t,e){var n=r1(t,e),r=AT[n];if(D(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},i1=[[new RegExp(Ls+"; "+Ls+" (.*?)[);]","i"),t=>[Ls,t&&t[1]||""]],[new RegExp(ha,"i"),[ha,""]],[new RegExp(pa,"i"),[pa,""]],[Qh,[Is,""]],[new RegExp(ga,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Wh,""];if(new RegExp(cn).test(e)&&!/IEMobile\b/.test(e))return[ga+" "+cn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=MT[r]||"";return/arm/i.test(e)&&(i="RT"),[ga,i]}return[ga,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Nu,e.join(".")]}return[Nu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=D(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Qn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Qn,e.join(".")]}return[Qn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ET,""]],[/Linux|debian/i,["Linux",""]]],s1=function(t){return PT.test(t)?ha:TT.test(t)?pa:RT.test(t)?Ls:new RegExp(Gh,"i").test(t)?Gh:new RegExp("("+Wh+"|WPDesktop)","i").test(t)?Wh:/iPad/.test(t)?Uw:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?qw:Qh.test(t)?Is:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(e1,"i").test(t)?e1:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(cn).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Qn:Hw:Qn:new RegExp("(pda|"+cn+")","i").test(t)?CT:new RegExp(da,"i").test(t)&&!new RegExp(da+" pc","i").test(t)?n1:""},ju="https?://(.*)",zu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FT=hu(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],zu),Xh="<masked>",LT=["li_fat_id"];function o1(t,e,n){if(!B)return{};var r,i=e?hu([],zu,n||[]):[],s=a1(Eh(B.URL,i,Xh),t),o=(r={},ke(LT,function(a){var l=Wn.J(a);r[a]=l||null}),r);return qe(o,s)}function a1(t,e){var n=FT.concat(e||[]),r={};return ke(n,function(i){var s=ku(t,i);r[i]=s||null}),r}function l1(t){var e=function(s){return s?s.search(ju+"google.([^/?]*)")===0?"google":s.search(ju+"bing.com")===0?"bing":s.search(ju+"yahoo.com")===0?"yahoo":s.search(ju+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!gr(e)){r.$search_engine=e;var i=B?ku(B.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function u1(){return navigator.language||navigator.userLanguage}function c1(){return(B==null?void 0:B.referrer)||"$direct"}function d1(t,e){var n=t?hu([],zu,e||[]):[],r=Lt==null?void 0:Lt.href.substring(0,1e3);return{r:c1().substring(0,1e3),u:r?Eh(r,n,Xh):void 0}}function f1(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Ms(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=Ms(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=a1(r);qe(i,o)}if(n){var a=l1(n);qe(i,a)}return i}function h1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function DT(){try{return new Date().getTimezoneOffset()}catch{return}}function NT(t,e){if(!Dt)return{};var n,r,i,s=t?hu([],zu,e||[]):[],[o,a]=function(l){for(var u=0;u<i1.length;u++){var[c,f]=i1[u],d=c.exec(l),h=d&&(ln(f)?f(d,l):f);if(h)return h}return["",""]}(Dt);return qe(ah({$os:o,$os_version:a,$browser:r1(Dt,navigator.vendor),$device:s1(Dt),$device_type:(r=Dt,i=s1(r),i===Uw||i===Hw||i==="Kobo"||i==="Kindle Fire"||i===n1?da:i===ha||i===Ls||i===pa||i===Gh?"Console":i===qw?"Wearable":i?cn:"Desktop"),$timezone:h1(),$timezone_offset:DT()}),{$current_url:Eh(Lt==null?void 0:Lt.href,s,Xh),$host:Lt==null?void 0:Lt.host,$pathname:Lt==null?void 0:Lt.pathname,$raw_user_agent:Dt.length>1e3?Dt.substring(0,997)+"...":Dt,$browser_version:IT(Dt,navigator.vendor),$browser_language:u1(),$browser_language_prefix:(n=u1(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:E==null?void 0:E.screen.height,$screen_width:E==null?void 0:E.screen.width,$viewport_height:E==null?void 0:E.innerHeight,$viewport_width:E==null?void 0:E.innerWidth,$lib:"web",$lib_version:pr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Tn=Ye("[FeatureFlags]"),Zh="$active_feature_flags",Ds="$override_feature_flags",p1="$feature_flag_payloads",va="$override_feature_flag_payloads",g1="$feature_flag_request_id",v1=t=>{var e={};for(var[n,r]of pu(t||{}))r&&(e[n]=r);return e},jT=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]}))):Tn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},zT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class HT{constructor(e){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=e,this.featureFlagEventHandlers=[]}Ie(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Tn.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r}):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var e=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:e})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(ph),n=this._instance.get_property(Ds),r=this._instance.get_property(va);if(!r&&!n)return e||{};var i=qe({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of s){var a,l,u=i[o],c=n==null?void 0:n[o],f=D(c)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!c,d=D(c)?u.variant:typeof c=="string"?c:void 0,h=r==null?void 0:r[o],p=j({},u,{enabled:f,variant:f?d??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(p.original_enabled=u==null?void 0:u.enabled),d!==(u==null?void 0:u.variant)&&(p.original_variant=u==null?void 0:u.variant),h&&(p.metadata=j({},u==null?void 0:u.metadata,{payload:h,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),i[o]=p}return this.we||(Tn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(Ts),n=this._instance.get_property(Ds);if(!n)return e||{};for(var r=qe({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Tn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(p1),n=this._instance.get_property(va);if(!n)return e||{};for(var r=qe({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Tn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this.we=!0),r}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout(()=>{this.Ce()},5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Ce(e){var n;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:j({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(na)||{}),group_properties:this._instance.get_property(Pi)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Pe()&&(r.evaluation_environments=this.Ie());var i=this._instance.config.__preview_remote_config,s=i?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+o);i&&(r.timezone=h1()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:mr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,f=!0;if(l.statusCode===200&&(this.xe||(this.$anon_distinct_id=void 0),f=!1),this.ke=!1,this.Ee||(this.Ee=!0,this._instance.Fe((c=l.json)!==null&&c!==void 0?c:{})),!r.disable_flags||this.xe)if(this.Re=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(zT.FeatureFlags))Tn.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.");else{var d;r.disable_flags||this.receivedFeatureFlags((d=l.json)!==null&&d!==void 0?d:{},f),this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],i=""+r,s=this._instance.get_property(g1)||void 0,o=this._instance.get_property(mu)||{};if((n.send_event||!("send_event"in n))&&(!(e in o)||!o[e].includes(i))){var a,l,u,c,f,d,h,p,g;$e(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[mu]:o});var w=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Re};D(w==null||(c=w.metadata)==null?void 0:c.version)||(m.$feature_flag_version=w.metadata.version);var v,y=(f=w==null||(d=w.reason)==null?void 0:d.description)!==null&&f!==void 0?f:w==null||(h=w.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),w!=null&&(p=w.metadata)!=null&&p.id&&(m.$feature_flag_id=w.metadata.id),D(w==null?void 0:w.original_variant)&&D(w==null?void 0:w.original_enabled)||(m.$feature_flag_original_response=D(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(g=w.metadata)!=null&&g.original_payload&&(m.$feature_flag_original_payload=w==null||(v=w.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",m)}return r}Tn.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Pe()&&(i.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:mr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;n((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,n);return D(r)?void 0:!!r}Tn.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this._instance.persistence){this.Se=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var f=jT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var g=o.requestId;if($e(h)){Tn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(h)for(var m=0;m<h.length;m++)w[h[m]]=!0;a&&a.register({[Zh]:h,[Ts]:w})}else{var v=h,y=p,b=d;o.errorsWhileComputingFlags&&(v=j({},l,v),y=j({},u,y),b=j({},c,b)),a&&a.register(j({[Zh]:Object.keys(v1(v)),[Ts]:v||{},[p1]:y||{},[ph]:b||{}},g?{[g1]:g}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),Tn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Tn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ds),this._instance.persistence.unregister(va),void this.Ae();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.we=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Ds);else if(r.flags)if($e(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Ds]:i})}else this._instance.persistence.register({[Ds]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(va):r.payloads&&this._instance.persistence.register({[va]:r.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Se){var{flags:n,flagVariants:r}=this.De();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var i,s=(this._instance.get_property(ta)||[]).find(u=>u.flagKey===e),o={["$feature_enrollment/"+e]:n},a={$feature_flag:e,$feature_enrollment:n,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=j({},this.getFlagVariants(),{[e]:n});(i=this._instance.persistence)==null||i.register({[Zh]:Object.keys(v1(l)),[Ts]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(ta),s=r?"&"+r.map(o=>"stage="+o).join("&"):"";if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(ta),(l=this._instance.persistence)==null||l.register({[ta]:u}),e(u)}}})}De(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}Ae(e){var{flags:n,flagVariants:r}=this.De();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(na)||{};this._instance.register({[na]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(na)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Pi)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[Pi]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(Pi)||{};this._instance.register({[Pi]:j({},n,{[e]:{}})})}else this._instance.unregister(Pi)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var UT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Jh{constructor(e,n){this.A=e,this.props={},this.je=!1,this.Le=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.it=this.Ne(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){UT.indexOf(e.persistence.toLowerCase())===-1&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&Qe.G()?Qe:n==="localstorage+cookie"&&$u.G()?$u:n==="sessionstorage"&&st.G()?st:n==="memory"?LR:n==="cookie"?Wn:$u.G()?$u:Wn}properties(){var e={};return ke(this.props,function(n,r){if(r===Ts&&ze(n))for(var i=Object.keys(n),s=0;s<i.length;s++)e["$feature/"+i[s]]=n[i[s]];else a=r,l=!1,(gr(o=vR)?l:c_&&o.indexOf===c_?o.indexOf(a)!=-1:(ke(o,function(u){if(l||(l=u===a))return fu}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=qe({},e))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(ze(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(ke(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=s,i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(ze(e)){this.ze=D(n)?this.He:n;var r=!1;if(ke(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.je){var e=o1(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);$s(ah(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=B==null?void 0:B.referrer)?l1(e):{})}update_referrer_info(){var e;this.register_once({$referrer:c1(),$referring_domain:B!=null&&B.referrer&&((e=Ms(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[yh]||this.props[_h]||this.register_once({[yu]:d1(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ke([_h,yh],o=>{var a=this.props[o];a&&ke(a,function(l,u){e["$initial_"+th(u)]=l})});var n,r,i=this.props[yu];if(i){var s=(n=f1(i),r={},ke(n,function(o,a){r["$initial_"+th(a)]=o}),r);qe(e,s)}return e}safe_merge(e){return ke(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.He=this.ze=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var i=this.Ne(e),s=this.props;this.clear(),this.it=i,this.props=s,this.save()}}set_disabled(e){this.Ue=e,this.Ue?this.remove():this.save()}set_cross_subdomain(e){e!==this.Be&&(this.Be=e,this.remove(),this.save())}set_secure(e){e!==this.qe&&(this.qe=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[ea]||{};r[e]=n,this.props[ea]=r,this.save()}remove_event_timer(e){var n=(this.props[ea]||{})[e];return D(n)||(delete this.props[ea][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({}),function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({});var ep=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({}),function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({});var Hu=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),m1=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),y1=function(t){return t.Popover="popover",t.Inline="inline",t}({});class tp{constructor(){this.We={},this.We={}}on(e,n){return this.We[e]||(this.We[e]=[]),this.We[e].push(n),()=>{this.We[e]=this.We[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.We[e]||[])r(n);for(var i of this.We["*"]||[])i(e,n)}}class Di{constructor(e){this.Ge=new tp,this.Ve=(n,r)=>this.Je(n,r)&&this.Ke(n,r)&&this.Ye(n,r),this.Je=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Xe=new Set,this.Qe=new Set}init(){var e;if(!D((e=this._instance)==null?void 0:e.Ze)){var n;(n=this._instance)==null||n.Ze((r,i)=>{this.on(r,i)})}}register(e){var n,r;if(!D((n=this._instance)==null?void 0:n.Ze)&&(e.forEach(o=>{var a,l;(a=this.Qe)==null||a.add(o),(l=o.steps)==null||l.forEach(u=>{var c;(c=this.Xe)==null||c.add((u==null?void 0:u.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&s.add(l==null?void 0:l.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Xe.has(e)||this.Xe.has(n==null?void 0:n.event))&&this.Qe&&((r=this.Qe)==null?void 0:r.size)>0&&this.Qe.forEach(i=>{this.tr(n,i)&&this.Ge.emit("actionCaptured",i.name)})}ir(e){this.onAction("actionCaptured",n=>e(n))}tr(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ve(e,r))return!0;return!1}onAction(e,n){return this.Ge.on(e,n)}Ke(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Di.er(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static er(e,n,r){switch(r){case"regex":return!!E&&As(e,n);case"exact":return n===e;case"contains":var i=Di.rr(n).replace(/_/g,".").replace(/%/g,".*");return As(e,i);default:return!1}}static rr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.sr(e).some(s=>!(n!=null&&n.href&&!Di.er(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Di.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Di.er(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}sr(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Se=Ye("[Surveys]"),np="seenSurvey_",BT=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},_1=t=>{var e=""+np+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+np+t.id+"_"+t.current_iteration),e},qT=[ep.Popover,ep.Widget,ep.API],VT={ignoreConditions:!1,ignoreDelay:!1,displayType:y1.Popover};class WT{constructor(e){this._instance=e,this.nr=new Map,this.ar=new Map}register(e){var n;D((n=this._instance)==null?void 0:n.Ze)||(this.lr(e),this.ur(e))}ur(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.hr==null&&(this.hr=new Di(this._instance),this.hr.init(),this.hr.ir(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.hr)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.ar.get(u.name);c&&c.push(r.id),this.ar.set(u.name,c||[r.id])}}))}))}lr(e){var n;e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.events)&&((s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((n=this._instance)==null||n.Ze((r,i)=>{this.onEvent(r,i)}),e.forEach(r=>{var i;(i=r.conditions)==null||(i=i.events)==null||(i=i.values)==null||i.forEach(s=>{if(s&&s.name){var o=this.nr.get(s.name);o&&o.push(r.id),this.nr.set(s.name,o||[r.id])}})}))}onEvent(e,n){var r,i,s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[vu])||[];if(Hu.SHOWN===e&&n&&s.length>0){var o;Se.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:n,existingActivatedSurveys:s});var a=n==null||(o=n.properties)==null?void 0:o.$survey_id;if(a){var l=s.indexOf(a);l>=0&&(s.splice(l,1),this.dr(s))}}else if(this.nr.has(e)){Se.info("survey event name matched",{event:e,eventPayload:n,surveys:this.nr.get(e)});var u=[];(i=this._instance)==null||i.getSurveys(f=>{u=f.filter(d=>{var h;return(h=this.nr.get(e))==null?void 0:h.includes(d.id)})});var c=u.filter(f=>{var d,h=(d=f.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.find(p=>p.name===e);return!!h&&(!h.propertyFilters||Object.entries(h.propertyFilters).every(p=>{var g,[w,m]=p,v=n==null||(g=n.properties)==null?void 0:g[w];if(D(v)||gr(v))return!1;var y=[String(v)],b=jw[m.operator];return b?b(m.values,y):(Se.warn("Unknown property comparison operator: "+m.operator),!1)}))});this.dr(s.concat(c.map(f=>f.id)||[]))}}onAction(e){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[vu])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;Se.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[vu]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[vu];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class GT{constructor(e){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(ge(n))return Se.warn("Flags not loaded yet. Not loading surveys.");var r=$e(n);this.cr=r?n.length>0:n,Se.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(np)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)Se.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Se.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Se.info("Not loading surveys in cookieless mode without consent.");else{var e=ee==null?void 0:ee.__PosthogExtensions__;if(e){if(!D(this.cr)||this._instance.config.advanced_enable_surveys){var n=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var r=e.generateSurveys;if(r)return void this.mr(r,n);var i=e.loadExternalDependency;if(!i)return void this.yr("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",s=>{s||!e.generateSurveys?this.yr("Could not load surveys script",s):this.mr(e.generateSurveys,n)})}catch(s){throw this.yr("Error initializing surveys",s),s}finally{this.gr=!1}}}else Se.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new WT(this._instance),Se.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){Se.error(e,n),this.br({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._r.push(e),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter(n=>n!==e)}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Se.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(gh);if(r&&!n)return e(r,{isLoaded:!0});if(this.pr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var s;this.pr=!1;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;return Se.error(a),e([],{isLoaded:!1,error:a})}var l,u=i.json.surveys||[],c=u.filter(f=>function(d){return!(!d.start_date||d.end_date)}(f)&&(function(d){var h;return!((h=d.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(f)||function(d){var h;return!((h=d.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(f)));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(s=this._instance.persistence)==null||s.register({[gh]:u}),e(u,{isLoaded:!0})}})}catch(i){throw this.pr=!1,i}}br(e){for(var n of this._r)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){Se.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Se.warn("init was not called")}wr(e){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===e))!==null&&i!==void 0?i:null}),n}Sr(e){if(ge(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.wr(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Se.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.Sr(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return ge(this._surveyManager)?(Se.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.Sr(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n){var r;if(ge(this._surveyManager))Se.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(qT.includes(i.type)){var s=B==null?void 0:B.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(Se.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Se.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s),Se.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);Se.warn("Survey element not found")}else Se.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Se.warn("Survey not found")}}displaySurvey(e,n){var r;if(ge(this._surveyManager))Se.warn("init was not called");else{var i=this.wr(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=j({},i,{appearance:j({},i.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Se.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==y1.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else Se.warn("Survey not found")}}}var w1=Ye("[RateLimiter]");class KT{constructor(e){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{w1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void w1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:s})}},this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var s=new Date().getTime(),o=(n=(r=this.instance.persistence)==null?void 0:r.get_property(mh))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(i=this.instance.persistence)==null||i.set_property(mh,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Ni=Ye("[RemoteConfig]");class YT{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=ee.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Ni.error("PostHog Extensions not found. Cannot load remote config."),e())}$r(e){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Ni.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Ni.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return Ni.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r(n=>{this.Fe(n)});this.Fe(e)})}catch(e){Ni.error("Error loading remote config",e)}}Fe(e){e?this._instance.config.__preview_remote_config?(this._instance.Fe(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Ni.info("__preview_remote_config is disabled. Logging config instead",e):Ni.error("Failed to fetch remote config from PostHog.")}}var rp=3e3;class QT{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Xt((n==null?void 0:n.flush_interval_ms)||rp,250,5e3,U.createLogger("flush interval"),rp),this.Pr=e}enqueue(e){this.Rr.push(e),this.Tr||this.Cr()}unload(){this.Mr();var e=this.Rr.length>0?this.Or():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Pr(j({},r,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Cr()}Cr(){var e=this;this.Er||(this.Tr=setTimeout(()=>{if(this.Mr(),this.Rr.length>0){var n=this.Or(),r=function(){var s=n[i],o=new Date().getTime();s.data&&$e(s.data)&&ke(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Pr(s)};for(var i in n)r()}},this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var e={};return ke(this.Rr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;D(e[s])&&(e[s]=j({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Rr=[],e}}var XT=["retriesPerformedSoFar"];class ZT{constructor(e){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.Dr=!0,!D(E)&&"onLine"in E.navigator&&(this.Dr=E.navigator.onLine,Ne(E,"online",()=>{this.Dr=!0,this.oe()}),Ne(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=p_(e,XT);ht(n)&&n>0&&(r.url=Fu(r.url,{retry_count:n})),this._instance.Oe(j({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.jr(j({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(i)}}))}jr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)}(n),i=Date.now()+r;this.Rr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),U.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout(()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()},this.Ar)}oe(){var e=Date.now(),n=[],r=this.Rr.filter(s=>s.retryAt<e||(n.push(s),!1));if(this.Rr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(j({},e,{transport:"sendBeacon"}))}catch(n){U.error(n)}this.Rr=[]}}class JT{constructor(e){this.Ur=()=>{var n,r,i,s;this.zr||(this.zr={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(a),this.zr.maxScrollY=Math.max(a,(n=this.zr.maxScrollY)!==null&&n!==void 0?n:0),this.zr.maxScrollHeight=Math.max(l,(r=this.zr.maxScrollHeight)!==null&&r!==void 0?r:0),this.zr.lastContentY=u,this.zr.maxContentY=Math.max(u,(i=this.zr.maxContentY)!==null&&i!==void 0?i:0),this.zr.maxContentHeight=Math.max(c,(s=this.zr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.zr}resetContext(){var e=this.zr;return setTimeout(this.Ur,0),e}startMeasuringScrollPosition(){Ne(E,"scroll",this.Ur,{capture:!0}),Ne(E,"scrollend",this.Ur,{capture:!0}),Ne(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=$e(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var r=E==null?void 0:E.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var eP=t=>d1(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class b1{constructor(e,n,r,i){this.Br=s=>{var o=this.qr();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Hr(this._instance)};this.Wr.register({[vh]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||eP,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[vh]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?f1(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return ke(ah(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+th(r)]=n}),e}}var ip=Ye("[SessionId]");class x1{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new tp,this.Kr=(c,f)=>Math.abs(c-f)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.Wr=e.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=n||Yr,this.Xr=r||Yr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Xt(o,60,36e3,ip.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var a=st.K(this.Zr),l=st.K(this.ts);a&&!l?this.pi=a:st.X(this.Zr),st.Y(this.ts,!0)}if((i=this.A.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var f=c.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(c){ip.error("Invalid sessionID in bootstrap",c)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return D(this.Jr)&&(this.Jr=[]),this.Jr.push(e),this.Ft&&e(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter(n=>n!==e)}}es(){return this.A.persistence!=="memory"&&!this.Wr.Ue&&st.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&st.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?st.K(this.Zr):null}rs(e,n,r){e===this.Ft&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ft=e,this.Wr.register({[gu]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[gu];return $e(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Ne(E,"beforeunload",()=>{this.es()&&st.X(this.ts)},{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.ls(),a=this.os(),l=ht(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,c=!s,f=!e&&this.Kr(r,i);c||f||l?(s=this.Yr(),a=this.Xr(),ip.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.Xr(),u=!0);var d=i===0||!e||l?r:i,h=o===0?new Date().getTime():o;return this.ns(a),this.rs(s,d,h),e||this.Qr(),u&&this.Jr.forEach(p=>p(s,a,u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}Qr(){clearTimeout(this.us),this.us=setTimeout(()=>{var[e]=this.ls();if(this.Kr(new Date().getTime(),e)){var n=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var tP=["$set_once","$set"],Jr=Ye("[SiteApps]");class nP{constructor(e){this._instance=e,this.hs=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(e,n){if(n){var r=this.globalsForEvent(n);this.hs.push(r),this.hs.length>1e3&&(this.hs=this.hs.slice(10))}}get siteAppLoaders(){var e;return(e=ee._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ze(this.ds.bind(this));this.vs=()=>{e(),this.hs=[],this.vs=void 0}}}globalsForEvent(e){var n,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(f))u[d]={id:c[d],type:d,properties:h};var{$set_once:p,$set:g}=e;return{event:j({},p_(e,tP),{properties:j({},e.properties,g?{$set:j({},(n=(r=e.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},g)}:{},p?{$set_once:j({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var a;!n.errored&&this.hs.length&&(Jr.info("Processing "+this.hs.length+" events for site app with id "+e.id),this.hs.forEach(l=>n.processEvent==null?void 0:n.processEvent(l)),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.vs)==null||a.call(this))},i=!1,s=a=>{n.errored=!a,n.loaded=!0,Jr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(n.processEvent=o),i=!0}catch(a){Jr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&n.loaded)try{r()}catch(a){Jr.error("Error while processing buffered events PostHog app with config id "+e.id,a),n.errored=!0}}cs(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}fs(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(i){Jr.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var n,r,i,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",u=>this.fs(u))):void Jr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.vs)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(u){var c;ee["__$$ph_site_app_"+u]=s._instance,(c=ee.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,l,f=>{if(f)return Jr.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:a,url:l}of e.siteApps)o(a)}else Jr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var rP=["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"],k1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return rP.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},S1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&k1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>k1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},ma=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),E1="i.posthog.com";class iP{constructor(e){this.ps={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+E1,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ma.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ma.EU:this.ps[this.apiHost]=ma.CUSTOM),this.ps[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(this.region===ma.CUSTOM)return this.apiHost+n;var r=E1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var sP={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&As(e.href,t),not_regex:(t,e)=>!!E&&!As(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class gt{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{gt.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(gt.gs("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n._s)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);He(a)&&s.variants[a]&&n.ys(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];gt.bs(u)&&n.ys(s.name,l,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())gt.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(ge(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();gt.gs("applying feature flags",e),e.forEach(n=>{var r;if(this._s&&(r=this._s)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this._s)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.ys(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=gt.getWindowLocation();if(e!=null&&e.search){var n=ku(e==null?void 0:e.search,"__experiment_id"),r=ku(e==null?void 0:e.search,"__experiment_variant");n&&r&&(gt.gs("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.ws(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}ws(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(gt.gs("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.ys(i[0].name,n,i[0].variants[n].transforms))}static bs(e){return!ge(e.conditions)&&gt.Ss(e)&&gt.ks(e)}static Ss(e){var n;if(ge(e.conditions)||ge((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=gt.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||sP[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E==null?void 0:E.location}static ks(e){var n;if(ge(e.conditions)||ge((n=e.conditions)==null?void 0:n.utm))return!0;var r=o1();if(r.utm_source){var i,s,o,a,l,u,c,f,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,h=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,g=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return d&&p&&g&&h}return!1}static gs(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];U.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?gt.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;gt.gs("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):gt.gs("Control variants leave the page unmodified.")}_is_bot(){return Qt&&this._instance?S1(Qt,this._instance.config.custom_blocked_useragents):void 0}}var oP=Ye("[PostHog ExternalIntegrations]"),aP={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class lP{constructor(e){this._instance=e}nt(e,n){var r;(r=ee.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return oP.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=ee.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(aP[o],()=>{var c;(c=ee.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=ee.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=ee.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var sp="[SessionRecording]",ya=Ye(sp);class uP{get started(){var e;return!((e=this.$s)==null||!e.isStarted)}get status(){var e;return((e=this.$s)==null?void 0:e.status)||"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ni=void 0,this._instance=e,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(sp+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(sp+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(ch))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&n&&r&&!i}startIfEnabledOrStop(e){var n;if(!this.Bt||(n=this.$s)==null||!n.isStarted){var r=!D(Object.assign)&&!D(Array.from);this.Bt&&r?(this.xs(e),ya.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(ee!=null&&(n=ee.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=ee.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=ee.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return ya.error("could not load recorder",s);this.Ri(e)}))}stopRecording(){var e;(e=this.$s)==null||e.stop()}ki(){var e;(e=this._instance.persistence)==null||e.unregister(Rs)}Ei(e){if(this._instance.persistence){var n,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording,a=o==null?void 0:o.sampleRate,l=ge(a)?null:parseFloat(a);ge(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[ch]:j({enabled:!!o},o,{networkPayloadCapture:j({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:l,minimumDurationMilliseconds:D(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(n=this.ni)==null||n.call(this),this.ni=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?(this.Ei(e),this.startIfEnabledOrStop()):ya.info("skipping remote config with no sessionRecording",e)}log(e,n){var r;n===void 0&&(n="log"),(r=this.$s)!=null&&r.log?this.$s.log(e,n):ya.warn("log called before recorder was ready")}get Ii(){var e,n,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ch);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=ee.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=ee.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.$s.start(e)}onRRwebEmit(e){var n;(n=this.$s)==null||n.onRRwebEmit==null||n.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.$s)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.$s)==null||e.overrideSampling()}overrideTrigger(e){var n;(n=this.$s)==null||n.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.$s)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,n){var r;return!((r=this.$s)==null||!r.tryAddCustomEvent(e,n))}}var _a={},op=()=>{},Ns="posthog",$1=!kT&&(Dt==null?void 0:Dt.indexOf("MSIE"))===-1&&(Dt==null?void 0:Dt.indexOf("Mozilla"))===-1,C1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:gR(B==null?void 0:B.location),persistence:"localStorage+cookie",persistence_name:"",loaded:op,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:t!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:t??"unset",debug:Lt&&He(Lt==null?void 0:Lt.search)&&Lt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;U.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:rp},error_tracking:{},_onCapture:op,__preview_eager_load_replay:!0}},R1=t=>{var e={};D(t.process_person)||(e.person_profiles=t.process_person),D(t.xhr_headers)||(e.request_headers=t.xhr_headers),D(t.cookie_name)||(e.persistence_name=t.cookie_name),D(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),D(t.store_google)||(e.save_campaign_params=t.store_google),D(t.verbose)||(e.debug=t.verbose);var n=qe({},e,t);return $e(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:$e(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:U.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class cP{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Uu{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new cP,this.Rs=!1,this.version=pr.LIB_VERSION,this.Is=new tp,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=C1(),this.SentryIntegration=hT,this.sentryIntegration=e=>function(n,r){var i=Ow(n,r);return{name:Mw,processEvent:s=>i(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new HT(this),this.toolbar=new gT(this),this.scrollManager=new JT(this),this.pageViewManager=new bT(this),this.surveys=new GT(this),this.experiments=new gt(this),this.exceptions=new ST(this),this.rateLimiter=new KT(this),this.requestRouter=new iP(this),this.consent=new DR(this),this.externalIntegrations=new lP(this),this.people={set:(e,n,r)=>{var i=He(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=He(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>U.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==Ns){var i,s=(i=_a[r])!==null&&i!==void 0?i:new Uu;return s._init(e,n,r),_a[r]=s,_a[Ns][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||nh(e))return U.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return U.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=n,this.Fs=[],n.person_profiles&&(this.Cs=n.person_profiles),this.set_config(qe({},C1(n.defaults),R1(n),{name:r,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:mr.GZipJS;var o=this.As();this.persistence=new Jh(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Jh(j({},this.config,{persistence:"sessionStorage"}),o);var a=j({},this.persistence.props),l=j({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ds=new QT(y=>this.js(y),this.config.request_queue_config),this.Ls=new ZT(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new x1(this),this.sessionPropsManager=new b1(this,this.sessionManager,this.persistence)),new mT(this).startIfEnabledOrStop(),this.siteApps=new nP(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new Pw(this):this.sessionRecording=new uP(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new TR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new wT(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new yT(this),this.exceptionObserver=new zR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new cw(this,jR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new HR(this),this.historyAutocapture.startIfEnabled(),pr.DEBUG=pr.DEBUG||this.config.debug,pr.DEBUG&&U.info("Starting in debug mode",{this:this,config:n,thisC:j({},this.config),p:a,s:l}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,f,d=this.config.get_device_id(Yr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(vr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,g,w=Object.keys(((p=n.bootstrap)==null?void 0:p.featureFlags)||{}).filter(y=>{var b;return!((b=n.bootstrap)==null||(b=b.featureFlags)==null||!b[y])}).reduce((y,b)=>{var x;return y[b]=((x=n.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[b])||!1,y},{}),m=Object.keys(((g=n.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(y=>w[y]).reduce((y,b)=>{var x,k;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(k=n.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:w,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:ra,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Yr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(vr,"anonymous")}return Ne(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?fT(this,()=>this.Us()):this.Us(),ln(this.config._onCapture)&&this.config._onCapture!==op&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&U.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}Fe(e){var n,r,i,s,o,a,l,u;if(!B||!B.body)return U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Fe(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,mr.GZipJS)?mr.GZipJS:ue(e.supportedCompression,mr.Base64)?mr.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Us(){try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new YT(this).load(),this.featureFlags.flags()}zs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ds)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Gr(this.__request_queue,e=>this.js(e)),this.__request_queue=[],this.zs()}_handle_unload(){var e,n;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),(e=this.Ds)==null||e.unload(),(n=this.Ls)==null||n.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(e){this.__loaded&&($1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Fu(e.url,{ip:this.config.ip?1:0}),e.headers=j({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=j({},n);o.timeout=o.timeout||6e4,o.url=Fu(o.url,{_:new Date().getTime().toString(),ver:pr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=Lu.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=C_(l,c=>c.transport===a))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(j({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,n)),e.callback==null||e.callback(n)}}))))}js(e){this.Ls?this.Ls.retriableRequest(e):this.Oe(e)}_execute_array(e){var n,r=[],i=[],s=[];Gr(e,a=>{a&&(n=a[0],$e(n)?s.push(a):ln(a)?a.call(this):$e(a)&&n==="alias"?r.push(a):$e(a)&&n.indexOf("capture")!==-1&&ln(this[n])?s.push(a):i.push(a))});var o=function(a,l){Gr(a,function(u){if($e(u[0])){var c=l;ke(u,function(f){c=c[f[0]].apply(c,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(r,this),o(i,this),o(s,this)}Ns(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!D(e)&&He(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!He(n==null?void 0:n.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$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();var o=new Date,a=(r==null?void 0:r.timestamp)||o,l=Yr(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,n||{},a,l)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var c,f=this.Hs(r==null?void 0:r.$set_once);if(f&&(u.$set_once=f),(u=hR(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,D(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Hu.DISMISSED||e===Hu.SENT){var d=n==null?void 0:n[m1.SURVEY_ID],h=n==null?void 0:n[m1.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(_1(c))||localStorage.setItem(_1(c),"true"),u.$set=j({},u.$set,{[BT({id:d,current_iteration:h},e===Hu.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if($s(p)||this.setPersonPropertiesForFlags(p),!ge(this.config.before_send)){var g=this.Ws(u);if(!g)return;u=g}this.Is.emit("eventCaptured",u);var w={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.js(w):this.Ds.enqueue(w),u}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.uninitializedWarning("posthog.capture")}Ze(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=j({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=j({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!He(a.distinct_id)&&!ht(a.distinct_id)||nh(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=NT(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=f,a.$window_id=d}this.sessionPropsManager&&qe(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&qe(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this.Ls)==null?void 0:h.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===ma.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=qe(a,u),e==="$pageview"&&B&&(a.title=B.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Dt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=qe({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),$e(this.config.property_denylist)?ke(this.config.property_denylist,function(m){delete a[m]}):U.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,e));var w=this.Gs();return a.$process_person_profile=w,w&&!s&&this.Vs("_calculate_event_properties"),a}Hs(e){var n;if(!this.persistence||!this.Gs()||this.Rs)return e;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=qe({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(U.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,$s(s)?void 0:s}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Js(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Is.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=VT),this.surveys.displaySurvey(e,n)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,r){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(ht(e)&&(e=e.toString(),U.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))U.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ra){if(this.Vs("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Jo)&&(this.unregister(Jo),this.register({distinct_id:e}));var o=(this.persistence.get_property(vr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(vr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=Nw(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(mu))}}else U.critical('The string "'+ra+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=Nw(this.get_distinct_id(),e,n);this.Ms!==r?(this.setPersonPropertiesForFlags(j({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ms=r):U.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){if(this.Vs("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:j({},i,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else U.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s;if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(vr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ra,$device_id:null},"");else{var a=this.config.get_device_id(Yr());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(R_)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(D(n)&&(n=this.get_distinct_id()),e!==n?(this.Js(Jo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(ze(e)){var r,i,s,o,a;qe(this.config,R1(e));var l=this.As();(r=this.persistence)==null||r.update_config(this.config,n,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Jh(j({},this.config,{persistence:"sessionStorage"}),l),Qe.G()&&Qe.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(pr.DEBUG=!0,U.info("set_config",{config:e,oldConfig:n,newConfig:j({},this.config)})),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(j({},i,n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ns;return n!==Ns&&(n=Ns+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(vr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(vr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&$s(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Jo])&&((n=this.persistence)==null||(n=n.props)==null||!n[_u]))}qs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(e){return this.config.person_profiles==="never"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(_u,!0),!0)}As(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}Ks(){var e,n,r,i,s=this.As();return((e=this.persistence)==null?void 0:e.Ue)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Ue)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new x1(this),this.persistence&&(this.sessionPropsManager=new b1(this,this.sessionManager,this.persistence)),this.sessionRecording=new Pw(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(D(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Bs()}else U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ra,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===yr.GRANTED?"granted":e===yr.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ks()}_is_bot(){return Qt?S1(Qt,this.config.custom_blocked_useragents):void 0}Bs(){B&&(B.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Ts&&(B.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Ne(B,"visibilitychange",this.Ts)))}debug(e){e===!1?(E==null||E.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(E==null||E.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var e,n,r,i,s,o,a,l=this.Os||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(U.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=U,o=(n="advanced_disable_flags")in(e=l)&&!D(e[n]),a=r in e&&!D(e[r]),o?e[n]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):i)}Ws(e){if(ge(this.config.before_send))return e;var n=$e(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),ge(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return H3(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!$s(r.properties)||U.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=fR(t.prototype[e[n]])})(Uu,["identify"]);var T1,ap=(T1=_a[Ns]=new Uu,function(){function t(){t.done||(t.done=!0,$1=!1,ke(_a,function(e){e._dom_loaded()}))}B!=null&&B.addEventListener?B.readyState==="complete"?t():Ne(B,"DOMContentLoaded",t,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),T1);console.info("Vehicle Search v3.0.36 powered by Partbot https://mmyvs.partbot.io");function Bu(t=[],e=[]){const n=[];return t.forEach(r=>{const[i,...s]=r.split(":"),o=s.join(":");if(o.includes(" > ")){const a=o.split(" > "),l=a[a.length-1].trim();if(i!=="make"&&a.length>=2){const u=a[0].trim();n.push(`make = "${u}"`)}n.push(`${i} = "${l}"`)}else n.push(`${i} = "${o}"`)}),e.forEach(r=>{n.push(r)}),n.length>0?n.join(" AND "):null}function vt(t){return String(t||"").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toUpperCase().trim().replace(/\s+/g," ")}function js(t){return String(t||"").split(">").pop().trim()}function lp(t,e,n){return!n||n.size===0||!Array.isArray(t)||!t.some(i=>n.has(vt(e(i))))?t:t.filter(i=>n.has(vt(e(i))))}function up({apiKey:t,makes:e="",models:n="",vehicleScopeTokens:r="",yearTokens:i="",callbackUrl:s="",layout:o="row",fields:a,fieldPrefix:l="",showBranding:u=!0,showLabels:c=!1,mobileFullWidthButton:f=!0,mobileDrawer:d=!0,modifyQueryString:h=!0,onChange:p,buttonLabel:g="Search",showButton:w=!0,onSubmit:m,store:v,useStoreVehicles:y=!0,fieldOrder:b="MMY",enableFeatureFlags:x=!1,yearOptional:k=!1,mobileButtonLabel:$="Select Vehicle"}){const C=_.useRef(null),q=_.useRef(null),F=_.useRef(null),I=_.useRef(null),N=_.useRef(null),K=_.useRef(null),Z=_.useRef(null),H=_.useRef(null),re=_.useRef(null),ne=_.useRef(!1),R=b==="YMM",[L,z]=_.useState([]),[ae,M]=_.useState([]),[le,te]=_.useState([]),[be,ie]=_.useState([]),[Me,ye]=_.useState([]),[dn,Ct]=_.useState([]),[Ue,ji]=_.useState([]),[zs,zi]=_.useState([]),qu=_.useRef([]),[Xn,wr]=_.useState([]),[S,Zt]=_.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[gP,cp]=_.useState(!1),M1=_.useRef(["body","series","variant","engine","engine_capacity"]),Vu=_.useRef(a&&a.length&&M1.current?a.split(",").filter(T=>{var P;return(P=M1.current)==null?void 0:P.includes(T)}):null),[dp,Wu]=_.useState(""),[Gu,O1]=_.useState(!1),Ku=typeof r=="string"&&r.trim().length?r:typeof dp=="string"&&dp.trim().length?dp:i,Zn=_.useMemo(()=>Gu?new Set:!e||typeof e!="string"?new Set:new Set(e.trim().split(",").map(T=>vt(T)).filter(Boolean)),[e,Gu]),ei=_.useMemo(()=>{const T=new Map,P=new Map;return!Ku||typeof Ku!="string"?{byMake:T,byMakeYear:P}:(Ku.split(",").map(G=>G.trim()).filter(Boolean).forEach(G=>{const[V,se,Y]=G.split("|"),Q=vt(V),X=vt(se),ve=String(Y||"").trim();if(!(!Q||!X)&&(T.has(Q)||T.set(Q,new Set),T.get(Q).add(X),/^\d{4}$/.test(ve))){const Ie=`${Q}|${ve}`;P.has(Ie)||P.set(Ie,new Set),P.get(Ie).add(X)}}),{byMake:T,byMakeYear:P})},[Ku]),Hs=_.useMemo(()=>new Set(Array.from(ei.byMake.keys())),[ei]),[Pn,vP]=_.useState(!1);_.useEffect(()=>{const T=navigator.userAgent;vP(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(T)),ap.__loaded||ap.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://app.posthog.com",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[ti,mP]=_.useState({}),[LP,yP]=_.useState(""),A1=_.useCallback(async()=>{if(!t)return;const P=`${x?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const G=await fetch(P,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify((()=>{const fe={use_store_vehicles:y};return v&&(fe.store=v),fe})())});if(!G.ok)throw new Error(`Error: ${G.status} ${G.statusText}`);const{merchant:V,vehicle_makes:se,vehicle_models:Y,scoped_vehicle_models:Q,vehicle_scope_tokens:X,vehicle_scope_applied:ve,vehicle_scope_source:Ie,meilisearch_search_key:_e,meilisearch_index_name:Rt,algolia_search_key:hn,algolia_index_name:Mn,store_index_name:ot,store_popular_makes:Jn,store_popular_models:Ce}=await G.json(),yt=Q&&typeof Q=="object"&&!Array.isArray(Q)&&Object.keys(Q).length>0,On=se||[],An=yt?Q:Y,er=!!ve||yt,xa=String(Ie||"").trim(),Qu=er&&xa.length>0&&xa!=="store_scope_cache";q.current=V,O1(Qu),Array.isArray(X)?Wu(X.join(",")):Wu(typeof X=="string"?X:""),F.current=On.map(fe=>({...fe,refinement:fe.value})),y&&An?typeof An=="object"&&!Array.isArray(An)?I.current=An:Array.isArray(An)?I.current=An.map(fe=>fe&&fe.value?String(fe.value).trim():"").filter(Boolean):I.current=[]:I.current=[],N.current=Array.isArray(Jn)?Jn.map(fe=>String(fe).trim().toUpperCase()):null,K.current=Ce||null,mP({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(G){console.error("[VehicleSearch] Auth failed:",G),yP(G),O1(!1),Wu("")}},[t,v,y,x]);_.useEffect(()=>{A1()},[A1]),_.useEffect(()=>{if(ti.searchKey){try{Z.current=new By({host:"https://search.partbot.io",apiKey:ti.searchKey}),H.current=Z.current.index(ti.indexName);const T=new By({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:ti.searchKey});re.current=T.index("otto_v1_vehicle_mmy")}catch(T){console.error("[VehicleSearch] Failed to initialize Meilisearch:",T)}return()=>{Z.current=null}}},[ti.searchKey,t]);const[fn,_P]=_.useState(!1),I1=_.useCallback(()=>{function T(Y){if(!Y)return"rgba(0,0,0,1)";var Q=P(),X=window.getComputedStyle(Y).backgroundColor;return X!==Q?X:Y.parentElement?T(Y.parentElement):"rgba(255,255,255,1)"}function P(){var Y=document.createElement("div");document.head.appendChild(Y);var Q=window.getComputedStyle(Y).backgroundColor;return document.head.removeChild(Y),Q}const G=document.querySelector("vehicle-search");let V;G?V=T(G):V=T(C.current);const se=J(V).isDark();_P(se)},[]);_.useEffect(()=>{async function T(){if(!S.make||!H.current)return;let P=[],G=[];S.make&&P.push(`make:${S.make.refinement}`),S.model&&P.push(`model:${S.make.refinement} > ${S.model.refinement}`),S.year&&(G=[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]),S.body&&P.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&P.push(`series:${S.series.refinement}`),S.engine&&P.push(`engine:${S.engine.refinement}`),S.engine_capacity&&P.push(`engine_capacity:${S.engine_capacity.refinement}`);let se=(await H.current.search("",{filter:Bu(P,G),attributesToRetrieve:["otto_id"],limit:500})).hits.map(X=>X.otto_id);wr(se);let Q={...Object.fromEntries(Object.entries(S||{}).map(([X,ve])=>[X,ve&&ve.value||null]).filter(([X,ve])=>ve!==null)),merchant:q.current};ap.capture("vehicle select",Q)}T()},[S,H,k]);const fp=T=>l?`${l}${T}`:T,wP=T=>l?T.replace(new RegExp(`^${l}`),""):T,F1=_.useCallback(()=>{const T=new URL(window.location.href).searchParams,P=["make","model","year","body","series","engine","engine_capacity"],G=P.map(fp),V={},se=/^filter\.p\.m\.app--\d+--partbot\.vehicle_(\w+)$/;for(const[Q,X]of T.entries()){const ve=Q.match(se);if(ve){const Ie=ve[1];if(Ie==="year_tokens"&&X){const Rt=X.split("|");if(Rt.length>=3){const hn=Rt[2].trim();/^\d{4}$/.test(hn)&&(V.year=hn)}continue}let _e=Ie.replace(/s$/,"");_e==="engine_capacitie"&&(_e="engine_capacity"),_e==="bodie"&&(_e="body"),_e==="serie"&&(_e="series"),P.includes(_e)&&(V[_e]=X)}}const Y=Object.fromEntries([...T.entries()].filter(([Q])=>G.includes(Q)).map(([Q,X])=>{const ve=wP(Q);if(ve==="year"&&X&&/^\d{4}$/.test(X)){const Ie=parseInt(X,10);return[ve,{value:Ie,refinement:Ie}]}return[ve,{value:X,refinement:X}]}));for(const[Q,X]of Object.entries(V))if(X&&X!=="[object Object]"&&!Y[Q])if(Q==="year"&&/^\d{4}$/.test(X)){const ve=parseInt(X,10);Y[Q]={value:ve,refinement:ve}}else Y[Q]={value:X,refinement:X};if(Object.keys(Y).length===0)try{const Q=localStorage.getItem("partbot_selected_vehicle");if(Q){const X=JSON.parse(Q);if(X!=null&&X.vehicle){const ve=X.vehicle;for(const Ie of P){const _e=ve[Ie];if(_e&&typeof _e=="string"&&_e.trim())if(Ie==="year"&&/^\d{4}$/.test(_e)){const Rt=parseInt(_e,10);Y[Ie]={value:Rt,refinement:Rt}}else Y[Ie]={value:_e,refinement:_e};else if(_e!=null&&_e.value&&typeof _e.value=="string")if(Ie==="year"&&/^\d{4}$/.test(_e.value)){const Rt=parseInt(_e.value,10);Y[Ie]={value:Rt,refinement:Rt}}else Y[Ie]={value:_e.value,refinement:_e.value}}}}}catch{}Zt(Y)},[]),mt=_.useCallback(({query:T,value:P,remove:G})=>{if(h&&"URLSearchParams"in window){let V=new URLSearchParams(window.location.search);T=fp(T),T&&P&&V.set(T,P),T&&!P&&V.delete(T),G&&G.forEach(Y=>{Y=fp(Y),V.delete(Y)});const se=window.location.pathname+"?"+V.toString();window.history.pushState(null,"",se)}},[]),bP=_.useCallback(()=>{var G;const T={vehicle_ids:Xn,vehicle:(G=S==null?void 0:S.make)!=null&&G.value?S:{}};m&&m(T);const P=new CustomEvent("vehicle-search-submit",{detail:T});window.dispatchEvent(P),document.dispatchEvent(P),setTimeout(()=>{cp(!1)},900)},[Xn,m]),L1=_.useCallback(()=>{var G,V,se,Y,Q,X,ve,Ie,_e;const T={vehicle_ids:Xn,vehicle:(G=S==null?void 0:S.make)!=null&&G.value?S:{},userSelected:ne.current};p&&p(T);const P=new CustomEvent("vehicle-search-change",{detail:T});if(ne.current===!0){localStorage.removeItem("partbot_plate_details");const Rt=JSON.stringify({description:`${((V=S.make)==null?void 0:V.value)||""} ${((se=S.model)==null?void 0:se.value)||""} ${((Y=S.year)==null?void 0:Y.value)||""} ${((Q=S.body)==null?void 0:Q.value)||""} ${((X=S.series)==null?void 0:X.value)||""} ${((ve=S.variant)==null?void 0:ve.value)||""} ${((Ie=S.engine)==null?void 0:Ie.value)||""} ${((_e=S.engine_capacity)==null?void 0:_e.value)||""}`.trim(),vehicle_ids:Xn,vehicle:S?Object.entries(S).reduce((hn,[Mn,ot])=>(hn[Mn]=ot!=null&&ot.value?ot.value:{},hn),{}):{}});localStorage.setItem("partbot_selected_vehicle",Rt),yk.set("partbot_selected_vehicle",Rt,{secure:!0})}window.dispatchEvent(P),ne.current&&document.dispatchEvent(P),qu.current=Xn,setTimeout(()=>{cp(!1)},900)},[Xn,p]),ni=_.useMemo(()=>h3(L1,100),[L1]);_.useEffect(()=>{ni()},[Xn,ni]),_.useEffect(()=>()=>{ni.cancel()},[ni]),_.useEffect(()=>{const T=()=>{ne.current=!1,ni.cancel(),Zt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),wr([])};return window.addEventListener("plate-search-change",T),()=>{window.removeEventListener("plate-search-change",T)}},[ni]),_.useEffect(()=>{const T=()=>{ne.current=!1,ni.cancel(),Zt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),wr([])};return document.addEventListener("partbot-clear-vehicle",T),()=>{document.removeEventListener("partbot-clear-vehicle",T)}},[ni]),_.useEffect(()=>{ti.searchKey&&(R||CP(),F1())},[ti.searchKey,R,F1]),_.useEffect(()=>{R&&H.current&&le.length===0&&!S.year&&H.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:T})=>{const P=T.map(Q=>Q.year_from).filter(Boolean),G=T.map(Q=>Q.year_to).filter(Boolean),V=Math.min(...P),se=Math.max(...G),Y=Array.from({length:se-V+1},(Q,X)=>({value:V+X,refinement:V+X})).reverse();te(Y)}).catch(T=>{console.error("[VehicleSearch] Error loading year range:",T)})},[R,ti.searchKey,le.length,S.year]),_.useEffect(()=>{typeof document>"u"||I1()},[I1]);const D1=_.useCallback(T=>{ne.current=!0,M([]),!R&&!k&&te([]),ie([]),ye([]),Ct([]),zi([]),ji([]),Zt(P=>({make:T,year:R||k?P.year:null})),mt({query:"make",value:(T==null?void 0:T.value)??"",remove:R?["model","body","series","engine","variant","engine_capacity"]:k?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),T||wr([])},[mt,R,k]),N1=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,model:T!==""?T:null,year:R||k?P.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!R&&!k&&te([]),ie([]),ye([]),Ct([]),zi([]),ji([]),mt({query:"model",value:(T==null?void 0:T.value)??"",remove:R?["body","series","engine","variant","engine_capacity"]:k?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[mt,R,k]),j1=_.useCallback(T=>{ne.current=!0,R?(z([]),M([]),Zt({year:T!==""?T:null}),(!T||T==="")&&te([])):Zt(k?P=>({...P,year:T!==""?T:null}):P=>({...P,year:T!==""?T:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),k||(ie([]),ye([]),Ct([]),zi([]),ji([])),mt({query:"year",value:(T==null?void 0:T.value)??"",remove:R?["make","model","body","series","variant","engine","engine_capacity"]:k?[]:["body","series","variant","engine","engine_capacity"]}),!k&&(!T||T==="")&&wr([])},[mt,R,k]),xP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,body:T!==""?T:null})),mt({query:"body",value:(T==null?void 0:T.value)??""})},[mt]),kP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,series:T!==""?T:null})),mt({query:"series",value:(T==null?void 0:T.value)??""})},[mt]),SP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,variant:T!==""?T:null})),mt({query:"variant",value:(T==null?void 0:T.value)??""})},[mt]),EP=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,engine:T!==""?T:null})),mt({query:"engine",value:(T==null?void 0:T.value)??""})},[mt]),$P=_.useCallback(T=>{ne.current=!0,Zt(P=>({...P,engine_capacity:T!==""?T:null})),mt({query:"engine_capacity",value:(T==null?void 0:T.value)??""})},[mt]);_.useEffect(()=>{R&&S.year&&H.current&&(async()=>{try{const P=await H.current.search("",{filter:`year_from <= ${S.year.value} AND year_to >= ${S.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),G=new Map;P.hits.forEach(Y=>{Y.make&&!G.has(Y.make)&&G.set(Y.make,{value:Y.make.toUpperCase(),refinement:Y.make.toUpperCase(),popularity:Y.make_popularity||0})});let V=Array.from(G.values());Zn.size>0?V=V.filter(Y=>Zn.has(vt(Y.value))):Hs.size>0&&(V=V.filter(Y=>Hs.has(vt(Y.value))));const se=new Set(N.current||[]);se.size>0?V.sort((Y,Q)=>{const X=se.has(Y.value),ve=se.has(Q.value);return X&&!ve?-1:!X&&ve?1:X&&ve?N.current.indexOf(Y.value)-N.current.indexOf(Q.value):Y.value.localeCompare(Q.value)}):V.sort((Y,Q)=>Q.popularity===Y.popularity?Y.value.localeCompare(Q.value):Q.popularity-Y.popularity),z(V)}catch(P){console.error("[VehicleSearch] Error loading makes for year:",P)}})()},[R,S.year,Zn,Hs]);const CP=_.useCallback(()=>{(async()=>{let P=[];if(F.current&&F.current.length)P=F.current;else if(H.current)try{const G=await H.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),V=new Map;G.hits.forEach(se=>{se.make&&!V.has(se.make)&&V.set(se.make,{value:se.make.toUpperCase(),refinement:se.make.toUpperCase(),popularity:se.make_popularity||0})}),P=Array.from(V.values())}catch(G){console.error("[VehicleSearch] Error loading makes:",G)}if(Zn.size>0&&P.length&&(P=P.filter(G=>Zn.has(vt(G.value)))),Zn.size===0&&Hs.size>0&&(P=P.filter(G=>Hs.has(vt(G.value)))),N.current&&N.current.length>0){const G=new Set(N.current);P.sort((V,se)=>{const Y=G.has(V.value),Q=G.has(se.value);return Y&&!Q?-1:!Y&&Q?1:Y&&Q?N.current.indexOf(V.value)-N.current.indexOf(se.value):V.value.localeCompare(se.value)})}else P.sort((G,V)=>G.popularity===V.popularity?G.value.localeCompare(V.value):V.popularity-G.popularity);z(P)})()},[Zn,Hs]);_.useEffect(()=>{var T,P;if(S.make&&S.make.refinement){const G=S.make.refinement,V=vt(G),se=Zn.size>0,Y=ei.byMake.size>0;if(se&&!Zn.has(V)){M([]);return}if(!se&&Y&&!ei.byMake.has(V)){M([]);return}const Q=String(((T=S.year)==null?void 0:T.value)||"").trim(),X=`${V}|${Q}`,ve=/^\d{4}$/.test(Q)&&ei.byMakeYear.has(X)?ei.byMakeYear.get(X):null,Ie=ei.byMake.get(V),_e=ve&&ve.size>0?ve:Ie||null,Rt=!Gu&&n?n.trim().split(",").map(Mn=>Mn.trim()).filter(Boolean):[],hn=new Set(Rt.map(Mn=>vt(Mn)));if(y&&hn.size===0&&typeof I.current=="object"&&!Array.isArray(I.current)&&I.current[G]){let ot=I.current[G].map(Ce=>({value:Ce,refinement:Ce,popularity:0}));ot=lp(ot,Ce=>Ce.value,hn),ot=lp(ot,Ce=>Ce.value,_e);const Jn=(P=K.current)==null?void 0:P[G];if(Jn&&Array.isArray(Jn)){const Ce=new Map(Jn.map((yt,On)=>[yt.toUpperCase(),Jn.length-On]));ot.sort((yt,On)=>{const An=Ce.get(yt.value.toUpperCase())||0,er=Ce.get(On.value.toUpperCase())||0;return An!==er?er-An:yt.value.localeCompare(On.value)})}else ot.sort((Ce,yt)=>Ce.value.localeCompare(yt.value));M(ot);return}if(!re.current||!t)return;re.current.search("",{filter:`make = "${S.make.refinement}"`,limit:1}).then(Mn=>{var xa,Qu;const{hits:ot}=Mn;let Jn=[];ot.length>0&&ot[0].models&&(Jn=ot[0].models);let Ce=Jn.map(fe=>({model:`${S.make.refinement} > ${fe.name}`,model_popularity:fe.popularity||0})),yt=[];Array.isArray(I.current)?yt=I.current:typeof I.current=="object"&&I.current!==null?yt=I.current[S.make.refinement]||[]:typeof I.current=="string"&&I.current.length&&(yt=I.current.split(",").map(fe=>fe.trim()).filter(Boolean));let On=yt;if(hn.size>0&&(On=yt.length?yt.filter(fe=>hn.has(vt(fe))):Rt,Ce=Ce.filter(fe=>hn.has(vt(js(fe.model))))),On&&On.length>0){const fe=new Set(On.map(br=>vt(br)));Ce.some(br=>fe.has(vt(js(br.model))))&&(Ce=Ce.filter(br=>fe.has(vt(js(br.model)))))}Ce=lp(Ce,fe=>js(fe.model),_e),Ce=Ce.filter(fe=>js(fe.model)!=="").map(fe=>{const jt=js(fe.model);return{value:jt,refinement:jt,popularity:fe.model_popularity}});const An=(xa=S.make)==null?void 0:xa.refinement,er=(Qu=K.current)==null?void 0:Qu[An];if(er&&Array.isArray(er)&&er.length>0){const fe=new Set(er.map(jt=>String(jt).trim().toUpperCase()));Ce.sort((jt,br)=>{const pp=fe.has(jt.value),gp=fe.has(br.value);if(pp&&!gp)return-1;if(!pp&&gp)return 1;if(pp&&gp){const z1=er.map(TP=>String(TP).trim().toUpperCase());return z1.indexOf(jt.value)-z1.indexOf(br.value)}return jt.value.localeCompare(br.value)})}else Ce.sort((fe,jt)=>fe.popularity===jt.popularity?fe.value.localeCompare(jt.value):jt.popularity-fe.popularity);M(Ce)}).catch(Mn=>{console.error("[VehicleSearch] Error loading models:",Mn),M([])})}else M([])},[S.make,n,t,R,S.year,y,Gu,Zn,ei]),_.useEffect(()=>{if(H.current&&S.make&&S.model){let T=[`model:${S.make.refinement} > ${S.model.refinement}`];k&&(S.body&&T.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&T.push(`series:${S.series.refinement}`),S.engine&&T.push(`engine:${S.engine.refinement}`),S.engine_capacity&&T.push(`engine_capacity:${S.engine_capacity.refinement}`)),H.current.search("",{filter:Bu(T,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:P})=>{const G=P.map(X=>X.year_from),V=Math.min(...G),se=P.map(X=>X.year_to),Y=Math.max(...se);let Q=Array.apply(null,{length:Y+1-V}).map(function(X,ve){return ve+V});Q=Q.reverse().map(X=>({value:X,refinement:X})),te(Q)}).catch(P=>{console.error("[VehicleSearch] Error fetching years:",P)})}},[S.model,S.make,R,k,S.body,S.series,S.engine,S.engine_capacity]),_.useEffect(()=>{const T=k?S.make&&S.model:S.year&&S.make&&S.model;if(H.current&&T){const P=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:Bu([`model:${S.make.refinement} > ${S.model.refinement}`],P),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:G})=>{G=[...new Map(G.map(V=>[V.body,V])).values()].map(V=>({value:V.body.match(/[^>]*$/)[0].trim(),refinement:V.body.match(/[^>]*$/)[0].trim()})).filter(V=>V.value),ie(G)})}},[S.year,S.make,S.model,k]);const ba=_.useCallback(({hits:T,attribute:P,stateCallback:G})=>{let V=[...new Map(T.map(se=>[se[P],se])).values()].map(se=>({value:se[P].match(/[^|]*$/)[0].trim(),refinement:se[P].match(/[^|]*$/)[0].trim()})).filter(se=>se.refinement);G(V)},[]),RP=_.useCallback(()=>{const T=Vu.current?Vu.current.length+3:3,P=w?T+1:T;return`vs:lg:grid-cols-${P>8?8:P}`},[w]);_.useEffect(()=>{const T=k?S.make&&S.model:S.make&&S.model&&S.year;if(H.current&&T){let P=[`make:${S.make.refinement}`,`model:${S.make.refinement} > ${S.model.refinement}`,S.body?`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`:"",S.series?`series:${S.series.refinement}`:"",S.variant?`variant:${S.variant.refinement}`:"",S.engine?`engine:${S.engine.refinement}`:"",S.engine_capacity?`engine_capacity:${S.engine_capacity.refinement}`:""].filter(V=>V);const G=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:Bu(P,G),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:V})=>{ba({hits:V,attribute:"series",stateCallback:ye}),ba({hits:V,attribute:"variant",stateCallback:Ct}),ba({hits:V,attribute:"engine",stateCallback:ji}),ba({hits:V,attribute:"engine_capacity",stateCallback:zi})})}},[S.body,S.series,S.variant,S.engine,S.engine_capacity,ba,S.make,S.model,S.year,k]);const[Yu,hp]=_.useState(!1);return _.useEffect(()=>{if(d)return Yu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Yu,d]),A.jsxs(A.Fragment,{children:[d&&A.jsx("button",{onClick:()=>hp(!0),type:"button",className:Br("vehicle-search-btn vs:md:hidden!",f?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:A.jsx("span",{children:$})}),d&&A.jsx("div",{onClick:()=>hp(!1),className:Br("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Yu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),A.jsxs("div",{className:Br("partbot-mmyvs-container",d&&Yu&&"active","w-full"),children:[d&&A.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[A.jsx("span",{children:"Select Vehicle"}),A.jsxs("button",{onClick:()=>hp(!1),type:"button",className:"vs:appearance-none vs:bg-transparent vs:border-none vs:ring-none vs:outline-none vs:hover:border-none vs:hover:ring-none vs:hover:outline-none",children:[A.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),A.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:A.jsx("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})})})]})]}),A.jsxs("div",{ref:C,className:Br("vs:grid vs:gap-3",o==="row"?`${RP()} vs:grid-cols-1 vs:md:grid-cols-3`:"vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5","vs:w-full vs:transition vs:lg:mx-auto"),children:[R?A.jsxs(A.Fragment,{children:[A.jsx(Sn,{label:"Year",items:le,refine:j1,selected:S.year,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:le.length===0,shouldBeActive:!0}),A.jsx(Sn,{label:"Make",items:L,refine:D1,selected:S.make,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.year&&L.length===0,shouldBeActive:!!S.year}),A.jsx(Sn,{label:"Model",items:ae,refine:N1,selected:S.model,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.make&&ae.length===0,shouldBeActive:!!S.make})]}):A.jsxs(A.Fragment,{children:[A.jsx(Sn,{label:"Make",items:L,refine:D1,selected:S.make,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:L.length===0,shouldBeActive:!0}),A.jsx(Sn,{label:"Model",items:ae,refine:N1,selected:S.model,showPopular:!0,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.make&&ae.length===0,shouldBeActive:!!S.make}),A.jsx(Sn,{label:"Year",items:le,refine:j1,selected:S.year,bgDark:fn,showLabel:c,isMobile:Pn,sortOptions:!1,loading:S.model&&le.length===0,shouldBeActive:!!S.model})]}),Vu.current&&Vu.current.map(T=>{let P=null;switch(T){case"body":P=A.jsx(Sn,{label:"Body",items:be,refine:xP,selected:S.body,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"body");break;case"series":P=A.jsx(Sn,{label:"Series",items:Me,refine:kP,selected:S.series,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&Me.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"series");break;case"variant":P=A.jsx(Sn,{label:"Variant",items:dn,refine:SP,selected:S.variant,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&dn.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"variant");break;case"engine_capacity":P=A.jsx(Sn,{label:"Engine Capacity",items:zs,refine:$P,selected:S.engine_capacity,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&zs.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine_capacity");break;case"engine":P=A.jsx(Sn,{label:"Engine",items:Ue,refine:EP,selected:S.engine,bgDark:fn,showLabel:c,isMobile:Pn,loading:!!(S.make&&S.model&&S.year)&&Ue.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine");break}return P}),w&&A.jsx("div",{className:"vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1",children:A.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{cp(!0),s&&!m?window.location.href=s+window.location.search:bP()},children:[A.jsx("span",{children:g}),gP&&A.jsx(Yf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),u&&A.jsx("div",{className:Br("vs:flex vs:w-full vs:justify-center vs:items-center",o==="row"?"vs:md:items-end vs:md:justify-end":"vs:md:justify-center","vs:mt-4 vs:md:mt-3 vs:md:pr-1.5"),children:A.jsxs("a",{href:`https://use.partbot.io/?ref=${typeof window<"u"?window.location.href.split("/")[2]:"unknown"}&utm_source=vehicle-select&utm_medium=referral&utm_campaign=powered-by`,target:"_blank",rel:"noreferrer",className:`${fn?"vs:text-white":"vs:text-black"} vs:flex vs:items-center vs:space-x-1.5 vs:px-1.5 vs:text-center vs:leading-normal vs:text-[10px] vs:opacity-75 vs:transition vs:hover:opacity-100 vs:font-sans vs:no-underline vs:m-0 pb-1.5`,children:[A.jsx("span",{children:"Powered by"}),A.jsx(_k,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let P1=!1,wa=!1;function dP(t){var c,f;const e=t.shadowRoot;if(!e){console.error("[ShadowDOMPatch] No shadow root found");return}const n=e.children[1];if(!n){console.error("[ShadowDOMPatch] No mount point found in shadow root");return}if(new MutationObserver(d=>{d.forEach(h=>{h.addedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.appendChild(p),wa=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(wa=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(wa=!1)})})}).observe(n,{childList:!0,subtree:!0}),P1)return;const s=(c=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"))==null?void 0:c.get;Object.defineProperty(Document.prototype,"activeElement",{get:function(){const d=s==null?void 0:s.call(this);return d===t?e.activeElement:d}});const o=(f=Object.getOwnPropertyDescriptor(Event.prototype,"target"))==null?void 0:f.get;Object.defineProperty(Event.prototype,"target",{get:function(){const d=o==null?void 0:o.call(this);return d===t?this.composedPath()[0]:d}});const a=d=>{try{return document.body&&d===document.body.style}catch{return!1}},l=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(d,h,p){if(!(a(this)&&d==="overflow"&&h==="hidden"&&wa))return l.call(this,d,h,p)};const u=Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype,"overflow");u&&Object.defineProperty(CSSStyleDeclaration.prototype,"overflow",{get:function(){return u.get.call(this)},set:function(d){if(!(a(this)&&d==="hidden"&&wa))return u.set.call(this,d)}}),P1=!0}const fP="/css/vehicle-search.css";class hP extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const I=document.createElement("link");I.id="vehicle-search-inter-font",I.rel="stylesheet",I.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(I)}let e=document.createElement("style");e.textContent=vk;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(I,N,K)=>{let Z;if(this.hasAttribute(N)){const H=this.getAttribute(N);if(/^#[0-9A-F]{6}$/i.test(H)){const re=parseInt(H.slice(1,3),16),ne=parseInt(H.slice(3,5),16),R=parseInt(H.slice(5,7),16);Z=`${re} ${ne} ${R}`}}return Z=Z||K,`:host { --${I}: ${Z}; } .partbot-mmyvs-container { --${I}: ${Z}; }`};let s=i("partbot-theme","data-button-color","0 0 0"),o=i("partbot-button-color","data-button-color","0 0 0"),a=i("partbot-button-hover-color","data-button-hover-color","0 0 0"),l=i("partbot-button-label-color","data-button-label-color","255 255 255"),u=i("partbot-button-hover-label-color","data-button-hover-label-color","255 255 255"),c=i("partbot-mobile-background-color","data-mobile-background-color","0 0 0"),f=`:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; }`,d=`:host { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; }`,h=`:host { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`,p=`:host { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; }`;const g=this.getAttribute("data-input-shadow"),w=g==="none"?"none":g||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${w}; } .partbot-mmyvs-container { --partbot-input-shadow: ${w}; }`;const v=this.getAttribute("data-input-border-color");let y="229 231 235";if(v)if(/^#[0-9A-F]{6}$/i.test(v)){const I=parseInt(v.slice(1,3),16),N=parseInt(v.slice(3,5),16),K=parseInt(v.slice(5,7),16);y=`${I} ${N} ${K}`}else/^\d+\s+\d+\s+\d+$/.test(v)&&(y=v);let b=`:host { --partbot-input-border-color: ${y}; } .partbot-mmyvs-container { --partbot-input-border-color: ${y}; }`;const x=this.getAttribute("data-input-border-width")||"1px";let k=`:host { --partbot-input-border-width: ${x}; } .partbot-mmyvs-container { --partbot-input-border-width: ${x}; }`;e.textContent+=s,e.textContent+=o,e.textContent+=a,e.textContent+=l,e.textContent+=u,e.textContent+=c,e.textContent+=f,e.textContent+=d,e.textContent+=h,e.textContent+=p,e.textContent+=m,e.textContent+=b,e.textContent+=k,r.appendChild(e),r.appendChild(n);const $=this.getAttribute("data-api-key");if(!$){console.warn("Missing attributes: "+($?"":"data-api-key "));return}const C=this.attributes,q={};for(let I=0;I<C.length;I++){const{name:N,value:K}=C[I];if(N.startsWith("data-")){const Z=N.slice(5).replace(/-([a-z])/g,H=>H[1].toUpperCase());q[Z]=K==="true"?!0:K==="false"?!1:K}}dP(this);const F=A.jsx(up,{...q});gk.render(F,n)}}customElements.define("vehicle-search",hP);const pP=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Tt.VehicleSearch=up,Tt.default=up,Tt.vehicleSearchCssUrl=fP,Object.defineProperties(Tt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartbot/vehicle-search-beta",
3
- "version": "3.0.35",
3
+ "version": "3.0.36",
4
4
  "type": "module",
5
5
  "author": "Partbot",
6
6
  "url": "https://mmyvs.partbot.io",