@deriv-com/analytics 1.39.4 → 1.39.6
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.
- package/dist/browser/analytics.bundle.global.js +13 -13
- package/dist/browser/analytics.bundle.global.js.map +1 -1
- package/dist/browser/analytics.esm.mjs +1 -1
- package/dist/browser/analytics.esm.mjs.map +1 -1
- package/dist/chunk-5PFWZVJN.mjs +3 -0
- package/dist/chunk-5PFWZVJN.mjs.map +1 -0
- package/dist/chunk-F3U33XPR.mjs +9 -0
- package/dist/{chunk-35PJECDZ.mjs.map → chunk-F3U33XPR.mjs.map} +1 -1
- package/dist/chunk-GTT7DF4Y.mjs +3 -0
- package/dist/chunk-GTT7DF4Y.mjs.map +1 -0
- package/dist/chunk-NCHU4435.js +3 -0
- package/dist/chunk-NCHU4435.js.map +1 -0
- package/dist/{chunk-T37YZXV4.mjs → chunk-OMGH3V7W.mjs} +2 -2
- package/dist/{chunk-XC5XM6FP.mjs → chunk-T4BXL6JM.js} +4 -4
- package/dist/chunk-T4BXL6JM.js.map +1 -0
- package/dist/chunk-TE3DYZVQ.mjs +4 -0
- package/dist/chunk-TE3DYZVQ.mjs.map +1 -0
- package/dist/chunk-YZ34YKBW.js +3 -0
- package/dist/chunk-YZ34YKBW.js.map +1 -0
- package/dist/{growthbook-TE4SOUS2.mjs → growthbook-FZV644NE.mjs} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/metafile-iife.json +1 -1
- package/dist/{posthog-CZnsy0at.d.ts → posthog-DUxm7AzZ.d.ts} +6 -0
- package/dist/{posthog-CRa194Jm.d.mts → posthog-DfHTd53-.d.mts} +6 -0
- package/dist/posthog-WH6LGSSW.mjs +6 -0
- package/dist/posthog-WH6LGSSW.mjs.map +1 -0
- package/dist/providers/growthbook/index.js +2 -2
- package/dist/providers/growthbook/index.mjs +2 -2
- package/dist/providers/posthog/index.d.mts +1 -1
- package/dist/providers/posthog/index.d.ts +1 -1
- package/dist/providers/posthog/index.js +2 -2
- package/dist/providers/posthog/index.js.map +1 -1
- package/dist/providers/posthog/index.mjs +2 -2
- package/dist/providers/posthog/index.mjs.map +1 -1
- package/dist/providers/rudderstack/index.js +1 -1
- package/dist/providers/rudderstack/index.mjs +1 -1
- package/dist/utils/analytics-cache/index.d.mts +4 -12
- package/dist/utils/analytics-cache/index.d.ts +4 -12
- package/dist/utils/analytics-cache/index.js +1 -1
- package/dist/utils/analytics-cache/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-35PJECDZ.mjs +0 -9
- package/dist/chunk-AGTZ7DYP.mjs +0 -3
- package/dist/chunk-AGTZ7DYP.mjs.map +0 -1
- package/dist/chunk-AKXW5KX7.js +0 -4
- package/dist/chunk-AKXW5KX7.js.map +0 -1
- package/dist/chunk-ASVWETRZ.mjs +0 -3
- package/dist/chunk-ASVWETRZ.mjs.map +0 -1
- package/dist/chunk-EZWNCHVR.js +0 -3
- package/dist/chunk-EZWNCHVR.js.map +0 -1
- package/dist/chunk-LFQLME3L.js +0 -3
- package/dist/chunk-LFQLME3L.js.map +0 -1
- package/dist/chunk-XC5XM6FP.mjs.map +0 -1
- package/dist/posthog-66UECPCZ.mjs +0 -6
- package/dist/posthog-66UECPCZ.mjs.map +0 -1
- /package/dist/{chunk-T37YZXV4.mjs.map → chunk-OMGH3V7W.mjs.map} +0 -0
- /package/dist/{growthbook-TE4SOUS2.mjs.map → growthbook-FZV644NE.mjs.map} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */
|
|
2
|
+
import{d as Xr,e as Kr,f as Jr,g as Zr,h as Qr}from"./chunk-F3U33XPR.mjs";var d=typeof window<"u"?window:void 0,V=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(V.self=V),typeof File>"u"&&(V.File=function(){});var Js=Array.prototype,es=Js.forEach,ts=Js.indexOf,ee=V?.navigator,m=V?.document,z=V?.location,Ni=V?.fetch,Di=V!=null&&V.XMLHttpRequest&&"withCredentials"in new V.XMLHttpRequest?V.XMLHttpRequest:void 0,is=V?.AbortController,J=ee?.userAgent,w=d??{},fe={DEBUG:!1,LIB_VERSION:"1.360.1"};function rs(i,e,t,r,s,n,o){try{var a=i[n](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(r,s)}function me(i){return function(){var e=this,t=arguments;return new Promise((function(r,s){var n=i.apply(e,t);function o(l){rs(n,r,s,o,a,"next",l)}function a(l){rs(n,r,s,o,a,"throw",l)}o(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},f.apply(null,arguments)}function Zs(i,e){if(i==null)return{};var t={};for(var r in i)if({}.hasOwnProperty.call(i,r)){if(e.indexOf(r)!==-1)continue;t[r]=i[r]}return t}var co=["$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"],uo=["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"],ss=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return uo.concat(e).some((r=>{var s=r.toLowerCase();return t.indexOf(s)!==-1}))};function k(i,e){return i.indexOf(e)!==-1}var pi=function(i){return i.trim()},Li=function(i){return i.replace(/^\$/,"")},ho=Array.isArray,Qs=Object.prototype,en=Qs.hasOwnProperty,vi=Qs.toString,C=ho||function(i){return vi.call(i)==="[object Array]"},we=i=>typeof i=="function",H=i=>i===Object(i)&&!C(i),Ke=i=>{if(H(i)){for(var e in i)if(en.call(i,e))return!1;return!0}return!1},y=i=>i===void 0,q=i=>vi.call(i)=="[object String]",Ui=i=>q(i)&&i.trim().length===0,ae=i=>i===null,$=i=>y(i)||ae(i),ve=i=>vi.call(i)=="[object Number]"&&i==i,Ye=i=>ve(i)&&i>0,xe=i=>vi.call(i)==="[object Boolean]",po=i=>i instanceof FormData,vo=i=>k(co,i);function tn(i){return i===null||typeof i!="object"}function Vt(i,e){return Object.prototype.toString.call(i)==="[object "+e+"]"}function Ar(i){return!y(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var _o=[!0,"true",1,"1","yes"],yi=i=>k(_o,i),go=[!1,"false",0,"0","no"];function pe(i,e,t,r,s){return e>t&&(r.warn("min cannot be greater than max."),e=t),ve(i)?i>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),pe(s||t,e,t,r))}var ji=class{constructor(e){this.t={},this.i=e.i,this.o=pe(e.bucketSize,0,100,e.h),this.m=pe(e.refillRate,0,this.o,e.h),this.S=pe(e.refillInterval,0,864e5,e.h)}$(e,t){var r=t-e.lastAccess,s=Math.floor(r/this.S);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.S}}consumeRateLimit(e){var t,r=Date.now(),s=String(e),n=this.t[s];return n?this.$(n,r):(n={tokens:this.o,lastAccess:r},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}},te="Mobile",Wt="iOS",Ee="Android",et="Tablet",rn=Ee+" "+et,sn="iPad",nn="Apple",on=nn+" Watch",$t="Safari",tt="BlackBerry",an="Samsung",ln=an+"Browser",cn=an+" Internet",je="Chrome",fo=je+" OS",un=je+" "+Wt,Mr="Internet Explorer",hn=Mr+" "+te,Nr="Opera",mo=Nr+" Mini",Dr="Edge",dn="Microsoft "+Dr,Ze="Firefox",pn=Ze+" "+Wt,Ct="Nintendo",Ot="PlayStation",Qe="Xbox",vn=Ee+" "+te,_n=te+" "+$t,ft="Windows",qi=ft+" Phone",ns="Nokia",Hi="Ouya",gn="Generic",yo=gn+" "+te.toLowerCase(),fn=gn+" "+et.toLowerCase(),Bi="Konqueror",G="(\\d+(\\.\\d+)?)",bi=new RegExp("Version/"+G),bo=new RegExp(Qe,"i"),wo=new RegExp(Ot+" \\w+","i"),Eo=new RegExp(Ct+" \\w+","i"),Lr=new RegExp(tt+"|PlayBook|BB10","i"),xo={"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"},Nt,os,wi,ko=(i,e)=>e&&k(e,nn)||(function(t){return k(t,$t)&&!k(t,je)&&!k(t,Ee)})(i),mn=function(i,e){return e=e||"",k(i," OPR/")&&k(i,"Mini")?mo:k(i," OPR/")?Nr:Lr.test(i)?tt:k(i,"IE"+te)||k(i,"WPDesktop")?hn:k(i,ln)?cn:k(i,Dr)||k(i,"Edg/")?dn:k(i,"FBIOS")?"Facebook "+te:k(i,"UCWEB")||k(i,"UCBrowser")?"UC Browser":k(i,"CriOS")?un:k(i,"CrMo")||k(i,je)?je:k(i,Ee)&&k(i,$t)?vn:k(i,"FxiOS")?pn:k(i.toLowerCase(),Bi.toLowerCase())?Bi:ko(i,e)?k(i,te)?_n:$t:k(i,Ze)?Ze:k(i,"MSIE")||k(i,"Trident/")?Mr:k(i,"Gecko")?Ze:""},So={[hn]:[new RegExp("rv:"+G)],[dn]:[new RegExp(Dr+"?\\/"+G)],[je]:[new RegExp("("+je+"|CrMo)\\/"+G)],[un]:[new RegExp("CriOS\\/"+G)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+G)],[$t]:[bi],[_n]:[bi],[Nr]:[new RegExp("(Opera|OPR)\\/"+G)],[Ze]:[new RegExp(Ze+"\\/"+G)],[pn]:[new RegExp("FxiOS\\/"+G)],[Bi]:[new RegExp("Konqueror[:/]?"+G,"i")],[tt]:[new RegExp(tt+" "+G),bi],[vn]:[new RegExp("android\\s"+G,"i")],[cn]:[new RegExp(ln+"\\/"+G)],[Mr]:[new RegExp("(rv:|MSIE )"+G)],Mozilla:[new RegExp("rv:"+G)]},Po=function(i,e){var t=mn(i,e),r=So[t];if(y(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=i.match(n);if(o)return parseFloat(o[o.length-2])}return null},as=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),i=>[Qe,i&&i[1]||""]],[new RegExp(Ct,"i"),[Ct,""]],[new RegExp(Ot,"i"),[Ot,""]],[Lr,[tt,""]],[new RegExp(ft,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[qi,""];if(new RegExp(te).test(e)&&!/IEMobile\b/.test(e))return[ft+" "+te,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],s=xo[r]||"";return/arm/i.test(e)&&(s="RT"),[ft,s]}return[ft,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[Wt,e.join(".")]}return[Wt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=y(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+Ee+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ee+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[Ee,e.join(".")]}return[Ee,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[fo,""]],[/Linux|debian/i,["Linux",""]]],ls=function(i){return Eo.test(i)?Ct:wo.test(i)?Ot:bo.test(i)?Qe:new RegExp(Hi,"i").test(i)?Hi:new RegExp("("+qi+"|WPDesktop)","i").test(i)?qi:/iPad/.test(i)?sn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?on:Lr.test(i)?tt:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(ns,"i").test(i)?ns:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(te).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?Ee:rn:new RegExp("(pda|"+te+")","i").test(i)?yo:new RegExp(et,"i").test(i)&&!new RegExp(et+" pc","i").test(i)?fn:""},To=i=>i instanceof Error;function $o(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return wi&&t.length===os||(os=t.length,wi=t.reduce(((r,s)=>{Nt||(Nt={});var n=Nt[s];if(n)r[n[0]]=n[1];else for(var o=i(s),a=o.length-1;a>=0;a--){var l=o[a],u=l?.filename,c=e[s];if(u&&c){r[u]=c,Nt[s]=[u,c];break}}return r}),{})),wi}}var zi=class{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var t=this;return me((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&C(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),f({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return me((function*(){var r=e;for(var s of t.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,f({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:$o(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var s=(n,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return f({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,r),next:n=>s(n,r+1)})}},it="?";function Vi(i,e,t,r,s){var n={platform:i,filename:e,function:t==="<anonymous>"?it:t,in_app:!0};return y(r)||(n.lineno=r),y(s)||(n.colno=s),n}var yn=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,r=i.indexOf("safari-web-extension")!==-1;return t||r?[i.indexOf("@")!==-1?i.split("@")[0]:it,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Co=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Oo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fo=/\((\S*)(?::(\d+))(?::(\d+))\)/,Io=(i,e)=>{var t=Co.exec(i);if(t){var[,r,s,n]=t;return Vi(e,r,it,+s,+n)}var o=Oo.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Fo.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=yn(o[1]||it,o[2]);return Vi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ro=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ao=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mo=(i,e)=>{var t=Ro.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=Ao.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var s=t[3],n=t[1]||it;return[n,s]=yn(n,s),Vi(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},cs=/\(error: (.*)\)/,us=50;function No(){return(function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return function(s,n){n===void 0&&(n=0);for(var o=[],a=s.split(`
|
|
3
|
+
`),l=n;l<a.length;l++){var u=a[l];if(!(u.length>1024)){var c=cs.test(u)?u.replace(cs,"$1"):u;if(!c.match(/\S*Error: /)){for(var h of t){var p=h(c,i);if(p){o.push(p);break}}if(o.length>=us)break}}}return(function(v){if(!v.length)return[];var g=Array.from(v);return g.reverse(),g.slice(0,us).map((_=>{return f({},_,{filename:_.filename||(x=g,x[x.length-1]||{}).filename,function:_.function||it});var x}))})(o)}})("web:javascript",Io,Mo)}var Wi=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=q(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Vt(e,"DOMException")}isDOMError(e){return Vt(e,"DOMError")}},Gi=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){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}},Yi=class{constructor(){}match(e){return Vt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var r,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Do=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Xi=class{match(e){return typeof e=="string"}coerce(e,t){var r,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,s=e.match(Do);return s&&(t=s[1],r=s[2]),[t,r]}},Lo=["fatal","error","warning","log","info","debug"];function bn(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var s=t.slice(0,r).join(", ");if(!(s.length>e))return r===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}var Ki=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ar(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}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: "+bn(e)}isSeverityLevel(e){return q(e)&&!Ui(e)&&Lo.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if(To(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Ji=class{match(e){return Ar(e)}coerce(e,t){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+bn(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Zi=class{match(e){return tn(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Qi=class{match(e){return Vt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ar(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var r,s=this.getUnhandledRejectionReason(e);return tn(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},wn=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(s){if(d&&(fe.DEBUG||w.POSTHOG_DEBUG||t)&&!y(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];n(i,...a)}},info:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning:s=>{r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>wn(i+" "+s,n)};return r},b=wn("[PostHog.js]"),L=b.createLogger,Uo=L("[ExternalScriptsLoader]"),hs=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Uo.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=m?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},o=0;o<r.length;o++)if(s=n())return s.v}var a=()=>{if(!m)return t("document not found");var l=m.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")m.head.appendChild(l);else{var u,c=m.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):m.body.appendChild(l)}};m!=null&&m.body?a():m?.addEventListener("DOMContentLoaded",a)};w.__PosthogExtensions__=w.__PosthogExtensions__||{},w.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{var r="/static/"+e+".js?v="+i.version;if(e==="remote-config"&&(r="/array/"+i.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=i.requestRouter.endpointFor("assets",r);hs(i,n,t)},w.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var r=i.requestRouter.endpointFor("api",e);hs(i,r,t)};var Gt={};function Ae(i,e,t){if(C(i)){if(es&&i.forEach===es)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var r=0,s=i.length;r<s;r++)if(r in i&&e.call(t,i[r],r)===Gt)return}}}function A(i,e,t){if(!$(i)){if(C(i))return Ae(i,e,t);if(po(i)){for(var r of i.entries())if(e.call(t,r[1],r[0])===Gt)return}else for(var s in i)if(en.call(i,s)&&e.call(t,i[s],s)===Gt)return}}var U=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Ae(t,(function(s){for(var n in s)s[n]!==void 0&&(i[n]=s[n])})),i},rt=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Ae(t,(function(s){Ae(s,(function(n){i.push(n)}))})),i};function Bt(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var ds=function(i){try{return i()}catch{return}},jo=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.apply(this,t)}catch(s){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(s)}}},Ur=function(i){var e={};return A(i,(function(t,r){(q(t)&&t.length>0||ve(t))&&(e[r]=t)})),e};function qo(i,e){return t=i,r=n=>q(n)&&!ae(e)?n.slice(0,e):n,s=new Set,(function n(o,a){return o!==Object(o)?r?r(o,a):o:s.has(o)?void 0:(s.add(o),C(o)?(l=[],Ae(o,(u=>{l.push(n(u))}))):(l={},A(o,((u,c)=>{s.has(u)||(l[c]=n(u,c))}))),l);var l})(t);var t,r,s}var Ho=["herokuapp.com","vercel.app","netlify.app"];function Bo(i){var e=i?.hostname;if(!q(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of Ho)if(t===r)return!1;return!0}function En(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}function j(i,e,t,r){var{capture:s=!1,passive:n=!0}=r??{};i?.addEventListener(e,t,{capture:s,passive:n})}function xn(i){return i.name==="ph_toolbar_internal"}var kn="$people_distinct_id",mt="__alias",yt="__timers",ps="$autocapture_disabled_server_side",er="$heatmaps_enabled_server_side",vs="$exception_capture_enabled_server_side",tr="$error_tracking_suppression_rules",_s="$error_tracking_capture_extension_exceptions",gs="$web_vitals_enabled_server_side",Sn="$dead_clicks_enabled_server_side",fs="$product_tours_enabled_server_side",ms="$web_vitals_allowed_metrics",Dt="$session_recording_remote_config",Yt="$sesid",Pn="$session_is_sampled",Je="$enabled_feature_flags",bt="$early_access_features",ir="$feature_flag_details",wt="$stored_person_properties",Ue="$stored_group_properties",rr="$surveys",Xt="$flag_call_reported",sr="$feature_flag_errors",Kt="$feature_flag_evaluated_at",he="$user_state",nr="$client_session_props",or="$capture_rate_limit",ar="$initial_campaign_params",lr="$initial_referrer_info",Jt="$initial_person_info",Zt="$epp",Tn="__POSTHOG_TOOLBAR__",at="$posthog_cookieless",zo=[kn,mt,"__cmpns",yt,"$session_recording_enabled_server_side",er,Yt,Je,tr,he,bt,ir,Ue,wt,rr,Xt,sr,Kt,nr,or,ar,lr,Zt,Jt];Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return ve(i)&&isFinite(i)&&Math.floor(i)===i});var ys="0123456789abcdef",cr=class i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||t<0||r<0||s<0||e>0xffffffffffff||t>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new i(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+ys.charAt(this.bytes[t]>>>4)+ys.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new i(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}},ur=class{constructor(){this.P=0,this.T=0,this.R=new hr}generate(){var e=this.generateOrAbort();if(y(e)){this.P=0;var t=this.generateOrAbort();if(y(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.I();else{if(!(e+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.I())}return cr.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.R.nextUint32())}I(){this.T=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}},bs,$n=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<i.length;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};d&&!y(d.crypto)&&crypto.getRandomValues&&($n=i=>crypto.getRandomValues(i));var hr=class{constructor(){this.C=new Uint32Array(8),this.O=1/0}nextUint32(){return this.O>=this.C.length&&($n(this.C),this.O=0),this.C[this.O++]}},Re=()=>Vo().toString(),Vo=()=>(bs||(bs=new ur)).generate(),lt="",Wo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Go(i,e){if(e){var t=(function(s,n){if(n===void 0&&(n=m),lt)return lt;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Re();!lt&&a--;){var u=o.slice(a).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",lt=u)}return lt})(i);if(!t){var r=(s=>{var n=s.match(Wo);return n?n[0]:""})(i);r!==t&&b.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var de={F:()=>!!m,M:function(i){b.error("cookieStore error: "+i)},A:function(i){if(m){try{for(var e=i+"=",t=m.cookie.split(";").filter((n=>n.length)),r=0;r<t.length;r++){for(var s=t[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},D:function(i){var e;try{e=JSON.parse(de.A(i))||{}}catch{}return e},j:function(i,e,t,r,s){if(m)try{var n="",o="",a=Go(m.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+u.length),m.cookie=u,u}catch{return}},L:function(i,e){if(m!=null&&m.cookie)try{de.j(i,"",-1,e)}catch{return}}},Ei=null,D={F:function(){if(!ae(Ei))return Ei;var i=!0;if(y(d))i=!1;else try{var e="__mplssupport__";D.j(e,"xyz"),D.A(e)!=='"xyz"'&&(i=!1),D.L(e)}catch{i=!1}return i||b.error("localStorage unsupported; falling back to cookie store"),Ei=i,i},M:function(i){b.error("localStorage error: "+i)},A:function(i){try{return d?.localStorage.getItem(i)}catch(e){D.M(e)}return null},D:function(i){try{return JSON.parse(D.A(i))||{}}catch{}return null},j:function(i,e){try{d?.localStorage.setItem(i,JSON.stringify(e))}catch(t){D.M(t)}},L:function(i){try{d?.localStorage.removeItem(i)}catch(e){D.M(e)}}},Yo=["$device_id","distinct_id",Yt,Pn,Zt,Jt,he],Lt={},Xo={F:function(){return!0},M:function(i){b.error("memoryStorage error: "+i)},A:function(i){return Lt[i]||null},D:function(i){return Lt[i]||null},j:function(i,e){Lt[i]=e},L:function(i){delete Lt[i]}},De=null,B={F:function(){if(!ae(De))return De;if(De=!0,y(d))De=!1;else try{var i="__support__";B.j(i,"xyz"),B.A(i)!=='"xyz"'&&(De=!1),B.L(i)}catch{De=!1}return De},M:function(i){b.error("sessionStorage error: ",i)},A:function(i){try{return d?.sessionStorage.getItem(i)}catch(e){B.M(e)}return null},D:function(i){try{return JSON.parse(B.A(i))||null}catch{}return null},j:function(i,e){try{d?.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){B.M(t)}},L:function(i){try{d?.sessionStorage.removeItem(i)}catch(e){B.M(e)}}},ye=(function(i){return i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED",i})({}),dr=class{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.U()?ye.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===ye.DENIED||this.consent===ye.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===ye.DENIED}optInOut(e){this.B.j(this.q,e?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.L(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get H(){var e=this.B.A(this.q);return yi(e)?ye.GRANTED:k(go,e)?ye.DENIED:ye.PENDING}get B(){if(!this.V){var e=this.N.opt_out_capturing_persistence_type;this.V=e==="localStorage"?D:de;var t=e==="localStorage"?de:D;t.A(this.q)&&(this.V.A(this.q)||this.optInOut(yi(t.A(this.q))),t.L(this.q,this.N.cross_subdomain_cookie))}return this.V}U(){return!!this.N.respect_dnt&&!!En([ee?.doNotTrack,ee?.msDoNotTrack,w.doNotTrack],(e=>yi(e)))}},Ut=L("[Dead Clicks]"),Ko=()=>!0,Jo=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Sn)),r=i.instance.config.capture_dead_clicks;return xe(r)?r:!!H(r)||t},Qt=class{get lazyLoadedDeadClicksAutocapture(){return this.W}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Sn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.G((()=>{this.Y()})):this.stop()}G(e){var t,r;(t=w.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(r=w.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Ut.error("failed to load script",s):e()}))}Y(){var e;if(m){if(!this.W&&(e=w.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=H(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.W=w.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.W.start(m),Ut.info("starting...")}}else Ut.error("`document` not found. Cannot start.")}stop(){this.W&&(this.W.stop(),this.W=void 0,Ut.info("stopping..."))}},xi=L("[SegmentIntegration]");function Zo(i,e){var t=i.config.segment;if(!t)return e();(function(r,s){var n=r.config.segment;if(!n)return s();var o=l=>{var u=()=>l.anonymousId()||Re();r.config.get_device_id=u,l.id()&&(r.register({distinct_id:l.id(),$device_id:u()}),r.persistence.set_property(he,"identified")),s()},a=n.user();"then"in a&&we(a.then)?a.then(o):o(a)})(i,(()=>{t.register((r=>{Promise&&Promise.resolve||xi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,o)=>{if(!o)return n;n.event.userId||n.event.anonymousId===r.get_distinct_id()||(xi.info("No userId set, resetting PostHog"),r.reset()),n.event.userId&&n.event.userId!==r.get_distinct_id()&&(xi.info("UserId set, identifying with PostHog"),r.identify(n.event.userId));var a=r.calculateEventProperties(o,n.event.properties);return n.event.properties=Object.assign({},a,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(i)).then((()=>{e()}))}))}var Cn="posthog-js";function On(i,e){var{organization:t,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,h,p;if(!(n==="*"||n.includes(a.level))||!i.__loaded)return a;a.tags||(a.tags={});var v=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=v,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var g,_=((l=a.exception)==null?void 0:l.values)||[],x=_.map((P=>f({},P,{stacktrace:P.stacktrace?f({},P.stacktrace,{type:"raw",frames:(P.stacktrace.frames||[]).map((F=>f({},F,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((u=_[0])==null?void 0:u.value)||a.message,$exception_type:(c=_[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:x,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=_[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=_[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&r&&(S.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&((g=i.exceptions)==null||g.sendExceptionEvent(S)),a}}var pr=class{constructor(e,t,r,s,n,o){this.name=Cn,this.setupOnce=function(a){a(On(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},ei=class{constructor(e){this.J=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.X()}X(){var e;this.Z=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.J)}destroy(){var e;(e=this.Z)==null||e.call(this),this.Z=void 0}doPageView(e,t){var r,s=this.tt(e,t);return this.K={pathname:(r=d?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.tt(e,(t=this.K)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.K)==null?void 0:e.pageViewId}}tt(e,t){var r=this.K;if(!r)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:h}=n;if(!(y(o)||y(a)||y(l)||y(u)||y(c)||y(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var p=o<=1?1:pe(a/o,0,1,b),v=o<=1?1:pe(l/o,0,1,b),g=u<=1?1:pe(c/u,0,1,b),_=u<=1?1:pe(h/u,0,1,b);s=U(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}},ti=i=>{var e=m?.createElement("a");return y(e)?null:(e.href=i,e)},Qo=function(i,e){var t,r;e===void 0&&(e="&");var s=[];return A(i,(function(n,o){y(n)||y(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(n)?n.name:n.toString()),r=encodeURIComponent(o),s[s.length]=r+"="+t)})),s.join(e)},ii=function(i,e){for(var t,r=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===e){t=n;break}}if(!C(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ft=function(i,e,t){if(!i||!e||!e.length)return i;for(var r=i.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],h=0;h<u.length;h++){var p=u[h].split("=");C(p)&&(e.includes(p[0])?c.push(p[0]+"="+t):c.push(u[h]))}var v=l;return a!=null&&(v+="?"+c.join("&")),n!=null&&(v+="#"+n),v},ri=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},jt="https?://(.*)",st=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ea=rt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],st),It="<masked>",ta=["li_fat_id"];function Fn(i,e,t){if(!m)return{};var r,s=e?rt([],st,t||[]):[],n=In(Ft(m.URL,s,It),i),o=(r={},A(ta,(function(a){var l=de.A(a);r[a]=l||null})),r);return U(o,n)}function In(i,e){var t=ea.concat(e||[]),r={};return A(t,(function(s){var n=ii(i,s);r[s]=n||null})),r}function Rn(i){var e=(function(n){return n?n.search(jt+"google.([^/?]*)")===0?"google":n.search(jt+"bing.com")===0?"bing":n.search(jt+"yahoo.com")===0?"yahoo":n.search(jt+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",r={};if(!ae(e)){r.$search_engine=e;var s=m?ii(m.referrer,t):"";s.length&&(r.ph_keyword=s)}return r}function ws(){return navigator.language||navigator.userLanguage}function An(){return m?.referrer||"$direct"}function Mn(i,e){var t=i?rt([],st,e||[]):[],r=z?.href.substring(0,1e3);return{r:An().substring(0,1e3),u:r?Ft(r,t,It):void 0}}function Nn(i){var e,{r:t,u:r}=i,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=ti(t))==null?void 0:e.host};if(r){s.$current_url=r;var n=ti(r);s.$host=n?.host,s.$pathname=n?.pathname;var o=In(r);U(s,o)}if(t){var a=Rn(t);U(s,a)}return s}function Dn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ia(){try{return new Date().getTimezoneOffset()}catch{return}}function ra(i,e){var t,r,s,n;if(!J)return{};var o,a,l,u,c,h,p,v,g=i?rt([],st,e||[]):[],[_,x]=(function(S){for(var P=0;P<as.length;P++){var[F,E]=as[P],I=F.exec(S),O=I&&(we(E)?E(I,S):E);if(O)return O}return["",""]})(J);return U(Ur({$os:_,$os_version:x,$browser:mn(J,navigator.vendor),$device:ls(J),$device_type:(a=J,l={userAgentDataPlatform:(t=navigator)==null||(t=t.userAgentData)==null?void 0:t.platform,maxTouchPoints:(r=navigator)==null?void 0:r.maxTouchPoints,screenWidth:d==null||(s=d.screen)==null?void 0:s.width,screenHeight:d==null||(n=d.screen)==null?void 0:n.height,devicePixelRatio:d?.devicePixelRatio},v=ls(a),v===sn||v===rn||v==="Kobo"||v==="Kindle Fire"||v===fn?et:v===Ct||v===Qe||v===Ot||v===Hi?"Console":v===on?"Wearable":v?te:l?.userAgentDataPlatform==="Android"&&((u=l?.maxTouchPoints)!==null&&u!==void 0?u:0)>0?Math.min((c=l?.screenWidth)!==null&&c!==void 0?c:0,(h=l?.screenHeight)!==null&&h!==void 0?h:0)/((p=l?.devicePixelRatio)!==null&&p!==void 0?p:1)>=600?et:te:"Desktop"),$timezone:Dn(),$timezone_offset:ia()}),{$current_url:Ft(z?.href,g,It),$host:z?.host,$pathname:z?.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Po(J,navigator.vendor),$browser_language:ws(),$browser_language_prefix:(o=ws(),typeof o=="string"?o.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:fe.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var sa=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],St=class{constructor(e,t){this.N=e,this.props={},this.it=!1,this.et=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.B=this.rt(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.st}rt(e){sa.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...Yo,...s];return f({},D,{D:function(o){try{var a={};try{a=de.D(o)||{}}catch{}var l=U(a,JSON.parse(D.A(o)||"{}"));return D.j(o,l),l}catch{}return null},j:function(o,a,l,u,c,h){try{D.j(o,a,void 0,void 0,h);var p={};n.forEach((v=>{a[v]&&(p[v]=a[v])})),Object.keys(p).length&&de.j(o,p,l,u,c,h)}catch(v){D.M(v)}},L:function(o,a){try{d?.localStorage.removeItem(o),de.L(o,a)}catch(l){D.M(l)}}})})(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&D.F()?D:r==="localstorage+cookie"&&t.F()?t:r==="sessionstorage"&&B.F()?B:r==="memory"?Xo:r==="cookie"?de:t.F()?t:de}nt(e){var t=e??this.N.feature_flag_cache_ttl_ms;if(!t||t<=0)return!1;var r=this.props[Kt];return!r||typeof r!="number"||Date.now()-r>t}properties(){var e={};return A(this.props,((t,r)=>{if(r===Je&&H(t)){if(!this.nt())for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]]}else a=r,l=!1,(ae(o=zo)?l:ts&&o.indexOf===ts?o.indexOf(a)!=-1:(A(o,(function(u){if(l||(l=u===a))return Gt})),l))||(e[r]=t);var o,a,l})),e}load(){if(!this.st){var e=this.B.D(this.et);e&&(this.props=U({},e))}}save(){this.st||this.B.j(this.et,this.props,this.ot,this.ut,this.ht,this.N.debug)}remove(){this.B.L(this.et,!1),this.B.L(this.et,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(H(e)){y(t)&&(t="None"),this.ot=y(r)?this.dt:r;var s=!1;if(A(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(H(e)){this.ot=y(t)?this.dt:t;var r=!1;if(A(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,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.it){var e=Fn(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);Ke(Ur(e))||this.register(e),this.it=!0}}update_search_keyword(){var e;this.register((e=m?.referrer)?Rn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:An(),$referring_domain:m!=null&&m.referrer&&((e=ti(m.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ar]||this.props[lr]||this.register_once({[Jt]:Mn(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};A([lr,ar],(o=>{var a=this.props[o];a&&A(a,(function(l,u){e["$initial_"+Li(u)]=l}))}));var t,r,s=this.props[Jt];if(s){var n=(t=Nn(s),r={},A(t,(function(o,a){r["$initial_"+Li(a)]=o})),r);U(e,n)}return e}safe_merge(e){return A(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){if(this.dt=this.ot=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!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),u=[...a].sort();return l.every(((c,h)=>c===u[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.rt(e),n=this.props;this.clear(),this.B=s,this.props=n,this.save()}}set_disabled(e){this.st=e,this.st?this.remove():this.save()}set_cross_subdomain(e){e!==this.ut&&(this.ut=e,this.remove(),this.save())}set_secure(e){e!==this.ht&&(this.ht=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[yt]||{};r[e]=t,this.props[yt]=r,this.save()}remove_event_timer(e){var t=(this.props[yt]||{})[e];return y(t)||(delete this.props[yt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},ct={Activation:"events",Cancellation:"cancelEvents"};var ki={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Et={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Si={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},vr={Popover:"popover",Inline:"inline"};var na=(function(i){return i.SHOWN="product tour shown",i.DISMISSED="product tour dismissed",i.COMPLETED="product tour completed",i.STEP_SHOWN="product tour step shown",i.STEP_COMPLETED="product tour step completed",i.BUTTON_CLICKED="product tour button clicked",i.STEP_SELECTOR_FAILED="product tour step selector failed",i.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",i.BANNER_ACTION_CLICKED="product tour banner action clicked",i})({}),Es=(function(i){return i.TOUR_ID="$product_tour_id",i.TOUR_NAME="$product_tour_name",i.TOUR_ITERATION="$product_tour_iteration",i.TOUR_RENDER_REASON="$product_tour_render_reason",i.TOUR_STEP_ID="$product_tour_step_id",i.TOUR_STEP_ORDER="$product_tour_step_order",i.TOUR_STEP_TYPE="$product_tour_step_type",i.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",i.TOUR_BUTTON_TEXT="$product_tour_button_text",i.TOUR_BUTTON_ACTION="$product_tour_button_action",i.TOUR_BUTTON_LINK="$product_tour_button_link",i.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",i.TOUR_STEPS_COUNT="$product_tour_steps_count",i.TOUR_STEP_SELECTOR="$product_tour_step_selector",i.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",i.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",i.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",i.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",i.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",i.TOUR_ERROR="$product_tour_error",i.TOUR_MATCHES_COUNT="$product_tour_matches_count",i.TOUR_FAILURE_PHASE="$product_tour_failure_phase",i.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",i.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",i.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",i.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",i.USE_MANUAL_SELECTOR="$use_manual_selector",i.INFERENCE_DATA_PRESENT="$inference_data_present",i.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",i.TOUR_TYPE="$product_tour_type",i})({}),xs=L("[RateLimiter]"),_r=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{xs.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void xs.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(or))!==null&&t!==void 0?t:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var u=l.tokens<1;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(s=this.instance.persistence)==null||s.set_property(or,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},ut=L("[RemoteConfig]"),si=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=w._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}vt(e){var t,r;(t=w.__PosthogExtensions__)!=null&&t.loadExternalDependency?(r=w.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}ct(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return ut.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void ut.warn("Remote config is disabled. Falling back to local config.");this.vt((e=>{if(!e)return ut.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct((t=>{this.ft(t),this._t()}));this.ft(e),this._t()}))}catch(e){ut.error("Error loading remote config",e)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||m?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}_t(){var e;if(!this.yt){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.yt=setInterval((()=>{this.refresh()}),t))}}ft(e){var t;e||ut.error("Failed to fetch remote config from PostHog."),this._instance.ft(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}};var be=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),ne=Uint8Array,Y=Uint16Array,nt=Uint32Array,jr=new ne([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]),qr=new ne([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]),ks=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ln=function(i,e){for(var t=new Y(31),r=0;r<31;++r)t[r]=e+=1<<i[r-1];var s=new nt(t[30]);for(r=1;r<30;++r)for(var n=t[r];n<t[r+1];++n)s[n]=n-t[r]<<5|r;return[t,s]},Un=Ln(jr,2),oa=Un[0],gr=Un[1];oa[28]=258,gr[258]=28;for(fr=Ln(qr,0)[1],ni=new Y(32768),M=0;M<32768;++M)Ce=(43690&M)>>>1|(21845&M)<<1,Ce=(61680&(Ce=(52428&Ce)>>>2|(13107&Ce)<<2))>>>4|(3855&Ce)<<4,ni[M]=((65280&Ce)>>>8|(255&Ce)<<8)>>>1;var Ce,fr,ni,M,Pt=function(i,e,t){for(var r=i.length,s=0,n=new Y(e);s<r;++s)++n[i[s]-1];var o,a=new Y(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;if(t){o=new Y(1<<e);var l=15-e;for(s=0;s<r;++s)if(i[s])for(var u=s<<4|i[s],c=e-i[s],h=a[i[s]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)o[ni[h]>>>l]=u}else for(o=new Y(r),s=0;s<r;++s)o[s]=ni[a[i[s]-1]++]>>>15-i[s];return o},qe=new ne(288);for(M=0;M<144;++M)qe[M]=8;for(M=144;M<256;++M)qe[M]=9;for(M=256;M<280;++M)qe[M]=7;for(M=280;M<288;++M)qe[M]=8;var oi=new ne(32);for(M=0;M<32;++M)oi[M]=5;var aa=Pt(qe,9,0),la=Pt(oi,5,0),jn=function(i){return(i/8>>0)+(7&i&&1)},qn=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var r=new(i instanceof Y?Y:i instanceof nt?nt:ne)(t-e);return r.set(i.subarray(e,t)),r},ge=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8},ht=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8,i[r+2]|=t>>>16},Pi=function(i,e){for(var t=[],r=0;r<i.length;++r)i[r]&&t.push({s:r,f:i[r]});var s=t.length,n=t.slice();if(!s)return[new ne(0),0];if(s==1){var o=new ne(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(I,O){return I.f-O.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=t[t[u].f<t[h].f?u++:h++],l=t[u!=c&&t[u].f<t[h].f?u++:h++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(r=1;r<s;++r)n[r].s>p&&(p=n[r].s);var v=new Y(p+1),g=mr(t[c-1],v,0);if(g>e){r=0;var _=0,x=g-e,S=1<<x;for(n.sort((function(I,O){return v[O.s]-v[I.s]||I.f-O.f}));r<s;++r){var P=n[r].s;if(!(v[P]>e))break;_+=S-(1<<g-v[P]),v[P]=e}for(_>>>=x;_>0;){var F=n[r].s;v[F]<e?_-=1<<e-v[F]++-1:++r}for(;r>=0&&_;--r){var E=n[r].s;v[E]==e&&(--v[E],++_)}g=e}return[new ne(v),g]},mr=function(i,e,t){return i.s==-1?Math.max(mr(i.l,e,t+1),mr(i.r,e,t+1)):e[i.s]=t},Ss=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Y(++e),r=0,s=i[0],n=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(i[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=i[a]}return[t.subarray(0,r),e]},dt=function(i,e){for(var t=0,r=0;r<e.length;++r)t+=i[r]*e[r];return t},yr=function(i,e,t){var r=t.length,s=jn(e+2);i[s]=255&r,i[s+1]=r>>>8,i[s+2]=255^i[s],i[s+3]=255^i[s+1];for(var n=0;n<r;++n)i[s+n+4]=t[n];return 8*(s+4+r)},Ps=function(i,e,t,r,s,n,o,a,l,u,c){ge(e,c++,t),++s[256];for(var h=Pi(s,15),p=h[0],v=h[1],g=Pi(n,15),_=g[0],x=g[1],S=Ss(p),P=S[0],F=S[1],E=Ss(_),I=E[0],O=E[1],N=new Y(19),T=0;T<P.length;++T)N[31&P[T]]++;for(T=0;T<I.length;++T)N[31&I[T]]++;for(var Z=Pi(N,7),X=Z[0],oe=Z[1],ie=19;ie>4&&!X[ks[ie-1]];--ie);var _e,le,ce,Be,Se=u+5<<3,Ne=dt(s,qe)+dt(n,oi)+o,ue=dt(s,p)+dt(n,_)+o+14+3*ie+dt(N,X)+(2*N[16]+3*N[17]+7*N[18]);if(Se<=Ne&&Se<=ue)return yr(e,c,i.subarray(l,l+u));if(ge(e,c,1+(ue<Ne)),c+=2,ue<Ne){_e=Pt(p,v,0),le=p,ce=Pt(_,x,0),Be=_;var Pe=Pt(X,oe,0);for(ge(e,c,F-257),ge(e,c+5,O-1),ge(e,c+10,ie-4),c+=14,T=0;T<ie;++T)ge(e,c+3*T,X[ks[T]]);c+=3*ie;for(var ze=[P,I],W=0;W<2;++W){var re=ze[W];for(T=0;T<re.length;++T){var Q=31&re[T];ge(e,c,Pe[Q]),c+=X[Q],Q>15&&(ge(e,c,re[T]>>>5&127),c+=re[T]>>>12)}}}else _e=aa,le=qe,ce=la,Be=oi;for(T=0;T<a;++T)if(r[T]>255){Q=r[T]>>>18&31,ht(e,c,_e[Q+257]),c+=le[Q+257],Q>7&&(ge(e,c,r[T]>>>23&31),c+=jr[Q]);var Ve=31&r[T];ht(e,c,ce[Ve]),c+=Be[Ve],Ve>3&&(ht(e,c,r[T]>>>5&8191),c+=qr[Ve])}else ht(e,c,_e[r[T]]),c+=le[r[T]];return ht(e,c,_e[256]),c+le[256]},ca=new nt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ua=(function(){for(var i=new nt(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),ha=function(i,e,t,r,s){return(function(n,o,a,l,u,c){var h=n.length,p=new ne(l+h+5*(1+Math.floor(h/7e3))+u),v=p.subarray(l,p.length-u),g=0;if(!o||h<8)for(var _=0;_<=h;_+=65535){var x=_+65535;x<h?g=yr(v,g,n.subarray(_,x)):(v[_]=c,g=yr(v,g,n.subarray(_,h)))}else{for(var S=ca[o-1],P=S>>>13,F=8191&S,E=(1<<a)-1,I=new Y(32768),O=new Y(E+1),N=Math.ceil(a/3),T=2*N,Z=function(mi){return(n[mi]^n[mi+1]<<N^n[mi+2]<<T)&E},X=new nt(25e3),oe=new Y(288),ie=new Y(32),_e=0,le=0,ce=(_=0,0),Be=0,Se=0;_<h;++_){var Ne=Z(_),ue=32767&_,Pe=O[Ne];if(I[ue]=Pe,O[Ne]=ue,Be<=_){var ze=h-_;if((_e>7e3||ce>24576)&&ze>423){g=Ps(n,v,0,X,oe,ie,le,ce,Se,_-Se,g),ce=_e=le=0,Se=_;for(var W=0;W<286;++W)oe[W]=0;for(W=0;W<30;++W)ie[W]=0}var re=2,Q=0,Ve=F,Te=ue-Pe&32767;if(ze>2&&Ne==Z(_-Te))for(var no=Math.min(P,ze)-1,oo=Math.min(32767,_),ao=Math.min(258,ze);Te<=oo&&--Ve&&ue!=Pe;){if(n[_+re]==n[_+re-Te]){for(var $e=0;$e<ao&&n[_+$e]==n[_+$e-Te];++$e);if($e>re){if(re=$e,Q=Te,$e>no)break;var lo=Math.min(Te,$e-2),Vr=0;for(W=0;W<lo;++W){var fi=_-Te+W+32768&32767,Wr=fi-I[fi]+32768&32767;Wr>Vr&&(Vr=Wr,Pe=fi)}}}Te+=(ue=Pe)-(Pe=I[ue])+32768&32767}if(Q){X[ce++]=268435456|gr[re]<<18|fr[Q];var Gr=31&gr[re],Yr=31&fr[Q];le+=jr[Gr]+qr[Yr],++oe[257+Gr],++ie[Yr],Be=_+re,++_e}else X[ce++]=n[_],++oe[n[_]]}}g=Ps(n,v,c,X,oe,ie,le,ce,Se,_-Se,g)}return qn(p,0,l+jn(g)+u)})(i,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+e.mem,t,r,!0)},Ti=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function da(i,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var u=a,c=0;c<l.length;++c)u=ua[255&u^l[c]]^u>>>8;a=u},d:function(){return 4294967295^a}}})(),r=i.length;t.p(i);var s,n=ha(i,e,10+((s=e).filename&&s.filename.length+1||0),8),o=n.length;return(function(a,l){var u=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&Ti(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){a[3]=8;for(var c=0;c<=u.length;++c)a[c+10]=u.charCodeAt(c)}})(n,e),Ti(n,o-8,t.d()),Ti(n,o-4,r),n}var pa=function(i){var e,t,r,s,n="";for(e=t=0,r=(i=(i+"").replace(/\r\n/g,`
|
|
4
|
+
`).replace(/\r/g,`
|
|
5
|
+
`)).length,s=0;s<r;s++){var o=i.charCodeAt(s),a=null;o<128?t++: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),ae(a)||(t>e&&(n+=i.substring(e,t)),n+=a,e=t=s+1)}return t>e&&(n+=i.substring(e,i.length)),n},va=!!Di||!!Ni,ai=function(i,e,t){var r;t===void 0&&(t=!0);var[s,n]=i.split("?"),o=f({},e),a=(r=n?.split("&").map((u=>{var c,[h,p]=u.split("="),v=t&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],h+"="+v})))!==null&&r!==void 0?r:[],l=Qo(o);return l&&a.push(l),s+"?"+a.join("&")},xt=(i,e)=>JSON.stringify(i,((t,r)=>typeof r=="bigint"?r.toString():r),e),$i=i=>{var{data:e,compression:t}=i;if(e){if(t===be.GZipJS){var r=da((function(a,l){var u=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new ne(a.length+(a.length>>>1)),h=0,p=function(x){c[h++]=x},v=0;v<u;++v){if(h+5>c.length){var g=new ne(h+8+(u-v<<1));g.set(c),c=g}var _=a.charCodeAt(v);_<128||l?p(_):_<2048?(p(192|_>>>6),p(128|63&_)):_>55295&&_<57344?(p(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++v))>>>18),p(128|_>>>12&63),p(128|_>>>6&63),p(128|63&_)):(p(224|_>>>12),p(128|_>>>6&63),p(128|63&_))}return qn(c,0,h)})(xt(e)),{mtime:0});return{contentType:"text/plain",body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(t===be.Base64){var s=(function(a){var l,u,c,h,p,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,x="",S=[];if(!a)return a;a=pa(a);do l=(p=a.charCodeAt(g++)<<16|a.charCodeAt(g++)<<8|a.charCodeAt(g++))>>18&63,u=p>>12&63,c=p>>6&63,h=63&p,S[_++]=v.charAt(l)+v.charAt(u)+v.charAt(c)+v.charAt(h);while(g<a.length);switch(x=S.join(""),a.length%3){case 1:x=x.slice(0,-2)+"==";break;case 2:x=x.slice(0,-1)+"="}return x})(xt(e)),n=(a=>"data="+encodeURIComponent(typeof a=="string"?a:xt(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=xt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},zt=[];Ni&&zt.push({transport:"fetch",method:i=>{var e,t,{contentType:r,body:s,estimatedSize:n}=(e=$i(i))!==null&&e!==void 0?e:{},o=new Headers;A(i.headers,(function(c,h){o.append(h,c)})),r&&o.append("Content-Type",r);var a=i.url,l=null;if(is){var u=new is;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),i.timeout)}}Ni(a,f({method:i?.method||"GET",headers:o,keepalive:i.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then((c=>c.text().then((h=>{var p={statusCode:c.status,text:h};if(c.status===200)try{p.json=JSON.parse(h)}catch(v){b.error(v)}i.callback==null||i.callback(p)})))).catch((c=>{b.error(c),i.callback==null||i.callback({statusCode:0,error:c})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Di&&zt.push({transport:"XHR",method:i=>{var e,t=new Di;t.open(i.method||"GET",i.url,!0);var{contentType:r,body:s}=(e=$i(i))!==null&&e!==void 0?e:{};A(i.headers,(function(n,o){t.setRequestHeader(o,n)})),r&&t.setRequestHeader("Content-Type",r),i.timeout&&(t.timeout=i.timeout),i.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(n)}},t.send(s)}}),ee!=null&&ee.sendBeacon&&zt.push({transport:"sendBeacon",method:i=>{var e=ai(i.url,{beacon:"1"});try{var t,{contentType:r,body:s}=(t=$i(i))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:r}):s;ee.sendBeacon(e,n)}catch{}}});var br=3e3,wr=class{constructor(e,t){this.wt=!0,this.Et=[],this.xt=pe(t?.flush_interval_ms||br,250,5e3,b.createLogger("flush interval"),br),this.St=e}enqueue(e){this.Et.push(e),this.$t||this.kt()}unload(){this.Pt();var e=this.Et.length>0?this.Tt():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.St(f({},r,{transport:"sendBeacon"}))}))}enable(){this.wt=!1,this.kt()}kt(){var e=this;this.wt||(this.$t=setTimeout((()=>{if(this.Pt(),this.Et.length>0){var t=this.Tt(),r=function(){var n=t[s],o=new Date().getTime();n.data&&C(n.data)&&A(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.St(n)};for(var s in t)r()}}),this.xt))}Pt(){clearTimeout(this.$t),this.$t=void 0}Tt(){var e={};return A(this.Et,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;y(e[n])&&(e[n]=f({},s,{data:[]})),(r=e[n].data)==null||r.push(s.data)})),this.Et=[],e}},_a=["retriesPerformedSoFar"],Er=class{constructor(e){this.Rt=!1,this.It=3e3,this.Et=[],this._instance=e,this.Et=[],this.Ct=!0,!y(d)&&"onLine"in d.navigator&&(this.Ct=d.navigator.onLine,this.Ot=()=>{this.Ct=!0,this.Ft()},this.Mt=()=>{this.Ct=!1},j(d,"online",this.Ot),j(d,"offline",this.Mt))}get length(){return this.Et.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=Zs(e,_a);Ye(t)&&(r.url=ai(r.url,{retry_count:t})),this._instance._send_request(f({},r,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.At(f({retriesPerformedSoFar:t},r)):r.callback==null||r.callback(s)}}))}At(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+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)})(t),s=Date.now()+r;this.Et.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.Rt||(this.Rt=!0,this.Dt())}Dt(){if(this.jt&&clearTimeout(this.jt),this.Et.length===0)return this.Rt=!1,void(this.jt=void 0);this.jt=setTimeout((()=>{this.Ct&&this.Et.length>0&&this.Ft(),this.Dt()}),this.It)}Ft(){var e=Date.now(),t=[],r=this.Et.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Et=t,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.jt&&(clearTimeout(this.jt),this.jt=void 0),this.Rt=!1,y(d)||(this.Ot&&(d.removeEventListener("online",this.Ot),this.Ot=void 0),this.Mt&&(d.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.Et))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.Et=[]}},xr=class{constructor(e){this.Lt=()=>{var t,r,s,n;this.Nt||(this.Nt={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Nt.lastScrollY=Math.ceil(a),this.Nt.maxScrollY=Math.max(a,(t=this.Nt.maxScrollY)!==null&&t!==void 0?t:0),this.Nt.maxScrollHeight=Math.max(l,(r=this.Nt.maxScrollHeight)!==null&&r!==void 0?r:0),this.Nt.lastContentY=u,this.Nt.maxContentY=Math.max(u,(s=this.Nt.maxContentY)!==null&&s!==void 0?s:0),this.Nt.maxContentHeight=Math.max(c,(n=this.Nt.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Nt}resetContext(){var e=this.Nt;return setTimeout(this.Lt,0),e}startMeasuringScrollPosition(){j(d,"scroll",this.Lt,{capture:!0}),j(d,"scrollend",this.Lt,{capture:!0}),j(d,"resize",this.Lt)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=C(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var r=d?.document.querySelector(t);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}},ga=i=>Mn(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties),li=class{constructor(e,t,r,s){this.Ut=n=>{var o=this.zt();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Ht(this._instance)};this.Bt.register({[nr]:a})}},this._instance=e,this.qt=t,this.Bt=r,this.Ht=s||ga,this.qt.onSessionId(this.Ut)}zt(){return this.Bt.props[nr]}getSetOnceProps(){var e,t=(e=this.zt())==null?void 0:e.props;return t?"r"in t?Nn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return A(Ur(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Li(r)]=t})),e}},Rt=class{constructor(){this.Vt={},this.Vt={}}on(e,t){return this.Vt[e]||(this.Vt[e]=[]),this.Vt[e].push(t),()=>{this.Vt[e]=this.Vt[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Vt[e]||[])r(t);for(var s of this.Vt["*"]||[])s(e,t)}},Ci=L("[SessionId]"),ci=class{on(e,t){return this.Wt.on(e,t)}constructor(e,t,r){var s;if(this.Gt=[],this.Yt=void 0,this.Wt=new Rt,this.Jt=(c,h)=>!(!Ye(c)||!Ye(h))&&Math.abs(c-h)>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.N=e.config,this.Bt=e.persistence,this.Kt=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Qt=t||Re,this.Zt=r||Re;var n=this.N.persistence_name||this.N.token,o=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pe(o,60,36e3,Ci.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ti(),this.ii="ph_"+n+"_window_id",this.ei="ph_"+n+"_primary_window_exists",this.ri()){var a=B.D(this.ii),l=B.D(this.ei);a&&!l?this.Kt=a:B.L(this.ii),B.j(this.ei,!0)}if((s=this.N.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var h=c.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.N.bootstrap.sessionID);this.si(this.N.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Ci.error("Invalid sessionID in bootstrap",c)}this.ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return y(this.Gt)&&(this.Gt=[]),this.Gt.push(e),this.Xt&&e(this.Xt,this.Kt),()=>{this.Gt=this.Gt.filter((t=>t!==e))}}ri(){return this.N.persistence!=="memory"&&!this.Bt.st&&B.F()}oi(e){e!==this.Kt&&(this.Kt=e,this.ri()&&B.j(this.ii,e))}ai(){return this.Kt?this.Kt:this.ri()?B.D(this.ii):null}si(e,t,r){e===this.Xt&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.Xt=e,this.Bt.register({[Yt]:[t,e,r]}))}li(){var e=this.Bt.props[Yt];return C(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.si(null,null,null)}destroy(){clearTimeout(this.ui),this.ui=void 0,this.Yt&&d&&(d.removeEventListener("beforeunload",this.Yt,{capture:!1}),this.Yt=void 0),this.Gt=[]}ni(){this.Yt=()=>{this.ri()&&B.L(this.ei)},j(d,"beforeunload",this.Yt,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.N.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),[s,n,o]=this.li(),a=this.ai(),l=Ye(o)&&Math.abs(r-o)>864e5,u=!1,c=!n,h=!c&&!e&&this.Jt(r,s);c||h||l?(n=this.Qt(),a=this.Zt(),Ci.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.Zt(),u=!0);var p=Ye(s)&&e&&!l?s:r,v=Ye(o)?o:new Date().getTime();return this.oi(a),this.si(n,p,v),e||this.ti(),u&&this.Gt.forEach((g=>g(n,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:v,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ti(){clearTimeout(this.ui),this.ui=setTimeout((()=>{var[e]=this.li();if(this.Jt(new Date().getTime(),e)){var t=this.Xt;this.resetSessionId(),this.Wt.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Hn=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&ss(t,e))return!0;try{var r=i?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>ss(s?.brand,e))))return!0}catch{}return!!i.webdriver},ui=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Ts(i,e,t){return xt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Bn={exact:(i,e)=>e.some((t=>i.some((r=>t===r)))),is_not:(i,e)=>e.every((t=>i.every((r=>t!==r)))),regex:(i,e)=>e.some((t=>i.some((r=>ui(t,r))))),not_regex:(i,e)=>e.every((t=>i.every((r=>!ui(t,r))))),icontains:(i,e)=>e.map(qt).some((t=>i.map(qt).some((r=>t.includes(r))))),not_icontains:(i,e)=>e.map(qt).every((t=>i.map(qt).every((r=>!t.includes(r))))),gt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r>parseFloat(s)))})),lt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r<parseFloat(s)))}))},qt=i=>i.toLowerCase();function zn(i,e){return!i||Object.entries(i).every((t=>{var[r,s]=t,n=e?.[r];if(y(n)||ae(n))return!1;var o=[String(n)],a=Bn[s.operator];return!!a&&a(s.values,o)}))}var kt=(function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i})({}),$s="i.posthog.com",kr=class{constructor(e){this.hi={},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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+$s,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.hi[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=kt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hi[this.apiHost]=kt.EU:this.hi[this.apiHost]=kt.CUSTOM),this.hi[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===kt.CUSTOM)return this.apiHost+t;var r=$s+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},R=L("[Surveys]"),Vn="seenSurvey_",fa=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t},Cs=i=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(Vn,i),ma=[ki.Popover,ki.Widget,ki.API],ya={ignoreConditions:!1,ignoreDelay:!1,displayType:vr.Popover},ba=L("[PostHog ExternalIntegrations]"),wa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Sr=class{constructor(e){this._instance=e}G(e,t){var r;(r=w.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return ba.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,u;!s||(a=w.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.G(wa[o],(()=>{var c;(c=w.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)})),!s&&(l=w.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=w.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(r)}}},Tt={},Oi=0,Pr=()=>{},Xe="posthog",Wn=!va&&J?.indexOf("MSIE")===-1&&J?.indexOf("Mozilla")===-1,Os=i=>{var e;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Bo(m?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,debug:z&&q(z?.search)&&z.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var r="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(r)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:br},error_tracking:{},_onCapture:Pr,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},Fs=i=>{var e={};y(i.process_person)||(e.person_profiles=i.process_person),y(i.xhr_headers)||(e.request_headers=i.xhr_headers),y(i.cookie_name)||(e.persistence_name=i.cookie_name),y(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),y(i.store_google)||(e.save_campaign_params=i.store_google),y(i.verbose)||(e.debug=i.verbose);var t=U({},e,i);return C(i.property_blacklist)&&(y(i.property_denylist)?t.property_denylist=i.property_blacklist:C(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:b.error("Invalid value for property_denylist config: "+i.property_denylist)),t},Tr=class{constructor(){this.__forceAllowLocalhost=!1}get di(){return this.__forceAllowLocalhost}set di(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ot=class i{vi(e,t){if(e){var r=this.ci.indexOf(e);r!==-1&&this.ci.splice(r,1)}return this.ci.push(t),t.initialize==null||t.initialize(),t}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Tr,this.fi=!1,this.version=fe.LIB_VERSION,this.pi=new Rt,this.ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Os(),this.SentryIntegration=pr,this.sentryIntegration=r=>(function(s,n){var o=On(s,n);return{name:Cn,processEvent:a=>o(a)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.gi=!1,this.mi=null,this.bi=null,this.yi=null,this.scrollManager=new xr(this),this.pageViewManager=new ei(this),this.rateLimiter=new _r(this),this.requestRouter=new kr(this),this.consent=new dr(this),this.externalIntegrations=new Sr(this);var t=(e=i.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(r,s,n)=>{var o=q(r)?{[r]:s}:r;this.setPersonProperties(o),n?.({})},set_once:(r,s,n)=>{var o=q(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",(r=>b.info('send "'+r?.event+'"',r)))}init(e,t,r){if(r&&r!==Xe){var s,n=(s=Tt[r])!==null&&s!==void 0?s:new i;return n._init(e,t,r),Tt[r]=n,Tt[Xe][r]=n,n}return this._init(e,t,r)}_init(e,t,r){var s;if(t===void 0&&(t={}),y(e)||Ui(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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.wi(t.debug),this.Ei=t,this.xi=[],t.person_profiles?this.bi=t.person_profiles:t.process_person&&(this.bi=t.process_person),this.set_config(U({},Os(t.defaults),Fs(t),{name:r,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:be.GZipJS;var n=this.Si();this.persistence=new St(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new St(f({},this.config,{persistence:"sessionStorage"}),n);var o=f({},this.persistence.props),a=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.$i=new wr((g=>this.ki(g)),this.config.request_queue_config),this.Pi=new Er(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new ci(this),this.sessionPropsManager=new li(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ti(l)}),0)):(b.info("Initializing extensions synchronously"),this.Ti(l)),fe.DEBUG=fe.DEBUG||this.config.debug,fe.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:f({},this.config),p:o,s:a}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,c,h=this.config.get_device_id(Re()),p=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(he,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(l)this.register_once({distinct_id:at,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Re());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(he,"anonymous")}return j(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?Zo(this,(()=>this.Ri())):this.Ri(),we(this.config._onCapture)&&this.config._onCapture!==Pr&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(g=>this.config._onCapture(g.event,g)))),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}Ti(e){var t,r,s,n,o,a,l,u=performance.now(),c=f({},i.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.ci.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new c.featureFlags(this)),c.exceptions&&this.ci.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new c.exceptions(this)),c.historyAutocapture&&this.ci.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.ci.push(new c.tracingHeaders(this)),c.siteApps&&this.ci.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.ci.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this.ci.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.ci.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new c.surveys(this)),c.logs&&this.ci.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new c.logs(this)),c.conversations&&this.ci.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.ci.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.ci.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.ci.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.ci.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.ci.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Jo)),c.toolbar&&this.ci.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.ci.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new c.experiments(this)),this.ci.forEach((p=>{p.initialize&&h.push((()=>{p.initialize==null||p.initialize()}))})),h.push((()=>{if(this.Ii){var p=this.Ii;this.Ii=void 0,this.ft(p)}})),this.Ci(h,u)}Ci(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Ci(e,t)}),0);var r=e.shift();if(r)try{r()}catch(n){b.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}ft(e){var t;if(!m||!m.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ft(e)}),500);this.config.__preview_deferred_init_extensions&&(this.Ii=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,be.GZipJS)?be.GZipJS:k(e.supportedCompression,be.Base64)?be.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.bi?this.bi:"identified_only"}),this.ci.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e)))}Ri(){try{this.config.loaded(this)}catch(r){b.critical("`loaded` function failed",r)}if(this.Oi(),this.config.internal_or_test_user_hostname&&z!=null&&z.hostname){var e=z.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Fi()}),1),this.Mi=new si(this),this.Mi.load()}Oi(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.$i)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ae(this.__request_queue,(e=>this.ki(e))),this.__request_queue=[],this.Oi()}_handle_unload(){var e,t,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Ai()&&this.capture("$pageleave"),(t=this.$i)==null||t.unload(),(r=this.Pi)==null||r.unload()):this.Ai()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Wn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ai(e.url,{ip:this.config.ip?1:0}),e.headers=f({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,s,n,o=f({},t);o.timeout=o.timeout||6e4,o.url=ai(o.url,{_:new Date().getTime().toString(),ver:fe.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=zt.filter((c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport))),u=(s=(n=En(l,(c=>c.transport===a)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(f({},e,{callback:t=>{var r,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((r=(s=this.config).on_request_error)==null||r.call(s,t)),e.callback==null||e.callback(t)}}))))}ki(e){this.Pi?this.Pi.retriableRequest(e):this._send_request(e)}_execute_array(e){Oi++;try{var t,r=[],s=[],n=[];Ae(e,(a=>{a&&(t=a[0],C(t)?n.push(a):we(a)?a.call(this):C(a)&&t==="alias"?r.push(a):C(a)&&t.indexOf("capture")!==-1&&we(this[t])?n.push(a):s.push(a))}));var o=function(a,l){Ae(a,(function(u){if(C(u[0])){var c=l;A(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),l)};o(r,this),o(s,this),o(n,this)}finally{Oi--}}push(e){if(Oi>0&&C(e)&&q(e[0])){var t=i.prototype[e[0]];we(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.$i){if(this.is_capturing())if(!y(e)&&q(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!q(t?.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||r!=null&&r.Di||b.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),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 a=new Date,l=r?.timestamp||a,u=Re(),c={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r?.$set&&(c.$set=r?.$set);var h,p=e!=="$groupidentify",v=this.ji(r?.$set_once,p);if(v&&(c.$set_once=v),(c=qo(c,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,y(r?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===Et.DISMISSED||e===Et.SENT){var g=t?.[Si.SURVEY_ID],_=t?.[Si.SURVEY_ITERATION];h={id:g,current_iteration:_},localStorage.getItem(Cs(h))||localStorage.setItem(Cs(h),"true"),c.$set=f({},c.$set,{[fa({id:g,current_iteration:_},e===Et.SENT?"responded":"dismissed")]:!0})}else e===Et.SHOWN&&(c.$set=f({},c.$set,{[Si.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===na.SHOWN){var x=t?.[Es.TOUR_TYPE];x&&(c.$set=f({},c.$set,{[Es.TOUR_LAST_SEEN_DATE+"/"+x]:new Date().toISOString()}))}var S=f({},c.properties.$set,c.$set);if(Ke(S)||this.setPersonPropertiesForFlags(S),!$(this.config.before_send)){var P=this.Li(c);if(!P)return;c=P}this.pi.emit("eventCaptured",c);var F={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.ki(F):this.$i.enqueue(F),c}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")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=f({},t);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=f({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!q(a.distinct_id)&&!ve(a.distinct_id)||Ui(a.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=ra(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=h,a.$window_id=p}this.sessionPropsManager&&U(a,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&U(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(v=this.Pi)==null?void 0:v.length}catch(S){a.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===kt.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=U(a,u),e==="$pageview"&&m&&(a.title=m.title),!y(o)){var g=r.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=U({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?A(this.config.property_denylist,(function(S){delete a[S]})):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(b.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,e));var x=this.Ni();return a.$process_person_profile=x,x&&!n&&this.Ui("_calculate_event_properties"),a}ji(e,t){var r;if(t===void 0&&(t=!0),!this.persistence||!this.Ni()||this.fi)return e;var s=this.persistence.get_initial_props(),n=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=U({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.fi=!0),Ke(o)?void 0:o}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var s;(s=this.persistence)==null||s.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}zi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var s;return t===void 0&&(t=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.pi.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:"Surveys module not available"}),()=>{})}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:"Surveys module not available"})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:"Surveys module not available"})}renderSurvey(e,t){var r;(r=this.surveys)==null||r.renderSurvey(e,t)}displaySurvey(e,t){var r;t===void 0&&(t=ya),(r=this.surveys)==null||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return(t=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:"Surveys module not available"}}canRenderSurveyAsync(e,t){var r,s;return t===void 0&&(t=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,t))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:"Surveys module not available"})}identify(e,t,r){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(ve(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!==at){if(this.Ui("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(mt)&&(this.unregister(mt),this.register({distinct_id:e}));var o,a=(this.persistence.get_property(he)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(he,"identified"),this.setPersonPropertiesForFlags(f({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this.yi=Ts(e,t,r),(o=this.featureFlags)==null||o.setAnonymousDistinctId(s)):(t||r)&&this.setPersonProperties(t,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Xt))}}else b.critical('The string "'+at+'" 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,t){if((e||t)&&this.Ui("posthog.setPersonProperties")){var r=Ts(this.get_distinct_id(),e,t);this.yi!==r?(this.setPersonPropertiesForFlags(f({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.yi=r):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:f({},s,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===t||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,t){var r;t===void 0&&(t=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var r;t===void 0&&(t=!0),this.Ui("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,r,s,n,o,a,l;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var u=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(n=this.Mi)==null||n.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.persistence)==null||a.set_property(he,"anonymous"),(l=this.sessionManager)==null||l.resetSessionId(),this.yi=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:at,$device_id:null},"");else{var c=this.config.get_device_id(Re());this.register_once({distinct_id:c,$device_id:e?c:u},"")}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,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&r){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,t){return e===this.get_property(kn)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ui("posthog.alias")?(y(t)&&(t=this.get_distinct_id()),e!==t?(this.zi(mt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=f({},this.config);if(H(e)){var r,s,n,o,a,l,u,c,h;U(this.config,Fs(e));var p=this.Si();(r=this.persistence)==null||r.update_config(this.config,t,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new St(f({},this.config,{persistence:"sessionStorage"}),p);var v=this.wi(this.config.debug);xe(v)&&(this.config.debug=v),xe(this.config.debug)&&(this.config.debug?(fe.DEBUG=!0,D.F()&&D.j("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:f({},this.config)})):(fe.DEBUG=!1,D.F()&&D.L("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(c=this.surveys)==null||c.loadIfEnabled(),this.Hi(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,r={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var s,n,o,a,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),r.sampling&&((n=this.sessionRecording)==null||n.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,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(f({},s,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return(t=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Xe;return t!==Xe&&(t=Xe+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(he))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(he))==="identified"}Ni(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ke(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[mt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Zt]))}Ai(){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.Ni()||this.Ui("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ui("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ui(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.zi(Zt,!0),!0)}Si(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Hi(){var e,t,r,s,n=this.Si();return((e=this.persistence)==null?void 0:e.st)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.st)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){if(this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()){var r,s,n,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new ci(this),this.pageViewManager=new ei(this),this.persistence&&(this.sessionPropsManager=new li(this,this.sessionManager,this.persistence));var l=(n=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&n!==void 0?n:(a=i.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.vi(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.Hi(),this.Oi(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((u=this.surveys)==null||u.loadIfEnabled()),(y(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Fi()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Hi(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:at,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Fi())):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===ye.GRANTED?"granted":e===ye.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.Hi()}_is_bot(){return ee?Hn(ee,this.config.custom_blocked_useragents):void 0}Fi(){m&&(m.visibilityState==="visible"?this.gi||(this.gi=!0,this.capture("$pageview",{title:m.title},{send_instantly:!0}),this.mi&&(m.removeEventListener("visibilitychange",this.mi),this.mi=null)):this.mi||(this.mi=this.Fi.bind(this),j(m,"visibilitychange",this.mi)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}bt(){var e,t,r,s,n,o,a,l=this.Ei||{};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",s=!1,n=b,o=(t="advanced_disable_flags")in(e=l)&&!$(e[t]),a=r in e&&!$(e[r]),o?e[t]:a?(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]):s)}Li(e){if($(this.config.before_send))return e;var t=C(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of t){if(r=s(r),$(r)){var n="Event '"+e.event+"' was rejected in beforeSend function";return vo(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}r.properties&&!Ke(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.K)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}wi(e){var t=xe(e)&&!e,r=D.F()&&D.A("ph_debug")==="true";return!t&&(!!r||e)}};ot.__defaultExtensionClasses={},(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=jo(i.prototype[e[t]])})(ot,["identify"]);function Is(i){return i instanceof Element&&(i.id===Tn||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function _i(i){return!!i&&i.nodeType===1}function Me(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Gn(i){return!!i&&i.nodeType===3}function Yn(i){return!!i&&i.nodeType===11}function Hr(i){return i?pi(i).split(/\s+/):[]}function Rs(i){var e=d?.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function hi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return Hr(e)}function Xn(i){return $(i)?null:pi(i).split(/(\s+)/).filter((e=>At(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Mt(i){var e="";return $r(i)&&!Qn(i)&&i.childNodes&&i.childNodes.length&&A(i.childNodes,(function(t){var r;Gn(t)&&t.textContent&&(e+=(r=Xn(t.textContent))!==null&&r!==void 0?r:"")})),pi(e)}function As(i){return y(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var Br=["a","button","form","input","select","textarea","label"];function Kn(i,e){if(y(e))return!0;var t,r=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var s of i)if(t=r(s))return t.v;return!1}function Jn(i){var e=i.parentNode;return!(!e||!_i(e))&&e}var Ea=["next","previous","prev",">","<"],Ms=10,Ns=[".ph-no-rageclick",".ph-no-capture"];function xa(i,e){if(!d||zr(i))return!1;var t,r,s;if(xe(e)?(t=!!e&&Ns,r=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Ns,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=Zn(i,!1);return!(function(o,a){if(o===!1||y(o))return!1;var l;if(o===!0)l=Ea;else{if(!C(o))return!1;if(o.length>Ms)return b.error("[PostHog] content_ignorelist array cannot exceed "+Ms+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((u=>u.toLowerCase()))}return a.some((u=>{var{safeText:c,ariaLabel:h}=u;return l.some((p=>c.includes(p)||h.includes(p)))}))})(r,n.map((o=>{var a;return{safeText:Mt(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!Kn(n,t)}var zr=i=>!i||Me(i,"html")||!_i(i),Zn=(i,e)=>{if(!d||zr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[i],s=i;s.parentNode&&!Me(s,"body");)if(Yn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Jn(s);if(!n)break;if(e||Br.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=d.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}r.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:r}};function ka(i,e,t,r,s){var n,o,a,l;if(t===void 0&&(t=void 0),!d||zr(i)||(n=t)!=null&&n.url_allowlist&&!Rs(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&Rs(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some((g=>e.type===g)))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Zn(i,r);if(!(function(g,_){var x=_?.element_allowlist;if(y(x))return!0;var S,P=function(E){if(x.some((I=>E.tagName.toLowerCase()===I)))return{v:!0}};for(var F of g)if(S=P(F))return S.v;return!1})(h,t)||!Kn(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(i);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var v=i.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Br.indexOf(v)>-1||i.getAttribute("contenteditable")==="true")}}function $r(i){for(var e=i;e.parentNode&&!Me(e,"body");e=e.parentNode){var t=hi(e);if(k(t,"ph-sensitive")||k(t,"ph-no-capture"))return!1}if(k(hi(i),"ph-include"))return!0;var r=i.type||"";if(q(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=i.name||i.id||"";return!(q(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Qn(i){return!!(Me(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||Me(i,"select")||Me(i,"textarea")||i.getAttribute("contenteditable")==="true")}var eo="(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})",Sa=new RegExp("^(?:"+eo+")$"),Pa=new RegExp(eo),to="\\d{3}-?\\d{2}-?\\d{4}",Ta=new RegExp("^("+to+")$"),$a=new RegExp("("+to+")");function At(i,e){return e===void 0&&(e=!0),!($(i)||q(i)&&(i=pi(i),(e?Sa:Pa).test((i||"").replace(/[- ]/g,""))||(e?Ta:$a).test(i)))}function io(i){var e=Mt(i);return At(e=(e+" "+ro(i)).trim())?e:""}function ro(i){var e="";return i&&i.childNodes&&i.childNodes.length&&A(i.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Mt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+ro(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function Ca(i){return(function(e){var t=e.map((r=>{var s,n,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=f({},r.text?{text:r.text}:{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=r.nth_of_type)!==null&&n!==void 0?n:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return Bt(l).sort(((c,h)=>{var[p]=c,[v]=h;return p.localeCompare(v)})).forEach((c=>{var[h,p]=c;return u[Ds(h.toString())]=Ds(p.toString())})),o+=":",o+=Bt(u).map((c=>{var[h,p]=c;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var r,s,n={text:(r=t.$el_text)==null?void 0:r.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:Oa(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Bt(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return n.attributes[a]=l})),n}))})(i))}function Ds(i){return i.replace(/"|\\"/g,'\\"')}function Oa(i){var e=i.attr__class;return e?C(e)?e:Hr(e):void 0}var di=class{constructor(e){this.disabled=e===!1;var t=H(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&r-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},Fi="$copy_autocapture",Ls=L("[AutoCapture]");function Ii(i,e){return e.length>i?e.slice(0,i)+"...":e}function Fa(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!_i(e));return e}function Ia(i,e,t,r){var s=i.tagName.toLowerCase(),n={tag_name:s};Br.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Ii(1024,io(i)):n.$el_text=Ii(1024,Mt(i)));var o=hi(i);o.length>0&&(n.classes=o.filter((function(c){return c!==""}))),A(i.attributes,(function(c){var h;if((!Qn(i)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(r==null||!r.includes(c.name))&&!e&&At(c.value)&&(h=c.name,!q(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=c.value;c.name==="class"&&(p=Hr(p).join(" ")),n["attr__"+c.name]=Ii(1024,p)}}));for(var a=1,l=1,u=i;u=Fa(u);)a++,u.tagName===i.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Ra(i,e){for(var t,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[i],c=i;c.parentNode&&!Me(c,"body");)Yn(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,p=[],v={},g=!1,_=!1;if(A(u,(E=>{var I=$r(E);E.tagName.toLowerCase()==="a"&&(g=E.getAttribute("href"),g=I&&g&&At(g)&&g),k(hi(E),"ph-no-capture")&&(_=!0),p.push(Ia(E,n,o,a));var O=(function(N){if(!$r(N))return{};var T={};return A(N.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var X=Z.name.replace("data-ph-capture-attribute-",""),oe=Z.value;X&&oe&&At(oe)&&(T[X]=oe)}})),T})(E);U(v,O)})),_)return{props:{},explicitNoCapture:_};if(o||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?p[0].$el_text=io(i):p[0].$el_text=Mt(i)),g){var x,S;p[0].attr__href=g;var P=(x=ti(g))==null?void 0:x.host,F=d==null||(S=d.location)==null?void 0:S.host;P&&F&&P!==F&&(h=g)}return{props:U({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:Ca(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},v)}}var pt=L("[ExceptionAutocapture]");function Us(i,e,t){try{if(!(e in i))return()=>{};var r=i[e],s=t(r);return we(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=s,()=>{i[e]=r}}catch{return()=>{}}}var Aa=L("[TracingHeaders]"),Oe=L("[Web Vitals]"),js=9e5,qs="disabled",Hs="lazy_loading",vt="awaiting_config",Ht="missing_config";L("[SessionRecording]");var Cr="[SessionRecording]",Le=L(Cr),Ma=L("[Heatmaps]");function Bs(i){return H(i)&&"clientX"in i&&"clientY"in i&&ve(i.clientX)&&ve(i.clientY)}var zs=L("[Product Tours]"),Ri="ph_product_tours",Na=["$set_once","$set"],Fe=L("[SiteApps]");function We(i,e,t){if($(i))return!1;switch(t){case"exact":return i===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}var Or=class{constructor(e){this.Bi=new Rt,this.qi=(t,r)=>this.Vi(t,r)&&this.Wi(t,r)&&this.Gi(t,r)&&this.Yi(t,r),this.Vi=(t,r)=>r==null||!r.event||t?.event===r?.event,this._instance=e,this.Ji=new Set,this.Ki=new Set}init(){var e;if(!y((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((r,s)=>{this.on(r,s)}))}}register(e){var t,r;if(!y((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Ki)==null||a.add(o),(l=o.steps)==null||l.forEach((u=>{var c;(c=this.Ji)==null||c.add(u?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var r;t!=null&&e.length!=0&&(this.Ji.has(e)||this.Ji.has(t?.event))&&this.Ki&&((r=this.Ki)==null?void 0:r.size)>0&&this.Ki.forEach((s=>{this.Xi(t,s)&&this.Bi.emit("actionCaptured",s.name)}))}Qi(e){this.onAction("actionCaptured",(t=>e(t)))}Xi(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.qi(e,r))return!0;return!1}onAction(e,t){return this.Bi.on(e,t)}Wi(e,t){if(t!=null&&t.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!We(s,t.url,t.url_matching||"contains"))return!1}return!0}Gi(e,t){return!!this.Zi(e,t)&&!!this.te(e,t)&&!!this.ie(e,t)}Zi(e,t){var r;if(t==null||!t.href)return!0;var s=this.ee(e);if(s.length>0)return s.some((a=>We(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&We((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}te(e,t){var r;if(t==null||!t.text)return!0;var s=this.ee(e);if(s.length>0)return s.some((u=>We(u.text,t.text,t.text_matching||"exact")||We(u.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],p=/(?::|")text="(.*?)"/g;!$(c=p.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((u=>We(u,o,a))))}ie(e,t){var r,s;if(t==null||!t.selector)return!0;var n=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}ee(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Yi(e,t){return t==null||!t.properties||t.properties.length===0||zn(t.properties.reduce(((r,s)=>{var n=C(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r}),{}),e?.properties)}},Fr=class{constructor(e){this._instance=e,this.re=new Map,this.se=new Map,this.ne=new Map}oe(e,t){return!!e&&zn(e.propertyFilters,t?.properties)}ae(e,t){var r=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}}))})),r}le(e,t,r){var s=(r===ct.Activation?this.re:this.se).get(e),n=[];return this.ue((o=>{n=o.filter((a=>s?.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find((u=>u.name===e));return this.oe(l,t)}))}register(e){var t;y((t=this._instance)==null?void 0:t._addCaptureHook)||(this.he(e),this.de(e))}de(e){var t=e.filter((r=>{var s,n;return((s=r.conditions)==null?void 0:s.actions)&&((n=r.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ve==null&&(this.ve=new Or(this._instance),this.ve.init(),this.ve.Qi((r=>{this.onAction(r)}))),t.forEach((r=>{var s,n,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(n=r.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ve)==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.ne.get(u.name);c&&c.push(r.id),this.ne.set(u.name,c||[r.id])}})))})))}he(e){var t,r=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),s=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.cancelEvents)&&((a=n.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(r.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.re=this.ae(e,ct.Activation),this.se=this.ae(e,ct.Cancellation))}onEvent(e,t){var r,s=this.ce(),n=this.fe(),o=this.pe(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[n])||[];if(o===e&&t&&a.length>0){var l,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(u=t.properties)==null?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);h>=0&&(a.splice(h,1),this._e(a))}}else{if(this.se.has(e)){var p=this.le(e,t,ct.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map((g=>g.id))}),p.forEach((g=>{var _=a.indexOf(g.id);_>=0&&a.splice(_,1),this.ge(g.id)})),this._e(a))}if(this.re.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.re.get(e)});var v=this.le(e,t,ct.Activation);this._e(a.concat(v.map((g=>g.id))||[]))}}}onAction(e){var t,r=this.fe(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[];this.ne.has(e)&&this._e(s.concat(this.ne.get(e)||[]))}_e(e){var t,r=this.ce(),s=this.fe(),n=[...new Set(e)].filter((o=>!this.me(o)));r.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.fe(),r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return r||[]}getEventToItemsMap(){return this.re}be(){return this.ve}},Ir=class extends Fr{constructor(e){super(e)}fe(){return"$surveys_activated"}pe(){return Et.SHOWN}ue(e){var t;(t=this._instance)==null||t.getSurveys(e)}ge(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ce(){return R}me(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Da=d!=null&&d.location?ri(d.location.hash,"__posthog")||ri(location.hash,"state"):null,Vs="_postHogToolbarParams",Ws=L("[Toolbar]"),Ie=(function(i){return i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i})(Ie||{}),K=L("[FeatureFlags]"),_t=L("[FeatureFlags]",{debugEnabled:!0}),La="errors_while_computing_flags",Ua="flag_missing",ja="quota_limited",qa="timeout",Ha="connection_error",Ba="unknown_error",za=i=>"api_error_"+i,Ai="$active_feature_flags",Ge="$override_feature_flags",Gs="$feature_flag_payloads",gt="$override_feature_flag_payloads",Ys="$feature_flag_request_id",Xs=i=>{var e={};for(var[t,r]of Bt(i||{}))r&&(e[t]=r);return e},Va=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var r;return[t,(r=e[t].variant)!==null&&r!==void 0?r:e[t].enabled]}))),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var r;return(r=e[t].metadata)==null?void 0:r.payload})).map((t=>{var r;return[t,(r=e[t].metadata)==null?void 0:r.payload]})))):K.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},Wa=(function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i})({}),Mi=L("[Error tracking]"),Ga={icontains:(i,e)=>!!d&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!d&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!d&&ui(e.href,i),not_regex:(i,e)=>!!d&&!ui(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i},Rr=class i{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((s=>{i.ye("retrieved web experiments from the server"),t.we=new Map,s.forEach((n=>{if(n.feature_flag_key){var o;t.we&&(i.ye("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.we)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);q(a)&&n.variants[a]&&t.Ee(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];i.xe(u)&&t.Ee(n.name,l,u.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())i.ye("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if($(this.we))return this.we=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.ye("applying feature flags",e),e.forEach((t=>{var r;if(this.we&&(r=this.we)!=null&&r.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.we)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.Ee(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=i.getWindowLocation();if(e!=null&&e.search){var t=ii(e?.search,"__experiment_id"),r=ii(e?.search,"__experiment_variant");t&&r&&(i.ye("previewing web experiments "+t+" && "+r),this.getWebExperiments((s=>{this.Se(parseInt(t),r,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var o=n.json.experiments||[];return e(o)}})}Se(e,t,r){var s=r.filter((n=>n.id===e));s&&s.length>0&&(i.ye("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ee(s[0].name,t,s[0].variants[t].transforms))}static xe(e){return!$(e.conditions)&&i.$e(e)&&i.ke(e)}static $e(e){var t;if($(e.conditions)||$((t=e.conditions)==null?void 0:t.url))return!0;var r,s,n,o=i.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||Ga[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return d?.location}static ke(e){var t;if($(e.conditions)||$((t=e.conditions)==null?void 0:t.utm))return!0;var r=Fn();if(r.utm_source){var s,n,o,a,l,u,c,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,v=(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,g=(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,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return p&&g&&_&&v}return!1}static ye(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];b.info("[WebExperiments] "+e,r)}Ee(e,t,r){this._is_bot()?i.ye("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach((s=>{if(s.selector){var n;i.ye("applying transform of variant "+t+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o?.forEach((a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):i.ye("Control variants leave the page unmodified.")}_is_bot(){return ee&&this._instance?Hn(ee,this._instance.config.custom_blocked_useragents):void 0}},se=L("[Conversations]"),gi={featureFlags:class{constructor(i){this.Pe=!1,this.Te=!1,this.Re=!1,this.Ie=!1,this.Ce=!1,this.Oe=!1,this.Fe=!1,this.Me=!1,this._instance=i,this.featureFlagEventHandlers=[]}Ae(){var i,e;return(i=(e=this._instance.persistence)==null?void 0:e.nt(this._instance.config.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}De(){return!!this.Ae()&&(this.Me||this.Re||(this.Me=!0,K.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}je(){var i,e=(i=this._instance.config.evaluation_contexts)!==null&&i!==void 0?i:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Fe||(K.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Fe=!0),e!=null&&e.length?e.filter((t=>{var r=t&&typeof t=="string"&&t.trim().length>0;return r||K.error("Invalid evaluation context found:",t,"Expected non-empty string"),r})):[]}Le(){return this.je().length>0}initialize(){var i,e,{config:t}=this._instance,r=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(r).length){var s,n,o=(s=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},a=Object.keys(r).filter((u=>!!r[u])).reduce(((u,c)=>(u[c]=r[c]||!1,u)),{}),l=Object.keys(o).filter((u=>a[u])).reduce(((u,c)=>(o[c]&&(u[c]=o[c]),u)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(i,e,t){var r=t!=null&&t.merge?this.getFlagVariants():{},s=t!=null&&t.merge?this.getFlagPayloads():{},n=f({},r,i),o=f({},s,e),a={};for(var[l,u]of Object.entries(n)){var c=typeof u=="string";a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:y(o?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Te}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this._instance.get_property(ir),e=this._instance.get_property(Ge),t=this._instance.get_property(gt);if(!t&&!e)return i||{};var r=U({},i||{}),s=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=e?.[n],c=y(u)?(o=l?.enabled)!==null&&o!==void 0&&o:!!u,h=y(u)?l.variant:typeof u=="string"?u:void 0,p=t?.[n],v=f({},l,{enabled:c,variant:c?h??l?.variant:void 0});c!==l?.enabled&&(v.original_enabled=l?.enabled),h!==l?.variant&&(v.original_variant=l?.variant),p&&(v.metadata=f({},l?.metadata,{payload:p,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[n]=v}return this.Pe||(K.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:r}),this.Pe=!0),r}getFlagVariants(){var i=this._instance.get_property(Je),e=this._instance.get_property(Ge);if(!e)return i||{};for(var t=U({},i),r=Object.keys(e),s=0;s<r.length;s++)t[r[s]]=e[r[s]];return this.Pe||(K.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Pe=!0),t}getFlagPayloads(){var i=this._instance.get_property(Gs),e=this._instance.get_property(gt);if(!e)return i||{};for(var t=U({},i||{}),r=Object.keys(e),s=0;s<r.length;s++)t[r[s]]=e[r[s]];return this.Pe||(K.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Pe=!0),t}reloadFeatureFlags(){this.Ie||this._instance.config.advanced_disable_feature_flags||this.Ne||(this._instance.pi.emit("featureFlagsReloading",!0),this.Ne=setTimeout((()=>{this.Ue()}),5))}ze(){clearTimeout(this.Ne),this.Ne=void 0}ensureFlagsLoaded(){this.Te||this.Re||this.Ne||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Ie=i}Ue(i){var e;if(this.ze(),!this._instance.bt())if(this.Re)this.Ce=!0;else{var t=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},((e=this._instance.persistence)==null?void 0:e.get_initial_props())||{},this._instance.get_property(wt)||{}),group_properties:this._instance.get_property(Ue),timezone:Dn()};ae(r)||y(r)||(s.$device_id=r),(i!=null&&i.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Le()&&(s.evaluation_contexts=this.je());var n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+n);this.Re=!0,this._instance._send_request({method:"POST",url:o,data:s,compression:this._instance.config.disable_compression?void 0:be.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var l,u,c,h=!0;if(a.statusCode===200&&(this.Ce||(this.$anon_distinct_id=void 0),h=!1),this.Re=!1,!s.disable_flags||this.Ce){this.Oe=!h;var p=[];a.error?a.error instanceof Error?p.push(a.error.name==="AbortError"?qa:Ha):p.push(Ba):a.statusCode!==200&&p.push(za(a.statusCode)),(l=a.json)!=null&&l.errorsWhileComputingFlags&&p.push(La);var v=!((u=a.json)==null||(u=u.quotaLimited)==null||!u.includes(Wa.FeatureFlags));if(v&&p.push(ja),(c=this._instance.persistence)==null||c.register({[sr]:p}),v)K.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 g;s.disable_flags||this.receivedFeatureFlags((g=a.json)!==null&&g!==void 0?g:{},h),this.Ce&&(this.Ce=!1,this.Ue())}}}})}}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Oe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var r=this.getFeatureFlagResult(i,e);return(t=r?.variant)!==null&&t!==void 0?t:r?.enabled}}else K.warn('getFeatureFlag for key "'+i+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Oe)if(this.Te||this.getFlags()&&this.getFlags().length>0){if(!this.De()){var t=this.getFlagVariants(),r=i in t,s=t[i],n=this.getFlagPayloads()[i],o=String(s),a=this._instance.get_property(Ys)||void 0,l=this._instance.get_property(Kt)||void 0,u=this._instance.get_property(Xt)||{};if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(o))){var c,h,p,v,g,_,x,S,P,F;C(u[i])?u[i].push(o):u[i]=[o],(c=this._instance.persistence)==null||c.register({[Xt]:u});var E=this.getFeatureFlagDetails(i),I=[...(h=this._instance.get_property(sr))!==null&&h!==void 0?h:[]];y(s)&&I.push(Ua);var O={$feature_flag:i,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((p=this._instance.config.bootstrap)==null||(p=p.featureFlags)==null?void 0:p[i])||null,$feature_flag_bootstrapped_payload:((v=this._instance.config.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[i])||null,$used_bootstrap_value:!this.Oe};y(E==null||(g=E.metadata)==null?void 0:g.version)||(O.$feature_flag_version=E.metadata.version);var N,T=(_=E==null||(x=E.reason)==null?void 0:x.description)!==null&&_!==void 0?_:E==null||(S=E.reason)==null?void 0:S.code;T&&(O.$feature_flag_reason=T),E!=null&&(P=E.metadata)!=null&&P.id&&(O.$feature_flag_id=E.metadata.id),y(E?.original_variant)&&y(E?.original_enabled)||(O.$feature_flag_original_response=y(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(F=E.metadata)!=null&&F.original_payload&&(O.$feature_flag_original_payload=E==null||(N=E.metadata)==null?void 0:N.original_payload),I.length&&(O.$feature_flag_error=I.join(",")),this._instance.capture("$feature_flag_called",O)}if(r){var Z=n;if(!y(n))try{Z=JSON.parse(n)}catch{}return{key:i,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:Z}}}}else K.warn('getFeatureFlagResult for key "'+i+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(i,e){var t=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:t};this.Le()&&(r.evaluation_contexts=this.je()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this._instance.config.disable_compression?void 0:be.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var n,o=(n=s.json)==null?void 0:n.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.Oe){if(this.Te||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return y(t)?void 0:!!t}K.warn('isFeatureEnabled for key "'+i+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e){if(this._instance.persistence){this.Te=!0;var t=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(n,o,a,l,u){a===void 0&&(a={}),l===void 0&&(l={}),u===void 0&&(u={});var c=Va(n),h=c.flags,p=c.featureFlags,v=c.featureFlagPayloads;if(p){var g=n.requestId,_=n.evaluatedAt;if(C(p)){K.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(p)for(var S=0;S<p.length;S++)x[p[S]]=!0;o&&o.register({[Ai]:p,[Je]:x})}else{var P=p,F=v,E=h;if(n.errorsWhileComputingFlags)if(h){var I=new Set(Object.keys(h).filter((O=>{var N;return!((N=h[O])!=null&&N.failed)})));P=f({},a,Object.fromEntries(Object.entries(P).filter((O=>{var[N]=O;return I.has(N)})))),F=f({},l,Object.fromEntries(Object.entries(F||{}).filter((O=>{var[N]=O;return I.has(N)})))),E=f({},u,Object.fromEntries(Object.entries(E||{}).filter((O=>{var[N]=O;return I.has(N)}))))}else P=f({},a,P),F=f({},l,F),E=f({},u,E);o&&o.register(f({[Ai]:Object.keys(Xs(P)),[Je]:P||{},[Gs]:F||{},[ir]:E||{}},g?{[Ys]:g}:{},_?{[Kt]:_}:{}))}}})(i,this._instance.persistence,t,r,s),e||(this.Me=!1),this.He(e)}}override(i,e){e===void 0&&(e=!1),K.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this._instance.persistence)return K.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this._instance.persistence.unregister(Ge),this._instance.persistence.unregister(gt),this.He(),_t.info("All overrides cleared");if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var e,t=i;if(this.Pe=!!((e=t.suppressWarning)!==null&&e!==void 0&&e),"flags"in t){if(t.flags===!1)this._instance.persistence.unregister(Ge),_t.info("Flag overrides cleared");else if(t.flags){if(C(t.flags)){for(var r={},s=0;s<t.flags.length;s++)r[t.flags[s]]=!0;this._instance.persistence.register({[Ge]:r})}else this._instance.persistence.register({[Ge]:t.flags});_t.info("Flag overrides set",{flags:t.flags})}}return"payloads"in t&&(t.payloads===!1?(this._instance.persistence.unregister(gt),_t.info("Payload overrides cleared")):t.payloads&&(this._instance.persistence.register({[gt]:t.payloads}),_t.info("Payload overrides set",{payloads:t.payloads}))),void this.He()}this.He()}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.Te){var{flags:e,flagVariants:t}=this.Be();i(e,t)}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var r,s=(this._instance.get_property(bt)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},o={$feature_flag:i,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),t&&(o.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f({},this.getFlagVariants(),{[i]:e});(r=this._instance.persistence)==null||r.register({[Ai]:Object.keys(Xs(a)),[Je]:a}),this.He()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var r=this._instance.get_property(bt),s=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(r&&!e)return i(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:n=>{var o,a;if(n.json){var l=n.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(bt),(a=this._instance.persistence)==null||a.register({[bt]:l}),i(l)}}})}Be(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,r)=>(t[r]=e[r],t)),{})}}He(i){var{flags:e,flagVariants:t}=this.Be();this.featureFlagEventHandlers.forEach((r=>r(e,t,{errorsLoading:i})))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this._instance.get_property(wt)||{};this._instance.register({[wt]:f({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(wt)}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this._instance.get_property(Ue)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((r=>{t[r]=f({},t[r],i[r]),delete i[r]})),this._instance.register({[Ue]:f({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this._instance.get_property(Ue)||{};this._instance.register({[Ue]:f({},e,{[i]:{}})})}else this._instance.unregister(Ue)}reset(){this.Te=!1,this.Re=!1,this.Ie=!1,this.Ce=!1,this.Oe=!1,this.$anon_distinct_id=void 0,this.ze(),this.Pe=!1}}},Ya={sessionRecording:class{get started(){var i;return!((i=this.qe)==null||!i.isStarted)}get status(){var i,e;return this.Ve===vt||this.Ve===Ht?this.Ve:(i=(e=this.qe)==null?void 0:e.status)!==null&&i!==void 0?i:this.Ve}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ve=qs,this.We=void 0,this._instance=i,!this._instance.sessionManager)throw Le.error("started without valid sessionManager"),new Error(Cr+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Cr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ge(){var i,e=!((i=this._instance.get_property(Dt))==null||!i.enabled),t=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&e&&t&&!r}startIfEnabledOrStop(i){var e;if(!this.Ge||(e=this.qe)==null||!e.isStarted){var t=!y(Object.assign)&&!y(Array.from);this.Ge&&t?(this.Ye(i),Le.info("starting")):(this.Ve=qs,this.stopRecording())}}Ye(i){var e,t,r;this.Ge&&(this.Ve!==vt&&this.Ve!==Ht&&(this.Ve=Hs),w!=null&&(e=w.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=w.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Je(i):(r=w.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Ke,(s=>{if(s)return Le.error("could not load recorder",s);this.Je(i)})))}stopRecording(){var i,e;(i=this.We)==null||i.call(this),this.We=void 0,(e=this.qe)==null||e.stop()}Xe(){var i,e;(i=this.We)==null||i.call(this),this.We=void 0,(e=this.qe)==null||e.discard()}Qe(){var i;(i=this._instance.persistence)==null||i.unregister(Pn)}Ze(i,e){if($(i))return null;var t,r=ve(i)?i:parseFloat(i);return typeof(t=r)=="number"&&Number.isFinite(t)&&t>=0&&t<=1?r:(Le.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null)}tr(i){if(this._instance.persistence){var e,t,r=this._instance.persistence,s=()=>{var n,o=i.sessionRecording===!1?void 0:i.sessionRecording,a=this.Ze((n=this._instance.config.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ze(o?.sampleRate,"remote config sampleRate"),u=a??l;$(u)&&this.Qe();var c=o?.minimumDurationMilliseconds;r.register({[Dt]:f({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:f({capturePerformance:i.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:y(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};s(),(e=this.We)==null||e.call(this),this.We=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(s)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.tr(i),void this.Xe()):(this.tr(i),void this.startIfEnabledOrStop()):(this.Ve===vt&&(this.Ve=Ht,Le.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.qe)!=null&&t.log?this.qe.log(i,e):Le.warn("log called before recorder was ready")}get Ke(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(Dt);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}ir(){var i,e=this._instance.get_property(Dt);if(!e)return!1;var t=(i=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&i!==void 0?i:Date.now();return Date.now()-t<=36e5}Je(i){var e,t;if((e=w.__PosthogExtensions__)==null||!e.initSessionRecording)throw Error("Called on script loaded before session recording is available");if(this.qe||(this.qe=(t=w.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ir())return this.Ve===Ht||this.Ve===vt?void 0:(this.Ve=vt,Le.info("persisted remote config is stale, requesting fresh config before starting"),void new si(this._instance).load());this.Ve=Hs,this.qe.start(i)}onRRwebEmit(i){var e;(e=this.qe)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.qe||(e=this._instance.persistence)==null||e.register({$replay_override_linked_flag:!0}),(i=this.qe)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.qe||(e=this._instance.persistence)==null||e.register({$replay_override_sampling:!0}),(i=this.qe)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.qe||(t=this._instance.persistence)==null||t.register({[i==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.qe)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.qe)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.qe)==null||!t.tryAddCustomEvent(i,e))}}},Xa={autocapture:class{constructor(i){this.er=!1,this.rr=null,this.sr=!1,this.instance=i,this.rageclicks=new di(i.config.rageclick),this.nr=null}initialize(){this.startIfEnabled()}get N(){var i,e,t=H(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((r=>new RegExp(r))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),t}ar(){if(this.isBrowserSupported()){if(d&&m){var i=t=>{t=t||d?.event;try{this.lr(t)}catch(r){Ls.error("Failed to capture event",r)}};if(j(m,"submit",i,{capture:!0}),j(m,"change",i,{capture:!0}),j(m,"click",i,{capture:!0}),this.N.capture_copied_text){var e=t=>{t=t||d?.event,this.lr(t,Fi)};j(m,"copy",e,{capture:!0}),j(m,"cut",e,{capture:!0})}}}else Ls.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.er&&(this.ar(),this.er=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.sr=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ps]:!!i.autocapture_opt_out}),this.rr=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.nr=i}getElementSelectors(i){var e,t=[];return(e=this.nr)==null||e.forEach((r=>{var s=m?.querySelectorAll(r);s?.forEach((n=>{i===n&&t.push(r)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[ps],r=this.rr;if(ae(r)&&!xe(t)&&!this.instance.bt())return!1;var s=(e=this.rr)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}lr(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,r=As(i);Gn(r)&&(r=r.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&xa(r,this.instance.config.rageclick)&&this.lr(i,"$rageclick");var s=e===Fi;if(r&&ka(r,i,this.N,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Ra(r,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.sr});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===Fi){var l,u=Xn(d==null||(l=d.getSelection())==null?void 0:l.toString()),c=i.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return we(m?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ur=(d==null||(e=d.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.hr&&this.hr(),this.hr=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(d&&d.history){var t=this;(i=d.history.pushState)!=null&&i.__posthog_wrapped__||Us(d.history,"pushState",(r=>function(s,n,o){r.call(this,s,n,o),t.dr("pushState")})),(e=d.history.replaceState)!=null&&e.__posthog_wrapped__||Us(d.history,"replaceState",(r=>function(s,n,o){r.call(this,s,n,o),t.dr("replaceState")})),this.vr()}}dr(i){try{var e,t=d==null||(e=d.location)==null?void 0:e.pathname;if(!t)return;t!==this.ur&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.ur=t}catch(r){b.error("Error capturing "+i+" pageview",r)}}vr(){if(!this.hr){var i=()=>{this.dr("popstate")};j(d,"popstate",i),this.hr=()=>{d&&d.removeEventListener("popstate",i)}}}},heatmaps:class{constructor(i){var e;this.cr=!1,this.er=!1,this.pr=null,this.instance=i,this.cr=!((e=this.instance.persistence)==null||!e.props[er]),this.rageclicks=new di(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return H(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(i=this.instance.config.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return $(this.instance.config.capture_heatmaps)?$(this.instance.config.enable_heatmaps)?this.cr:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.er)return;Ma.info("starting..."),this._r(),this.gr()}else{var i;clearInterval((i=this.pr)!==null&&i!==void 0?i:void 0),this.mr(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[er]:e}),this.cr=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.C;return this.C=void 0,i}br(i){this.yr(i.originalEvent,"deadclick")}gr(){this.pr&&clearInterval(this.pr),this.pr=(function(i){return i?.visibilityState==="visible"})(m)?setInterval(this.Ft.bind(this),this.flushIntervalMilliseconds):null}_r(){d&&m&&(this.wr=this.Ft.bind(this),j(d,"beforeunload",this.wr),this.Er=i=>this.yr(i||d?.event),j(m,"click",this.Er,{capture:!0}),this.Sr=i=>this.$r(i||d?.event),j(m,"mousemove",this.Sr,{capture:!0}),this.kr=new Qt(this.instance,Ko,this.br.bind(this)),this.kr.startIfEnabledOrStop(),this.Pr=this.gr.bind(this),j(m,"visibilitychange",this.Pr),this.er=!0)}mr(){var i;d&&m&&(this.wr&&d.removeEventListener("beforeunload",this.wr),this.Er&&m.removeEventListener("click",this.Er,{capture:!0}),this.Sr&&m.removeEventListener("mousemove",this.Sr,{capture:!0}),this.Pr&&m.removeEventListener("visibilitychange",this.Pr),clearTimeout(this.Tr),(i=this.kr)==null||i.stop(),this.er=!1)}Rr(i,e){var t=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){for(var u=o;u&&_i(u)&&!Me(u,"body");){if(u===l)return!1;if(k(a,d?.getComputedStyle(u).position))return!0;u=Jn(u)}return!1})(As(i),["fixed","sticky"],s);return{x:i.clientX+(n?0:r),y:i.clientY+(n?0:t),target_fixed:n,type:e}}yr(i,e){var t;if(e===void 0&&(e="click"),!Is(i.target)&&Bs(i)){var r=this.Rr(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&this.Ir(f({},r,{type:"rageclick"})),this.Ir(r)}}$r(i){!Is(i.target)&&Bs(i)&&(clearTimeout(this.Tr),this.Tr=setTimeout((()=>{this.Ir(this.Rr(i,"mousemove"))}),500))}Ir(i){if(d){var e=d.location.href,t=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,s=t?rt([],st,r||[]):[],n=Ft(e,s,It);this.C=this.C||{},this.C[n]||(this.C[n]=[]),this.C[n].push(i)}}Ft(){this.C&&!Ke(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Qt,webVitalsAutocapture:class{constructor(i){var e;this.cr=!1,this.er=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Cr=()=>{clearTimeout(this.Or),this.C.metrics.length!==0&&(this._instance.capture("$web_vitals",this.C.metrics.reduce(((t,r)=>f({},t,{["$web_vitals_"+r.name+"_event"]:f({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Fr=t=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(y(s))Oe.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Mr();y(n)||($(t?.name)||$(t?.value)?Oe.error("Invalid metric received",t):this.Ar&&t.value>=this.Ar?Oe.error("Ignoring metric with value >= "+this.Ar,t):(this.C.url!==n&&(this.Cr(),this.Or=setTimeout(this.Cr,this.flushToCaptureTimeoutMs)),y(this.C.url)&&(this.C.url=n),this.C.firstMetricTimestamp=y(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.C.metrics.push(f({},t,{$current_url:n,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Cr()))}},this.Dr=()=>{if(!this.er){var t,r,s,n,o=w.__PosthogExtensions__;y(o)||y(o.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:r,onFCP:s,onINP:n}=o.postHogWebVitalsCallbacks),t&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Fr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Fr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.Fr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.Fr.bind(this)),this.er=!0):Oe.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.cr=!((e=this._instance.persistence)==null||!e.props[gs]),this.startIfEnabled()}get allowedMetrics(){var i,e,t=H(this._instance.config.capture_performance)?(i=this._instance.config.capture_performance)==null?void 0:i.web_vitals_allowed_metrics:void 0;return $(t)?((e=this._instance.persistence)==null?void 0:e.props[ms])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(H(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=H(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return i!=null&&i}get Ar(){var i=H(this._instance.config.capture_performance)&&ve(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:js;return 0<i&&i<=6e4?js:i}get isEnabled(){var i=z?.protocol;if(i!=="http:"&&i!=="https:")return Oe.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=H(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:xe(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return xe(e)?e:this.cr}startIfEnabled(){this.isEnabled&&!this.er&&(Oe.info("enabled, starting..."),this.G(this.Dr))}onRemoteConfig(i){if("capturePerformance"in i){var e=H(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=H(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[gs]:e}),this._instance.persistence.register({[ms]:t})),this.cr=e,this.startIfEnabled()}}G(i){var e,t;if((e=w.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks)i();else{var r=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(t=w.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,r,(s=>{s?Oe.error("failed to load script",s):i()}))}}Mr(){var i=d?d.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,t=this._instance.config.custom_personal_data_properties,r=e?rt([],st,t||[]):[];return Ft(i,r,It)}Oe.error("Could not determine current URL")}}},Ka={exceptionObserver:class{constructor(i){var e,t,r;this.Dr=()=>{var s;if(d&&this.isEnabled&&(s=w.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=w.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=w.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=w.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jr&&this.N.capture_unhandled_errors&&(this.jr=n(this.captureException.bind(this))),!this.Lr&&this.N.capture_unhandled_rejections&&(this.Lr=o(this.captureException.bind(this))),!this.Nr&&this.N.capture_console_errors&&(this.Nr=a(this.captureException.bind(this)))}catch(l){pt.error("failed to start",l),this.Ur()}}},this._instance=i,this.zr=!((e=this._instance.persistence)==null||!e.props[vs]),this.Hr=new ji({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:pt}),this.N=this.Br(),this.startIfEnabledOrStop()}Br(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return H(i)?e=f({},e,i):(y(i)?this.zr:i)&&(e=f({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(pt.info("enabled"),this.Ur(),this.G(this.Dr)):this.Ur()}G(i){var e,t;(e=w.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=w.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return pt.error("failed to load script",r);i()}))}Ur(){var i,e,t;(i=this.jr)==null||i.call(this),this.jr=void 0,(e=this.Lr)==null||e.call(this),this.Lr=void 0,(t=this.Nr)==null||t.call(this),this.Nr=void 0}onRemoteConfig(i){if("autocaptureExceptions"in i){var e=i.autocaptureExceptions;this.zr=!!e||!1,this._instance.persistence&&this._instance.persistence.register({[vs]:this.zr}),this.N=this.Br(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this.Br()}captureException(i){var e,t,r,s=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.Hr.consumeRateLimit(s)?pt.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.qr=[],this.Vr=new zi([new Wi,new Qi,new Yi,new Gi,new Ji,new Ki,new Xi,new Zi],No()),this._instance=i,this.qr=(e=(t=this._instance.persistence)==null?void 0:t.get_property(tr))!==null&&e!==void 0?e:[]}onRemoteConfig(i){var e,t,r;if("errorTracking"in i){var s=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.qr=s,this._instance.persistence&&this._instance.persistence.register({[tr]:this.qr,[_s]:n})}}get Wr(){var i,e=!!this._instance.get_property(_s),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.Vr.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}sendExceptionEvent(i){var e=i.$exception_list;if(this.Gr(e)){if(this.Yr(e))return void Mi.info("Skipping exception capture because a suppression rule matched");if(!this.Wr&&this.Jr(e))return void Mi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Kr(e))return void Mi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Di:!0})}Yr(i){if(i.length===0)return!1;var e=i.reduce(((t,r)=>{var{type:s,value:n}=r;return q(s)&&s.length>0&&t.$exception_types.push(s),q(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.qr.some((t=>{var r=t.values.map((s=>{var n,o=Bn[s.operator],a=C(s.value)?s.value:[s.value],l=(n=e[s.key])!==null&&n!==void 0?n:[];return a.length>0&&o(a,l)}));return t.type==="OR"?r.some(Boolean):r.every(Boolean)}))}Jr(i){return i.flatMap((e=>{var t,r;return(t=(r=e.stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Kr(i){if(i.length>0){var e,t,r,s,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Gr(i){return!$(i)&&C(i)}}},Ja=f({productTours:class{constructor(i){this.Xr=null,this.Qr=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this._instance.persistence&&this._instance.persistence.register({[fs]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.Xr||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(fs)||this.G((()=>this.Zr()))}G(i){var e,t;(e=w.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=w.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(r=>{r?zs.error("Could not load product tours script",r):i()}))}Zr(){var i;!this.Xr&&(i=w.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.Xr=w.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!C(this.Qr)||e){var t=this._instance.persistence;if(t){var r=t.props[Ri];if(C(r)&&!e)return this.Qr=r,void i(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var n=s.statusCode;if(n!==200||!s.json){var o="Product Tours API could not be loaded, status: "+n;return zs.error(o),void i([],{isLoaded:!1,error:o})}var a=C(s.json.product_tours)?s.json.product_tours:[];this.Qr=a,t&&t.register({[Ri]:a}),i(a,{isLoaded:!0})}})}else i(this.Qr,{isLoaded:!0})}getActiveProductTours(i){$(this.Xr)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.Xr.getActiveProductTours(i)}showProductTour(i){var e;(e=this.Xr)==null||e.showTourById(i)}previewTour(i){this.Xr?this.Xr.previewTour(i):this.G((()=>{var e;this.Zr(),(e=this.Xr)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.Xr)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.Xr)==null||i.nextStep()}previousStep(){var i;(i=this.Xr)==null||i.previousStep()}clearCache(){var i;this.Qr=null,(i=this._instance.persistence)==null||i.unregister(Ri)}resetTour(i){var e;(e=this.Xr)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.Xr)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.Xr)==null||e.cancelPendingTour(i)}}},gi),Za={siteApps:class{constructor(i){this._instance=i,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(i,e){if(e){var t=this.globalsForEvent(e);this.ts.push(t),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var i;return(i=w._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.es.bind(this));this.rs=()=>{i(),this.ts=[],this.rs=void 0}}}globalsForEvent(i){var e,t,r,s,n,o,a;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(c))l[h]={id:u[h],type:h,properties:p};var{$set_once:v,$set:g}=i;return{event:f({},Zs(i,Na),{properties:f({},i.properties,g?{$set:f({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},v?{$set_once:f({},(r=(s=i.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},v)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.ts.length&&(Fe.info("Processing "+this.ts.length+" events for site app with id "+i.id),this.ts.forEach((a=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this.rs)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,Fe.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),r&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback:o=>{s(o)}});n&&(e.processEvent=n),r=!0}catch(o){Fe.error("Error while initializing PostHog app with config id "+i.id,o),s(!1)}if(r&&e.loaded)try{t()}catch(o){Fe.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}ss(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}ns(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(r){Fe.error("Error while processing event "+i.event+" for site app "+t.id,r)}}}onRemoteConfig(i){var e,t,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",(l=>this.ns(l)))):void Fe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.rs)==null||t.call(this),(r=i.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var u;w["__$$ph_site_app_"+l]=s._instance,(u=w.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,a,(c=>{if(c)return Fe.error("Error while initializing PostHog app with config id "+l,c)}))};for(var{id:o,url:a}of i.siteApps)n(o)}else Fe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Qa={tracingHeaders:class{constructor(i){this.os=void 0,this.ls=void 0,this.Dr=()=>{var e,t;y(this.os)&&((e=w.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),y(this.ls)&&((t=w.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=i}initialize(){this.startIfEnabledOrStop()}G(i){var e,t;(e=w.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&i(),(t=w.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return Aa.error("failed to load script",r);i()}))}startIfEnabledOrStop(){var i,e;this._instance.config.__add_tracing_headers?this.G(this.Dr):((i=this.os)==null||i.call(this),(e=this.ls)==null||e.call(this),this.os=void 0,this.ls=void 0)}}},el=f({surveys:class{constructor(i){this.us=void 0,this._surveyManager=null,this.hs=!1,this.ds=[],this.vs=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_surveys){var e=i.surveys;if($(e))return R.warn("Flags not loaded yet. Not loading surveys.");var t=C(e);this.us=t?e.length>0:e,R.info("flags response received, isSurveysEnabled: "+this.us),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var t=localStorage.key(e);(t!=null&&t.startsWith(Vn)||t!=null&&t.startsWith("inProgressSurvey_"))&&i.push(t)}i.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.hs)R.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)R.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())R.info("Not loading surveys in cookieless mode without consent.");else{var i=w?.__PosthogExtensions__;if(i){if(!y(this.us)||this._instance.config.advanced_enable_surveys){var e=this.us||this._instance.config.advanced_enable_surveys;this.hs=!0;try{var t=i.generateSurveys;if(t)return void this.cs(t,e);var r=i.loadExternalDependency;if(!r)return void this.fs("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(s=>{s||!i.generateSurveys?this.fs("Could not load surveys script",s):this.cs(i.generateSurveys,e)}))}catch(s){throw this.fs("Error initializing surveys",s),s}finally{this.hs=!1}}}else R.error("PostHog Extensions not found.")}}cs(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Ir(this._instance),R.info("Surveys loaded successfully"),this.ps({isLoaded:!0})}fs(i,e){R.error(i,e),this.ps({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.ds.push(i),this._surveyManager&&this.ps({isLoaded:!0}),()=>{this.ds=this.ds.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this._instance.config.disable_surveys)return R.info("Disabled. Not loading surveys."),i([]);var t,r=this._instance.get_property(rr);if(r&&!e)return i(r,{isLoaded:!0});typeof Promise<"u"&&this.vs?this.vs.then((s=>{var{surveys:n,context:o}=s;return i(n,o)})):(typeof Promise<"u"&&(this.vs=new Promise((s=>{t=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var n;this.vs=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;R.error(a);var l={isLoaded:!1,error:a};return i([],l),void(t==null||t({surveys:[],context:l}))}var u,c=s.json.surveys||[],h=c.filter((v=>(function(g){return!(!g.start_date||g.end_date)})(v)&&((function(g){var _;return!((_=g.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)})(v)||(function(g){var _;return!((_=g.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(v))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[rr]:c});var p={isLoaded:!0};i(c,p),t?.({surveys:c,context:p})}}))}ps(i){for(var e of this.ds)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){R.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!$(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);R.warn("init was not called")}_s(i){var e=null;return this.getSurveys((t=>{var r;e=(r=t.find((s=>s.id===i)))!==null&&r!==void 0?r:null})),e}gs(i){if($(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var e=typeof i=="string"?this._s(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if($(this._surveyManager))return R.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var e=this.gs(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return $(this._surveyManager)?(R.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((t=>{this.getSurveys((r=>{var s,n=(s=r.find((a=>a.id===i)))!==null&&s!==void 0?s:null;if(n){var o=this.gs(n);t({visible:o.eligible,disabledReason:o.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var r;if($(this._surveyManager))R.warn("init was not called");else{var s=typeof i=="string"?this._s(i):i;if(s!=null&&s.id)if(ma.includes(s.type)){var n=m?.querySelector(e);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(R.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;R.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,n,t),R.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,t);R.warn("Survey element not found")}else R.warn("Surveys of type "+s.type+" cannot be rendered in the app");else R.warn("Survey not found")}}displaySurvey(i,e){var t;if($(this._surveyManager))R.warn("init was not called");else{var r=this._s(i);if(r){var s=r;if((t=r.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=f({},r,{appearance:f({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==vr.Popover&&e.initialResponses&&R.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(r);if(!n.visible)return void R.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==vr.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else R.warn("Survey not found")}}cancelPendingSurvey(i){$(this._surveyManager)?R.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},gi),tl={toolbar:class{constructor(i){this.instance=i}bs(i){w.ph_toolbar_state=i}ys(){var i;return(i=w.ph_toolbar_state)!==null&&i!==void 0?i:Ie.UNINITIALIZED}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),xn(this.instance.config)||!d||!m)return!1;i=i??d.location,t=t??d.history;try{if(!e){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}e=d?.localStorage}var r,s=Da||ri(i.hash,"__posthog")||ri(i.hash,"state"),n=s?ds((()=>JSON.parse(atob(decodeURIComponent(s)))))||ds((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((r=JSON.parse(e.getItem(Vs)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}ws(i){var e=w.ph_load_toolbar||w.ph_load_editor;!$(e)&&we(e)?e(i,this.instance):Ws.warn("No toolbar load function found")}loadToolbar(i){var e=!(m==null||!m.getElementById(Tn));if(!d||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=f({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(d.localStorage.setItem(Vs,JSON.stringify(f({},r,{source:void 0}))),this.ys()===Ie.LOADED)this.ws(r);else if(this.ys()===Ie.UNINITIALIZED){var s;this.bs(Ie.LOADING),(s=w.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Ws.error("[Toolbar] Failed to load",n),void this.bs(Ie.UNINITIALIZED);this.bs(Ie.LOADED),this.ws(r)})),j(d,"turbolinks:load",(()=>{this.bs(Ie.UNINITIALIZED),this.loadToolbar(r)}))}return!0}Es(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},il=f({experiments:Rr},gi),rl={conversations:class{constructor(i){this.xs=void 0,this._conversationsManager=null,this.Ss=!1,this.$s=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;$(e)||(xe(e)?this.xs=e:(this.xs=e.enabled,this.$s=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.xs=void 0,this.$s=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ss||this._instance.config.disable_conversations||xn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=w?.__PosthogExtensions__;if(i&&!y(this.xs)&&this.xs)if(this.$s&&this.$s.token){this.Ss=!0;try{var e=i.initConversations;if(e)return this.ks(e),void(this.Ss=!1);var t=i.loadExternalDependency;if(!t)return void this.Ps("PostHog loadExternalDependency extension not found.");t(this._instance,"conversations",(r=>{r||!i.initConversations?this.Ps("Could not load conversations script",r):this.ks(i.initConversations),this.Ss=!1}))}catch(r){this.Ps("Error initializing conversations",r),this.Ss=!1}}else se.error("Conversations enabled but missing token in remote config.")}}ks(i){if(this.$s)try{this._conversationsManager=i(this.$s,this._instance),se.info("Conversations loaded successfully")}catch(e){this.Ps("Error completing conversations initialization",e)}else se.error("Cannot complete initialization: remote config is null")}Ps(i,e){se.error(i,e),this._conversationsManager=null,this.Ss=!1}show(){this._conversationsManager?this._conversationsManager.show():se.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.xs===!0&&!ae(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var r=this;return me((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(i,e,t):(se.warn("Conversations not available yet."),null)}))()}getMessages(i,e){var t=this;return me((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(se.warn("Conversations not available yet."),null)}))()}markAsRead(i){var e=this;return me((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(se.warn("Conversations not available yet."),null)}))()}getTickets(i){var e=this;return me((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(se.warn("Conversations not available yet."),null)}))()}requestRestoreLink(i){var e=this;return me((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(se.warn("Conversations not available yet."),null)}))()}restoreFromToken(i){var e=this;return me((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(se.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var i=this;return me((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(se.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}}},sl={logs:class{constructor(i){var e;this.Ts=!1,this.Rs=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Ts=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!$(t)&&t&&(this.Ts=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ts&&!this.Rs){var i=L("[logs]"),e=w?.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(r=>{var s;r||(s=e.logs)==null||!s.initializeLogs?i.error("Could not load logs script",r):(e.logs.initializeLogs(this._instance),this.Rs=!0)})):i.error("PostHog loadExternalDependency extension not found.")}else i.error("PostHog Extensions not found.")}}}},nl=f({},gi,Ya,Xa,Ka,Ja,Za,el,Qa,tl,il,rl,sl);ot.__defaultExtensionClasses=f({},nl);var Ks,ke=(Ks=Tt[Xe]=new ot,(function(){function i(){i.done||(i.done=!0,Wn=!1,A(Tt,(function(e){e._dom_loaded()})))}m!=null&&m.addEventListener?m.readyState==="complete"?i():j(m,"DOMContentLoaded",i,{capture:!1}):d&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Ks);var He=class He{constructor(e,t=!1){this.has_initialized=!1;this.has_identified=!1;this.debug=!1;this.log=Zr("[PostHog]",()=>this.debug);this.cleanupStalePosthogCookies=e=>{if(typeof document>"u"||typeof window>"u")return;let t=`ph_${e}_posthog`,r=document.cookie.split(";").map(a=>a.trim().split("=")[0]??"").filter(a=>/^ph_.+_posthog$/.test(a)&&a!==t);if(r.length===0)return;let s=window.location.hostname,n=s.split("."),o=n.length>=2?`.${n.slice(-2).join(".")}`:s;r.forEach(a=>{[o,s,""].forEach(u=>{let c=u?`; Domain=${u}`:"";document.cookie=`${a}=; path=/${c}; max-age=0; SameSite=Lax`});let l=!document.cookie.split(";").some(u=>u.trim().startsWith(`${a}=`));this.log(`cleanupStalePosthogCookies | ${l?"removed":"failed to remove"} stale cookie: ${a}`)})};this.init=()=>{try{let{apiKey:e,api_host:t,config:r={}}=this.options;if(!e){console.warn("Posthog: No API key provided");return}this.cleanupStalePosthogCookies(e);let s=t||Kr();this.log("init | loading PostHog SDK",{api_host:s});let n={api_host:s,ui_host:Xr,autocapture:!0,capture_pageview:"history_change",session_recording:{recordCrossOriginIframes:!0,minimumDurationMilliseconds:3e4,...r.session_recording},before_send:o=>{if(typeof window>"u")return null;let a=window.location.hostname;if(a==="localhost"||a==="127.0.0.1")return o;let l=Jr.some(u=>a.endsWith(`.${u}`)||a===u);return l||this.log("init | before_send blocked event from disallowed host",{currentHost:a}),l?o:null},...r};ke.init(e,n),this.has_initialized=!0,this.log("init | PostHog SDK loaded successfully")}catch(e){console.error("Posthog: Failed to initialize",e)}};this.identifyEvent=(e,t)=>{if(!this.has_initialized){console.warn("Posthog: Cannot identify - not initialized");return}try{let r=typeof ke._isIdentified=="function"?ke._isIdentified():this.has_identified;e&&!r?(this.log("identifyEvent | identifying user",{user_id:e,traits:t}),ke.identify(e,{...t,client_id:e}),this.has_identified=!0):this.log("identifyEvent | skipped \u2014 user already identified",{user_id:e})}catch(r){console.error("Posthog: Failed to identify user",r)}};this.reset=()=>{if(this.has_initialized)try{this.log("reset | resetting PostHog session"),ke.reset(),this.has_identified=!1}catch(e){console.error("Posthog: Failed to reset",e)}};this.backfillPersonProperties=({user_id:e,email:t,country_of_residence:r})=>{if(!(!this.has_initialized||!e))try{let s=ke.get_property("$stored_person_properties")??{},n={};s.client_id||(n.client_id=e),t&&s.is_internal===void 0&&(n.is_internal=Qr(t)),r&&!s.country_of_residence&&(n.country_of_residence=r),Object.keys(n).length>0?(this.log("backfillPersonProperties | backfilling person properties",{user_id:e,updates:n}),ke.setPersonProperties(n)):this.log("backfillPersonProperties | skipped \u2014 all properties already present",{user_id:e,country_of_residence:r})}catch(s){console.error("Posthog: Failed to backfill person properties",s)}};this.capture=(e,t)=>{if(this.has_initialized)try{this.log("capture | sending event to PostHog",{event_name:e,properties:t}),ke.capture(e,t)}catch(r){console.error("Posthog: Failed to capture event",r)}};this.options=e,this.debug=t,this.init()}};He.getPosthogInstance=(e,t=!1)=>(He._instance||(He._instance=new He(e,t)),He._instance);var so=He;export{so as Posthog};
|
|
6
|
+
//# sourceMappingURL=posthog-WH6LGSSW.mjs.map
|