@cartbot/vehicle-search-beta 3.0.19 → 3.0.20
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 X({
|
|
|
328
328
|
)
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
|
-
const $t = "3.0.
|
|
331
|
+
const $t = "3.0.20";
|
|
332
332
|
console.info(
|
|
333
333
|
`Vehicle Search v${$t} powered by Partbot https://mmyvs.partbot.io`
|
|
334
334
|
);
|
|
@@ -565,7 +565,7 @@ function Mt({
|
|
|
565
565
|
const r = new CustomEvent("vehicle-search-submit", {
|
|
566
566
|
detail: t
|
|
567
567
|
});
|
|
568
|
-
window.dispatchEvent(r), setTimeout(() => {
|
|
568
|
+
window.dispatchEvent(r), document.dispatchEvent(r), setTimeout(() => {
|
|
569
569
|
Me(!1);
|
|
570
570
|
}, 900);
|
|
571
571
|
}, [se, q]), Te = N(() => {
|
|
@@ -580,10 +580,7 @@ function Mt({
|
|
|
580
580
|
const r = new CustomEvent("vehicle-search-change", {
|
|
581
581
|
detail: t
|
|
582
582
|
});
|
|
583
|
-
if (
|
|
584
|
-
"[VehicleSearch] Dispatching vehicle-search-change:",
|
|
585
|
-
t
|
|
586
|
-
), j.current === !0) {
|
|
583
|
+
if (j.current === !0) {
|
|
587
584
|
localStorage.removeItem("partbot_plate_details");
|
|
588
585
|
const ae = JSON.stringify({
|
|
589
586
|
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((l = e.model) == null ? void 0 : l.value) || ""} ${((n = e.year) == null ? void 0 : n.value) || ""} ${((c = e.body) == null ? void 0 : c.value) || ""} ${((d = e.series) == null ? void 0 : d.value) || ""} ${(($ = e.variant) == null ? void 0 : $.value) || ""} ${((te = e.engine) == null ? void 0 : te.value) || ""} ${((pe = e.engine_capacity) == null ? void 0 : pe.value) || ""}`.trim(),
|
|
@@ -597,7 +594,7 @@ function Mt({
|
|
|
597
594
|
secure: !0
|
|
598
595
|
});
|
|
599
596
|
}
|
|
600
|
-
window.dispatchEvent(r),
|
|
597
|
+
window.dispatchEvent(r), document.dispatchEvent(r), Je.current = se, setTimeout(() => {
|
|
601
598
|
Me(!1);
|
|
602
599
|
}, 900);
|
|
603
600
|
}, [se, u]), _e = ut(
|
|
@@ -609,11 +606,8 @@ function Mt({
|
|
|
609
606
|
}, [se, _e]), B(() => () => {
|
|
610
607
|
_e.cancel();
|
|
611
608
|
}, [_e]), B(() => {
|
|
612
|
-
const t = (
|
|
613
|
-
|
|
614
|
-
"[VehicleSearch] Received plate-search-change:",
|
|
615
|
-
r.detail
|
|
616
|
-
), console.log("[VehicleSearch] Clearing vehicle selection"), Y({
|
|
609
|
+
const t = () => {
|
|
610
|
+
Y({
|
|
617
611
|
make: null,
|
|
618
612
|
model: null,
|
|
619
613
|
year: null,
|
|
@@ -624,9 +618,7 @@ function Mt({
|
|
|
624
618
|
engine_capacity: null
|
|
625
619
|
}), ke([]);
|
|
626
620
|
};
|
|
627
|
-
return
|
|
628
|
-
"[VehicleSearch] Adding plate-search-change listener to window"
|
|
629
|
-
), window.addEventListener("plate-search-change", t), () => {
|
|
621
|
+
return window.addEventListener("plate-search-change", t), () => {
|
|
630
622
|
window.removeEventListener(
|
|
631
623
|
"plate-search-change",
|
|
632
624
|
t
|
|
@@ -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 wy(t){return Buffer.from(JSON.stringify(t)).toString("base64")}async function N2(t,e,n){const{createHmac:r}=await Promise.resolve().then(()=>BT);return r("sha256",t).update(`${e}.${n}`).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function j2(){return wy({alg:"HS256",typ:"JWT"}).replace(/=/g,"")}function z2(t){const{searchRules:e,uid:n,apiKey:r,expiresAt:i}=t;if(i)if(i instanceof Date){if(i.getTime()<Date.now())throw new ct("Meilisearch: The expiresAt field must be a date in the future.")}else throw new ct("Meilisearch: The expiredAt field must be an instance of Date.");if(e&&!(typeof e=="object"||Array.isArray(e)))throw new ct("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!r||typeof r!="string")throw new ct("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||typeof n!="string")throw new ct("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(!A2(n))throw new ct("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}function H2(t){const{searchRules:e,uid:n,expiresAt:r}=t,i={searchRules:e,apiKeyUid:n,exp:r?Math.floor(r.getTime()/1e3):void 0};return wy(i).replace(/=/g,"")}class U2{constructor(e){ie(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;z2({apiKey:i,uid:s,expiresAt:o,searchRules:n});const a=j2(),l=H2({searchRules:n,uid:s,expiresAt:o}),u=await N2(i,a,l);return`${a}.${l}.${u}`}}class _y extends D2{constructor(n){super(n);ie(this,"tokens");this.tokens=new U2(n)}async generateTenantToken(n,r,i){return typeof window>"u"?await this.tokens.generateTenantToken(n,r,i):await super.generateTenantToken(n,r,i)}}function B2(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var by=B2,q2=typeof Sn=="object"&&Sn&&Sn.Object===Object&&Sn,V2=q2,W2=V2,G2=typeof self=="object"&&self&&self.Object===Object&&self,K2=W2||G2||Function("return this")(),xy=K2,Y2=xy,Q2=function(){return Y2.Date.now()},X2=Q2,Z2=/\s/;function J2(t){for(var e=t.length;e--&&Z2.test(t.charAt(e)););return e}var eC=J2,tC=eC,nC=/^\s+/;function rC(t){return t&&t.slice(0,tC(t)+1).replace(nC,"")}var iC=rC,sC=xy,oC=sC.Symbol,ky=oC,Sy=ky,Ey=Object.prototype,aC=Ey.hasOwnProperty,lC=Ey.toString,Io=Sy?Sy.toStringTag:void 0;function uC(t){var e=aC.call(t,Io),n=t[Io];try{t[Io]=void 0;var r=!0}catch{}var i=lC.call(t);return r&&(e?t[Io]=n:delete t[Io]),i}var cC=uC,dC=Object.prototype,fC=dC.toString;function hC(t){return fC.call(t)}var pC=hC,$y=ky,gC=cC,vC=pC,mC="[object Null]",yC="[object Undefined]",Cy=$y?$y.toStringTag:void 0;function wC(t){return t==null?t===void 0?yC:mC:Cy&&Cy in Object(t)?gC(t):vC(t)}var _C=wC;function bC(t){return t!=null&&typeof t=="object"}var xC=bC,kC=_C,SC=xC,EC="[object Symbol]";function $C(t){return typeof t=="symbol"||SC(t)&&kC(t)==EC}var CC=$C,RC=iC,Ry=by,TC=CC,Ty=NaN,PC=/^[-+]0x[0-9a-f]+$/i,OC=/^0b[01]+$/i,AC=/^0o[0-7]+$/i,MC=parseInt;function IC(t){if(typeof t=="number")return t;if(TC(t))return Ty;if(Ry(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ry(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=RC(t);var n=OC.test(t);return n||AC.test(t)?MC(t.slice(2),n?2:8):PC.test(t)?Ty:+t}var FC=IC,LC=by,Pf=X2,Py=FC,DC="Expected a function",NC=Math.max,jC=Math.min;function zC(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(DC);e=Py(e)||0,LC(n)&&(c=!!n.leading,f="maxWait"in n,s=f?NC(Py(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d);function h(S){var $=r,C=i;return r=i=void 0,u=S,o=t.apply(C,$),o}function p(S){return u=S,a=setTimeout(m,e),c?h(S):o}function g(S){var $=S-l,C=S-u,L=e-$;return f?jC(L,s-C):L}function _(S){var $=S-l,C=S-u;return l===void 0||$>=e||$<0||f&&C>=s}function m(){var S=Pf();if(_(S))return v(S);a=setTimeout(m,g(S))}function v(S){return a=void 0,d&&r?h(S):(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(Pf())}function x(){var S=Pf(),$=_(S);if(r=arguments,i=this,l=S,$){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 HC=zC;const UC=Es(HC);function Bl(t){"@babel/helpers - typeof";return Bl=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},Bl(t)}var BC=/^\s+/,qC=/\s+$/;function Z(t,e){if(t=t||"",e=e||{},t instanceof Z)return t;if(!(this instanceof Z))return new Z(t,e);var n=VC(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}Z.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=Ly(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=Ay(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=Ay(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=Oy(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=Oy(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 My(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return YC(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(Oe(this._r,255)*100)+"%",g:Math.round(Oe(this._g,255)*100)+"%",b:Math.round(Oe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Oe(this._r,255)*100)+"%, "+Math.round(Oe(this._g,255)*100)+"%, "+Math.round(Oe(this._b,255)*100)+"%)":"rgba("+Math.round(Oe(this._r,255)*100)+"%, "+Math.round(Oe(this._g,255)*100)+"%, "+Math.round(Oe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:a3[My(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var n="#"+Iy(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(e){var s=Z(e);r="#"+Iy(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 Z(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(JC,arguments)},brighten:function(){return this._applyModification(e3,arguments)},darken:function(){return this._applyModification(t3,arguments)},desaturate:function(){return this._applyModification(QC,arguments)},saturate:function(){return this._applyModification(XC,arguments)},greyscale:function(){return this._applyModification(ZC,arguments)},spin:function(){return this._applyModification(n3,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(s3,arguments)},complement:function(){return this._applyCombination(r3,arguments)},monochromatic:function(){return this._applyCombination(o3,arguments)},splitcomplement:function(){return this._applyCombination(i3,arguments)},triad:function(){return this._applyCombination(Fy,[3])},tetrad:function(){return this._applyCombination(Fy,[4])}},Z.fromRatio=function(t,e){if(Bl(t)=="object"){var n={};for(var r in t)t.hasOwnProperty(r)&&(r==="a"?n[r]=t[r]:n[r]=Fo(t[r]));t=n}return Z(t,e)};function VC(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=d3(t)),Bl(t)=="object"&&(er(t.r)&&er(t.g)&&er(t.b)?(e=WC(t.r,t.g,t.b),o=!0,a=String(t.r).substr(-1)==="%"?"prgb":"rgb"):er(t.h)&&er(t.s)&&er(t.v)?(r=Fo(t.s),i=Fo(t.v),e=KC(t.h,r,i),o=!0,a="hsv"):er(t.h)&&er(t.s)&&er(t.l)&&(r=Fo(t.s),s=Fo(t.l),e=GC(t.h,r,s),o=!0,a="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=Ly(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 WC(t,e,n){return{r:Oe(t,255)*255,g:Oe(e,255)*255,b:Oe(n,255)*255}}function Oy(t,e,n){t=Oe(t,255),e=Oe(e,255),n=Oe(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 GC(t,e,n){var r,i,s;t=Oe(t,360),e=Oe(e,100),n=Oe(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 Ay(t,e,n){t=Oe(t,255),e=Oe(e,255),n=Oe(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 KC(t,e,n){t=Oe(t,360)*6,e=Oe(e,100),n=Oe(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 My(t,e,n,r){var i=[yn(Math.round(t).toString(16)),yn(Math.round(e).toString(16)),yn(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 YC(t,e,n,r,i){var s=[yn(Math.round(t).toString(16)),yn(Math.round(e).toString(16)),yn(Math.round(n).toString(16)),yn(Dy(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 Iy(t,e,n,r){var i=[yn(Dy(r)),yn(Math.round(t).toString(16)),yn(Math.round(e).toString(16)),yn(Math.round(n).toString(16))];return i.join("")}Z.equals=function(t,e){return!t||!e?!1:Z(t).toRgbString()==Z(e).toRgbString()},Z.random=function(){return Z.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function QC(t,e){e=e===0?0:e||10;var n=Z(t).toHsl();return n.s-=e/100,n.s=ql(n.s),Z(n)}function XC(t,e){e=e===0?0:e||10;var n=Z(t).toHsl();return n.s+=e/100,n.s=ql(n.s),Z(n)}function ZC(t){return Z(t).desaturate(100)}function JC(t,e){e=e===0?0:e||10;var n=Z(t).toHsl();return n.l+=e/100,n.l=ql(n.l),Z(n)}function e3(t,e){e=e===0?0:e||10;var n=Z(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)))),Z(n)}function t3(t,e){e=e===0?0:e||10;var n=Z(t).toHsl();return n.l-=e/100,n.l=ql(n.l),Z(n)}function n3(t,e){var n=Z(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,Z(n)}function r3(t){var e=Z(t).toHsl();return e.h=(e.h+180)%360,Z(e)}function Fy(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Z(t).toHsl(),r=[Z(t)],i=360/e,s=1;s<e;s++)r.push(Z({h:(n.h+s*i)%360,s:n.s,l:n.l}));return r}function i3(t){var e=Z(t).toHsl(),n=e.h;return[Z(t),Z({h:(n+72)%360,s:e.s,l:e.l}),Z({h:(n+216)%360,s:e.s,l:e.l})]}function s3(t,e,n){e=e||6,n=n||30;var r=Z(t).toHsl(),i=360/n,s=[Z(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(Z(r));return s}function o3(t,e){e=e||6;for(var n=Z(t).toHsv(),r=n.h,i=n.s,s=n.v,o=[],a=1/e;e--;)o.push(Z({h:r,s:i,v:s})),s=(s+a)%1;return o}Z.mix=function(t,e,n){n=n===0?0:n||50;var r=Z(t).toRgb(),i=Z(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 Z(o)},Z.readability=function(t,e){var n=Z(t),r=Z(e);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},Z.isReadable=function(t,e,n){var r=Z.readability(t,e),i,s;switch(s=!1,i=f3(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},Z.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=Z.readability(t,e[u]),s>i&&(i=s,r=Z(e[u]));return Z.isReadable(t,r,{level:a,size:l})||!o?r:(n.includeFallbackColors=!1,Z.mostReadable(t,["#fff","#000"],n))};var Of=Z.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"},a3=Z.hexNames=l3(Of);function l3(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function Ly(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Oe(t,e){u3(t)&&(t="100%");var n=c3(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 ql(t){return Math.min(1,Math.max(0,t))}function qt(t){return parseInt(t,16)}function u3(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function c3(t){return typeof t=="string"&&t.indexOf("%")!=-1}function yn(t){return t.length==1?"0"+t:""+t}function Fo(t){return t<=1&&(t=t*100+"%"),t}function Dy(t){return Math.round(parseFloat(t)*255).toString(16)}function Ny(t){return qt(t)/255}var wn=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 er(t){return!!wn.CSS_UNIT.exec(t)}function d3(t){t=t.replace(BC,"").replace(qC,"").toLowerCase();var e=!1;if(Of[t])t=Of[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=wn.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=wn.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=wn.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=wn.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=wn.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=wn.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=wn.hex8.exec(t))?{r:qt(n[1]),g:qt(n[2]),b:qt(n[3]),a:Ny(n[4]),format:e?"name":"hex8"}:(n=wn.hex6.exec(t))?{r:qt(n[1]),g:qt(n[2]),b:qt(n[3]),format:e?"name":"hex"}:(n=wn.hex4.exec(t))?{r:qt(n[1]+""+n[1]),g:qt(n[2]+""+n[2]),b:qt(n[3]+""+n[3]),a:Ny(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=wn.hex3.exec(t))?{r:qt(n[1]+""+n[1]),g:qt(n[2]+""+n[2]),b:qt(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function f3(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,Ot=typeof globalThis<"u"?globalThis:E,jy=Array.prototype,zy=jy.forEach,Hy=jy.indexOf,Vt=Ot==null?void 0:Ot.navigator,V=Ot==null?void 0:Ot.document,At=Ot==null?void 0:Ot.location,Af=Ot==null?void 0:Ot.fetch,Mf=Ot!=null&&Ot.XMLHttpRequest&&"withCredentials"in new Ot.XMLHttpRequest?Ot.XMLHttpRequest:void 0,Uy=Ot==null?void 0:Ot.AbortController,Mt=Vt==null?void 0:Vt.userAgent,J=E??{},tr={DEBUG:!1,LIB_VERSION:"1.270.1"};function By(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 qy(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(l){By(s,r,i,o,a,"next",l)}function a(l){By(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 Vy(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 h3=["$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 ae(t,e){return t.indexOf(e)!==-1}var Vl=function(t){return t.trim()},If=function(t){return t.replace(/^\$/,"")},p3=Array.isArray,Wy=Object.prototype,Gy=Wy.hasOwnProperty,Wl=Wy.toString,Ee=p3||function(t){return Wl.call(t)==="[object Array]"},tn=t=>typeof t=="function",De=t=>t===Object(t)&&!Ee(t),ds=t=>{if(De(t)){for(var e in t)if(Gy.call(t,e))return!1;return!0}return!1},D=t=>t===void 0,Ne=t=>Wl.call(t)=="[object String]",Ff=t=>Ne(t)&&t.trim().length===0,nr=t=>t===null,he=t=>D(t)||nr(t),dt=t=>Wl.call(t)=="[object Number]",_n=t=>Wl.call(t)==="[object Boolean]",g3=t=>t instanceof FormData,v3=t=>ae(h3,t);function Lf(t){return t===null||typeof t!="object"}function Gl(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function Ky(t){return!D(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var m3=[!0,"true",1,"1","yes"],Df=t=>ae(m3,t),y3=[!1,"false",0,"0","no"];function Wt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),dt(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),Wt(i||n,e,n,r))}class Yy{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=Wt(this.t.bucketSize,0,100,this.t.R),this.m=Wt(this.t.refillRate,0,this.S,this.t.R),this.I=Wt(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 Kl,Qy,Nf,w3=t=>t instanceof Error;function _3(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Nf&&n.length===Qy||(Qy=n.length,Nf=n.reduce((r,i)=>{Kl||(Kl={});var s=Kl[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,Kl[i]=[u,c];break}}return r},{})),Nf}}var fs="?";function jf(t,e,n,r){var i={platform:"web:javascript",filename:t,function:e==="<anonymous>"?fs:e,in_app:!0};return D(n)||(i.lineno=n),D(r)||(i.colno=r),i}var Xy=(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]:fs,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},b3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,x3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,k3=/\((\S*)(?::(\d+))(?::(\d+))\)/,S3=t=>{var e=b3.exec(t);if(e){var[,n,r,i]=e;return jf(n,fs,+r,+i)}var s=x3.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]=Xy(s[1]||fs,s[2]);return jf(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},E3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,C3=t=>{var e=E3.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=$3.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]||fs;return[i,r]=Xy(i,r),jf(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Zy=/\(error: (.*)\)/,Jy=50;function R3(){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=Zy.test(l)?l.replace(Zy,"$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>=Jy)break}}}return function(d){if(!d.length)return[];var h=Array.from(d);return h.reverse(),h.slice(0,Jy).map(p=>{return j({},p,{filename:p.filename||(g=h,g[g.length-1]||{}).filename,function:p.function||fs});var g})}(s)}}class T3{constructor(e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r=[]),this.coercers=e,this.modifiers=r,this.stackParser=R3(...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 qy(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Ee(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 qy(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:_3(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 P3{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=Ne(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 Gl(e,"DOMException")}isDOMError(e){return Gl(e,"DOMError")}}class O3{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 A3{constructor(){}match(e){return Gl(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 M3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class I3{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(M3);return i&&(n=i[1],r=i[2]),[n,r]}}var F3=["fatal","error","warning","log","info","debug"];function ew(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 L3{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 Ky(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: "+ew(e)}isSeverityLevel(e){return Ne(e)&&!Ff(e)&&F3.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(w3(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class D3{match(e){return Ky(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+ew(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class N3{match(e){return Lf(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 j3{match(e){return Gl(e,"PromiseRejectionEvent")}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return Lf(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(Lf(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 tw=t=>{var e={T:function(n){if(E&&(tr.DEBUG||J.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=>tw(t+" "+n)};return e},B=tw("[PostHog.js]"),Ge=B.createLogger,z3=Ge("[ExternalScriptsLoader]"),nw=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return z3.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=V==null?void 0:V.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(!V)return n("document not found");var l=V.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=V.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):V.body.appendChild(l)};V!=null&&V.body?a():V==null||V.addEventListener("DOMContentLoaded",a)};J.__PosthogExtensions__=J.__PosthogExtensions__||{},J.__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);nw(t,s,n)},J.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);nw(t,r,n)};var Yl={};function Mr(t,e,n){if(Ee(t)){if(zy&&t.forEach===zy)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)===Yl)return}}}function be(t,e,n){if(!he(t)){if(Ee(t))return Mr(t,e,n);if(g3(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===Yl)return}else for(var i in t)if(Gy.call(t,i)&&e.call(n,t[i],i)===Yl)return}}var Ue=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 Mr(n,function(i){for(var s in i)i[s]!==void 0&&(t[s]=i[s])}),t},Ql=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 Mr(n,function(i){Mr(i,function(s){t.push(s)})}),t};function Xl(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 rw=function(t){try{return t()}catch{return}},H3=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){B.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),B.critical(i)}}},zf=function(t){var e={};return be(t,function(n,r){(Ne(n)&&n.length>0||dt(n))&&(e[r]=n)}),e};function U3(t,e){return n=t,r=s=>Ne(s)&&!nr(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),Ee(o)?(l=[],Mr(o,u=>{l.push(s(u))})):(l={},be(o,(u,c)=>{i.has(u)||(l[c]=s(u,c))})),l);var l}(n);var n,r,i}var B3=["herokuapp.com","vercel.app","netlify.app"];function q3(t){var e=t==null?void 0:t.hostname;if(!Ne(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of B3)if(n===r)return!1;return!0}function iw(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Fe(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t==null||t.addEventListener(e,n,{capture:i,passive:s})}var sw="$people_distinct_id",Lo="__alias",Do="__timers",ow="$autocapture_disabled_server_side",Hf="$heatmaps_enabled_server_side",aw="$exception_capture_enabled_server_side",Uf="$error_tracking_suppression_rules",lw="$error_tracking_capture_extension_exceptions",uw="$web_vitals_enabled_server_side",cw="$dead_clicks_enabled_server_side",dw="$web_vitals_allowed_metrics",Bf="$session_recording_remote_config",qf="$session_recording_enabled_server_side",fw="$console_log_recording_enabled_server_side",hw="$session_recording_network_payload_capture",pw="$session_recording_masking",gw="$session_recording_canvas_recording",vw="$replay_sample_rate",mw="$replay_minimum_duration",yw="$replay_script_config",Zl="$sesid",hs="$session_is_sampled",Vf="$session_recording_url_trigger_activated_session",Wf="$session_recording_event_trigger_activated_session",ps="$enabled_feature_flags",No="$early_access_features",Gf="$feature_flag_details",jo="$stored_person_properties",gi="$stored_group_properties",Kf="$surveys",Jl="$surveys_activated",eu="$flag_call_reported",rr="$user_state",Yf="$client_session_props",Qf="$capture_rate_limit",Xf="$initial_campaign_params",Zf="$initial_referrer_info",tu="$initial_person_info",nu="$epp",ww="__POSTHOG_TOOLBAR__",zo="$posthog_cookieless",V3=[sw,Lo,"__cmpns",Do,qf,Hf,Zl,ps,Uf,rr,No,Gf,gi,jo,Kf,eu,Yf,Qf,Xf,Zf,nu,tu];function _w(t){return t instanceof Element&&(t.id===ww||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ru(t){return!!t&&t.nodeType===1}function Ir(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function bw(t){return!!t&&t.nodeType===3}function xw(t){return!!t&&t.nodeType===11}function Jf(t){return t?Vl(t).split(/\s+/):[]}function kw(t){var e=E==null?void 0:E.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function iu(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 Jf(e)}function Sw(t){return he(t)?null:Vl(t).split(/(\s+)/).filter(e=>gs(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function su(t){var e="";return nh(t)&&!Pw(t)&&t.childNodes&&t.childNodes.length&&be(t.childNodes,function(n){var r;bw(n)&&n.textContent&&(e+=(r=Sw(n.textContent))!==null&&r!==void 0?r:"")}),Vl(e)}function Ew(t){return D(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var eh=["a","button","form","input","select","textarea","label"];function $w(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 Cw(t){var e=t.parentNode;return!(!e||!ru(e))&&e}var Rw=[".ph-no-rageclick",".ph-no-capture"],th=t=>!t||Ir(t,"html")||!ru(t),Tw=(t,e)=>{if(!E||th(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Ir(i,"body");)if(xw(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=Cw(i);if(!s)break;if(e||eh.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 W3(t,e,n,r,i){var s,o,a,l;if(n===void 0&&(n=void 0),!E||th(t)||(s=n)!=null&&s.url_allowlist&&!kw(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&kw(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}=Tw(t,r);if(!function(p,g){var _=g==null?void 0:g.element_allowlist;if(D(_))return!0;var m,v=function(b){if(_.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)||!$w(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&&(eh.indexOf(h)>-1||t.getAttribute("contenteditable")==="true")}}function nh(t){for(var e=t;e.parentNode&&!Ir(e,"body");e=e.parentNode){var n=iu(e);if(ae(n,"ph-sensitive")||ae(n,"ph-no-capture"))return!1}if(ae(iu(t),"ph-include"))return!0;var r=t.type||"";if(Ne(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!(Ne(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 Pw(t){return!!(Ir(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ir(t,"select")||Ir(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Ow="(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})",G3=new RegExp("^(?:"+Ow+")$"),K3=new RegExp(Ow),Aw="\\d{3}-?\\d{2}-?\\d{4}",Y3=new RegExp("^("+Aw+")$"),Q3=new RegExp("("+Aw+")");function gs(t,e){return e===void 0&&(e=!0),!(he(t)||Ne(t)&&(t=Vl(t),(e?G3:K3).test((t||"").replace(/[- ]/g,""))||(e?Y3:Q3).test(t)))}function Mw(t){var e=su(t);return gs(e=(e+" "+Iw(t)).trim())?e:""}function Iw(t){var e="";return t&&t.childNodes&&t.childNodes.length&&be(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=su(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Iw(n)).trim())}catch(s){B.error("[AutoCapture]",s)}}),e}function X3(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 Xl(l).sort((c,f)=>{var[d]=c,[h]=f;return d.localeCompare(h)}).forEach(c=>{var[f,d]=c;return u[Fw(f.toString())]=Fw(d.toString())}),o+=":",o+=Xl(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:Z3(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Xl(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 Fw(t){return t.replace(/"|\\"/g,'\\"')}function Z3(t){var e=t.attr__class;return e?Ee(e)?e:Jf(e):void 0}class Lw{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 rh="$copy_autocapture",ir=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),J3=["localhost","127.0.0.1"],vs=t=>{var e=V==null?void 0:V.createElement("a");return D(e)?null:(e.href=t,e)},eR=function(t,e){var n,r;e===void 0&&(e="&");var i=[];return be(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)},ou=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(!Ee(n)||n.length<2)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{B.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ih=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("=");Ee(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},au=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Dw=Ge("[AutoCapture]");function sh(t,e){return e.length>t?e.slice(0,t)+"...":e}function tR(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ru(e));return e}function nR(t,e,n,r){var i=t.tagName.toLowerCase(),s={tag_name:i};eh.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=sh(1024,Mw(t)):s.$el_text=sh(1024,su(t)));var o=iu(t);o.length>0&&(s.classes=o.filter(function(c){return c!==""})),be(t.attributes,function(c){var f;if((!Pw(t)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(r==null||!r.includes(c.name))&&!e&&gs(c.value)&&(f=c.name,!Ne(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var d=c.value;c.name==="class"&&(d=Jf(d).join(" ")),s["attr__"+c.name]=sh(1024,d)}});for(var a=1,l=1,u=t;u=tR(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&&!Ir(c,"body");)xw(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(be(u,b=>{var x=nh(b);b.tagName.toLowerCase()==="a"&&(p=b.getAttribute("href"),p=x&&p&&gs(p)&&p),ae(iu(b),"ph-no-capture")&&(g=!0),d.push(nR(b,s,o,a));var S=function($){if(!nh($))return{};var C={};return be($.attributes,function(L){if(L.name&&L.name.indexOf("data-ph-capture-attribute")===0){var O=L.name.replace("data-ph-capture-attribute-",""),z=L.value;O&&z&&gs(z)&&(C[O]=z)}}),C}(b);Ue(h,S)}),g)return{props:{},explicitNoCapture:g};if(o||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?d[0].$el_text=Mw(t):d[0].$el_text=su(t)),p){var _,m;d[0].attr__href=p;var v=(_=vs(p))==null?void 0:_.host,y=E==null||(m=E.location)==null?void 0:m.host;v&&y&&v!==y&&(f=p)}return{props:Ue({$event_type:i.type,$ce_version:1},l?{}:{$elements:d},{$elements_chain:X3(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 iR{constructor(e){this.C=!1,this.M=null,this.rageclicks=new Lw,this.O=!1,this.instance=e,this.F=null}get A(){var e,n,r=De(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&&V){var e=r=>{r=r||(E==null?void 0:E.event);try{this.j(r)}catch(i){Dw.error("Failed to capture event",i)}};if(Fe(V,"submit",e,{capture:!0}),Fe(V,"change",e,{capture:!0}),Fe(V,"click",e,{capture:!0}),this.A.capture_copied_text){var n=r=>{r=r||(E==null?void 0:E.event),this.j(r,rh)};Fe(V,"copy",n,{capture:!0}),Fe(V,"cut",n,{capture:!0})}}}else Dw.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({[ow]:!!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=V==null?void 0:V.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[ow],i=this.M;if(nr(i)&&!_n(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=Ew(e);bw(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||th(d))return!1;var p,g;if((p=_n(h)?!!h&&Rw:(g=h==null?void 0:h.css_selector_ignorelist)!==null&&g!==void 0?g:Rw)===!1)return!1;var{targetElementList:_}=Tw(d,!1);return!$w(_,p)}(i,this.instance.config.rageclick)&&this.j(e,"$rageclick");var s=n===rh;if(i&&W3(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===rh){var u,c=Sw(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 tn(V==null?void 0:V.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return dt(t)&&isFinite(t)&&Math.floor(t)===t});var Nw="0123456789abcdef";class lu{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 lu(s)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+Nw.charAt(this.bytes[n]>>>4)+Nw.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 lu(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 sR{constructor(){this.N=0,this.U=0,this.B=new oR}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 lu.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 jw,zw=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&&(zw=t=>crypto.getRandomValues(t));class oR{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(zw(this.H),this.W=0),this.H[this.W++]}}var Fr=()=>aR().toString(),aR=()=>(jw||(jw=new sR)).generate(),Ho="",lR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function uR(t,e){if(e){var n=function(i,s){if(s===void 0&&(s=V),Ho)return Ho;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Fr();!Ho&&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",Ho=u)}return Ho}(t);if(!n){var r=(i=>{var s=i.match(lR);return s?s[0]:""})(t);r!==n&&B.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Ln={G:()=>!!V,V:function(t){B.error("cookieStore error: "+t)},J:function(t){if(V){try{for(var e=t+"=",n=V.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(Ln.J(t))||{}}catch{}return e},Y:function(t,e,n,r,i){if(V)try{var s="",o="",a=uR(V.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&&B.warn("cookieStore warning: large cookie, len="+u.length),V.cookie=u,u}catch{return}},X:function(t,e){if(V!=null&&V.cookie)try{Ln.Y(t,"",-1,e)}catch{return}}},oh=null,Ke={G:function(){if(!nr(oh))return oh;var t=!0;if(D(E))t=!1;else try{var e="__mplssupport__";Ke.Y(e,"xyz"),Ke.J(e)!=='"xyz"'&&(t=!1),Ke.X(e)}catch{t=!1}return t||B.error("localStorage unsupported; falling back to cookie store"),oh=t,t},V:function(t){B.error("localStorage error: "+t)},J:function(t){try{return E==null?void 0:E.localStorage.getItem(t)}catch(e){Ke.V(e)}return null},K:function(t){try{return JSON.parse(Ke.J(t))||{}}catch{}return null},Y:function(t,e){try{E==null||E.localStorage.setItem(t,JSON.stringify(e))}catch(n){Ke.V(n)}},X:function(t){try{E==null||E.localStorage.removeItem(t)}catch(e){Ke.V(e)}}},cR=["distinct_id",Zl,hs,nu,tu],uu=j({},Ke,{K:function(t){try{var e={};try{e=Ln.K(t)||{}}catch{}var n=Ue(e,JSON.parse(Ke.J(t)||"{}"));return Ke.Y(t,n),n}catch{}return null},Y:function(t,e,n,r,i,s){try{Ke.Y(t,e,void 0,void 0,s);var o={};cR.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&Ln.Y(t,o,n,r,i,s)}catch(a){Ke.V(a)}},X:function(t,e){try{E==null||E.localStorage.removeItem(t),Ln.X(t,e)}catch(n){Ke.V(n)}}}),cu={},dR={G:function(){return!0},V:function(t){B.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]}},vi=null,it={G:function(){if(!nr(vi))return vi;if(vi=!0,D(E))vi=!1;else try{var t="__support__";it.Y(t,"xyz"),it.J(t)!=='"xyz"'&&(vi=!1),it.X(t)}catch{vi=!1}return vi},V:function(t){B.error("sessionStorage error: ",t)},J:function(t){try{return E==null?void 0:E.sessionStorage.getItem(t)}catch(e){it.V(e)}return null},K:function(t){try{return JSON.parse(it.J(t))||null}catch{}return null},Y:function(t,e){try{E==null||E.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){it.V(n)}},X:function(t){try{E==null||E.sessionStorage.removeItem(t)}catch(e){it.V(e)}}},sr=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class fR{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?sr.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===sr.DENIED||this.consent===sr.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===sr.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 Df(e)?sr.GRANTED:ae(y3,e)?sr.DENIED:sr.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?Ke:Ln;var n=e==="localStorage"?Ln:Ke;n.J(this.et)&&(this.rt.J(this.et)||this.optInOut(Df(n.J(this.et))),n.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!iw([Vt==null?void 0:Vt.doNotTrack,Vt==null?void 0:Vt.msDoNotTrack,J.doNotTrack],e=>Df(e))}}var du=Ge("[Dead Clicks]"),hR=()=>!0,pR=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(cw)),r=t.instance.config.capture_dead_clicks;return _n(r)?r:n};class Hw{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({[cw]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt(()=>{this.ot()})}nt(e){var n,r;(n=J.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?du.error("failed to load script",i):e()})}ot(){var e;if(V){if(!this.st&&(e=J.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=De(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.st=J.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.st.start(V),du.info("starting...")}}else du.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,du.info("stopping..."))}}var Uo=Ge("[ExceptionAutocapture]");class gR{constructor(e){var n,r,i;this.lt=()=>{var s;if(E&&this.isEnabled&&(s=J.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=J.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=J.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=J.__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){Uo.error("failed to start",u),this.vt()}}},this._instance=e,this.ct=!((n=this._instance.persistence)==null||!n.props[aw]),this.A=this.ft(),this.gt=new Yy({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:Uo}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return De(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&&(Uo.info("enabled"),this.nt(this.lt))}nt(e){var n,r;(n=J.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Uo.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({[aw]: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)?Uo.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}}function Uw(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return tn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}class vR{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&&(B.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,B.info("History API monitoring stopped")}monitorHistoryChanges(){var e,n;if(E&&E.history){var r=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||Uw(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__||Uw(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){B.error("Error capturing "+e+" pageview",i)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};Fe(E,"popstate",e),this.yt=()=>{E&&E.removeEventListener("popstate",e)}}}}function fu(t){var e,n;return((e=JSON.stringify(t,(n=[],function(r,i){if(De(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 ah(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[ah({size:fu(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),ah({size:fu(i),data:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(s=>s)}return[t]}var Dn=(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))(Dn||{}),bn=(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))(bn||{}),lh="[SessionRecording]",uh="redacted",hu={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"]},mR=["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"],yR=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],wR=["/s/","/e/","/i/"];function Bw(t,e,n,r){if(he(t))return t;var i=(e==null?void 0:e["content-length"])||function(s){return new Blob([s]).size}(t);return Ne(i)&&(i=parseInt(i)),i>n?lh+" "+r+" body too large to record ("+i+" bytes)":t}function qw(t,e){if(he(t))return t;var n=t;return gs(n,!1)||(n=lh+" "+e+" body "+uh),be(yR,r=>{var i,s;(i=n)!=null&&i.length&&((s=n)==null?void 0:s.indexOf(r))!==-1&&(n=lh+" "+e+" body "+uh+" as might contain: "+r)}),n}var _R=(t,e)=>{var n,r,i,s={payloadSizeLimitBytes:hu.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...hu.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...hu.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=Bw(d.requestBody,d.requestHeaders,i,"Request")),d!=null&&d.responseBody&&(d.responseBody=Bw(d.responseBody,d.responseHeaders,i,"Response")),d)),c=d=>{return u(((g,_)=>{var m,v=vs(g.name),y=_.indexOf("http")===0?(m=vs(_))==null?void 0:m.pathname:_;y==="/"&&(y="");var b=v==null?void 0:v.pathname.replace(y||"","");if(!(v&&b&&wR.some(x=>b.indexOf(x)===0)))return g})((p=(h=d).requestHeaders,he(p)||be(Object.keys(p??{}),g=>{mR.includes(g.toLowerCase())&&(p[g]=uh)}),h),t.api_host));var h,p},f=tn(t.session_recording.maskNetworkRequestFn);return f&&tn(t.session_recording.maskCapturedNetworkRequestFn)&&B.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=tn(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=qw(h.requestBody,"Request"),h.responseBody=qw(h.responseBody,"Response"),h}(c(d)),j({},hu,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class bR{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 Yy({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:B})}}var nn=Uint8Array,It=Uint16Array,ms=Uint32Array,ch=new nn([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]),dh=new nn([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]),Vw=new nn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ww=function(t,e){for(var n=new It(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new ms(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]},Gw=Ww(ch,2),xR=Gw[0],fh=Gw[1];xR[28]=258,fh[258]=28;for(var Kw=Ww(dh,0)[1],Yw=new It(32768),Re=0;Re<32768;++Re){var mi=(43690&Re)>>>1|(21845&Re)<<1;mi=(61680&(mi=(52428&mi)>>>2|(13107&mi)<<2))>>>4|(3855&mi)<<4,Yw[Re]=((65280&mi)>>>8|(255&mi)<<8)>>>1}var Bo=function(t,e,n){for(var r=t.length,i=0,s=new It(e);i<r;++i)++s[t[i]-1];var o,a=new It(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new It(r),i=0;i<r;++i)o[i]=Yw[a[t[i]-1]++]>>>15-t[i];return o},yi=new nn(288);for(Re=0;Re<144;++Re)yi[Re]=8;for(Re=144;Re<256;++Re)yi[Re]=9;for(Re=256;Re<280;++Re)yi[Re]=7;for(Re=280;Re<288;++Re)yi[Re]=8;var pu=new nn(32);for(Re=0;Re<32;++Re)pu[Re]=5;var kR=Bo(yi,9),SR=Bo(pu,5),Qw=function(t){return(t/8>>0)+(7&t&&1)},Xw=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof It?It:t instanceof ms?ms:nn)(n-e);return r.set(t.subarray(e,n)),r},or=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},qo=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},hh=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 nn(0),0];if(i==1){var o=new nn(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(x,S){return x.f-S.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 It(d+1),p=ph(n[c-1],h,0);if(p>e){r=0;var g=0,_=p-e,m=1<<_;for(s.sort(function(x,S){return h[S.s]-h[x.s]||x.f-S.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>>>=_;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 nn(h),p]},ph=function(t,e,n){return t.s==-1?Math.max(ph(t.l,e,n+1),ph(t.r,e,n+1)):e[t.s]=n},Zw=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new It(++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]},Vo=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},gh=function(t,e,n){var r=n.length,i=Qw(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)},Jw=function(t,e,n,r,i,s,o,a,l,u,c){or(e,c++,n),++i[256];for(var f=hh(i,15),d=f[0],h=f[1],p=hh(s,15),g=p[0],_=p[1],m=Zw(d),v=m[0],y=m[1],b=Zw(g),x=b[0],S=b[1],$=new It(19),C=0;C<v.length;++C)$[31&v[C]]++;for(C=0;C<x.length;++C)$[31&x[C]]++;for(var L=hh($,7),O=L[0],z=L[1],H=19;H>4&&!O[Vw[H-1]];--H);var U,X,W,K,oe=u+5<<3,T=Vo(i,yi)+Vo(s,pu)+o,F=Vo(i,d)+Vo(s,g)+o+14+3*H+Vo($,O)+(2*$[16]+3*$[17]+7*$[18]);if(oe<=T&&oe<=F)return gh(e,c,t.subarray(l,l+u));if(or(e,c,1+(F<T)),c+=2,F<T){U=Bo(d,h),X=d,W=Bo(g,_),K=g;var N=Bo(O,z);for(or(e,c,y-257),or(e,c+5,S-1),or(e,c+10,H-4),c+=14,C=0;C<H;++C)or(e,c+3*C,O[Vw[C]]);c+=3*H;for(var ne=[v,x],A=0;A<2;++A){var ce=ne[A];for(C=0;C<ce.length;++C){var te=31&ce[C];or(e,c,N[te]),c+=O[te],te>15&&(or(e,c,ce[C]>>>5&127),c+=ce[C]>>>12)}}}else U=kR,X=yi,W=SR,K=pu;for(C=0;C<a;++C)if(r[C]>255){te=r[C]>>>18&31,qo(e,c,U[te+257]),c+=X[te+257],te>7&&(or(e,c,r[C]>>>23&31),c+=ch[te]);var ye=31&r[C];qo(e,c,W[ye]),c+=K[ye],ye>3&&(qo(e,c,r[C]>>>5&8191),c+=dh[ye])}else qo(e,c,U[r[C]]),c+=X[r[C]];return qo(e,c,U[256]),c+X[256]},ER=new ms([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$R=function(){for(var t=new ms(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),CR=function(){var t=4294967295;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=$R[255&n^e[r]]^n>>>8;t=n},d:function(){return 4294967295^t}}},RR=function(t,e,n,r,i){return function(s,o,a,l,u,c){var f=s.length,d=new nn(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 _=g+65535;_<f?p=gh(h,p,s.subarray(g,_)):(h[g]=c,p=gh(h,p,s.subarray(g,f)))}else{for(var m=ER[o-1],v=m>>>13,y=8191&m,b=(1<<a)-1,x=new It(32768),S=new It(b+1),$=Math.ceil(a/3),C=2*$,L=function(pt){return(s[pt]^s[pt+1]<<$^s[pt+2]<<C)&b},O=new ms(25e3),z=new It(288),H=new It(32),U=0,X=0,W=(g=0,0),K=0,oe=0;g<f;++g){var T=L(g),F=32767&g,N=S[T];if(x[F]=N,S[T]=F,K<=g){var ne=f-g;if((U>7e3||W>24576)&&ne>423){p=Jw(s,h,0,O,z,H,X,W,oe,g-oe,p),W=U=X=0,oe=g;for(var A=0;A<286;++A)z[A]=0;for(A=0;A<30;++A)H[A]=0}var ce=2,te=0,ye=y,re=F-N&32767;if(ne>2&&T==L(g-re))for(var Te=Math.min(v,ne)-1,ve=Math.min(32767,g),sn=Math.min(258,ne);re<=ve&&--ye&&F!=N;){if(s[g+ce]==s[g+ce-re]){for(var St=0;St<sn&&s[g+St]==s[g+St-re];++St);if(St>ce){if(ce=St,te=re,St>Te)break;var je=Math.min(re,St-2),Si=0;for(A=0;A<je;++A){var ia=g-re+A+32768&32767,Hn=ia-x[ia]+32768&32767;Hn>Si&&(Si=Hn,N=ia)}}}re+=(F=N)-(N=x[F])+32768&32767}if(te){O[W++]=268435456|fh[ce]<<18|Kw[te];var Ei=31&fh[ce],k=31&Kw[te];X+=ch[Ei]+dh[k],++z[257+Ei],++H[k],K=g+ce,++U}else O[W++]=s[g],++z[s[g]]}}p=Jw(s,h,c,O,z,H,X,W,oe,g-oe,p)}return Xw(d,0,l+Qw(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)},vh=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},TR=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&&vh(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)}},PR=function(t){return 10+(t.filename&&t.filename.length+1||0)};function e_(t,e){e===void 0&&(e={});var n=CR(),r=t.length;n.p(t);var i=RR(t,e,PR(e),8),s=i.length;return TR(i,e),vh(i,s-8,n.d()),vh(i,s-4,r),i}function t_(t,e){var n=t.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new nn(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 nn(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 Xw(r,0,i)}function OR(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<Wt(100*e,0,100,B)}var Lr="disabled",mh="sampled",gu="active",wi="buffering",yh="paused",wh="trigger",Nn=wh+"_activated",ft=wh+"_pending",jn=wh+"_"+Lr;function n_(t,e){return e.some(n=>n.matching==="regex"&&new RegExp(n.url).test(t))}class r_{constructor(e){this.Rt=e}triggerStatus(e){var n=this.Rt.map(r=>r.triggerStatus(e));return n.includes(Nn)?Nn:n.includes(ft)?ft:jn}stop(){this.Rt.forEach(e=>e.stop())}}class i_{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(jn),n.size){case 0:return jn;case 1:return Array.from(n)[0];default:return ft}}stop(){this.Rt.forEach(e=>e.stop())}}class AR{triggerStatus(){return ft}stop(){}}var vu=t=>"sessionRecording"in t;class MR{constructor(e){this.It=[],this.Pt=[],this.urlBlocked=!1,this._instance=e}onConfig(e){var n,r;this.It=(vu(e)?(n=e.sessionRecording)==null?void 0:n.urlTriggers:e==null?void 0:e.urlTriggers)||[],this.Pt=(vu(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?jn:((n=this._instance)==null?void 0:n.get_property(Vf))===e?Nn:ft}triggerStatus(e){var n=this.Tt(e),r=n===Nn?Nn:n===ft?ft:jn;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=n_(i,this.Pt);s&&o||(o&&!s?e():!o&&s&&n(),n_(i,this.It)&&r("url"))}}stop(){}}class IR{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=e}triggerStatus(){var e=ft;return he(this.linkedFlag)&&(e=jn),this.linkedFlagSeen&&(e=Nn),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onConfig(e,n){var r;if(this.linkedFlag=(vu(e)?(r=e.sessionRecording)==null?void 0:r.linkedFlag:e==null?void 0:e.linkedFlag)||null,!he(this.linkedFlag)&&!this.linkedFlagSeen){var i=Ne(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=Ne(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags((o,a)=>{var l=!1;if(De(a)&&i in a){var u=a[i];l=_n(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 FR{constructor(e){this.Mt=[],this._instance=e}onConfig(e){var n;this.Mt=(vu(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?jn:((n=this._instance)==null?void 0:n.get_property(Wf))===e?Nn:ft}triggerStatus(e){var n=this.Ot(e),r=n===Nn?Nn:n===ft?ft:jn;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}stop(){}}function LR(t){return t.isRecordingEnabled?wi:Lr}function DR(t){if(!t.receivedFlags)return wi;if(!t.isRecordingEnabled)return Lr;if(t.urlTriggerMatching.urlBlocked)return yh;var e=t.isSampled===!0,n=new r_([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?mh:n===Nn?gu:n===ft?wi:t.isSampled===!1?Lr:gu}function NR(t){if(!t.receivedFlags)return wi;if(!t.isRecordingEnabled)return Lr;if(t.urlTriggerMatching.urlBlocked)return yh;var e=new i_([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==jn,r=_n(t.isSampled);return n&&e===ft?wi:n&&e===jn||r&&!t.isSampled?Lr:t.isSampled===!0?mh:gu}var Wo="[SessionRecording]",et=Ge(Wo);function mu(){var t;return J==null||(t=J.__PosthogExtensions__)==null||(t=t.rrweb)==null?void 0:t.record}var jR=3e5,zR=[bn.MouseMove,bn.MouseInteraction,bn.Scroll,bn.ViewportResize,bn.Input,bn.TouchMove,bn.MediaInteraction,bn.Drag],s_=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function _i(t){return function(e,n){for(var r="",i=0;i<e.length;){var s=e[i++];r+=String.fromCharCode(s)}return r}(e_(t_(JSON.stringify(t))))}function o_(t){return t.type===Dn.Custom&&t.data.tag==="sessionIdle"}class a_{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(Wo+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var e,n;return this.Nt.triggerStatus(this.sessionId)===ft?6e4:(e=(n=this._instance.config.session_recording)==null?void 0:n.full_snapshot_interval_millis)!==null&&e!==void 0?e:jR}get Ut(){var e=this._instance.get_property(hs);return _n(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(qf),n=!this._instance.config.disable_session_recording;return E&&e&&n}get qt(){var e=!!this._instance.get_property(fw),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(gw),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:Wt(c,0,12,et.createLogger("canvas recording fps"),4),quality:Wt(f,0,1,et.createLogger("canvas recording quality"),.4)}}get Wt(){var e,n,r=this._instance.get_property(hw),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=De(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(_n(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(pw),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(vw);return dt(e)?e:null}get Jt(){var e=this._instance.get_property(mw);return dt(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}):wi}constructor(e){if(this.Yt=LR,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new AR,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(V!=null&&V.visibilityState){var i="window "+V.visibilityState;this.tryAddCustomEvent(i,{})}},this._instance=e,this.Dt=!1,this.ci="/s/",this.fi=void 0,this.Kt=!1,!this._instance.sessionManager)throw et.error("started without valid sessionManager"),new Error(Wo+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Wo+' cannot be used with cookieless_mode="always"');this.Zt=new IR(this._instance),this.Xt=new MR(this._instance),this.Qt=new FR(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&&et.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),Fe(E,"beforeunload",this.li),Fe(E,"offline",this.hi),Fe(E,"online",this.di),Fe(E,"visibilitychange",this.vi),this.yi(),this.bi(),he(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){et.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(Wf),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(Vf))}))):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(),et.info("stopped"))}ki(){var e;(e=this._instance.persistence)==null||e.unregister(hs)}$i(e){var n,r=this.Ft!==e,i=this.Vt;if(dt(i)){var s=this.Ut,o=r||!_n(s),a=o?OR(e,i):s;o&&(a?this.xi(mh):et.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({[hs]: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=DR,this.Nt=new r_([this.Qt,this.Xt])):(this.Yt=NR,this.Nt=new i_([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(){dt(this.Vt)&&he(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=he(p)?null:parseFloat(p);he(g)&&this.ki();var _=(o=e.sessionRecording)==null?void 0:o.minimumDurationMilliseconds;r.register({[qf]:!!e.sessionRecording,[fw]:(a=e.sessionRecording)==null?void 0:a.consoleLogRecordingEnabled,[hw]:j({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[pw]:(u=e.sessionRecording)==null?void 0:u.masking,[gw]:{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},[vw]:g,[mw]:D(_)?null:_,[yw]:(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(),mu()?this.Ri():(n=J.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.Ii,r=>{if(r)return et.error("could not load recorder",r);this.Ri()}),et.info("starting"),this.status===gu&&this.xi(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(yw))==null?void 0:e.script)||"recorder"}Pi(e){var n;return e.type===3&&zR.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}):et.warn("could not emit queued rrweb event.",n,e),!1}}tryAddCustomEvent(e,n){return this.Mi(s_(()=>mu().addCustomEvent(e,n)))}Oi(){return this.Mi(s_(()=>mu().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=mu();if(u){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new bR(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";et.info(h,{node:d}),this.log(Wo+" "+h,"warn")}});var c=this.Ai();this.fi=u(j({emit:f=>{this.onRRwebEmit(f)},plugins:c},s)),this.ei=Date.now(),this.ii=_n(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 et.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=J.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;i&&this.qt&&r.push(i());var s=(n=J.__PosthogExtensions__)==null||(n=n.rrwebPlugins)==null?void 0:n.getRecordNetworkPlugin;return this.Wt&&tn(s)&&(!J3.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(_R(this._instance.config,this.Wt))):et.info("NetworkCapture not started because we are on localhost.")),r}onRRwebEmit(e){var n;if(this.Di(),e&&De(e)){if(e.type===Dn.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===Dn.Custom&&i.data.tag==="recording paused"){var i;e.type===Dn.FullSnapshot&&this.Ci(),e.type===Dn.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===ft&&this.Bi();var s=this.Fi?this.Fi.throttleMutations(e):e;if(s){var o=function(d){var h=d;if(h&&De(h)&&h.type===6&&De(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||o_(o)){if(o_(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===Dn.FullSnapshot)return j({},d,{data:_i(d.data),cv:"2024-10"});if(d.type===Dn.IncrementalSnapshot&&d.data.source===bn.Mutation)return j({},d,{cv:"2024-10",data:j({},d.data,{texts:_i(d.data.texts),attributes:_i(d.data.attributes),removes:_i(d.data.removes),adds:_i(d.data.adds)})});if(d.type===Dn.IncrementalSnapshot&&d.data.source===bn.StyleSheetRule)return j({},d,{cv:"2024-10",data:j({},d.data,{adds:d.data.adds?_i(d.data.adds):void 0,removes:d.data.removes?_i(d.data.removes):void 0})})}catch(h){et.error("could not compress event - will use uncompressed event",h)}return d}(o):o,f={$snapshot_bytes:fu(c),$snapshot_data:c,$session_id:this.Ft,$window_id:this.pi};this.status!==Lr?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===Dn.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+fu(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=dt(n)&&n>=0,i=dt(e)&&r&&n<e;return this.status===wi||this.status===yh||this.status===Lr||i?(this.Hi=setTimeout(()=>{this.ui()},2e3),this.H):(this.H.data.length>0&&ah(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:tr.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)===ft&&((n=this._instance)==null||(n=n.persistence)==null||n.register({[e==="url"?Vf:Wf]:this.Ft}),this.ui(),this.xi(e+"_trigger_matched"))}Ni(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.Si),et.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"}),et.info("recording resumed"))}bi(){this.Qt.Mt.length!==0&&he(this.ai)&&(this.ai=this._instance.on("eventCaptured",e=>{try{this.Qt.Mt.includes(e.event)&&this.zi("event")}catch(n){et.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({[hs]:!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}),et.info(e.replace("_"," "),n),ae(["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 _h=Ge("[SegmentIntegration]");function HR(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()||Fr();r.config.get_device_id=u,l.id()&&(r.register({distinct_id:l.id(),$device_id:u()}),r.persistence.set_property(rr,"identified")),i()},a=s.user();"then"in a&&tn(a.then)?a.then(l=>o(l)):o(a)})(t,()=>{n.register((r=>{Promise&&Promise.resolve||_h.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()||(_h.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(_h.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 l_="posthog-js";function u_(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})),_={$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&&(_.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&t.exceptions.sendExceptionEvent(_),a}}class UR{constructor(e,n,r,i,s,o){this.name=l_,this.setupOnce=function(a){a(u_(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}var BR=E!=null&&E.location?au(E.location.hash,"__posthog")||au(location.hash,"state"):null,c_="_postHogToolbarParams",d_=Ge("[Toolbar]"),Dr=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Dr||{});class qR{constructor(e){this.instance=e}Gi(e){J.ph_toolbar_state=e}Vi(){var e;return(e=J.ph_toolbar_state)!==null&&e!==void 0?e:Dr.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||!V)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=BR||au(e.hash,"__posthog")||au(e.hash,"state"),o=s?rw(()=>JSON.parse(atob(decodeURIComponent(s))))||rw(()=>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(c_)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}Ji(e){var n=J.ph_load_toolbar||J.ph_load_editor;!he(n)&&tn(n)?n(e,this.instance):d_.warn("No toolbar load function found")}loadToolbar(e){var n=!(V==null||!V.getElementById(ww));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(c_,JSON.stringify(j({},i,{source:void 0}))),this.Vi()===Dr.LOADED)this.Ji(i);else if(this.Vi()===Dr.UNINITIALIZED){var s;this.Gi(Dr.LOADING),(s=J.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return d_.error("[Toolbar] Failed to load",o),void this.Gi(Dr.UNINITIALIZED);this.Gi(Dr.LOADED),this.Ji(i)}),Fe(E,"turbolinks:load",()=>{this.Gi(Dr.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 VR=Ge("[TracingHeaders]");class WR{constructor(e){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var n,r;D(this.Yi)&&((n=J.__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=J.__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=J.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return VR.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 Nr=Ge("[Web Vitals]"),f_=9e5;class GR{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))Nr.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)||(he(r==null?void 0:r.name)||he(r==null?void 0:r.value)?Nr.error("Invalid metric received",r):this.re&&r.value>=this.re?Nr.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=J.__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):Nr.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Qi=!((n=this._instance.persistence)==null||!n.props[uw]),this.startIfEnabled()}get allowedMetrics(){var e,n,r=De(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[dw])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(De(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var e=De(this._instance.config.capture_performance)&&dt(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:f_;return 0<e&&e<=6e4?f_:e}get isEnabled(){var e=At==null?void 0:At.protocol;if(e!=="http:"&&e!=="https:")return Nr.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=De(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:_n(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return _n(n)?n:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Nr.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var n=De(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=De(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[uw]:n}),this._instance.persistence.register({[dw]:r})),this.Qi=n,this.startIfEnabled()}nt(e){var n,r;(n=J.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&e(),(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",i=>{i?Nr.error("failed to load script",i):e()})}ee(){var e=E?E.location.href:void 0;return e||Nr.error("Could not determine current URL"),e}}var KR=Ge("[Heatmaps]");function h_(t){return De(t)&&"clientX"in t&&"clientY"in t&&dt(t.clientX)&&dt(t.clientY)}class YR{constructor(e){var n;this.rageclicks=new Lw,this.Qi=!1,this.C=!1,this.se=null,this.instance=e,this.Qi=!((n=this.instance.persistence)==null||!n.props[Hf])}get flushIntervalMilliseconds(){var e=5e3;return De(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;KR.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({[Hf]: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&&V&&(Fe(E,"beforeunload",this.oe.bind(this)),Fe(V,"click",e=>this.ue(e||(E==null?void 0:E.event)),{capture:!0}),Fe(V,"mousemove",e=>this.he(e||(E==null?void 0:E.event)),{capture:!0}),this.ae=new Hw(this.instance,hR,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&&ru(c)&&!Ir(c,"body");){if(c===u)return!1;if(ae(l,E==null?void 0:E.getComputedStyle(c).position))return!0;c=Cw(c)}return!1}(Ew(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"),!_w(e.target)&&h_(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){!_w(e.target)&&h_(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&&!ds(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class QR{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:Wt(a/o,0,1,B),h=o<=1?1:Wt(l/o,0,1,B),p=u<=1?1:Wt(c/u,0,1,B),g=u<=1?1:Wt(f/u,0,1,B);i=Ue(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 XR=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),nr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},ZR=!!Mf||!!Af,p_="text/plain",yu=(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)},Go=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),bh=t=>{var{data:e,compression:n}=t;if(e){if(n===ir.GZipJS){var r=e_(t_(Go(e)),{mtime:0}),i=new Blob([r],{type:p_});return{contentType:p_,body:i,estimatedSize:i.size}}if(n===ir.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,m="",v=[];if(!l)return l;l=XR(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[_++]=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}(Go(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Go(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Go(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},wu=[];Af&&wu.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=bh(t))!==null&&e!==void 0?e:{},o=new Headers;be(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(Uy){var u=new Uy;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Af(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){B.error(h)}t.callback==null||t.callback(d)})).catch(c=>{B.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Mf&&wu.push({transport:"XHR",method:t=>{var e,n=new Mf;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=bh(t))!==null&&e!==void 0?e:{};be(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)}}),Vt!=null&&Vt.sendBeacon&&wu.push({transport:"sendBeacon",method:t=>{var e=yu(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=bh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Vt.sendBeacon(e,s)}catch{}}});var ys=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 g_(t,e,n){return Go({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var v_={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=>ys(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!ys(n,r))),icontains:(t,e)=>e.map(_u).some(n=>t.map(_u).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(_u).every(n=>t.map(_u).every(r=>!n.includes(r)))},_u=t=>t.toLowerCase(),m_=Ge("[Error tracking]");class JR{constructor(e){var n,r;this.ge=[],this._e=new T3([new P3,new j3,new A3,new O3,new D3,new L3,new I3,new N3],[S3,C3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(Uf))!==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({[Uf]:this.ge,[lw]:o})}get me(){var e,n=!!this._instance.get_property(lw),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))m_.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"});m_.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!Ee(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return Ne(o)&&o.length>0&&i.$exception_types.push(o),Ne(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=v_[o.operator],u=Ee(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||!Ee(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 rn="Mobile",bu="iOS",zn="Android",Ko="Tablet",y_=zn+" "+Ko,w_="iPad",__="Apple",b_=__+" Watch",Yo="Safari",ws="BlackBerry",x_="Samsung",k_=x_+"Browser",S_=x_+" Internet",bi="Chrome",eT=bi+" OS",E_=bi+" "+bu,xh="Internet Explorer",$_=xh+" "+rn,kh="Opera",tT=kh+" Mini",Sh="Edge",C_="Microsoft "+Sh,_s="Firefox",R_=_s+" "+bu,Qo="Nintendo",Xo="PlayStation",bs="Xbox",T_=zn+" "+rn,P_=rn+" "+Yo,Zo="Windows",Eh=Zo+" Phone",O_="Nokia",$h="Ouya",A_="Generic",nT=A_+" "+rn.toLowerCase(),M_=A_+" "+Ko.toLowerCase(),Ch="Konqueror",kt="(\\d+(\\.\\d+)?)",Rh=new RegExp("Version/"+kt),rT=new RegExp(bs,"i"),iT=new RegExp(Xo+" \\w+","i"),sT=new RegExp(Qo+" \\w+","i"),Th=new RegExp(ws+"|PlayBook|BB10","i"),oT={"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"},aT=(t,e)=>e&&ae(e,__)||function(n){return ae(n,Yo)&&!ae(n,bi)&&!ae(n,zn)}(t),I_=function(t,e){return e=e||"",ae(t," OPR/")&&ae(t,"Mini")?tT:ae(t," OPR/")?kh:Th.test(t)?ws:ae(t,"IE"+rn)||ae(t,"WPDesktop")?$_:ae(t,k_)?S_:ae(t,Sh)||ae(t,"Edg/")?C_:ae(t,"FBIOS")?"Facebook "+rn:ae(t,"UCWEB")||ae(t,"UCBrowser")?"UC Browser":ae(t,"CriOS")?E_:ae(t,"CrMo")||ae(t,bi)?bi:ae(t,zn)&&ae(t,Yo)?T_:ae(t,"FxiOS")?R_:ae(t.toLowerCase(),Ch.toLowerCase())?Ch:aT(t,e)?ae(t,rn)?P_:Yo:ae(t,_s)?_s:ae(t,"MSIE")||ae(t,"Trident/")?xh:ae(t,"Gecko")?_s:""},lT={[$_]:[new RegExp("rv:"+kt)],[C_]:[new RegExp(Sh+"?\\/"+kt)],[bi]:[new RegExp("("+bi+"|CrMo)\\/"+kt)],[E_]:[new RegExp("CriOS\\/"+kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+kt)],[Yo]:[Rh],[P_]:[Rh],[kh]:[new RegExp("(Opera|OPR)\\/"+kt)],[_s]:[new RegExp(_s+"\\/"+kt)],[R_]:[new RegExp("FxiOS\\/"+kt)],[Ch]:[new RegExp("Konqueror[:/]?"+kt,"i")],[ws]:[new RegExp(ws+" "+kt),Rh],[T_]:[new RegExp("android\\s"+kt,"i")],[S_]:[new RegExp(k_+"\\/"+kt)],[xh]:[new RegExp("(rv:|MSIE )"+kt)],Mozilla:[new RegExp("rv:"+kt)]},uT=function(t,e){var n=I_(t,e),r=lT[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},F_=[[new RegExp(bs+"; "+bs+" (.*?)[);]","i"),t=>[bs,t&&t[1]||""]],[new RegExp(Qo,"i"),[Qo,""]],[new RegExp(Xo,"i"),[Xo,""]],[Th,[ws,""]],[new RegExp(Zo,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Eh,""];if(new RegExp(rn).test(e)&&!/IEMobile\b/.test(e))return[Zo+" "+rn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=oT[r]||"";return/arm/i.test(e)&&(i="RT"),[Zo,i]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[bu,e.join(".")]}return[bu,""]}],[/(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("("+zn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+zn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[zn,e.join(".")]}return[zn,""]}],[/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",""]]],L_=function(t){return sT.test(t)?Qo:iT.test(t)?Xo:rT.test(t)?bs:new RegExp($h,"i").test(t)?$h:new RegExp("("+Eh+"|WPDesktop)","i").test(t)?Eh:/iPad/.test(t)?w_:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?b_:Th.test(t)?ws:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(O_,"i").test(t)?O_:/(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(rn).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)?zn:y_:zn:new RegExp("(pda|"+rn+")","i").test(t)?nT:new RegExp(Ko,"i").test(t)&&!new RegExp(Ko+" pc","i").test(t)?M_:""},xu="https?://(.*)",ku=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],cT=Ql(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ku),Ph="<masked>",dT=["li_fat_id"];function D_(t,e,n){if(!V)return{};var r,i=e?Ql([],ku,n||[]):[],s=N_(ih(V.URL,i,Ph),t),o=(r={},be(dT,function(a){var l=Ln.J(a);r[a]=l||null}),r);return Ue(o,s)}function N_(t,e){var n=cT.concat(e||[]),r={};return be(n,function(i){var s=ou(t,i);r[i]=s||null}),r}function j_(t){var e=function(s){return s?s.search(xu+"google.([^/?]*)")===0?"google":s.search(xu+"bing.com")===0?"bing":s.search(xu+"yahoo.com")===0?"yahoo":s.search(xu+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!nr(e)){r.$search_engine=e;var i=V?ou(V.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function z_(){return navigator.language||navigator.userLanguage}function H_(){return(V==null?void 0:V.referrer)||"$direct"}function U_(t,e){var n=t?Ql([],ku,e||[]):[],r=At==null?void 0:At.href.substring(0,1e3);return{r:H_().substring(0,1e3),u:r?ih(r,n,Ph):void 0}}function B_(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=vs(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=vs(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=N_(r);Ue(i,o)}if(n){var a=j_(n);Ue(i,a)}return i}function q_(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function fT(){try{return new Date().getTimezoneOffset()}catch{return}}function hT(t,e){if(!Mt)return{};var n,r,i,s=t?Ql([],ku,e||[]):[],[o,a]=function(l){for(var u=0;u<F_.length;u++){var[c,f]=F_[u],d=c.exec(l),h=d&&(tn(f)?f(d,l):f);if(h)return h}return["",""]}(Mt);return Ue(zf({$os:o,$os_version:a,$browser:I_(Mt,navigator.vendor),$device:L_(Mt),$device_type:(r=Mt,i=L_(r),i===w_||i===y_||i==="Kobo"||i==="Kindle Fire"||i===M_?Ko:i===Qo||i===bs||i===Xo||i===$h?"Console":i===b_?"Wearable":i?rn:"Desktop"),$timezone:q_(),$timezone_offset:fT()}),{$current_url:ih(At==null?void 0:At.href,s,Ph),$host:At==null?void 0:At.host,$pathname:At==null?void 0:At.pathname,$raw_user_agent:Mt.length>1e3?Mt.substring(0,997)+"...":Mt,$browser_version:uT(Mt,navigator.vendor),$browser_language:z_(),$browser_language_prefix:(n=z_(),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:tr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var xn=Ge("[FeatureFlags]"),Oh="$active_feature_flags",xs="$override_feature_flags",V_="$feature_flag_payloads",Jo="$override_feature_flag_payloads",W_="$feature_flag_request_id",G_=t=>{var e={};for(var[n,r]of Xl(t||{}))r&&(e[n]=r);return e},pT=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]}))):xn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},gT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class vT{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||xn.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(Gf),n=this._instance.get_property(xs),r=this._instance.get_property(Jo);if(!r&&!n)return e||{};var i=Ue({},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||(xn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(ps),n=this._instance.get_property(xs);if(!n)return e||{};for(var r=Ue({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(xn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(V_),n=this._instance.get_property(Jo);if(!n)return e||{};for(var r=Ue({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(xn.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(jo)||{}),group_properties:this._instance.get_property(gi)};(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=q_()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:ir.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(gT.FeatureFlags))xn.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(W_)||void 0,o=this._instance.get_property(eu)||{};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;Ee(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[eu]:o});var _=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(_==null||(c=_.metadata)==null?void 0:c.version)||(m.$feature_flag_version=_.metadata.version);var v,y=(f=_==null||(d=_.reason)==null?void 0:d.description)!==null&&f!==void 0?f:_==null||(h=_.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),_!=null&&(p=_.metadata)!=null&&p.id&&(m.$feature_flag_id=_.metadata.id),D(_==null?void 0:_.original_variant)&&D(_==null?void 0:_.original_enabled)||(m.$feature_flag_original_response=D(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(g=_.metadata)!=null&&g.original_payload&&(m.$feature_flag_original_payload=_==null||(v=_.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",m)}return r}xn.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:ir.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}xn.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=pT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var g=o.requestId;if(Ee(h)){xn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(h)for(var m=0;m<h.length;m++)_[h[m]]=!0;a&&a.register({[Oh]:h,[ps]:_})}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({[Oh]:Object.keys(G_(v)),[ps]:v||{},[V_]:y||{},[Gf]:b||{}},g?{[W_]:g}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),xn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return xn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(xs),this._instance.persistence.unregister(Jo),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(xs);else if(r.flags)if(Ee(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[xs]:i})}else this._instance.persistence.register({[xs]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(Jo):r.payloads&&this._instance.persistence.register({[Jo]: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(No)||[]).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({[Oh]:Object.keys(G_(l)),[ps]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(No),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(No),(l=this._instance.persistence)==null||l.register({[No]: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(jo)||{};this._instance.register({[jo]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(jo)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(gi)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[gi]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(gi)||{};this._instance.register({[gi]:j({},n,{[e]:{}})})}else this._instance.unregister(gi)}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 mT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Ah{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&&B.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){mT.indexOf(e.persistence.toLowerCase())===-1&&(B.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&Ke.G()?Ke:n==="localstorage+cookie"&&uu.G()?uu:n==="sessionstorage"&&it.G()?it:n==="memory"?dR:n==="cookie"?Ln:uu.G()?uu:Ln}properties(){var e={};return be(this.props,function(n,r){if(r===ps&&De(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,(nr(o=V3)?l:Hy&&o.indexOf===Hy?o.indexOf(a)!=-1:(be(o,function(u){if(l||(l=u===a))return Yl}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=Ue({},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(De(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(be(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(De(e)){this.ze=D(n)?this.He:n;var r=!1;if(be(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=D_(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);ds(zf(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=V==null?void 0:V.referrer)?j_(e):{})}update_referrer_info(){var e;this.register_once({$referrer:H_(),$referring_domain:V!=null&&V.referrer&&((e=vs(V.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Xf]||this.props[Zf]||this.register_once({[tu]:U_(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};be([Zf,Xf],o=>{var a=this.props[o];a&&be(a,function(l,u){e["$initial_"+If(u)]=l})});var n,r,i=this.props[tu];if(i){var s=(n=B_(i),r={},be(n,function(o,a){r["$initial_"+If(a)]=o}),r);Ue(e,s)}return e}safe_merge(e){return be(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[Do]||{};r[e]=n,this.props[Do]=r,this.save()}remove_event_timer(e){var n=(this.props[Do]||{})[e];return D(n)||(delete this.props[Do][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 Mh=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 Su=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),K_=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}({}),Y_=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Ih{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 xi{constructor(e){this.Ge=new Ih,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"||!xi.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&&ys(e,n);case"exact":return n===e;case"contains":var i=xi.rr(n).replace(/_/g,".").replace(/%/g,".*");return ys(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&&!xi.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&&!xi.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!xi.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 xe=Ge("[Surveys]"),Fh="seenSurvey_",yT=(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},Q_=t=>{var e=""+Fh+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+Fh+t.id+"_"+t.current_iteration),e},wT=[Mh.Popover,Mh.Widget,Mh.API],_T={ignoreConditions:!1,ignoreDelay:!1,displayType:Y_.Popover};class bT{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 xi(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[Jl])||[];if(Su.SHOWN===e&&n&&s.length>0){var o;xe.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)){xe.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,[_,m]=p,v=n==null||(g=n.properties)==null?void 0:g[_];if(D(v)||nr(v))return!1;var y=[String(v)],b=v_[m.operator];return b?b(m.values,y):(xe.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[Jl])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;xe.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[Jl]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[Jl];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class xT{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(he(n))return xe.warn("Flags not loaded yet. Not loading surveys.");var r=Ee(n);this.cr=r?n.length>0:n,xe.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(Fh)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)xe.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)xe.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())xe.info("Not loading surveys in cookieless mode without consent.");else{var e=J==null?void 0:J.__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 xe.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new bT(this._instance),xe.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){xe.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 xe.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(Kf);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 xe.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({[Kf]: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){xe.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!he(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);xe.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(he(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(he(this._surveyManager))return xe.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 he(this._surveyManager)?(xe.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(he(this._surveyManager))xe.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(wT.includes(i.type)){var s=V==null?void 0:V.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(xe.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;xe.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),xe.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);xe.warn("Survey element not found")}else xe.warn("Surveys of type "+i.type+" cannot be rendered in the app");else xe.warn("Survey not found")}}displaySurvey(e,n){var r;if(he(this._surveyManager))xe.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 xe.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==Y_.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else xe.warn("Survey not found")}}}var X_=Ge("[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=>{X_.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void X_.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(Qf))!==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(Qf,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ki=Ge("[RemoteConfig]");class ST{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=J._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=J.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(ki.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 ki.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void ki.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return ki.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){ki.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()):ki.info("__preview_remote_config is disabled. Logging config instead",e):ki.error("Failed to fetch remote config from PostHog.")}}var Lh=3e3;class ET{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Wt((n==null?void 0:n.flush_interval_ms)||Lh,250,5e3,B.createLogger("flush interval"),Lh),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&&Ee(s.data)&&be(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 be(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 $T=["retriesPerformedSoFar"];class CT{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,Fe(E,"online",()=>{this.Dr=!0,this.oe()}),Fe(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=Vy(e,$T);dt(n)&&n>0&&(r.url=yu(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)"),B.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){B.error(n)}this.Rr=[]}}class RT{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(){Fe(E,"scroll",this.Ur,{capture:!0}),Fe(E,"scrollend",this.Ur,{capture:!0}),Fe(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=Ee(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 TT=t=>U_(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class Z_{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({[Yf]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||TT,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[Yf]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?B_(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 be(zf(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+If(r)]=n}),e}}var Dh=Ge("[SessionId]");class J_{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new Ih,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||Fr,this.Xr=r||Fr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Wt(o,60,36e3,Dh.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=it.K(this.Zr),l=it.K(this.ts);a&&!l?this.pi=a:it.X(this.Zr),it.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){Dh.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&&it.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&it.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?it.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({[Zl]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[Zl];return Ee(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Fe(E,"beforeunload",()=>{this.es()&&it.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=dt(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(),Dh.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 PT=["$set_once","$set"],jr=Ge("[SiteApps]");class OT{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=J._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({},Vy(e,PT),{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;J["__$$ph_site_app_"+u]=s._instance,(c=J.__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 AT=["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"],e1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return AT.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},t1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&e1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>e1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},ea=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),n1="i.posthog.com";class MT{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("."+n1,".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]=ea.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ea.EU:this.ps[this.apiHost]=ea.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===ea.CUSTOM)return this.apiHost+n;var r=n1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var IT={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&&ys(e.href,t),not_regex:(t,e)=>!!E&&!ys(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class ht{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{ht.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(ht.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);Ne(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];ht.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())ht.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(he(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ht.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=ht.getWindowLocation();if(e!=null&&e.search){var n=ou(e==null?void 0:e.search,"__experiment_id"),r=ou(e==null?void 0:e.search,"__experiment_variant");n&&r&&(ht.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&&(ht.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!he(e.conditions)&&ht.Ss(e)&&ht.ks(e)}static Ss(e){var n;if(he(e.conditions)||he((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=ht.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||IT[(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(he(e.conditions)||he((n=e.conditions)==null?void 0:n.utm))return!0;var r=D_();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];B.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?ht.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;ht.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)})}}):ht.gs("Control variants leave the page unmodified.")}_is_bot(){return Vt&&this._instance?t1(Vt,this._instance.config.custom_blocked_useragents):void 0}}var FT=Ge("[PostHog ExternalIntegrations]"),LT={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class DT{constructor(e){this._instance=e}nt(e,n){var r;(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return FT.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=J.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(LT[o],()=>{var c;(c=J.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=J.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=J.__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 Nh="[SessionRecording]",ta=Ge(Nh);class NT{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 ta.error("started without valid sessionManager"),new Error(Nh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Nh+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(Bf))==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),ta.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(J!=null&&(n=J.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=J.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=J.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return ta.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(hs)}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=he(a)?null:parseFloat(a);he(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[Bf]: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()):ta.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):ta.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(Bf);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=J.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=J.__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 na={},jh=()=>{},ks="posthog",r1=!ZR&&(Mt==null?void 0:Mt.indexOf("MSIE"))===-1&&(Mt==null?void 0:Mt.indexOf("Mozilla"))===-1,i1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:q3(V==null?void 0:V.location),persistence:"localStorage+cookie",persistence_name:"",loaded:jh,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:At&&Ne(At==null?void 0:At.search)&&At.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;B.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:Lh},error_tracking:{},_onCapture:jh,__preview_eager_load_replay:!0}},s1=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=Ue({},e,t);return Ee(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:Ee(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:B.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class jT{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Eu{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 jT,this.Rs=!1,this.version=tr.LIB_VERSION,this.Is=new Ih,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=i1(),this.SentryIntegration=UR,this.sentryIntegration=e=>function(n,r){var i=u_(n,r);return{name:l_,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 vT(this),this.toolbar=new qR(this),this.scrollManager=new RT(this),this.pageViewManager=new QR(this),this.surveys=new xT(this),this.experiments=new ht(this),this.exceptions=new JR(this),this.rateLimiter=new kT(this),this.requestRouter=new MT(this),this.consent=new fR(this),this.externalIntegrations=new DT(this),this.people={set:(e,n,r)=>{var i=Ne(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=Ne(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>B.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==ks){var i,s=(i=na[r])!==null&&i!==void 0?i:new Eu;return s._init(e,n,r),na[r]=s,na[ks][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||Ff(e))return B.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 B.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(Ue({},i1(n.defaults),s1(n),{name:r,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ir.GZipJS;var o=this.As();this.persistence=new Ah(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ah(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 ET(y=>this.js(y),this.config.request_queue_config),this.Ls=new CT(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 J_(this),this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence)),new WR(this).startIfEnabledOrStop(),this.siteApps=new OT(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new a_(this):this.sessionRecording=new NT(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new iR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new YR(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new GR(this),this.exceptionObserver=new gR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Hw(this,pR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new vR(this),this.historyAutocapture.startIfEnabled(),tr.DEBUG=tr.DEBUG||this.config.debug,tr.DEBUG&&B.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(Fr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(rr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,g,_=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=>_[y]).reduce((y,b)=>{var x,S;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(S=n.bootstrap)==null||(S=S.featureFlagPayloads)==null?void 0:S[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:zo,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Fr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(rr,"anonymous")}return Fe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?HR(this,()=>this.Us()):this.Us(),tn(this.config._onCapture)&&this.config._onCapture!==jh&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&B.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(!V||!V.body)return B.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=ae(e.supportedCompression,ir.GZipJS)?ir.GZipJS:ae(e.supportedCompression,ir.Base64)?ir.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){B.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new ST(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()&&Mr(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&&(r1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=yu(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=yu(o.url,{_:new Date().getTime().toString(),ver:tr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=wu.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=iw(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=[];Mr(e,a=>{a&&(n=a[0],Ee(n)?s.push(a):tn(a)?a.call(this):Ee(a)&&n==="alias"?r.push(a):Ee(a)&&n.indexOf("capture")!==-1&&tn(this[n])?s.push(a):i.push(a))});var o=function(a,l){Mr(a,function(u){if(Ee(u[0])){var c=l;be(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)&&Ne(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&&!Ne(n==null?void 0:n.$current_url)&&(B.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=Fr(),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=U3(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===Su.DISMISSED||e===Su.SENT){var d=n==null?void 0:n[K_.SURVEY_ID],h=n==null?void 0:n[K_.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(Q_(c))||localStorage.setItem(Q_(c),"true"),u.$set=j({},u.$set,{[yT({id:d,current_iteration:h},e===Su.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if(ds(p)||this.setPersonPropertiesForFlags(p),!he(this.config.before_send)){var g=this.Ws(u);if(!g)return;u=g}this.Is.emit("eventCaptured",u);var _={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(_):this.Ds.enqueue(_),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.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,(!Ne(a.distinct_id)&&!dt(a.distinct_id)||Ff(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=hT(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&&Ue(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Ue(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===ea.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=Ue(a,u),e==="$pageview"&&V&&(a.title=V.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Mt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ue({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Ee(this.config.property_denylist)?be(this.config.property_denylist,function(m){delete a[m]}):B.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&&(B.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,e));var _=this.Gs();return a.$process_person_profile=_,_&&!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=Ue({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(B.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,ds(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=_T),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 B.uninitializedWarning("posthog.identify");if(dt(e)&&(e=e.toString(),B.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()))B.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!==zo){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(Lo)&&(this.unregister(Lo),this.register({distinct_id:e}));var o=(this.persistence.get_property(rr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(rr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=g_(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(eu))}}else B.critical('The string "'+zo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=g_(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):B.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 B.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(B.info("reset"),!this.__loaded)return B.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(rr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:zo,$device_id:null},"");else{var a=this.config.get_device_id(Fr());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(sw)?(B.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(Lo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(De(e)){var r,i,s,o,a;Ue(this.config,s1(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 Ah(j({},this.config,{persistence:"sessionStorage"}),l),Ke.G()&&Ke.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(tr.DEBUG=!0,B.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:ks;return n!==ks&&(n=ks+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(rr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(rr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ds(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Lo])&&((n=this.persistence)==null||(n=n.props)==null||!n[nu]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(nu,!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 J_(this),this.persistence&&(this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence)),this.sessionRecording=new a_(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 B.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:zo,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):B.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===sr.GRANTED?"granted":e===sr.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 Vt?t1(Vt,this.config.custom_blocked_useragents):void 0}Bs(){V&&(V.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:V.title},{send_instantly:!0}),this.Ts&&(V.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Fe(V,"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?(B.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=B,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(he(this.config.before_send))return e;var n=Ee(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),he(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return v3(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}r.properties&&!ds(r.properties)||B.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]]=H3(t.prototype[e[n]])})(Eu,["identify"]);var o1,zh=(o1=na[ks]=new Eu,function(){function t(){t.done||(t.done=!0,r1=!1,be(na,function(e){e._dom_loaded()}))}V!=null&&V.addEventListener?V.readyState==="complete"?t():Fe(V,"DOMContentLoaded",t,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),o1);console.info("Vehicle Search v3.0.19 powered by Partbot https://mmyvs.partbot.io");function $u(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 Hh({apiKey:t,makes:e="",models:n="",callbackUrl:r="",layout:i="row",fields:s,fieldPrefix:o="",showBranding:a=!0,showLabels:l=!1,mobileFullWidthButton:u=!0,mobileDrawer:c=!0,modifyQueryString:f=!0,onChange:d,buttonLabel:h="Search",showButton:p=!0,onSubmit:g,store:_,useStoreVehicles:m=!0,fieldOrder:v="MMY",enableFeatureFlags:y=!1,yearOptional:b=!1,mobileButtonLabel:x="Select Vehicle"}){const S=w.useRef(null),$=w.useRef(null),C=w.useRef(null),L=w.useRef(null),O=w.useRef(null),z=w.useRef(null),H=w.useRef(null),U=w.useRef(null),X=w.useRef(null),W=w.useRef(!1),K=v==="YMM",[oe,T]=w.useState([]),[F,N]=w.useState([]),[ne,A]=w.useState([]),[ce,te]=w.useState([]),[ye,re]=w.useState([]),[Te,ve]=w.useState([]),[sn,St]=w.useState([]),[je,Si]=w.useState([]),ia=w.useRef([]),[Hn,Ei]=w.useState([]),[k,pt]=w.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[qT,Uh]=w.useState(!1),l1=w.useRef(["body","series","variant","engine","engine_capacity"]),Cu=w.useRef(s&&s.length&&l1.current?s.split(",").filter(R=>{var I;return(I=l1.current)==null?void 0:I.includes(R)}):null),[kn,VT]=w.useState(!1);w.useEffect(()=>{const R=navigator.userAgent;VT(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(R)),zh.__loaded||zh.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://app.posthog.com",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[zr,WT]=w.useState({}),[fP,GT]=w.useState(""),u1=w.useCallback(async()=>{if(!t)return;const I=`${y?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const Q=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,referrerPolicy:"no-referrer"},body:JSON.stringify((()=>{const ke={use_store_vehicles:m};return _&&(ke.store=_),ke})())});if(!Q.ok)throw new Error(`Error: ${Q.status} ${Q.statusText}`);const{merchant:q,vehicle_makes:ee,vehicle_models:Y,meilisearch_search_key:se,meilisearch_index_name:pe,algolia_search_key:Ye,algolia_index_name:ar,store_index_name:Ss,store_popular_makes:Hr,store_popular_models:we}=await Q.json();$.current=q,C.current=(ee||[]).map(ke=>({...ke,refinement:ke.value})),m&&Y?typeof Y=="object"&&!Array.isArray(Y)?L.current=Y:Array.isArray(Y)?L.current=Y.map(ke=>ke&&ke.value?String(ke.value).trim():"").filter(Boolean):L.current=[]:L.current=[],O.current=Array.isArray(Hr)?Hr.map(ke=>String(ke).trim().toUpperCase()):null,z.current=we||null,WT({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(Q){console.error("[VehicleSearch] Auth failed:",Q),GT(Q)}},[t,_,m,y]);w.useEffect(()=>{u1()},[u1]),w.useEffect(()=>{if(zr.searchKey){try{H.current=new _y({host:"https://search.partbot.io",apiKey:zr.searchKey}),U.current=H.current.index(zr.indexName);const R=new _y({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:zr.searchKey});X.current=R.index("otto_v1_vehicle_mmy")}catch(R){console.error("[VehicleSearch] Failed to initialize Meilisearch:",R)}return()=>{H.current=null}}},[zr.searchKey,t]);const[on,KT]=w.useState(!1),c1=w.useCallback(()=>{function R(Y){if(!Y)return"rgba(0,0,0,1)";var se=I(),pe=window.getComputedStyle(Y).backgroundColor;return pe!==se?pe:Y.parentElement?R(Y.parentElement):"rgba(255,255,255,1)"}function I(){var Y=document.createElement("div");document.head.appendChild(Y);var se=window.getComputedStyle(Y).backgroundColor;return document.head.removeChild(Y),se}const Q=document.querySelector("vehicle-search");let q;Q?q=R(Q):q=R(S.current);const ee=Z(q).isDark();KT(ee)},[]);w.useEffect(()=>{async function R(){if(!k.make||!U.current)return;let I=[],Q=[];k.make&&I.push(`make:${k.make.refinement}`),k.model&&I.push(`model:${k.make.refinement} > ${k.model.refinement}`),k.year&&(Q=[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]),k.body&&I.push(`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`),k.series&&I.push(`series:${k.series.refinement}`),k.engine&&I.push(`engine:${k.engine.refinement}`),k.engine_capacity&&I.push(`engine_capacity:${k.engine_capacity.refinement}`);let ee=(await U.current.search("",{filter:$u(I,Q),attributesToRetrieve:["otto_id"],limit:500})).hits.map(pe=>pe.otto_id);Ei(ee);let se={...Object.fromEntries(Object.entries(k||{}).map(([pe,Ye])=>[pe,Ye&&Ye.value||null]).filter(([pe,Ye])=>Ye!==null)),merchant:$.current};zh.capture("vehicle select",se)}R()},[k,U,b]);const Bh=R=>o?`${o}${R}`:R,YT=R=>o?R.replace(new RegExp(`^${o}`),""):R,QT=w.useCallback(()=>{const R=new URL(window.location.href).searchParams,I=["make","model","year","body","series","engine","engine_capacity"].map(Bh),Q=Object.fromEntries([...R.entries()].filter(([q])=>I.includes(q)).map(([q,ee])=>[YT(q),{value:ee,refinement:ee}]));pt(Q)},[]),gt=w.useCallback(({query:R,value:I,remove:Q})=>{if(f&&"URLSearchParams"in window){let q=new URLSearchParams(window.location.search);R=Bh(R),R&&I&&q.set(R,I),R&&!I&&q.delete(R),Q&&Q.forEach(Y=>{Y=Bh(Y),q.delete(Y)});const ee=window.location.pathname+"?"+q.toString();window.history.pushState(null,"",ee)}},[]),XT=w.useCallback(()=>{var Q;const R={vehicle_ids:Hn,vehicle:(Q=k==null?void 0:k.make)!=null&&Q.value?k:{}};g&&g(R);const I=new CustomEvent("vehicle-search-submit",{detail:R});window.dispatchEvent(I),setTimeout(()=>{Uh(!1)},900)},[Hn,g]),d1=w.useCallback(()=>{var Q,q,ee,Y,se,pe,Ye,ar,Ss;const R={vehicle_ids:Hn,vehicle:(Q=k==null?void 0:k.make)!=null&&Q.value?k:{},userSelected:W.current};d&&d(R);const I=new CustomEvent("vehicle-search-change",{detail:R});if(console.log("[VehicleSearch] Dispatching vehicle-search-change:",R),W.current===!0){localStorage.removeItem("partbot_plate_details");const Hr=JSON.stringify({description:`${((q=k.make)==null?void 0:q.value)||""} ${((ee=k.model)==null?void 0:ee.value)||""} ${((Y=k.year)==null?void 0:Y.value)||""} ${((se=k.body)==null?void 0:se.value)||""} ${((pe=k.series)==null?void 0:pe.value)||""} ${((Ye=k.variant)==null?void 0:Ye.value)||""} ${((ar=k.engine)==null?void 0:ar.value)||""} ${((Ss=k.engine_capacity)==null?void 0:Ss.value)||""}`.trim(),vehicle_ids:Hn,vehicle:k?Object.entries(k).reduce((we,[ke,ze])=>(we[ke]=ze!=null&&ze.value?ze.value:{},we),{}):{}});localStorage.setItem("partbot_selected_vehicle",Hr),Gx.set("partbot_selected_vehicle",Hr,{secure:!0})}window.dispatchEvent(I),console.log("[VehicleSearch] Event dispatched to window"),ia.current=Hn,setTimeout(()=>{Uh(!1)},900)},[Hn,d]),Ru=w.useMemo(()=>UC(d1,100),[d1]);w.useEffect(()=>{Ru()},[Hn,Ru]),w.useEffect(()=>()=>{Ru.cancel()},[Ru]),w.useEffect(()=>{const R=I=>{console.log("[VehicleSearch] Received plate-search-change:",I.detail),console.log("[VehicleSearch] Clearing vehicle selection"),pt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),Ei([])};return console.log("[VehicleSearch] Adding plate-search-change listener to window"),window.addEventListener("plate-search-change",R),()=>{window.removeEventListener("plate-search-change",R)}},[]),w.useEffect(()=>{zr.searchKey&&(K||rP(),QT())},[zr.searchKey,K]),w.useEffect(()=>{K&&U.current&&ne.length===0&&!k.year&&U.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:R})=>{const I=R.map(se=>se.year_from).filter(Boolean),Q=R.map(se=>se.year_to).filter(Boolean),q=Math.min(...I),ee=Math.max(...Q),Y=Array.from({length:ee-q+1},(se,pe)=>({value:q+pe,refinement:q+pe})).reverse();A(Y)}).catch(R=>{console.error("[VehicleSearch] Error loading year range:",R)})},[K,zr.searchKey,ne.length,k.year]),w.useEffect(()=>{typeof document>"u"||c1()},[c1]);const f1=w.useCallback(R=>{W.current=!0,N([]),!K&&!b&&A([]),te([]),re([]),ve([]),Si([]),St([]),pt(I=>({make:R,year:K||b?I.year:null})),gt({query:"make",value:(R==null?void 0:R.value)??"",remove:K?["model","body","series","engine","variant","engine_capacity"]:b?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),R||Ei([])},[gt,K,b]),h1=w.useCallback(R=>{W.current=!0,pt(I=>({...I,model:R!==""?R:null,year:K||b?I.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!K&&!b&&A([]),te([]),re([]),ve([]),Si([]),St([]),gt({query:"model",value:(R==null?void 0:R.value)??"",remove:K?["body","series","engine","variant","engine_capacity"]:b?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[gt,K,b]),p1=w.useCallback(R=>{W.current=!0,K?(T([]),N([]),pt({year:R!==""?R:null}),(!R||R==="")&&A([])):pt(b?I=>({...I,year:R!==""?R:null}):I=>({...I,year:R!==""?R:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),b||(te([]),re([]),ve([]),Si([]),St([])),gt({query:"year",value:(R==null?void 0:R.value)??"",remove:K?["make","model","body","series","variant","engine","engine_capacity"]:b?[]:["body","series","variant","engine","engine_capacity"]}),!b&&(!R||R==="")&&Ei([])},[gt,K,b]),ZT=w.useCallback(R=>{W.current=!0,pt(I=>({...I,body:R!==""?R:null})),gt({query:"body",value:(R==null?void 0:R.value)??""})},[gt]),JT=w.useCallback(R=>{W.current=!0,pt(I=>({...I,series:R!==""?R:null})),gt({query:"series",value:(R==null?void 0:R.value)??""})},[gt]),eP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,variant:R!==""?R:null})),gt({query:"variant",value:(R==null?void 0:R.value)??""})},[gt]),tP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,engine:R!==""?R:null})),gt({query:"engine",value:(R==null?void 0:R.value)??""})},[gt]),nP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,engine_capacity:R!==""?R:null})),gt({query:"engine_capacity",value:(R==null?void 0:R.value)??""})},[gt]);w.useEffect(()=>{K&&k.year&&U.current&&(async()=>{try{const I=await U.current.search("",{filter:`year_from <= ${k.year.value} AND year_to >= ${k.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),Q=new Map;I.hits.forEach(Y=>{Y.make&&!Q.has(Y.make)&&Q.set(Y.make,{value:Y.make.toUpperCase(),refinement:Y.make.toUpperCase(),popularity:Y.make_popularity||0})});let q=Array.from(Q.values());const ee=new Set(O.current||[]);ee.size>0?q.sort((Y,se)=>{const pe=ee.has(Y.value),Ye=ee.has(se.value);return pe&&!Ye?-1:!pe&&Ye?1:pe&&Ye?O.current.indexOf(Y.value)-O.current.indexOf(se.value):Y.value.localeCompare(se.value)}):q.sort((Y,se)=>se.popularity===Y.popularity?Y.value.localeCompare(se.value):se.popularity-Y.popularity),T(q)}catch(I){console.error("[VehicleSearch] Error loading makes for year:",I)}})()},[K,k.year]);const rP=w.useCallback(()=>{(async()=>{let I=[];if(C.current&&C.current.length)I=C.current;else if(U.current)try{const Q=await U.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),q=new Map;Q.hits.forEach(ee=>{ee.make&&!q.has(ee.make)&&q.set(ee.make,{value:ee.make.toUpperCase(),refinement:ee.make.toUpperCase(),popularity:ee.make_popularity||0})}),I=Array.from(q.values())}catch(Q){console.error("[VehicleSearch] Error loading makes:",Q)}if(e&&I.length){const Q=e.trim().split(",").map(q=>q.trim().toUpperCase());I=I.filter(q=>Q.includes(q.value))}if(O.current&&O.current.length>0){const Q=new Set(O.current);I.sort((q,ee)=>{const Y=Q.has(q.value),se=Q.has(ee.value);return Y&&!se?-1:!Y&&se?1:Y&&se?O.current.indexOf(q.value)-O.current.indexOf(ee.value):q.value.localeCompare(ee.value)})}else I.sort((Q,q)=>Q.popularity===q.popularity?Q.value.localeCompare(q.value):q.popularity-Q.popularity);T(I)})()},[e]);w.useEffect(()=>{var R;if(k.make&&k.make.refinement){const I=k.make.refinement;if(m&&typeof L.current=="object"&&!Array.isArray(L.current)&&L.current[I]){const Q=L.current[I].map(ee=>({value:ee,refinement:ee,popularity:0})),q=(R=z.current)==null?void 0:R[I];if(q&&Array.isArray(q)){const ee=new Map(q.map((Y,se)=>[Y.toUpperCase(),q.length-se]));Q.sort((Y,se)=>{const pe=ee.get(Y.value.toUpperCase())||0,Ye=ee.get(se.value.toUpperCase())||0;return pe!==Ye?Ye-pe:Y.value.localeCompare(se.value)})}else Q.sort((ee,Y)=>ee.value.localeCompare(Y.value));N(Q);return}if(!X.current||!t)return;X.current.search("",{filter:`make = "${k.make.refinement}"`,limit:1}).then(Q=>{var Ss,Hr;const{hits:q}=Q;let ee=[];q.length>0&&q[0].models&&(ee=q[0].models);let Y=ee.map(we=>({model:`${k.make.refinement} > ${we.name}`,model_popularity:we.popularity||0})),se=[];Array.isArray(L.current)?se=L.current:typeof L.current=="object"&&L.current!==null?se=L.current[k.make.refinement]||[]:typeof L.current=="string"&&L.current.length&&(se=L.current.split(",").map(we=>we.trim()).filter(Boolean));let pe=se;if(n){const we=n.trim().split(",").map(ze=>ze.trim()).filter(Boolean),ke=new Set(we.map(ze=>ze.toLowerCase()));pe=se.length?se.filter(ze=>ke.has(String(ze).toLowerCase())):we,Y=Y.filter(ze=>ke.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase()))}if(pe&&pe.length>0){const we=new Set(pe.map(ze=>String(ze).toLowerCase()));Y.some(ze=>we.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase()))&&(Y=Y.filter(ze=>we.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase())))}Y=Y.filter(we=>we.model&&we.model!==""?we.model.match(/[^>]*$/)[0].trim()!=="":!1).map(we=>({value:we.model.match(/[^>]*$/)[0].trim(),refinement:we.model.match(/[^>]*$/)[0].trim(),popularity:we.model_popularity}));const Ye=(Ss=k.make)==null?void 0:Ss.refinement,ar=(Hr=z.current)==null?void 0:Hr[Ye];if(ar&&Array.isArray(ar)&&ar.length>0){const we=new Set(ar.map(ke=>String(ke).trim().toUpperCase()));Y.sort((ke,ze)=>{const Vh=we.has(ke.value),Wh=we.has(ze.value);if(Vh&&!Wh)return-1;if(!Vh&&Wh)return 1;if(Vh&&Wh){const g1=ar.map(sP=>String(sP).trim().toUpperCase());return g1.indexOf(ke.value)-g1.indexOf(ze.value)}return ke.value.localeCompare(ze.value)})}else Y.sort((we,ke)=>we.popularity===ke.popularity?we.value.localeCompare(ke.value):ke.popularity-we.popularity);N(Y)}).catch(Q=>{console.error("[VehicleSearch] Error loading models:",Q),N([])})}else N([])},[k.make,n,t,K,k.year,m]),w.useEffect(()=>{if(U.current&&k.make&&k.model){let R=[`model:${k.make.refinement} > ${k.model.refinement}`];b&&(k.body&&R.push(`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`),k.series&&R.push(`series:${k.series.refinement}`),k.engine&&R.push(`engine:${k.engine.refinement}`),k.engine_capacity&&R.push(`engine_capacity:${k.engine_capacity.refinement}`)),U.current.search("",{filter:$u(R,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:I})=>{const Q=I.map(pe=>pe.year_from),q=Math.min(...Q),ee=I.map(pe=>pe.year_to),Y=Math.max(...ee);let se=Array.apply(null,{length:Y+1-q}).map(function(pe,Ye){return Ye+q});se=se.reverse().map(pe=>({value:pe,refinement:pe})),A(se)}).catch(I=>{console.error("[VehicleSearch] Error fetching years:",I)})}},[k.model,k.make,K,b,k.body,k.series,k.engine,k.engine_capacity]),w.useEffect(()=>{const R=b?k.make&&k.model:k.year&&k.make&&k.model;if(U.current&&R){const I=k.year?[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]:[];U.current.search("",{filter:$u([`model:${k.make.refinement} > ${k.model.refinement}`],I),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:Q})=>{Q=[...new Map(Q.map(q=>[q.body,q])).values()].map(q=>({value:q.body.match(/[^>]*$/)[0].trim(),refinement:q.body.match(/[^>]*$/)[0].trim()})).filter(q=>q.value),te(Q)})}},[k.year,k.make,k.model,b]);const sa=w.useCallback(({hits:R,attribute:I,stateCallback:Q})=>{let q=[...new Map(R.map(ee=>[ee[I],ee])).values()].map(ee=>({value:ee[I].match(/[^|]*$/)[0].trim(),refinement:ee[I].match(/[^|]*$/)[0].trim()})).filter(ee=>ee.refinement);Q(q)},[]),iP=w.useCallback(()=>{const R=Cu.current?Cu.current.length+3:3,I=p?R+1:R;return`vs:lg:grid-cols-${I>8?8:I}`},[p]);w.useEffect(()=>{const R=b?k.make&&k.model:k.make&&k.model&&k.year;if(U.current&&R){let I=[`make:${k.make.refinement}`,`model:${k.make.refinement} > ${k.model.refinement}`,k.body?`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`:"",k.series?`series:${k.series.refinement}`:"",k.variant?`variant:${k.variant.refinement}`:"",k.engine?`engine:${k.engine.refinement}`:"",k.engine_capacity?`engine_capacity:${k.engine_capacity.refinement}`:""].filter(q=>q);const Q=k.year?[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]:[];U.current.search("",{filter:$u(I,Q),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:q})=>{sa({hits:q,attribute:"series",stateCallback:re}),sa({hits:q,attribute:"variant",stateCallback:ve}),sa({hits:q,attribute:"engine",stateCallback:St}),sa({hits:q,attribute:"engine_capacity",stateCallback:Si})})}},[k.body,k.series,k.variant,k.engine,k.engine_capacity,sa,k.make,k.model,k.year,b]);const[Tu,qh]=w.useState(!1);return w.useEffect(()=>{if(c)return Tu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Tu,c]),M.jsxs(M.Fragment,{children:[c&&M.jsx("button",{onClick:()=>qh(!0),type:"button",className:Tr("vehicle-search-btn vs:md:hidden!",u?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:M.jsx("span",{children:x})}),c&&M.jsx("div",{onClick:()=>qh(!1),className:Tr("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Tu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),M.jsxs("div",{className:Tr("partbot-mmyvs-container",c&&Tu&&"active","w-full"),children:[c&&M.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[M.jsx("span",{children:"Select Vehicle"}),M.jsxs("button",{onClick:()=>qh(!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:[M.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),M.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:M.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"})})})]})]}),M.jsxs("div",{ref:S,className:Tr("vs:grid vs:gap-3",i==="row"?`${iP()} 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:[K?M.jsxs(M.Fragment,{children:[M.jsx(mn,{label:"Year",items:ne,refine:p1,selected:k.year,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:ne.length===0,shouldBeActive:!0}),M.jsx(mn,{label:"Make",items:oe,refine:f1,selected:k.make,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.year&&oe.length===0,shouldBeActive:!!k.year}),M.jsx(mn,{label:"Model",items:F,refine:h1,selected:k.model,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.make&&F.length===0,shouldBeActive:!!k.make})]}):M.jsxs(M.Fragment,{children:[M.jsx(mn,{label:"Make",items:oe,refine:f1,selected:k.make,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:oe.length===0,shouldBeActive:!0}),M.jsx(mn,{label:"Model",items:F,refine:h1,selected:k.model,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.make&&F.length===0,shouldBeActive:!!k.make}),M.jsx(mn,{label:"Year",items:ne,refine:p1,selected:k.year,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.model&&ne.length===0,shouldBeActive:!!k.model})]}),Cu.current&&Cu.current.map(R=>{let I=null;switch(R){case"body":I=M.jsx(mn,{label:"Body",items:ce,refine:ZT,selected:k.body,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&ce.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"body");break;case"series":I=M.jsx(mn,{label:"Series",items:ye,refine:JT,selected:k.series,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&ye.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"series");break;case"variant":I=M.jsx(mn,{label:"Variant",items:Te,refine:eP,selected:k.variant,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&Te.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"variant");break;case"engine_capacity":I=M.jsx(mn,{label:"Engine Capacity",items:je,refine:nP,selected:k.engine_capacity,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&je.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"engine_capacity");break;case"engine":I=M.jsx(mn,{label:"Engine",items:sn,refine:tP,selected:k.engine,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&sn.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"engine");break}return I}),p&&M.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:M.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{Uh(!0),r&&!g?window.location.href=r+window.location.search:XT()},children:[M.jsx("span",{children:h}),qT&&M.jsx(Rf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),a&&M.jsx("div",{className:Tr("vs:flex vs:w-full vs:justify-center vs:items-center",i==="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:M.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:`${on?"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:[M.jsx("span",{children:"Powered by"}),M.jsx(Kx,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let a1=!1,ra=!1;function zT(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),ra=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(ra=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(ra=!1)})})}).observe(n,{childList:!0,subtree:!0}),a1)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"&&ra))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"&&ra))return u.set.call(this,d)}}),a1=!0}const HT="/css/vehicle-search.css";class UT extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const z=document.createElement("link");z.id="vehicle-search-inter-font",z.rel="stylesheet",z.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(z)}let e=document.createElement("style");e.textContent=Vx;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(z,H,U)=>{let X;if(this.hasAttribute(H)){const W=this.getAttribute(H);if(/^#[0-9A-F]{6}$/i.test(W)){const K=parseInt(W.slice(1,3),16),oe=parseInt(W.slice(3,5),16),T=parseInt(W.slice(5,7),16);X=`${K} ${oe} ${T}`}}return X=X||U,`:host { --${z}: ${X}; } .partbot-mmyvs-container { --${z}: ${X}; }`};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"),_=g==="none"?"none":g||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${_}; } .partbot-mmyvs-container { --partbot-input-shadow: ${_}; }`;const v=this.getAttribute("data-input-border-color");let y="229 231 235";if(v)if(/^#[0-9A-F]{6}$/i.test(v)){const z=parseInt(v.slice(1,3),16),H=parseInt(v.slice(3,5),16),U=parseInt(v.slice(5,7),16);y=`${z} ${H} ${U}`}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 S=`: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+=S,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,L={};for(let z=0;z<C.length;z++){const{name:H,value:U}=C[z];if(H.startsWith("data-")){const X=H.slice(5).replace(/-([a-z])/g,W=>W[1].toUpperCase());L[X]=U==="true"?!0:U==="false"?!1:U}}zT(this);const O=M.jsx(Hh,{...L});qx.render(O,n)}}customElements.define("vehicle-search",UT);const BT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Et.VehicleSearch=Hh,Et.default=Hh,Et.vehicleSearchCssUrl=HT,Object.defineProperties(Et,{__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),nr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},ZR=!!Mf||!!Af,p_="text/plain",yu=(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)},Go=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),bh=t=>{var{data:e,compression:n}=t;if(e){if(n===ir.GZipJS){var r=e_(t_(Go(e)),{mtime:0}),i=new Blob([r],{type:p_});return{contentType:p_,body:i,estimatedSize:i.size}}if(n===ir.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,m="",v=[];if(!l)return l;l=XR(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[_++]=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}(Go(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Go(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Go(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},wu=[];Af&&wu.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=bh(t))!==null&&e!==void 0?e:{},o=new Headers;be(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(Uy){var u=new Uy;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Af(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){B.error(h)}t.callback==null||t.callback(d)})).catch(c=>{B.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Mf&&wu.push({transport:"XHR",method:t=>{var e,n=new Mf;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=bh(t))!==null&&e!==void 0?e:{};be(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)}}),Vt!=null&&Vt.sendBeacon&&wu.push({transport:"sendBeacon",method:t=>{var e=yu(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=bh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Vt.sendBeacon(e,s)}catch{}}});var ys=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 g_(t,e,n){return Go({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var v_={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=>ys(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!ys(n,r))),icontains:(t,e)=>e.map(_u).some(n=>t.map(_u).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(_u).every(n=>t.map(_u).every(r=>!n.includes(r)))},_u=t=>t.toLowerCase(),m_=Ge("[Error tracking]");class JR{constructor(e){var n,r;this.ge=[],this._e=new T3([new P3,new j3,new A3,new O3,new D3,new L3,new I3,new N3],[S3,C3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(Uf))!==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({[Uf]:this.ge,[lw]:o})}get me(){var e,n=!!this._instance.get_property(lw),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))m_.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"});m_.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!Ee(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return Ne(o)&&o.length>0&&i.$exception_types.push(o),Ne(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=v_[o.operator],u=Ee(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||!Ee(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 rn="Mobile",bu="iOS",zn="Android",Ko="Tablet",y_=zn+" "+Ko,w_="iPad",__="Apple",b_=__+" Watch",Yo="Safari",ws="BlackBerry",x_="Samsung",k_=x_+"Browser",S_=x_+" Internet",bi="Chrome",eT=bi+" OS",E_=bi+" "+bu,xh="Internet Explorer",$_=xh+" "+rn,kh="Opera",tT=kh+" Mini",Sh="Edge",C_="Microsoft "+Sh,_s="Firefox",R_=_s+" "+bu,Qo="Nintendo",Xo="PlayStation",bs="Xbox",T_=zn+" "+rn,P_=rn+" "+Yo,Zo="Windows",Eh=Zo+" Phone",O_="Nokia",$h="Ouya",A_="Generic",nT=A_+" "+rn.toLowerCase(),M_=A_+" "+Ko.toLowerCase(),Ch="Konqueror",kt="(\\d+(\\.\\d+)?)",Rh=new RegExp("Version/"+kt),rT=new RegExp(bs,"i"),iT=new RegExp(Xo+" \\w+","i"),sT=new RegExp(Qo+" \\w+","i"),Th=new RegExp(ws+"|PlayBook|BB10","i"),oT={"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"},aT=(t,e)=>e&&ae(e,__)||function(n){return ae(n,Yo)&&!ae(n,bi)&&!ae(n,zn)}(t),I_=function(t,e){return e=e||"",ae(t," OPR/")&&ae(t,"Mini")?tT:ae(t," OPR/")?kh:Th.test(t)?ws:ae(t,"IE"+rn)||ae(t,"WPDesktop")?$_:ae(t,k_)?S_:ae(t,Sh)||ae(t,"Edg/")?C_:ae(t,"FBIOS")?"Facebook "+rn:ae(t,"UCWEB")||ae(t,"UCBrowser")?"UC Browser":ae(t,"CriOS")?E_:ae(t,"CrMo")||ae(t,bi)?bi:ae(t,zn)&&ae(t,Yo)?T_:ae(t,"FxiOS")?R_:ae(t.toLowerCase(),Ch.toLowerCase())?Ch:aT(t,e)?ae(t,rn)?P_:Yo:ae(t,_s)?_s:ae(t,"MSIE")||ae(t,"Trident/")?xh:ae(t,"Gecko")?_s:""},lT={[$_]:[new RegExp("rv:"+kt)],[C_]:[new RegExp(Sh+"?\\/"+kt)],[bi]:[new RegExp("("+bi+"|CrMo)\\/"+kt)],[E_]:[new RegExp("CriOS\\/"+kt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+kt)],[Yo]:[Rh],[P_]:[Rh],[kh]:[new RegExp("(Opera|OPR)\\/"+kt)],[_s]:[new RegExp(_s+"\\/"+kt)],[R_]:[new RegExp("FxiOS\\/"+kt)],[Ch]:[new RegExp("Konqueror[:/]?"+kt,"i")],[ws]:[new RegExp(ws+" "+kt),Rh],[T_]:[new RegExp("android\\s"+kt,"i")],[S_]:[new RegExp(k_+"\\/"+kt)],[xh]:[new RegExp("(rv:|MSIE )"+kt)],Mozilla:[new RegExp("rv:"+kt)]},uT=function(t,e){var n=I_(t,e),r=lT[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},F_=[[new RegExp(bs+"; "+bs+" (.*?)[);]","i"),t=>[bs,t&&t[1]||""]],[new RegExp(Qo,"i"),[Qo,""]],[new RegExp(Xo,"i"),[Xo,""]],[Th,[ws,""]],[new RegExp(Zo,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Eh,""];if(new RegExp(rn).test(e)&&!/IEMobile\b/.test(e))return[Zo+" "+rn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=oT[r]||"";return/arm/i.test(e)&&(i="RT"),[Zo,i]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[bu,e.join(".")]}return[bu,""]}],[/(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("("+zn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+zn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[zn,e.join(".")]}return[zn,""]}],[/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",""]]],L_=function(t){return sT.test(t)?Qo:iT.test(t)?Xo:rT.test(t)?bs:new RegExp($h,"i").test(t)?$h:new RegExp("("+Eh+"|WPDesktop)","i").test(t)?Eh:/iPad/.test(t)?w_:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?b_:Th.test(t)?ws:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(O_,"i").test(t)?O_:/(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(rn).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)?zn:y_:zn:new RegExp("(pda|"+rn+")","i").test(t)?nT:new RegExp(Ko,"i").test(t)&&!new RegExp(Ko+" pc","i").test(t)?M_:""},xu="https?://(.*)",ku=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],cT=Ql(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ku),Ph="<masked>",dT=["li_fat_id"];function D_(t,e,n){if(!V)return{};var r,i=e?Ql([],ku,n||[]):[],s=N_(ih(V.URL,i,Ph),t),o=(r={},be(dT,function(a){var l=Ln.J(a);r[a]=l||null}),r);return Ue(o,s)}function N_(t,e){var n=cT.concat(e||[]),r={};return be(n,function(i){var s=ou(t,i);r[i]=s||null}),r}function j_(t){var e=function(s){return s?s.search(xu+"google.([^/?]*)")===0?"google":s.search(xu+"bing.com")===0?"bing":s.search(xu+"yahoo.com")===0?"yahoo":s.search(xu+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!nr(e)){r.$search_engine=e;var i=V?ou(V.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function z_(){return navigator.language||navigator.userLanguage}function H_(){return(V==null?void 0:V.referrer)||"$direct"}function U_(t,e){var n=t?Ql([],ku,e||[]):[],r=At==null?void 0:At.href.substring(0,1e3);return{r:H_().substring(0,1e3),u:r?ih(r,n,Ph):void 0}}function B_(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=vs(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=vs(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=N_(r);Ue(i,o)}if(n){var a=j_(n);Ue(i,a)}return i}function q_(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function fT(){try{return new Date().getTimezoneOffset()}catch{return}}function hT(t,e){if(!Mt)return{};var n,r,i,s=t?Ql([],ku,e||[]):[],[o,a]=function(l){for(var u=0;u<F_.length;u++){var[c,f]=F_[u],d=c.exec(l),h=d&&(tn(f)?f(d,l):f);if(h)return h}return["",""]}(Mt);return Ue(zf({$os:o,$os_version:a,$browser:I_(Mt,navigator.vendor),$device:L_(Mt),$device_type:(r=Mt,i=L_(r),i===w_||i===y_||i==="Kobo"||i==="Kindle Fire"||i===M_?Ko:i===Qo||i===bs||i===Xo||i===$h?"Console":i===b_?"Wearable":i?rn:"Desktop"),$timezone:q_(),$timezone_offset:fT()}),{$current_url:ih(At==null?void 0:At.href,s,Ph),$host:At==null?void 0:At.host,$pathname:At==null?void 0:At.pathname,$raw_user_agent:Mt.length>1e3?Mt.substring(0,997)+"...":Mt,$browser_version:uT(Mt,navigator.vendor),$browser_language:z_(),$browser_language_prefix:(n=z_(),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:tr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var xn=Ge("[FeatureFlags]"),Oh="$active_feature_flags",xs="$override_feature_flags",V_="$feature_flag_payloads",Jo="$override_feature_flag_payloads",W_="$feature_flag_request_id",G_=t=>{var e={};for(var[n,r]of Xl(t||{}))r&&(e[n]=r);return e},pT=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]}))):xn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},gT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class vT{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||xn.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(Gf),n=this._instance.get_property(xs),r=this._instance.get_property(Jo);if(!r&&!n)return e||{};var i=Ue({},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||(xn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(ps),n=this._instance.get_property(xs);if(!n)return e||{};for(var r=Ue({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(xn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(V_),n=this._instance.get_property(Jo);if(!n)return e||{};for(var r=Ue({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(xn.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(jo)||{}),group_properties:this._instance.get_property(gi)};(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=q_()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:ir.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(gT.FeatureFlags))xn.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(W_)||void 0,o=this._instance.get_property(eu)||{};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;Ee(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[eu]:o});var _=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(_==null||(c=_.metadata)==null?void 0:c.version)||(m.$feature_flag_version=_.metadata.version);var v,y=(f=_==null||(d=_.reason)==null?void 0:d.description)!==null&&f!==void 0?f:_==null||(h=_.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),_!=null&&(p=_.metadata)!=null&&p.id&&(m.$feature_flag_id=_.metadata.id),D(_==null?void 0:_.original_variant)&&D(_==null?void 0:_.original_enabled)||(m.$feature_flag_original_response=D(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(g=_.metadata)!=null&&g.original_payload&&(m.$feature_flag_original_payload=_==null||(v=_.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",m)}return r}xn.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:ir.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}xn.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=pT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var g=o.requestId;if(Ee(h)){xn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(h)for(var m=0;m<h.length;m++)_[h[m]]=!0;a&&a.register({[Oh]:h,[ps]:_})}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({[Oh]:Object.keys(G_(v)),[ps]:v||{},[V_]:y||{},[Gf]:b||{}},g?{[W_]:g}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),xn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return xn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(xs),this._instance.persistence.unregister(Jo),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(xs);else if(r.flags)if(Ee(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[xs]:i})}else this._instance.persistence.register({[xs]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(Jo):r.payloads&&this._instance.persistence.register({[Jo]: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(No)||[]).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({[Oh]:Object.keys(G_(l)),[ps]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(No),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(No),(l=this._instance.persistence)==null||l.register({[No]: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(jo)||{};this._instance.register({[jo]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(jo)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(gi)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[gi]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(gi)||{};this._instance.register({[gi]:j({},n,{[e]:{}})})}else this._instance.unregister(gi)}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 mT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Ah{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&&B.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){mT.indexOf(e.persistence.toLowerCase())===-1&&(B.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&Ke.G()?Ke:n==="localstorage+cookie"&&uu.G()?uu:n==="sessionstorage"&&it.G()?it:n==="memory"?dR:n==="cookie"?Ln:uu.G()?uu:Ln}properties(){var e={};return be(this.props,function(n,r){if(r===ps&&De(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,(nr(o=V3)?l:Hy&&o.indexOf===Hy?o.indexOf(a)!=-1:(be(o,function(u){if(l||(l=u===a))return Yl}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=Ue({},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(De(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(be(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(De(e)){this.ze=D(n)?this.He:n;var r=!1;if(be(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=D_(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);ds(zf(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=V==null?void 0:V.referrer)?j_(e):{})}update_referrer_info(){var e;this.register_once({$referrer:H_(),$referring_domain:V!=null&&V.referrer&&((e=vs(V.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Xf]||this.props[Zf]||this.register_once({[tu]:U_(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};be([Zf,Xf],o=>{var a=this.props[o];a&&be(a,function(l,u){e["$initial_"+If(u)]=l})});var n,r,i=this.props[tu];if(i){var s=(n=B_(i),r={},be(n,function(o,a){r["$initial_"+If(a)]=o}),r);Ue(e,s)}return e}safe_merge(e){return be(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[Do]||{};r[e]=n,this.props[Do]=r,this.save()}remove_event_timer(e){var n=(this.props[Do]||{})[e];return D(n)||(delete this.props[Do][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 Mh=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 Su=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),K_=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}({}),Y_=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Ih{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 xi{constructor(e){this.Ge=new Ih,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"||!xi.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&&ys(e,n);case"exact":return n===e;case"contains":var i=xi.rr(n).replace(/_/g,".").replace(/%/g,".*");return ys(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&&!xi.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&&!xi.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!xi.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 xe=Ge("[Surveys]"),Fh="seenSurvey_",yT=(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},Q_=t=>{var e=""+Fh+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+Fh+t.id+"_"+t.current_iteration),e},wT=[Mh.Popover,Mh.Widget,Mh.API],_T={ignoreConditions:!1,ignoreDelay:!1,displayType:Y_.Popover};class bT{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 xi(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[Jl])||[];if(Su.SHOWN===e&&n&&s.length>0){var o;xe.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)){xe.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,[_,m]=p,v=n==null||(g=n.properties)==null?void 0:g[_];if(D(v)||nr(v))return!1;var y=[String(v)],b=v_[m.operator];return b?b(m.values,y):(xe.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[Jl])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;xe.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[Jl]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[Jl];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class xT{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(he(n))return xe.warn("Flags not loaded yet. Not loading surveys.");var r=Ee(n);this.cr=r?n.length>0:n,xe.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(Fh)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)xe.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)xe.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())xe.info("Not loading surveys in cookieless mode without consent.");else{var e=J==null?void 0:J.__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 xe.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new bT(this._instance),xe.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){xe.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 xe.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(Kf);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 xe.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({[Kf]: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){xe.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!he(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);xe.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(he(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(he(this._surveyManager))return xe.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 he(this._surveyManager)?(xe.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(he(this._surveyManager))xe.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(wT.includes(i.type)){var s=V==null?void 0:V.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(xe.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;xe.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),xe.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);xe.warn("Survey element not found")}else xe.warn("Surveys of type "+i.type+" cannot be rendered in the app");else xe.warn("Survey not found")}}displaySurvey(e,n){var r;if(he(this._surveyManager))xe.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 xe.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==Y_.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else xe.warn("Survey not found")}}}var X_=Ge("[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=>{X_.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void X_.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(Qf))!==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(Qf,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ki=Ge("[RemoteConfig]");class ST{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=J._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=J.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(ki.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 ki.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void ki.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return ki.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){ki.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()):ki.info("__preview_remote_config is disabled. Logging config instead",e):ki.error("Failed to fetch remote config from PostHog.")}}var Lh=3e3;class ET{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Wt((n==null?void 0:n.flush_interval_ms)||Lh,250,5e3,B.createLogger("flush interval"),Lh),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&&Ee(s.data)&&be(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 be(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 $T=["retriesPerformedSoFar"];class CT{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,Fe(E,"online",()=>{this.Dr=!0,this.oe()}),Fe(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=Vy(e,$T);dt(n)&&n>0&&(r.url=yu(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)"),B.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){B.error(n)}this.Rr=[]}}class RT{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(){Fe(E,"scroll",this.Ur,{capture:!0}),Fe(E,"scrollend",this.Ur,{capture:!0}),Fe(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=Ee(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 TT=t=>U_(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class Z_{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({[Yf]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||TT,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[Yf]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?B_(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 be(zf(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+If(r)]=n}),e}}var Dh=Ge("[SessionId]");class J_{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new Ih,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||Fr,this.Xr=r||Fr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Wt(o,60,36e3,Dh.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=it.K(this.Zr),l=it.K(this.ts);a&&!l?this.pi=a:it.X(this.Zr),it.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){Dh.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&&it.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&it.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?it.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({[Zl]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[Zl];return Ee(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Fe(E,"beforeunload",()=>{this.es()&&it.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=dt(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(),Dh.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 PT=["$set_once","$set"],jr=Ge("[SiteApps]");class OT{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=J._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({},Vy(e,PT),{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;J["__$$ph_site_app_"+u]=s._instance,(c=J.__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 AT=["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"],e1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return AT.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},t1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&e1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>e1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},ea=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),n1="i.posthog.com";class MT{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("."+n1,".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]=ea.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=ea.EU:this.ps[this.apiHost]=ea.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===ea.CUSTOM)return this.apiHost+n;var r=n1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var IT={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&&ys(e.href,t),not_regex:(t,e)=>!!E&&!ys(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class ht{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{ht.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(ht.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);Ne(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];ht.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())ht.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(he(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ht.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=ht.getWindowLocation();if(e!=null&&e.search){var n=ou(e==null?void 0:e.search,"__experiment_id"),r=ou(e==null?void 0:e.search,"__experiment_variant");n&&r&&(ht.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&&(ht.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!he(e.conditions)&&ht.Ss(e)&&ht.ks(e)}static Ss(e){var n;if(he(e.conditions)||he((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=ht.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||IT[(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(he(e.conditions)||he((n=e.conditions)==null?void 0:n.utm))return!0;var r=D_();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];B.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?ht.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;ht.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)})}}):ht.gs("Control variants leave the page unmodified.")}_is_bot(){return Vt&&this._instance?t1(Vt,this._instance.config.custom_blocked_useragents):void 0}}var FT=Ge("[PostHog ExternalIntegrations]"),LT={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class DT{constructor(e){this._instance=e}nt(e,n){var r;(r=J.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return FT.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=J.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(LT[o],()=>{var c;(c=J.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=J.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=J.__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 Nh="[SessionRecording]",ta=Ge(Nh);class NT{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 ta.error("started without valid sessionManager"),new Error(Nh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Nh+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(Bf))==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),ta.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(J!=null&&(n=J.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=J.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=J.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return ta.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(hs)}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=he(a)?null:parseFloat(a);he(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[Bf]: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()):ta.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):ta.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(Bf);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=J.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=J.__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 na={},jh=()=>{},ks="posthog",r1=!ZR&&(Mt==null?void 0:Mt.indexOf("MSIE"))===-1&&(Mt==null?void 0:Mt.indexOf("Mozilla"))===-1,i1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:q3(V==null?void 0:V.location),persistence:"localStorage+cookie",persistence_name:"",loaded:jh,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:At&&Ne(At==null?void 0:At.search)&&At.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;B.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:Lh},error_tracking:{},_onCapture:jh,__preview_eager_load_replay:!0}},s1=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=Ue({},e,t);return Ee(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:Ee(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:B.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class jT{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Eu{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 jT,this.Rs=!1,this.version=tr.LIB_VERSION,this.Is=new Ih,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=i1(),this.SentryIntegration=UR,this.sentryIntegration=e=>function(n,r){var i=u_(n,r);return{name:l_,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 vT(this),this.toolbar=new qR(this),this.scrollManager=new RT(this),this.pageViewManager=new QR(this),this.surveys=new xT(this),this.experiments=new ht(this),this.exceptions=new JR(this),this.rateLimiter=new kT(this),this.requestRouter=new MT(this),this.consent=new fR(this),this.externalIntegrations=new DT(this),this.people={set:(e,n,r)=>{var i=Ne(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=Ne(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>B.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==ks){var i,s=(i=na[r])!==null&&i!==void 0?i:new Eu;return s._init(e,n,r),na[r]=s,na[ks][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||Ff(e))return B.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 B.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(Ue({},i1(n.defaults),s1(n),{name:r,token:e})),this.config.on_xhr_error&&B.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:ir.GZipJS;var o=this.As();this.persistence=new Ah(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ah(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 ET(y=>this.js(y),this.config.request_queue_config),this.Ls=new CT(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 J_(this),this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence)),new WR(this).startIfEnabledOrStop(),this.siteApps=new OT(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new a_(this):this.sessionRecording=new NT(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new iR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new YR(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new GR(this),this.exceptionObserver=new gR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Hw(this,pR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new vR(this),this.historyAutocapture.startIfEnabled(),tr.DEBUG=tr.DEBUG||this.config.debug,tr.DEBUG&&B.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(Fr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(rr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,g,_=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=>_[y]).reduce((y,b)=>{var x,S;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(S=n.bootstrap)==null||(S=S.featureFlagPayloads)==null?void 0:S[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:zo,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Fr());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(rr,"anonymous")}return Fe(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?HR(this,()=>this.Us()):this.Us(),tn(this.config._onCapture)&&this.config._onCapture!==jh&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&B.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(!V||!V.body)return B.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=ae(e.supportedCompression,ir.GZipJS)?ir.GZipJS:ae(e.supportedCompression,ir.Base64)?ir.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){B.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new ST(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()&&Mr(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&&(r1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=yu(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=yu(o.url,{_:new Date().getTime().toString(),ver:tr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=wu.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=iw(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=[];Mr(e,a=>{a&&(n=a[0],Ee(n)?s.push(a):tn(a)?a.call(this):Ee(a)&&n==="alias"?r.push(a):Ee(a)&&n.indexOf("capture")!==-1&&tn(this[n])?s.push(a):i.push(a))});var o=function(a,l){Mr(a,function(u){if(Ee(u[0])){var c=l;be(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)&&Ne(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&&!Ne(n==null?void 0:n.$current_url)&&(B.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=Fr(),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=U3(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===Su.DISMISSED||e===Su.SENT){var d=n==null?void 0:n[K_.SURVEY_ID],h=n==null?void 0:n[K_.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(Q_(c))||localStorage.setItem(Q_(c),"true"),u.$set=j({},u.$set,{[yT({id:d,current_iteration:h},e===Su.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if(ds(p)||this.setPersonPropertiesForFlags(p),!he(this.config.before_send)){var g=this.Ws(u);if(!g)return;u=g}this.Is.emit("eventCaptured",u);var _={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(_):this.Ds.enqueue(_),u}B.critical("This capture call is ignored due to client rate limiting.")}}else B.error("No event name provided to posthog.capture")}else B.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,(!Ne(a.distinct_id)&&!dt(a.distinct_id)||Ff(a.distinct_id))&&B.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=hT(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&&Ue(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Ue(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===ea.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=Ue(a,u),e==="$pageview"&&V&&(a.title=V.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Mt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ue({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Ee(this.config.property_denylist)?be(this.config.property_denylist,function(m){delete a[m]}):B.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&&(B.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,e));var _=this.Gs();return a.$process_person_profile=_,_&&!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=Ue({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(B.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,ds(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=_T),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 B.uninitializedWarning("posthog.identify");if(dt(e)&&(e=e.toString(),B.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()))B.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!==zo){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(Lo)&&(this.unregister(Lo),this.register({distinct_id:e}));var o=(this.persistence.get_property(rr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(rr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=g_(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(eu))}}else B.critical('The string "'+zo+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else B.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=g_(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):B.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 B.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(B.info("reset"),!this.__loaded)return B.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(rr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:zo,$device_id:null},"");else{var a=this.config.get_device_id(Fr());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(sw)?(B.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(Lo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(B.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(De(e)){var r,i,s,o,a;Ue(this.config,s1(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 Ah(j({},this.config,{persistence:"sessionStorage"}),l),Ke.G()&&Ke.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(tr.DEBUG=!0,B.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:ks;return n!==ks&&(n=ks+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(rr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(rr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ds(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Lo])&&((n=this.persistence)==null||(n=n.props)==null||!n[nu]))}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"?(B.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(nu,!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 J_(this),this.persistence&&(this.sessionPropsManager=new Z_(this,this.sessionManager,this.persistence)),this.sessionRecording=new a_(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 B.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:zo,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):B.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===sr.GRANTED?"granted":e===sr.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 Vt?t1(Vt,this.config.custom_blocked_useragents):void 0}Bs(){V&&(V.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:V.title},{send_instantly:!0}),this.Ts&&(V.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Fe(V,"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?(B.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=B,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(he(this.config.before_send))return e;var n=Ee(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),he(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return v3(e.event)?B.warn(s+". This can cause unexpected behavior."):B.info(s),null}r.properties&&!ds(r.properties)||B.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]]=H3(t.prototype[e[n]])})(Eu,["identify"]);var o1,zh=(o1=na[ks]=new Eu,function(){function t(){t.done||(t.done=!0,r1=!1,be(na,function(e){e._dom_loaded()}))}V!=null&&V.addEventListener?V.readyState==="complete"?t():Fe(V,"DOMContentLoaded",t,{capture:!1}):E&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),o1);console.info("Vehicle Search v3.0.20 powered by Partbot https://mmyvs.partbot.io");function $u(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 Hh({apiKey:t,makes:e="",models:n="",callbackUrl:r="",layout:i="row",fields:s,fieldPrefix:o="",showBranding:a=!0,showLabels:l=!1,mobileFullWidthButton:u=!0,mobileDrawer:c=!0,modifyQueryString:f=!0,onChange:d,buttonLabel:h="Search",showButton:p=!0,onSubmit:g,store:_,useStoreVehicles:m=!0,fieldOrder:v="MMY",enableFeatureFlags:y=!1,yearOptional:b=!1,mobileButtonLabel:x="Select Vehicle"}){const S=w.useRef(null),$=w.useRef(null),C=w.useRef(null),L=w.useRef(null),O=w.useRef(null),z=w.useRef(null),H=w.useRef(null),U=w.useRef(null),X=w.useRef(null),W=w.useRef(!1),K=v==="YMM",[oe,T]=w.useState([]),[F,N]=w.useState([]),[ne,A]=w.useState([]),[ce,te]=w.useState([]),[ye,re]=w.useState([]),[Te,ve]=w.useState([]),[sn,St]=w.useState([]),[je,Si]=w.useState([]),ia=w.useRef([]),[Hn,Ei]=w.useState([]),[k,pt]=w.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[qT,Uh]=w.useState(!1),l1=w.useRef(["body","series","variant","engine","engine_capacity"]),Cu=w.useRef(s&&s.length&&l1.current?s.split(",").filter(R=>{var I;return(I=l1.current)==null?void 0:I.includes(R)}):null),[kn,VT]=w.useState(!1);w.useEffect(()=>{const R=navigator.userAgent;VT(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(R)),zh.__loaded||zh.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://app.posthog.com",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[zr,WT]=w.useState({}),[fP,GT]=w.useState(""),u1=w.useCallback(async()=>{if(!t)return;const I=`${y?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const Q=await fetch(I,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`,referrerPolicy:"no-referrer"},body:JSON.stringify((()=>{const ke={use_store_vehicles:m};return _&&(ke.store=_),ke})())});if(!Q.ok)throw new Error(`Error: ${Q.status} ${Q.statusText}`);const{merchant:q,vehicle_makes:ee,vehicle_models:Y,meilisearch_search_key:se,meilisearch_index_name:pe,algolia_search_key:Ye,algolia_index_name:ar,store_index_name:Ss,store_popular_makes:Hr,store_popular_models:we}=await Q.json();$.current=q,C.current=(ee||[]).map(ke=>({...ke,refinement:ke.value})),m&&Y?typeof Y=="object"&&!Array.isArray(Y)?L.current=Y:Array.isArray(Y)?L.current=Y.map(ke=>ke&&ke.value?String(ke.value).trim():"").filter(Boolean):L.current=[]:L.current=[],O.current=Array.isArray(Hr)?Hr.map(ke=>String(ke).trim().toUpperCase()):null,z.current=we||null,WT({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(Q){console.error("[VehicleSearch] Auth failed:",Q),GT(Q)}},[t,_,m,y]);w.useEffect(()=>{u1()},[u1]),w.useEffect(()=>{if(zr.searchKey){try{H.current=new _y({host:"https://search.partbot.io",apiKey:zr.searchKey}),U.current=H.current.index(zr.indexName);const R=new _y({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:zr.searchKey});X.current=R.index("otto_v1_vehicle_mmy")}catch(R){console.error("[VehicleSearch] Failed to initialize Meilisearch:",R)}return()=>{H.current=null}}},[zr.searchKey,t]);const[on,KT]=w.useState(!1),c1=w.useCallback(()=>{function R(Y){if(!Y)return"rgba(0,0,0,1)";var se=I(),pe=window.getComputedStyle(Y).backgroundColor;return pe!==se?pe:Y.parentElement?R(Y.parentElement):"rgba(255,255,255,1)"}function I(){var Y=document.createElement("div");document.head.appendChild(Y);var se=window.getComputedStyle(Y).backgroundColor;return document.head.removeChild(Y),se}const Q=document.querySelector("vehicle-search");let q;Q?q=R(Q):q=R(S.current);const ee=Z(q).isDark();KT(ee)},[]);w.useEffect(()=>{async function R(){if(!k.make||!U.current)return;let I=[],Q=[];k.make&&I.push(`make:${k.make.refinement}`),k.model&&I.push(`model:${k.make.refinement} > ${k.model.refinement}`),k.year&&(Q=[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]),k.body&&I.push(`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`),k.series&&I.push(`series:${k.series.refinement}`),k.engine&&I.push(`engine:${k.engine.refinement}`),k.engine_capacity&&I.push(`engine_capacity:${k.engine_capacity.refinement}`);let ee=(await U.current.search("",{filter:$u(I,Q),attributesToRetrieve:["otto_id"],limit:500})).hits.map(pe=>pe.otto_id);Ei(ee);let se={...Object.fromEntries(Object.entries(k||{}).map(([pe,Ye])=>[pe,Ye&&Ye.value||null]).filter(([pe,Ye])=>Ye!==null)),merchant:$.current};zh.capture("vehicle select",se)}R()},[k,U,b]);const Bh=R=>o?`${o}${R}`:R,YT=R=>o?R.replace(new RegExp(`^${o}`),""):R,QT=w.useCallback(()=>{const R=new URL(window.location.href).searchParams,I=["make","model","year","body","series","engine","engine_capacity"].map(Bh),Q=Object.fromEntries([...R.entries()].filter(([q])=>I.includes(q)).map(([q,ee])=>[YT(q),{value:ee,refinement:ee}]));pt(Q)},[]),gt=w.useCallback(({query:R,value:I,remove:Q})=>{if(f&&"URLSearchParams"in window){let q=new URLSearchParams(window.location.search);R=Bh(R),R&&I&&q.set(R,I),R&&!I&&q.delete(R),Q&&Q.forEach(Y=>{Y=Bh(Y),q.delete(Y)});const ee=window.location.pathname+"?"+q.toString();window.history.pushState(null,"",ee)}},[]),XT=w.useCallback(()=>{var Q;const R={vehicle_ids:Hn,vehicle:(Q=k==null?void 0:k.make)!=null&&Q.value?k:{}};g&&g(R);const I=new CustomEvent("vehicle-search-submit",{detail:R});window.dispatchEvent(I),document.dispatchEvent(I),setTimeout(()=>{Uh(!1)},900)},[Hn,g]),d1=w.useCallback(()=>{var Q,q,ee,Y,se,pe,Ye,ar,Ss;const R={vehicle_ids:Hn,vehicle:(Q=k==null?void 0:k.make)!=null&&Q.value?k:{},userSelected:W.current};d&&d(R);const I=new CustomEvent("vehicle-search-change",{detail:R});if(W.current===!0){localStorage.removeItem("partbot_plate_details");const Hr=JSON.stringify({description:`${((q=k.make)==null?void 0:q.value)||""} ${((ee=k.model)==null?void 0:ee.value)||""} ${((Y=k.year)==null?void 0:Y.value)||""} ${((se=k.body)==null?void 0:se.value)||""} ${((pe=k.series)==null?void 0:pe.value)||""} ${((Ye=k.variant)==null?void 0:Ye.value)||""} ${((ar=k.engine)==null?void 0:ar.value)||""} ${((Ss=k.engine_capacity)==null?void 0:Ss.value)||""}`.trim(),vehicle_ids:Hn,vehicle:k?Object.entries(k).reduce((we,[ke,ze])=>(we[ke]=ze!=null&&ze.value?ze.value:{},we),{}):{}});localStorage.setItem("partbot_selected_vehicle",Hr),Gx.set("partbot_selected_vehicle",Hr,{secure:!0})}window.dispatchEvent(I),document.dispatchEvent(I),ia.current=Hn,setTimeout(()=>{Uh(!1)},900)},[Hn,d]),Ru=w.useMemo(()=>UC(d1,100),[d1]);w.useEffect(()=>{Ru()},[Hn,Ru]),w.useEffect(()=>()=>{Ru.cancel()},[Ru]),w.useEffect(()=>{const R=()=>{pt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),Ei([])};return window.addEventListener("plate-search-change",R),()=>{window.removeEventListener("plate-search-change",R)}},[]),w.useEffect(()=>{zr.searchKey&&(K||rP(),QT())},[zr.searchKey,K]),w.useEffect(()=>{K&&U.current&&ne.length===0&&!k.year&&U.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:R})=>{const I=R.map(se=>se.year_from).filter(Boolean),Q=R.map(se=>se.year_to).filter(Boolean),q=Math.min(...I),ee=Math.max(...Q),Y=Array.from({length:ee-q+1},(se,pe)=>({value:q+pe,refinement:q+pe})).reverse();A(Y)}).catch(R=>{console.error("[VehicleSearch] Error loading year range:",R)})},[K,zr.searchKey,ne.length,k.year]),w.useEffect(()=>{typeof document>"u"||c1()},[c1]);const f1=w.useCallback(R=>{W.current=!0,N([]),!K&&!b&&A([]),te([]),re([]),ve([]),Si([]),St([]),pt(I=>({make:R,year:K||b?I.year:null})),gt({query:"make",value:(R==null?void 0:R.value)??"",remove:K?["model","body","series","engine","variant","engine_capacity"]:b?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),R||Ei([])},[gt,K,b]),h1=w.useCallback(R=>{W.current=!0,pt(I=>({...I,model:R!==""?R:null,year:K||b?I.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!K&&!b&&A([]),te([]),re([]),ve([]),Si([]),St([]),gt({query:"model",value:(R==null?void 0:R.value)??"",remove:K?["body","series","engine","variant","engine_capacity"]:b?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[gt,K,b]),p1=w.useCallback(R=>{W.current=!0,K?(T([]),N([]),pt({year:R!==""?R:null}),(!R||R==="")&&A([])):pt(b?I=>({...I,year:R!==""?R:null}):I=>({...I,year:R!==""?R:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),b||(te([]),re([]),ve([]),Si([]),St([])),gt({query:"year",value:(R==null?void 0:R.value)??"",remove:K?["make","model","body","series","variant","engine","engine_capacity"]:b?[]:["body","series","variant","engine","engine_capacity"]}),!b&&(!R||R==="")&&Ei([])},[gt,K,b]),ZT=w.useCallback(R=>{W.current=!0,pt(I=>({...I,body:R!==""?R:null})),gt({query:"body",value:(R==null?void 0:R.value)??""})},[gt]),JT=w.useCallback(R=>{W.current=!0,pt(I=>({...I,series:R!==""?R:null})),gt({query:"series",value:(R==null?void 0:R.value)??""})},[gt]),eP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,variant:R!==""?R:null})),gt({query:"variant",value:(R==null?void 0:R.value)??""})},[gt]),tP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,engine:R!==""?R:null})),gt({query:"engine",value:(R==null?void 0:R.value)??""})},[gt]),nP=w.useCallback(R=>{W.current=!0,pt(I=>({...I,engine_capacity:R!==""?R:null})),gt({query:"engine_capacity",value:(R==null?void 0:R.value)??""})},[gt]);w.useEffect(()=>{K&&k.year&&U.current&&(async()=>{try{const I=await U.current.search("",{filter:`year_from <= ${k.year.value} AND year_to >= ${k.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),Q=new Map;I.hits.forEach(Y=>{Y.make&&!Q.has(Y.make)&&Q.set(Y.make,{value:Y.make.toUpperCase(),refinement:Y.make.toUpperCase(),popularity:Y.make_popularity||0})});let q=Array.from(Q.values());const ee=new Set(O.current||[]);ee.size>0?q.sort((Y,se)=>{const pe=ee.has(Y.value),Ye=ee.has(se.value);return pe&&!Ye?-1:!pe&&Ye?1:pe&&Ye?O.current.indexOf(Y.value)-O.current.indexOf(se.value):Y.value.localeCompare(se.value)}):q.sort((Y,se)=>se.popularity===Y.popularity?Y.value.localeCompare(se.value):se.popularity-Y.popularity),T(q)}catch(I){console.error("[VehicleSearch] Error loading makes for year:",I)}})()},[K,k.year]);const rP=w.useCallback(()=>{(async()=>{let I=[];if(C.current&&C.current.length)I=C.current;else if(U.current)try{const Q=await U.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),q=new Map;Q.hits.forEach(ee=>{ee.make&&!q.has(ee.make)&&q.set(ee.make,{value:ee.make.toUpperCase(),refinement:ee.make.toUpperCase(),popularity:ee.make_popularity||0})}),I=Array.from(q.values())}catch(Q){console.error("[VehicleSearch] Error loading makes:",Q)}if(e&&I.length){const Q=e.trim().split(",").map(q=>q.trim().toUpperCase());I=I.filter(q=>Q.includes(q.value))}if(O.current&&O.current.length>0){const Q=new Set(O.current);I.sort((q,ee)=>{const Y=Q.has(q.value),se=Q.has(ee.value);return Y&&!se?-1:!Y&&se?1:Y&&se?O.current.indexOf(q.value)-O.current.indexOf(ee.value):q.value.localeCompare(ee.value)})}else I.sort((Q,q)=>Q.popularity===q.popularity?Q.value.localeCompare(q.value):q.popularity-Q.popularity);T(I)})()},[e]);w.useEffect(()=>{var R;if(k.make&&k.make.refinement){const I=k.make.refinement;if(m&&typeof L.current=="object"&&!Array.isArray(L.current)&&L.current[I]){const Q=L.current[I].map(ee=>({value:ee,refinement:ee,popularity:0})),q=(R=z.current)==null?void 0:R[I];if(q&&Array.isArray(q)){const ee=new Map(q.map((Y,se)=>[Y.toUpperCase(),q.length-se]));Q.sort((Y,se)=>{const pe=ee.get(Y.value.toUpperCase())||0,Ye=ee.get(se.value.toUpperCase())||0;return pe!==Ye?Ye-pe:Y.value.localeCompare(se.value)})}else Q.sort((ee,Y)=>ee.value.localeCompare(Y.value));N(Q);return}if(!X.current||!t)return;X.current.search("",{filter:`make = "${k.make.refinement}"`,limit:1}).then(Q=>{var Ss,Hr;const{hits:q}=Q;let ee=[];q.length>0&&q[0].models&&(ee=q[0].models);let Y=ee.map(we=>({model:`${k.make.refinement} > ${we.name}`,model_popularity:we.popularity||0})),se=[];Array.isArray(L.current)?se=L.current:typeof L.current=="object"&&L.current!==null?se=L.current[k.make.refinement]||[]:typeof L.current=="string"&&L.current.length&&(se=L.current.split(",").map(we=>we.trim()).filter(Boolean));let pe=se;if(n){const we=n.trim().split(",").map(ze=>ze.trim()).filter(Boolean),ke=new Set(we.map(ze=>ze.toLowerCase()));pe=se.length?se.filter(ze=>ke.has(String(ze).toLowerCase())):we,Y=Y.filter(ze=>ke.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase()))}if(pe&&pe.length>0){const we=new Set(pe.map(ze=>String(ze).toLowerCase()));Y.some(ze=>we.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase()))&&(Y=Y.filter(ze=>we.has(ze.model.match(/[^>]*$/)[0].trim().toLowerCase())))}Y=Y.filter(we=>we.model&&we.model!==""?we.model.match(/[^>]*$/)[0].trim()!=="":!1).map(we=>({value:we.model.match(/[^>]*$/)[0].trim(),refinement:we.model.match(/[^>]*$/)[0].trim(),popularity:we.model_popularity}));const Ye=(Ss=k.make)==null?void 0:Ss.refinement,ar=(Hr=z.current)==null?void 0:Hr[Ye];if(ar&&Array.isArray(ar)&&ar.length>0){const we=new Set(ar.map(ke=>String(ke).trim().toUpperCase()));Y.sort((ke,ze)=>{const Vh=we.has(ke.value),Wh=we.has(ze.value);if(Vh&&!Wh)return-1;if(!Vh&&Wh)return 1;if(Vh&&Wh){const g1=ar.map(sP=>String(sP).trim().toUpperCase());return g1.indexOf(ke.value)-g1.indexOf(ze.value)}return ke.value.localeCompare(ze.value)})}else Y.sort((we,ke)=>we.popularity===ke.popularity?we.value.localeCompare(ke.value):ke.popularity-we.popularity);N(Y)}).catch(Q=>{console.error("[VehicleSearch] Error loading models:",Q),N([])})}else N([])},[k.make,n,t,K,k.year,m]),w.useEffect(()=>{if(U.current&&k.make&&k.model){let R=[`model:${k.make.refinement} > ${k.model.refinement}`];b&&(k.body&&R.push(`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`),k.series&&R.push(`series:${k.series.refinement}`),k.engine&&R.push(`engine:${k.engine.refinement}`),k.engine_capacity&&R.push(`engine_capacity:${k.engine_capacity.refinement}`)),U.current.search("",{filter:$u(R,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:I})=>{const Q=I.map(pe=>pe.year_from),q=Math.min(...Q),ee=I.map(pe=>pe.year_to),Y=Math.max(...ee);let se=Array.apply(null,{length:Y+1-q}).map(function(pe,Ye){return Ye+q});se=se.reverse().map(pe=>({value:pe,refinement:pe})),A(se)}).catch(I=>{console.error("[VehicleSearch] Error fetching years:",I)})}},[k.model,k.make,K,b,k.body,k.series,k.engine,k.engine_capacity]),w.useEffect(()=>{const R=b?k.make&&k.model:k.year&&k.make&&k.model;if(U.current&&R){const I=k.year?[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]:[];U.current.search("",{filter:$u([`model:${k.make.refinement} > ${k.model.refinement}`],I),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:Q})=>{Q=[...new Map(Q.map(q=>[q.body,q])).values()].map(q=>({value:q.body.match(/[^>]*$/)[0].trim(),refinement:q.body.match(/[^>]*$/)[0].trim()})).filter(q=>q.value),te(Q)})}},[k.year,k.make,k.model,b]);const sa=w.useCallback(({hits:R,attribute:I,stateCallback:Q})=>{let q=[...new Map(R.map(ee=>[ee[I],ee])).values()].map(ee=>({value:ee[I].match(/[^|]*$/)[0].trim(),refinement:ee[I].match(/[^|]*$/)[0].trim()})).filter(ee=>ee.refinement);Q(q)},[]),iP=w.useCallback(()=>{const R=Cu.current?Cu.current.length+3:3,I=p?R+1:R;return`vs:lg:grid-cols-${I>8?8:I}`},[p]);w.useEffect(()=>{const R=b?k.make&&k.model:k.make&&k.model&&k.year;if(U.current&&R){let I=[`make:${k.make.refinement}`,`model:${k.make.refinement} > ${k.model.refinement}`,k.body?`body:${k.make.refinement} > ${k.model.refinement} > ${k.body.refinement}`:"",k.series?`series:${k.series.refinement}`:"",k.variant?`variant:${k.variant.refinement}`:"",k.engine?`engine:${k.engine.refinement}`:"",k.engine_capacity?`engine_capacity:${k.engine_capacity.refinement}`:""].filter(q=>q);const Q=k.year?[`year_from <= ${k.year.value}`,`year_to >= ${k.year.value}`]:[];U.current.search("",{filter:$u(I,Q),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:q})=>{sa({hits:q,attribute:"series",stateCallback:re}),sa({hits:q,attribute:"variant",stateCallback:ve}),sa({hits:q,attribute:"engine",stateCallback:St}),sa({hits:q,attribute:"engine_capacity",stateCallback:Si})})}},[k.body,k.series,k.variant,k.engine,k.engine_capacity,sa,k.make,k.model,k.year,b]);const[Tu,qh]=w.useState(!1);return w.useEffect(()=>{if(c)return Tu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Tu,c]),M.jsxs(M.Fragment,{children:[c&&M.jsx("button",{onClick:()=>qh(!0),type:"button",className:Tr("vehicle-search-btn vs:md:hidden!",u?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:M.jsx("span",{children:x})}),c&&M.jsx("div",{onClick:()=>qh(!1),className:Tr("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Tu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),M.jsxs("div",{className:Tr("partbot-mmyvs-container",c&&Tu&&"active","w-full"),children:[c&&M.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[M.jsx("span",{children:"Select Vehicle"}),M.jsxs("button",{onClick:()=>qh(!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:[M.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),M.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:M.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"})})})]})]}),M.jsxs("div",{ref:S,className:Tr("vs:grid vs:gap-3",i==="row"?`${iP()} 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:[K?M.jsxs(M.Fragment,{children:[M.jsx(mn,{label:"Year",items:ne,refine:p1,selected:k.year,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:ne.length===0,shouldBeActive:!0}),M.jsx(mn,{label:"Make",items:oe,refine:f1,selected:k.make,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.year&&oe.length===0,shouldBeActive:!!k.year}),M.jsx(mn,{label:"Model",items:F,refine:h1,selected:k.model,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.make&&F.length===0,shouldBeActive:!!k.make})]}):M.jsxs(M.Fragment,{children:[M.jsx(mn,{label:"Make",items:oe,refine:f1,selected:k.make,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:oe.length===0,shouldBeActive:!0}),M.jsx(mn,{label:"Model",items:F,refine:h1,selected:k.model,showPopular:!0,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.make&&F.length===0,shouldBeActive:!!k.make}),M.jsx(mn,{label:"Year",items:ne,refine:p1,selected:k.year,bgDark:on,showLabel:l,isMobile:kn,sortOptions:!1,loading:k.model&&ne.length===0,shouldBeActive:!!k.model})]}),Cu.current&&Cu.current.map(R=>{let I=null;switch(R){case"body":I=M.jsx(mn,{label:"Body",items:ce,refine:ZT,selected:k.body,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&ce.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"body");break;case"series":I=M.jsx(mn,{label:"Series",items:ye,refine:JT,selected:k.series,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&ye.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"series");break;case"variant":I=M.jsx(mn,{label:"Variant",items:Te,refine:eP,selected:k.variant,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&Te.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"variant");break;case"engine_capacity":I=M.jsx(mn,{label:"Engine Capacity",items:je,refine:nP,selected:k.engine_capacity,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&je.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"engine_capacity");break;case"engine":I=M.jsx(mn,{label:"Engine",items:sn,refine:tP,selected:k.engine,bgDark:on,showLabel:l,isMobile:kn,loading:!!(k.make&&k.model&&k.year)&&sn.length===0,shouldBeActive:!!(k.make&&k.model&&k.year)},"engine");break}return I}),p&&M.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:M.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{Uh(!0),r&&!g?window.location.href=r+window.location.search:XT()},children:[M.jsx("span",{children:h}),qT&&M.jsx(Rf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),a&&M.jsx("div",{className:Tr("vs:flex vs:w-full vs:justify-center vs:items-center",i==="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:M.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:`${on?"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:[M.jsx("span",{children:"Powered by"}),M.jsx(Kx,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let a1=!1,ra=!1;function zT(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),ra=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(ra=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(ra=!1)})})}).observe(n,{childList:!0,subtree:!0}),a1)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"&&ra))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"&&ra))return u.set.call(this,d)}}),a1=!0}const HT="/css/vehicle-search.css";class UT extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const z=document.createElement("link");z.id="vehicle-search-inter-font",z.rel="stylesheet",z.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(z)}let e=document.createElement("style");e.textContent=Vx;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(z,H,U)=>{let X;if(this.hasAttribute(H)){const W=this.getAttribute(H);if(/^#[0-9A-F]{6}$/i.test(W)){const K=parseInt(W.slice(1,3),16),oe=parseInt(W.slice(3,5),16),T=parseInt(W.slice(5,7),16);X=`${K} ${oe} ${T}`}}return X=X||U,`:host { --${z}: ${X}; } .partbot-mmyvs-container { --${z}: ${X}; }`};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"),_=g==="none"?"none":g||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${_}; } .partbot-mmyvs-container { --partbot-input-shadow: ${_}; }`;const v=this.getAttribute("data-input-border-color");let y="229 231 235";if(v)if(/^#[0-9A-F]{6}$/i.test(v)){const z=parseInt(v.slice(1,3),16),H=parseInt(v.slice(3,5),16),U=parseInt(v.slice(5,7),16);y=`${z} ${H} ${U}`}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 S=`: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+=S,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,L={};for(let z=0;z<C.length;z++){const{name:H,value:U}=C[z];if(H.startsWith("data-")){const X=H.slice(5).replace(/-([a-z])/g,W=>W[1].toUpperCase());L[X]=U==="true"?!0:U==="false"?!1:U}}zT(this);const O=M.jsx(Hh,{...L});qx.render(O,n)}}customElements.define("vehicle-search",UT);const BT=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Et.VehicleSearch=Hh,Et.default=Hh,Et.vehicleSearchCssUrl=HT,Object.defineProperties(Et,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|