posthog-js 1.396.2 → 1.396.3

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.
Files changed (43) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.js +1 -1
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -1
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -1
  9. package/dist/array.no-external.js +1 -1
  10. package/dist/customizations.full.js +1 -1
  11. package/dist/default-extensions.js +1 -1
  12. package/dist/extension-bundles.js +1 -1
  13. package/dist/lazy-recorder.js +1 -1
  14. package/dist/main.js +1 -1
  15. package/dist/module.full.js +1 -1
  16. package/dist/module.full.js.map +1 -1
  17. package/dist/module.full.no-external.js +1 -1
  18. package/dist/module.full.no-external.js.map +1 -1
  19. package/dist/module.js +1 -1
  20. package/dist/module.no-external.js +1 -1
  21. package/dist/module.slim.js +1 -1
  22. package/dist/module.slim.no-external.js +1 -1
  23. package/dist/posthog-recorder.js +1 -1
  24. package/dist/product-tours.js +1 -1
  25. package/dist/src/entrypoints/web-vitals-with-attribution.d.ts +19 -0
  26. package/dist/src/entrypoints/web-vitals.d.ts +18 -0
  27. package/dist/surveys.js +1 -1
  28. package/dist/web-vitals-with-attribution.js +1 -1
  29. package/dist/web-vitals-with-attribution.js.map +1 -1
  30. package/dist/web-vitals.js +1 -1
  31. package/dist/web-vitals.js.map +1 -1
  32. package/lib/package.json +1 -1
  33. package/lib/src/entrypoints/web-vitals-with-attribution.d.ts +19 -0
  34. package/lib/src/entrypoints/web-vitals-with-attribution.js +3 -0
  35. package/lib/src/entrypoints/web-vitals-with-attribution.js.map +1 -1
  36. package/lib/src/entrypoints/web-vitals.d.ts +18 -0
  37. package/lib/src/entrypoints/web-vitals.js +3 -0
  38. package/lib/src/entrypoints/web-vitals.js.map +1 -1
  39. package/lib/src/utils/array-at-polyfill.d.ts +0 -0
  40. package/lib/src/utils/array-at-polyfill.js +33 -0
  41. package/lib/src/utils/array-at-polyfill.js.map +1 -0
  42. package/lib/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s="1.396.2",r={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},n="$people_distinct_id",o="$device_id",a="$device_model",l="__alias",_="__timers",u="$dead_clicks_enabled_server_side",d="$session_recording_remote_config",c="$sesid",h="$session_is_sampled",p="$enabled_feature_flags",g="$surveys_loaded_at",v="$flag_call_reported",f="$feature_flag_evaluated_at",m="$user_state",y="$client_session_props",b="$capture_rate_limit",w="$initial_campaign_params",S="$initial_referrer_info",x="$initial_person_info",E="$epp",P="$posthog_cookieless",T="$sdk_debug_extensions_init_method",I="$sdk_debug_extensions_init_time_ms",k="on_reject",R="always",C="anonymous",O="identified",A="identified_only",F="visibilitychange",M="beforeunload",L="$pageview",D="$pageleave",U="$identify",N="$groupidentify",q="undefined"!=typeof window?window:void 0,B="undefined"!=typeof globalThis?globalThis:q;"undefined"==typeof self&&(B.self=B),"undefined"==typeof File&&(B.File=function(){});var H,G=null==B?void 0:B.navigator,z=null==B?void 0:B.document,V=null==B?void 0:B.location,j=null==B?void 0:B.fetch,W=null!=B&&B.XMLHttpRequest&&"withCredentials"in new B.XMLHttpRequest?B.XMLHttpRequest:void 0,Y=null==B?void 0:B.AbortController,K=null==B?void 0:B.CompressionStream,J=null==G?void 0:G.userAgent,Q=null!=q?q:{},X=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Z=["$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"],ee=["token"],te="NativeGzipValidationError",ie=e=>e.length>=2&&31===e[0]&&139===e[1],se=(e,t)=>e===X.GZipJS||t===X.GZipJS||"gzip"===t,re=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ne=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=te,t},oe=function(){var e=t((function*(e,t){18>e.size&&ne("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ie(i)&&8===i[2]||ne("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(H)return H;H=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;H[e]=t>>>0}return H})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&ne("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&ne("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function ae(){return ae=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[_]=yield Promise.all([l,a]);return yield oe(_,r),_}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),ae.apply(this,arguments)}var le=["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"],_e=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return le.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function ue(e,t){return-1!==e.indexOf(t)}var de=function(e){return e.replace(/^\$/,"")},ce=Object.prototype,he=ce.hasOwnProperty,pe=ce.toString,ge=Array.isArray||function(e){return"[object Array]"===pe.call(e)},ve=e=>"function"==typeof e,fe=e=>e===Object(e)&&!ge(e),me=e=>{if(fe(e)){for(var t in e)if(he.call(e,t))return!1;return!0}return!1},ye=e=>void 0===e,be=e=>"[object String]"==pe.call(e),we=e=>be(e)&&0===e.trim().length,Se=e=>null===e,xe=e=>ye(e)||Se(e),Ee=e=>"[object Number]"==pe.call(e)&&e==e,Pe=e=>Ee(e)&&e>0,Te=e=>"[object Boolean]"===pe.call(e),Ie=e=>e instanceof FormData,ke=e=>ue(Z,e),$e=e=>ue(ee,e),Re=[!0,"true",1,"1","yes"],Ce=e=>ue(Re,e),Oe=[!1,"false",0,"0","no"];function Ae(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ee(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ae(r||i,t,i,s))}var Fe="Mobile",Me="iOS",Le="Android",De="Tablet",Ue=Le+" "+De,Ne="iPad",qe="Apple",Be=qe+" Watch",He="Safari",Ge="BlackBerry",ze="Samsung",Ve=ze+"Browser",je=ze+" Internet",We="Chrome",Ye=We+" OS",Ke=We+" "+Me,Je="Internet Explorer",Qe=Je+" "+Fe,Xe="Opera",Ze=Xe+" Mini",et="Edge",tt="Microsoft "+et,it="Firefox",st=it+" "+Me,rt="Nintendo",nt="PlayStation",ot="Xbox",at=Le+" "+Fe,lt=Fe+" "+He,_t="Windows",ut=_t+" Phone",dt="Nokia",ct="Ouya",ht="Generic",pt=ht+" "+Fe.toLowerCase(),gt=ht+" "+De.toLowerCase(),vt="Konqueror",ft="Oculus Browser",mt="Vivaldi",yt="Yandex",bt="Whale",wt="DuckDuckGo",St="Pale Moon",xt="Waterfox",Et="Brave",Pt="Google Search App",Tt="(\\d+(\\.\\d+)?)",It=new RegExp("Version/"+Tt),kt=new RegExp(ot,"i"),$t=new RegExp(nt+" \\w+","i"),Rt=new RegExp(rt+" \\w+","i"),Ct=new RegExp(Ge+"|PlayBook|BB10","i"),Ot={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},At=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?Et:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ue(e,"GSA/")?Pt:ue(e," OPR/")&&ue(e,"Mini")?Ze:ue(e," OPR/")?Xe:Ct.test(e)?Ge:ue(e,"IE"+Fe)||ue(e,"WPDesktop")?Qe:ue(e,"OculusBrowser")?ft:ue(e,Ve)?je:ue(e,et)||ue(e,"Edg/")?tt:ue(e,mt+"/")?mt:ue(e,"YaBrowser/")?yt:ue(e,bt+"/")?bt:ue(e,wt+"/")||ue(e,"Ddg/")?wt:ue(e,"FBIOS")?"Facebook "+Fe:ue(e,"UCWEB")||ue(e,"UCBrowser")?"UC Browser":ue(e,"CriOS")?Ke:ue(e,"CrMo")||ue(e,We)?We:ue(e,Le)&&ue(e,He)?at:ue(e,"FxiOS")?st:ue(e.toLowerCase(),vt.toLowerCase())?vt:ue(e,Et+"/")?Et:((e,t)=>t&&ue(t,qe)||function(e){return ue(e,He)&&!ue(e,We)&&!ue(e,Le)}(e))(e,t)?ue(e,Fe)?lt:He:ue(e,"PaleMoon/")?St:ue(e,xt+"/")?xt:ue(e,it)?it:ue(e,"MSIE")||ue(e,"Trident/")?Je:ue(e,"Gecko")?it:"")},Ft={[Qe]:[new RegExp("rv:"+Tt)],[tt]:[new RegExp(et+"?\\/"+Tt)],[We]:[new RegExp("("+We+"|CrMo)\\/"+Tt)],[Ke]:[new RegExp("CriOS\\/"+Tt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Tt)],[He]:[It],[lt]:[It],[Xe]:[new RegExp("(Opera|OPR)\\/"+Tt)],[it]:[new RegExp(it+"\\/"+Tt)],[st]:[new RegExp("FxiOS\\/"+Tt)],[vt]:[new RegExp("Konqueror[:/]?"+Tt,"i")],[Ge]:[new RegExp(Ge+" "+Tt),It],[at]:[new RegExp("android\\s"+Tt,"i")],[je]:[new RegExp(Ve+"\\/"+Tt)],[ft]:[new RegExp("OculusBrowser\\/"+Tt)],[mt]:[new RegExp(mt+"\\/"+Tt)],[yt]:[new RegExp("YaBrowser\\/"+Tt)],[bt]:[new RegExp(bt+"\\/"+Tt)],[Et]:[new RegExp(Et+"\\/"+Tt)],[wt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Tt)],[St]:[new RegExp("PaleMoon\\/"+Tt)],[xt]:[new RegExp(xt+"\\/"+Tt)],[Pt]:[new RegExp("GSA\\/"+Tt)],[Je]:[new RegExp("(rv:|MSIE )"+Tt)],Mozilla:[new RegExp("rv:"+Tt)]},Mt=function(e,t,i,s){var r=At(e,t,i,s),n=Ft[r];if(ye(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Lt=[[new RegExp(ot+"; "+ot+" (.*?)[);]","i"),e=>[ot,e&&e[1]||""]],[new RegExp(rt,"i"),[rt,""]],[new RegExp(nt,"i"),[nt,""]],[Ct,[Ge,""]],[new RegExp(_t,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ut,""];if(new RegExp(Fe).test(t)&&!/IEMobile\b/.test(t))return[_t+" "+Fe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Ot[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[_t,s]}return[_t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Me,[e[3],e[4],e[5]||"0"].join(".")]:[Me,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ye(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Le+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Le+")","i"),e=>e&&e[2]?[Le,[e[2],e[3],e[4]||"0"].join(".")]:[Le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ye,""]],[/Linux|debian/i,["Linux",""]]],Dt=function(e){return Rt.test(e)?rt:$t.test(e)?nt:kt.test(e)?ot:new RegExp(ct,"i").test(e)?ct:new RegExp("("+ut+"|WPDesktop)","i").test(e)?ut:/iPad/.test(e)?Ne:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Be:Ct.test(e)?Ge:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(dt,"i").test(e)?dt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Fe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Le:Ue:new RegExp("(pda|"+Fe+")","i").test(e)?pt:new RegExp(De,"i").test(e)&&!new RegExp(De+" pc","i").test(e)?gt:""},Ut=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nt(e,t){return"string"==typeof(i=e)&&Ut.test(i)?e:t();var i}function qt(e){return e?e.split("#")[0]:e}var Bt=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(q&&(r.DEBUG||Q.POSTHOG_DEBUG||i)&&!ye(q.console)&&q.console){for(var s=("__rrweb_original__"in q.console[t]?q.console[t].__rrweb_original__:q.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Bt(e+" "+t,i)};return s},Ht=Bt("[PostHog.js]"),Gt=Ht.createLogger;function zt(e,t){ge(e)&&e.forEach(t)}function Vt(e,t){if(!xe(e))if(ge(e))e.forEach(t);else if(Ie(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)he.call(e,i)&&t(e[i],i)}var jt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Wt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Ht.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ht.critical(e)}}},Yt=function(e){var t={};return Vt(e,(function(e,i){(be(e)&&e.length>0||Ee(e))&&(t[i]=e)})),t};var Kt=["herokuapp.com","vercel.app","netlify.app"];function Jt(e){var t=null==e?void 0:e.hostname;if(!be(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Kt)if(i===s)return!1;return!0}function Qt(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ee(e)&&isFinite(e)&&Math.floor(e)===e});class Xt{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new Xt(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Xt(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Zt{constructor(){this._timestamp=0,this._counter=0,this._random=new ii}generate(){var e=this.generateOrAbort();if(ye(e)){this._timestamp=0;var t=this.generateOrAbort();if(ye(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Xt.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var ei,ti=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};q&&!ye(q.crypto)&&crypto.getRandomValues&&(ti=e=>crypto.getRandomValues(e));class ii{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(ti(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var si=()=>ri().toString(),ri=()=>(ei||(ei=new Zt)).generate(),ni="",oi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ai={_is_supported:()=>!!z,_error(e){Ht.error("cookieStore error: "+e)},_get(e){if(z){try{for(var t=e+"=",i=z.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(ai._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!z)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=z),ni)return ni;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+si();!ni&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ni=n)}return ni}(e);if(!i){var s=(e=>{var t=e.match(oi);return t?t[0]:""})(e);s!==i&&Ht.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(z.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var _=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return _.length>3686.4&&Ht.warn("cookieStore warning: large cookie, len="+_.length),z.cookie=_,!0}catch(e){return!1}},_remove(e,t){if(null!=z&&z.cookie)try{ai._set(e,"",-1,t)}catch(e){return}}},li=null,_i={_is_supported(){if(!Se(li))return li;var e=!0;if(ye(q))e=!1;else try{var t="__mplssupport__";_i._set(t,"xyz"),'"xyz"'!==_i._get(t)&&(e=!1),_i._remove(t)}catch(t){e=!1}return e||Ht.error("localStorage unsupported; falling back to cookie store"),li=e,e},_error(e){Ht.error("localStorage error: "+e)},_get(e){try{return null==q?void 0:q.localStorage.getItem(e)}catch(e){_i._error(e)}return null},_parse(e){try{return JSON.parse(_i._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==q||q.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){_i._error(e)}return!1},_remove(e){try{null==q||q.localStorage.removeItem(e)}catch(e){_i._error(e)}}},ui=[o,"distinct_id",c,h,E,x,m],di={},ci={_is_supported:()=>!0,_error(e){Ht.error("memoryStorage error: "+e)},_get:e=>di[e]||null,_parse:e=>di[e]||null,_set:(e,t)=>(di[e]=t,!0),_remove(e){delete di[e]}},hi=null,pi={_is_supported(){if(!Se(hi))return hi;if(hi=!0,ye(q))hi=!1;else try{var e="__support__";pi._set(e,"xyz"),'"xyz"'!==pi._get(e)&&(hi=!1),pi._remove(e)}catch(e){hi=!1}return hi},_error(e){Ht.error("sessionStorage error: ",e)},_get(e){try{return null==q?void 0:q.sessionStorage.getItem(e)}catch(e){pi._error(e)}return null},_parse(e){try{return JSON.parse(pi._get(e))||null}catch(e){}return null},_set(e,t){try{return null==q||q.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){pi._error(e)}return!1},_remove(e){try{null==q||q.sessionStorage.removeItem(e)}catch(e){pi._error(e)}}};class gi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===R||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===k}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Ce(e)?1:ue(Oe,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?_i:ai;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?ai:_i;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ce(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==G?void 0:G.doNotTrack,null==G?void 0:G.msDoNotTrack,Q.doNotTrack].some((e=>Ce(e)))}}var vi=["next","previous","prev",">","<","+","-","−","–"];Gt("[Dead Clicks]");var fi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(u)),s=e.instance.config.capture_dead_clicks;return Te(s)?s:!!fe(s)||i},mi=Gt("[SegmentIntegration]");var yi="posthog-js";function bi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,_,u,d,c;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class wi{constructor(e,t,i,s,r,n){this.name=yi,this.setupOnce=function(o){o(bi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Si{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ht.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==q?void 0:q.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:_,maxContentY:u}=r;if(!(ye(n)||ye(o)||ye(a)||ye(l)||ye(_)||ye(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),_=Math.ceil(_),u=Math.ceil(u);var d=n>1?Ae(o/n,0,1,Ht):1,c=n>1?Ae(a/n,0,1,Ht):1,h=l>1?Ae(_/l,0,1,Ht):1,p=l>1?Ae(u/l,0,1,Ht):1;s=jt(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:_,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var xi=["flags","surveys"],Ei={[n]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[_]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[u]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[d]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[c]:{exposure:"hidden"},[h]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>Se(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[p]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!fe(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[v]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[E]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[T]:{exposure:"event"},[I]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Pi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ti=e=>{var t=Ei[e];if(t)return t;for(var[i,s]of Pi)if(0===e.indexOf(i))return s},Ii=e=>{var t=null==z?void 0:z.createElement("a");return ye(t)?null:(t.href=e,t)},ki=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!ge(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Ht.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$i=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),_=[],u=0;l.length>u;u++){var d=l[u].split("=");ge(d)&&(t.includes(d[0])?_.push(d[0]+"="+i):_.push(l[u]))}var c=a;return null!=o&&(c+="?"+_.join("&")),null!=r&&(c+="#"+r),c},Ri="https?://(.*)",Ci=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ci],Ai="<masked>",Fi=["li_fat_id"];function Mi(e,t){var i=Oi.concat(t||[]),s={};return Vt(i,(function(t){var i=ki(e,t);s[t]=i||null})),s}function Li(e){var t=function(e){return e?0===e.search(Ri+"google.([^/?]*)")?"google":0===e.search(Ri+"bing.com")?"bing":0===e.search(Ri+"yahoo.com")?"yahoo":0===e.search(Ri+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Se(t)){s.$search_engine=t;var r=z?ki(z.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Di(){return navigator.language||navigator.userLanguage}var Ui="$direct";function Ni(){return(null==z?void 0:z.referrer)||Ui}function qi(e,t,i){void 0===i&&(i=!1);var s=e?[...Ci,...t||[]]:[],r=i?qt(null==V?void 0:V.href):null==V?void 0:V.href,n=null==r?void 0:r.substring(0,1e3);return{r:Ni().substring(0,1e3),u:n?$i(n,s,Ai):void 0}}function Bi(e,t){var i;void 0===t&&(t=!1);var{r:s,u:r}=e,n=t?qt(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==Ui?Ui:null==(i=Ii(s))?void 0:i.host};if(n){o.$current_url=n;var a=Ii(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Mi(n);jt(o,l)}if(s){var _=Li(s);jt(o,_)}return o}function Hi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Gi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var zi={flags:f,surveys:g},Vi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ji="main";class Wi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Ht.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),q){var r=()=>this.flush();Qt(q,"beforeunload",r,{capture:!1}),Qt(q,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ee(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Vi.indexOf(e.persistence.toLowerCase())&&(Ht.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ui,...e];return i({},_i,{_parse(e){try{var i={};try{i=ai._parse(e)||{}}catch(e){}var s,r=JSON.parse(_i._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Se(a)||""===a||(n[o]=a)}s=jt(r,n)}else s=jt(i,r);return _i._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=_i._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ai._set(e,l,i,r,n,o)}catch(e){_i._error(e)}return a},_remove(e,t){try{null==q||q.localStorage.removeItem(e),ai._remove(e,t)}catch(e){_i._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&_i._is_supported()?(t=_i,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&pi._is_supported()?t=pi:"memory"===n?t=ci:"cookie"===n?t=ai:s._is_supported()?(t=s,r=!0):t=ai,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[f];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Vt(this.props,((t,i)=>{var s=Ti(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===p?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&jt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=jt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of xi){var t=_i._parse(this._groupEntryName(e));if(t&&!me(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||jt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ti(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=zi[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ee(s)&&Ee(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ti(e))?void 0:t.storageGroup:void 0,s=i?_i._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?ye(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){ye(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,ji))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,ji),xi)){var s,r=t[i];(!me(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(_i,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of xi)t[i]={};return Vt(this.props,((i,s)=>{var r,n=null==(r=Ti(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===ji)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Vt(e,((e,t)=>{var s;i[t]=null!=(s=Ti(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===ji||r.dirty||ye(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==ji&&(r.persisted=!0),ye(n)||(r.fingerprint=n)):this._config.debug&&Ht.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(ye(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of xi)_i._remove(this._groupEntryName(i));t?delete this._slotState[ji]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(fe(e)){ye(t)&&(t="None"),this._expire_days=ye(i)?this._default_expiry:i;var s=!1;if(Vt(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(fe(e)){this._expire_days=ye(t)?this._default_expiry:t;var i=!1;if(Vt(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!z)return{};var s,r=t?[...Ci,...i||[]]:[],n=Mi($i(z.URL,r,Ai),e),o=(s={},Vt(Fi,(function(e){var t=ai._get(e);s[e]=t||null})),s);return jt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);me(Yt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==z?void 0:z.referrer)?Li(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ni(),$referring_domain:null!=z&&z.referrer&&(null==(e=Ii(z.referrer))?void 0:e.host)||Ui},void 0)}set_initial_person_info(){this.props[w]||this.props[S]||this.register_once({[x]:qi(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Vt([S,w],(t=>{var i=this.props[t];i&&Vt(i,(function(t,i){e["$initial_"+de(i)]=t}))}));var t=this.props[x];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=Bi(e,t),s={};return Vt(i,(function(e,t){s["$initial_"+de(t)]=e})),s}(t,this._config.disable_capture_url_hashes);jt(e,i)}return e}safe_merge(e){return Vt(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[_]||{};i[e]=t,this._setProp(_,i),this.save()}remove_event_timer(e){var t=this.props[_]||{},i=t[e];return ye(i)||(delete t[e],this._setProp(_,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=Ti(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Ti(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Yi={Activation:"events",Cancellation:"cancelEvents"},Ki={Button:"button",Tab:"tab",Selector:"selector"},Ji={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Qi={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Xi={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Zi={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},es={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ts={Once:"once",Recurring:"recurring",Always:"always"},is={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ss={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",SURVEY_LANGUAGE:"$survey_language"},rs={Popover:"popover",Inline:"inline"},ns={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},os={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},as={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ls=Gt("[RateLimiter]");class _s{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ls.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ls.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(b))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(b,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var us=Gt("[RemoteConfig]");class ds{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Q._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Q.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Q.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(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 us.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void us.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return us.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){us.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&z&&"hidden"!==z.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||us.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var cs=["fatal","error","warning","log","info","debug"],hs={GZipJS:"gzip-js",Base64:"base64"},ps=Uint8Array,gs=Uint16Array,vs=Uint32Array,fs=new ps([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]),ms=new ps([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]),ys=new ps([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bs=function(e,t){for(var i=new gs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new vs(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},ws=bs(fs,2),Ss=ws[1];ws[0][28]=258,Ss[258]=28;for(var xs=bs(ms,0)[1],Es=new gs(32768),Ps=0;32768>Ps;++Ps){var Ts=(43690&Ps)>>>1|(21845&Ps)<<1;Es[Ps]=((65280&(Ts=(61680&(Ts=(52428&Ts)>>>2|(13107&Ts)<<2))>>>4|(3855&Ts)<<4))>>>8|(255&Ts)<<8)>>>1}var Is=function(e,t,i){for(var s=e.length,r=0,n=new gs(t);s>r;++r)++n[e[r]-1];var o,a=new gs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new gs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var _=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,c=d|(1<<u)-1;c>=d;++d)o[Es[d]>>>l]=_}else for(o=new gs(s),r=0;s>r;++r)o[r]=Es[a[e[r]-1]++]>>>15-e[r];return o},ks=new ps(288);for(Ps=0;144>Ps;++Ps)ks[Ps]=8;for(Ps=144;256>Ps;++Ps)ks[Ps]=9;for(Ps=256;280>Ps;++Ps)ks[Ps]=7;for(Ps=280;288>Ps;++Ps)ks[Ps]=8;var $s=new ps(32);for(Ps=0;32>Ps;++Ps)$s[Ps]=5;var Rs=Is(ks,9,0),Cs=Is($s,5,0),Os=function(e){return(e/8>>0)+(7&e&&1)},As=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof gs?gs:e instanceof vs?vs:ps)(i-t);return s.set(e.subarray(t,i)),s},Fs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Ms=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Ls=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ps(0),0];if(1==r){var o=new ps(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],_=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[d].f>i[_].f?_++:d++],l=i[_!=u&&i[d].f>i[_].f?_++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new gs(c+1),p=Ds(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ps(h),p]},Ds=function(e,t,i){return-1==e.s?Math.max(Ds(e.l,t,i+1),Ds(e.r,t,i+1)):t[e.s]=i},Us=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new gs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Ns=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},qs=function(e,t,i){var s=i.length,r=Os(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Bs=function(e,t,i,s,r,n,o,a,l,_,u){Fs(t,u++,i),++r[256];for(var d=Ls(r,15),c=d[0],h=d[1],p=Ls(n,15),g=p[0],v=p[1],f=Us(c),m=f[0],y=f[1],b=Us(g),w=b[0],S=b[1],x=new gs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=Ls(x,7),T=P[0],I=P[1],k=19;k>4&&!T[ys[k-1]];--k);var R,C,O,A,F=_+5<<3,M=Ns(r,ks)+Ns(n,$s)+o,L=Ns(r,c)+Ns(n,g)+o+14+3*k+Ns(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&L>=F)return qs(t,u,e.subarray(l,l+_));if(Fs(t,u,1+(M>L)),u+=2,M>L){R=Is(c,h,0),C=c,O=Is(g,v,0),A=g;var D=Is(T,I,0);for(Fs(t,u,y-257),Fs(t,u+5,S-1),Fs(t,u+10,k-4),u+=14,E=0;k>E;++E)Fs(t,u+3*E,T[ys[E]]);u+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Fs(t,u,D[B=31&q[E]]),u+=T[B],B>15&&(Fs(t,u,q[E]>>>5&127),u+=q[E]>>>12)}}else R=Rs,C=ks,O=Cs,A=$s;for(E=0;a>E;++E)if(s[E]>255){var B;Ms(t,u,R[257+(B=s[E]>>>18&31)]),u+=C[B+257],B>7&&(Fs(t,u,s[E]>>>23&31),u+=fs[B]);var H=31&s[E];Ms(t,u,O[H]),u+=A[H],H>3&&(Ms(t,u,s[E]>>>5&8191),u+=ms[H])}else Ms(t,u,R[s[E]]),u+=C[s[E]];return Ms(t,u,R[256]),u+C[256]},Hs=new vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gs=function(){for(var e=new vs(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),zs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Vs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Gs[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,_=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ps(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),_=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?_=qs(l,_,e.subarray(u,d)):(l[u]=!0,_=qs(l,_,e.subarray(u,o)))}else{for(var c=Hs[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new gs(32768),f=new gs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new vs(25e3),S=new gs(288),x=new gs(32),E=0,P=0,T=(u=0,0),I=0,k=0;o>u;++u){var R=b(u),C=32767&u,O=f[R];if(v[C]=O,f[R]=C,u>=I){var A=o-u;if((E>7e3||T>24576)&&A>423){_=Bs(e,l,0,w,S,x,P,T,k,u-k,_),T=E=P=0,k=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,L=0,D=p,U=C-O&32767;if(A>2&&R==b(u-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,u),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[u+M]==e[u+M-U]){for(var H=0;B>H&&e[u+H]==e[u+H-U];++H);if(H>M){if(M=H,L=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=u-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(L){w[T++]=268435456|Ss[M]<<18|xs[L];var W=31&Ss[M],Y=31&xs[L];P+=fs[W]+ms[Y],++S[257+W],++x[Y],I=u+M,++E}else w[T++]=e[u],++S[e[u]]}}_=Bs(e,l,!0,w,S,x,P,T,k,u-k,_)}return As(a,0,s+Os(_)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=_.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&zs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(_,t),zs(_,u-8,i.d()),zs(_,u-4,s),_}var js=!!W||!!j,Ws="text/plain",Ys=!1,Ks=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Js=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Vt(e,(function(e,t){ye(e)||ye(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return _&&l.push(_),n+"?"+l.join("&")},Qs=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Xs=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===hs.GZipJS){var s=Vs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ps(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ps(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return As(s,0,r)}(Qs(t)),{mtime:0});return{contentType:Ws,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===hs.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Qs(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Qs(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Qs(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Zs=e=>{var t,s,r=()=>({url:Ks(e.url,"compression"),encodedBody:Xs(i({},e,{compression:void 0,_encodedBody:void 0}))});try{t=Xs(e)}catch(t){if(se(e.compression,ki(e.url,"compression")))return Ht.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&se(e.compression,ki(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?ie(new Uint8Array(s)):ArrayBuffer.isView(s)&&ie(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Ys=!0,r()):{url:e.url,encodedBody:t}},er=e=>{try{return Zs(e)}catch(t){return Ht.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},tr=function(){var e=t((function*(e){var t=Qs(e.data),s=yield function(e,t,i){return ae.apply(this,arguments)}(t,r.DEBUG,{rethrow:!0});if(!s)return e;var n=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:Ws,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),ir=(e,t)=>Js(e,{_:(new Date).getTime().toString(),ver:r.JS_SDK_VERSION,compression:t}),sr=[];j&&sr.push({transport:"fetch",method(e){var t,s=er(e);if(s){var{url:r,encodedBody:n}=s,{contentType:o,body:a,estimatedSize:l}=null!=n?n:{},_=new Headers;Vt(e.headers,(function(e,t){_.append(t,e)})),o&&_.append("Content-Type",o);var u=null,d=null;if(Y){var c=new Y;u={signal:c.signal,timeout:setTimeout((()=>{var t,i;t=e.timeout,(i=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",c.abort(d=i)}),e.timeout)}}j(r,i({method:(null==e?void 0:e.method)||"GET",headers:_,keepalive:"POST"===e.method&&52428.8>(l||0),body:a,signal:null==(t=u)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Ht.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{t===d?Ht.warn(t):Ht.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}}),W&&sr.push({transport:"XHR",method(e){var t=er(e);if(t){var i=new W,{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);var{contentType:n,body:o}=null!=r?r:{};Vt(e.headers,(function(e,t){i.setRequestHeader(t,e)})),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}}}),null!=G&&G.sendBeacon&&sr.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Zs(e),{contentType:s,body:r}=null!=i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});G.sendBeacon(t,n)}catch(e){}}});var rr=3e3;class nr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ae((null==t?void 0:t.flush_interval_ms)||rr,250,5e3,Ht.createLogger("flush interval"),rr),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&ge(i.data)&&Vt(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequestSafely(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Ht.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Vt(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;ye(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var or=["retriesPerformedSoFar"];class ar{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!ye(q)&&"onLine"in q.navigator&&(this._areWeOnline=q.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Qt(q,"online",this._onlineListener),Qt(q,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,or);Pe(t)&&(s.url=Js(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Ht.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Ht.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,ye(q)||(this._onlineListener&&(q.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(q.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Ht.error(e)}this._queue=[]}}class lr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Qt(q,"scroll",this._updateScrollData,{capture:!0}),Qt(q,"scrollend",this._updateScrollData,{capture:!0}),Qt(q,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==q?void 0:q.document.documentElement;var e=ge(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==q?void 0:q.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return q?"y"===e?q.scrollY||q.pageYOffset||q.document.documentElement.scrollTop||0:q.scrollX||q.pageXOffset||q.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var _r=e=>qi(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class ur{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[y]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||_r,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[y]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Bi(t,this._instance.config.disable_capture_url_hashes):{$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 Vt(Yt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+de(i)]=t})),e}}class dr{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var cr=Gt("[SessionId]");class hr{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new dr,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Pe(e)||!Pe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===R)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||si,this._windowIdGenerator=i||si;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ae(this._config.session_idle_timeout_seconds||1800,60,36e3,cr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=pi._parse(this._window_id_storage_key),o=pi._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:pi._remove(this._window_id_storage_key),pi._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){cr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ye(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&pi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&pi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?pi._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Se(t)&&!Se(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[c]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Pe(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(c):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Se(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[c]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Pe(e)?e:0,i=Pe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[c];return ge(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&q&&(q.removeEventListener(M,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&pi._remove(this._primary_window_exists_storage_key)},Qt(q,M,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===R)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=Pe(r)&&Math.abs(i-r)>864e5,l=!1,_=!1,u=!s,d=s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);c&&((c=this._isSessionIdleAfterCrossTabRefresh(i))||cr.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,r]=this._getSessionId()),u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),cr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(_=s!==d)&&(cr.info("adopted cross-tab session id",{sessionId:s,windowId:o}),l=!0));var h=Pe(n)&&e&&!a?n:i,p=Pe(r)?r:(new Date).getTime();this._setWindowId(o),this._setSessionId(s,h,p),e||this._resetIdleTimer();var g={noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a,crossTabAdoption:_};return l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,g))),{sessionId:s,windowId:o,sessionStartTimestamp:p,changeReason:l?g:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function pr(){return(pr=t((function*(){var e=null==G?void 0:G.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return be(i)&&i.length>0?i:void 0}catch(e){return void Ht.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}))).apply(this,arguments)}function gr(e,t,i){return Qs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var vr="custom",fr="i.posthog.com",mr=/^\/static\//;class yr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+fr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":vr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(mr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===vr)return this.apiHost+t;var s=fr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var br=Gt("[Surveys]"),wr={ignoreConditions:!1,ignoreDelay:!1,displayType:rs.Popover},Sr=Gt("[PostHog ExternalIntegrations]"),xr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Er{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Q.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Sr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Q.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(xr[t],(()=>{var i;null==(i=Q.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Q.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Q.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var Pr,Tr={},Ir=0,kr=()=>{},$r='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Rr="Surveys module not available",Cr="sanitize_properties is deprecated. Use before_send instead",Or="Invalid value for property_denylist config: ",Ar="posthog",Fr=!js&&-1===(null==J?void 0:J.indexOf("MSIE"))&&-1===(null==J?void 0:J.indexOf("Mozilla")),Mr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Jt(null==z?void 0:z.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:kr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:V&&be(null==V?void 0:V.search)&&-1!==V.search.indexOf("__posthog_debug=true")||!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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==q||null==(t=q.location)?void 0:t.protocol),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_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Ht.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:A,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:rr},error_tracking:{},_onCapture:kr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:vi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},Lr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Dr=e=>{var t={};for(var[i,s]of Lr)ye(e[i])||(t[s]=e[i]);var r=jt({},t,e),n=e.__preview_external_dependency_versioned_paths;return ye(n)||(ye(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),be(n)&&ye(e.asset_host)&&(r.asset_host=n)),ge(e.property_blacklist)&&(ye(e.property_denylist)?r.property_denylist=e.property_blacklist:ge(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ht.error(Or+e.property_denylist)),r};class Ur{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ht.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Nr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===R||this.config.cookieless_mode===k&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Ur,this._personProcessingSetOncePropertiesSent=!1,this.version=r.LIB_VERSION,this._internalEventEmitter=new dr,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mr(),this.SentryIntegration=wi,this.sentryIntegration=e=>function(e,t){var i=bi(e,t);return{name:yi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new lr(this),this.pageViewManager=new Si(this),this.rateLimiter=new _s(this),this.requestRouter=new yr(this),this.consent=new gi(this),this.externalIntegrations=new Er(this);var t=null!==(e=Nr.__defaultExtensionClasses)&&void 0!==e?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:(e,t,i)=>{var s=be(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=be(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Ht.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Ar){var s,r=null!==(s=Tr[i])&&void 0!==s?s:new Nr;return r._init(e,t,i),Tr[i]=r,Tr[Ar][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var n,o;void 0===t&&(t={});var l=be(e)?e.trim():"";if(!l)return Ht.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._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var _=Mr(t.defaults),u=Dr(t),d=jt({},_,u,{name:s,token:l});fe(_.rageclick)&&fe(u.rageclick)&&(d.rageclick=jt({},_.rageclick,u.rageclick)),fe(_.session_recording)&&fe(u.session_recording)&&(d.session_recording=jt({},_.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Ht.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:hs.GZipJS;var c=this._is_persistence_disabled();this.persistence=new Wi(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wi(i({},this.config,{persistence:"sessionStorage"}),c,!1);var h=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new nr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new ar(this),this.__request_queue=[];var g=this._inCookielessMode();if(g||(this.sessionManager=new hr(this),this.sessionPropsManager=new ur(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ht.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(g)}),0)):(Ht.info("Initializing extensions synchronously"),this._initExtensions(g)),r.DEBUG=r.DEBUG||this.config.debug,r.DEBUG&&Ht.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var v=t.bootstrap.distinctID,f=this.get_distinct_id(),y=this.persistence.get_property(m);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===C)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===O)Ht.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(si()),w=t.bootstrap.isIdentifiedID?b:v;this.persistence.set_property(m,t.bootstrap.isIdentifiedID?O:C),this.register({distinct_id:v,$device_id:w})}}if(g)this.register_once({distinct_id:P,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(si());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(m,C)}return Qt(q,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||si();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(m,O)),t()},r=i.user();"then"in r&&ve(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||mi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(mi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(mi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,L),identify:e=>t(e,U),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),ve(this.config._onCapture)&&this.config._onCapture!==kr&&(Ht.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Ht.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.config.disableDeviceModel||function(){return pr.apply(this,arguments)}().then((e=>{e&&this.register({[a]:e})})).catch(kr),this}_initExtensions(e){var t,s,r,n,o,a,l,_=performance.now(),u=i({},Nr.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new u.featureFlags(this)),u.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._extensions.push(this.autocapture=new u.autocapture(this)),u.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,fi)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Ht.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[T]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[I]:s}),this.config.__preview_deferred_init_extensions&&Ht.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!z||!z.body)return Ht.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,hs.GZipJS)?hs.GZipJS:ue(e.supportedCompression,hs.Base64)?hs.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:A}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Ht.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=V&&V.hostname){var e=V.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ds(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&zt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(D),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(D,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Fr?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(ye(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=ir(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=sr.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===hs.GZipJS&&K&&"undefined"!=typeof Promise&&!Ys?tr(n).then((e=>{l(e)})).catch((t=>{if(re(t))return Ys=!0,void l(i({},n,{compression:void 0,url:ir(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return re(e)||t===te})(t)&&(Ys=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Ir++;try{var t,i=[],s=[],r=[];zt(e,(e=>{if(e)if(ge(t=e[0]))r.push(e);else if(ve(e))try{e.call(this)}catch(t){Ht.error("Error executing queued PostHog call",e,t)}else ge(e)&&"alias"===t?i.push(e):ge(e)&&-1!==t.indexOf("capture")&&ve(this[t])?r.push(e):s.push(e)}));var n=function(e,t){zt(e,(function(e){try{if(ge(e[0])){var i=t;Vt(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Ht.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Ir--}}push(e){if(Ir>0&&ge(e)&&be(e[0])){var t=Nr.prototype[e[0]];ve(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!ye(e)&&be(e)){var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var u=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!be(null==t?void 0:t.$current_url)&&(Ht.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Ht.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 d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Nt(null==s?void 0:s.uuid,si),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===L&&this.config.__preview_capture_bot_pageviews&&_&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g=null==s?void 0:s.$unset;g&&(p.$unset=g);var v,f,m,y=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==N,e===U);if(y&&(p.$set_once=y),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>be(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),ge(t)?(s=[],zt(t,(t=>{s.push(e(t))}))):(s={},Vt(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=c,ye(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===is.DISMISSED||e===is.SENT){var b=null==t?void 0:t[ss.SURVEY_ID],w=null==t?void 0:t[ss.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})("seenSurvey_",e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){br.error("Failed to persist survey seen state",e)}})({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(v={id:b,current_iteration:w},f=e===is.SENT?"responded":"dismissed",m="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(m="$survey_"+f+"/"+v.id+"/"+v.current_iteration),m)]:!0})}else e===is.SHOWN&&(p.$set=i({},p.$set,{[ss.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===os.SHOWN){var S=null==t?void 0:t[as.TOUR_TYPE];S&&(p.$set=i({},p.$set,{[as.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(me(x)||this.setPersonPropertiesForFlags(x),!xe(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;(p=E).uuid=Nt(p.uuid,si)}this._internalEventEmitter.emit("eventCaptured",p);var P={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(P):this._requestQueue.enqueue(P),p}Ht.critical("This capture call is ignored due to client rate limiting.")}}else Ht.error("No event name provided to posthog.capture")}else Ht.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,n,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var _=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=_.distinct_id,(!be(l.distinct_id)&&!Ee(l.distinct_id)||we(l.distinct_id))&&Ht.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(e,t,i,s){var n,o,a,l;if(void 0===s&&(s=!1),!J)return{};var _,u,d,c,h,p,g,v,f,m=e?[...Ci,...t||[]]:[],[y,b]=function(e){for(var t=0;Lt.length>t;t++){var[i,s]=Lt[t],r=i.exec(e),n=r&&(ve(s)?s(r,e):s);if(n)return n}return["",""]}(J),w=null!=(_="undefined"!=typeof navigator?navigator:void 0)&&_.brave?{brave:!0}:{},S={detectGoogleSearchApp:i},x=jt(Yt({$os:y,$os_version:b,$browser:At(J,navigator.vendor,w,S),$device:Dt(J),$device_type:(d=J,c={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(o=navigator)?void 0:o.maxTouchPoints,screenWidth:null==q||null==(a=q.screen)?void 0:a.width,screenHeight:null==q||null==(l=q.screen)?void 0:l.height,devicePixelRatio:null==q?void 0:q.devicePixelRatio},f=Dt(d),f===Ne||f===Ue||"Kobo"===f||"Kindle Fire"===f||f===gt?De:f===rt||f===ot||f===nt||f===ct?"Console":f===Be?"Wearable":f?Fe:"Android"===(null==c?void 0:c.userAgentDataPlatform)&&(null!==(h=null==c?void 0:c.maxTouchPoints)&&void 0!==h?h:0)>0?600>Math.min(null!==(p=null==c?void 0:c.screenWidth)&&void 0!==p?p:0,null!==(g=null==c?void 0:c.screenHeight)&&void 0!==g?g:0)/(null!==(v=null==c?void 0:c.devicePixelRatio)&&void 0!==v?v:1)?Fe:De:"Desktop"),$timezone:Hi(),$timezone_offset:Gi()}),{$current_url:$i(s?qt(null==V?void 0:V.href):null==V?void 0:V.href,m,Ai),$host:null==V?void 0:V.host,$pathname:null==V?void 0:V.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Mt(J,navigator.vendor,w,S),$browser_language:Di(),$browser_language_prefix:(u=Di(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==q?void 0:q.screen.height,$screen_width:null==q?void 0:q.screen.width,$viewport_height:null==q?void 0:q.innerHeight,$viewport_width:null==q?void 0:q.innerWidth,$lib:r.LIB_NAME,$lib_version:r.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return r.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=r.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=c,l.$window_id=h}this.sessionPropsManager&&jt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&jt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===vr&&(l.$lib_custom_api_host=this.config.api_host),u=e!==L||o?e!==D||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=jt(l,u),e===L&&z&&(l.title=z.title),!ye(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=jt({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),ge(this.config.property_denylist)?Vt(this.config.property_denylist,(function(e){delete l[e]})):Ht.error(Or+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Ht.error(Cr),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=jt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Ht.error(Cr),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),me(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.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:Rr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Rr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Rr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=wr),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Rr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Rr})}_validateIdentifyId(e){return!e||we(e)?(Ht.critical("Unique user id has not been set in posthog.identify"),!1):e===P?(Ht.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Ht.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.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Ht.uninitializedWarning("posthog.identify");if(Ee(e)&&(e=e.toString(),Ht.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(m)||C)===C;e!==s&&n?(this.persistence.set_property(m,O),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(U,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=gr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(v))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=gr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Ht.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(ge(e)?e:[e]).filter((e=>be(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(N,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Ht.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,l,_,u,c;if(Ht.info("reset"),!this.__loaded)return Ht.uninitializedWarning("posthog.reset");var h,p=this.get_property(o),g=this.get_property(a),v=this.get_property(d);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),ye(v)||null==(h=this.persistence)||h.register({[d]:v}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(l=this.conversations)||l.reset(),null==(_=this.logs)||_.reset(),null==(u=this.persistence)||u.set_property(m,C),null==(c=this.sessionManager)||c.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===R)this.register_once({distinct_id:P,$device_id:null},"");else{var f=this.config.get_device_id(si());this.register_once({distinct_id:f,$device_id:e?f:p},""),e||ye(g)||this.register({[a]:g})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(n)?(Ht.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(ye(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ht.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(fe(e)){var s,n,o,a,l,_,u,d,c,h,p;jt(this.config,Dr(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);Te(v)&&(this.config.debug=v),Te(this.config.debug)&&(this.config.debug?(r.DEBUG=!0,_i._is_supported()&&_i._set("ph_debug",!0),Ht.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(r.DEBUG=!1,_i._is_supported()&&_i._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){r.LIB_NAME=e,r.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Nr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Ar;return t!==Ar&&(t=Ar+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(m))===O||(null==(t=this.sessionPersistence)?void 0:t.get_property(m))===O}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===A&&!this._isIdentified()&&me(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[E]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ht.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(E,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==k)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==R){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new hr(this),this.pageViewManager=new Si(this),this.persistence&&(this.sessionPropsManager=new ur(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Nr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var _,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==k&&(null==(_=this.surveys)||_.loadIfEnabled()),(ye(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Ht.warn($r)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==R?(this.config.cookieless_mode===k&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===k&&(this.register({distinct_id:P,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Ht.warn($r)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===R||(this.config.cookieless_mode===k?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return G?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&_e(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>_e(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(G,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){z&&("visible"===z.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(L,{title:z.title},{send_instantly:!0}),this._visibilityStateListener&&(z.removeEventListener(F,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Qt(z,F,this._visibilityStateListener)))}debug(e){!1===e?(null==q||q.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==q||q.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ht.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=Ht,r=(t="advanced_disable_flags")in(e=o)&&!xe(e[t]),n=i in e&&!xe(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){var t;if(xe(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($e),s=ge(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),xe(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return ke(e.event)?Ht.warn(o+". This can cause unexpected behavior."):Ht.info(o),null}r.properties&&!me(r.properties)||Ht.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&xe(r.properties[a]))return Ht.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=Te(e)&&!e,i=_i._is_supported()&&"true"===_i._get("ph_debug");return!t&&(!!i||e)}}Nr.__defaultExtensionClasses={},Nr._noopLogger={trace:Pr=()=>{},debug:Pr,info:Pr,warn:Pr,error:Pr,fatal:Pr},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Wt(e.prototype[t[i]])}(Nr,["identify"]);var qr=function(){r.SDK_DIST_CHANNEL="npm";var e=Tr[Ar]=new Nr;return function(){function e(){e.done||(e.done=!0,Fr=!1,Vt(Tr,(function(e){e._dom_loaded()})))}null!=z&&z.addEventListener?"complete"===z.readyState?e():Qt(z,"DOMContentLoaded",e,{capture:!1}):q&&Ht.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{hs as Compression,ns as DEFAULT_PRODUCT_TOUR_APPEARANCE,rs as DisplaySurveyType,Nr as PostHog,os as ProductTourEventName,as as ProductTourEventProperties,is as SurveyEventName,ss as SurveyEventProperties,Yi as SurveyEventType,Ji as SurveyPosition,es as SurveyQuestionBranchingType,Zi as SurveyQuestionType,ts as SurveySchedule,Qi as SurveyTabPosition,Xi as SurveyType,Ki as SurveyWidgetType,qr as default,qr as posthog,cs as severityLevels};
1
+ function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s="1.396.3",r={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},n="$people_distinct_id",o="$device_id",a="$device_model",l="__alias",_="__timers",u="$dead_clicks_enabled_server_side",d="$session_recording_remote_config",c="$sesid",h="$session_is_sampled",p="$enabled_feature_flags",g="$surveys_loaded_at",v="$flag_call_reported",f="$feature_flag_evaluated_at",m="$user_state",y="$client_session_props",b="$capture_rate_limit",w="$initial_campaign_params",S="$initial_referrer_info",x="$initial_person_info",E="$epp",P="$posthog_cookieless",T="$sdk_debug_extensions_init_method",I="$sdk_debug_extensions_init_time_ms",k="on_reject",R="always",C="anonymous",O="identified",A="identified_only",F="visibilitychange",M="beforeunload",L="$pageview",D="$pageleave",U="$identify",N="$groupidentify",q="undefined"!=typeof window?window:void 0,B="undefined"!=typeof globalThis?globalThis:q;"undefined"==typeof self&&(B.self=B),"undefined"==typeof File&&(B.File=function(){});var H,G=null==B?void 0:B.navigator,z=null==B?void 0:B.document,V=null==B?void 0:B.location,j=null==B?void 0:B.fetch,W=null!=B&&B.XMLHttpRequest&&"withCredentials"in new B.XMLHttpRequest?B.XMLHttpRequest:void 0,Y=null==B?void 0:B.AbortController,K=null==B?void 0:B.CompressionStream,J=null==G?void 0:G.userAgent,Q=null!=q?q:{},X=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),Z=["$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"],ee=["token"],te="NativeGzipValidationError",ie=e=>e.length>=2&&31===e[0]&&139===e[1],se=(e,t)=>e===X.GZipJS||t===X.GZipJS||"gzip"===t,re=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ne=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=te,t},oe=function(){var e=t((function*(e,t){18>e.size&&ne("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ie(i)&&8===i[2]||ne("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(H)return H;H=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;H[e]=t>>>0}return H})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&ne("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&ne("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function ae(){return ae=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[_]=yield Promise.all([l,a]);return yield oe(_,r),_}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),ae.apply(this,arguments)}var le=["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"],_e=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return le.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function ue(e,t){return-1!==e.indexOf(t)}var de=function(e){return e.replace(/^\$/,"")},ce=Object.prototype,he=ce.hasOwnProperty,pe=ce.toString,ge=Array.isArray||function(e){return"[object Array]"===pe.call(e)},ve=e=>"function"==typeof e,fe=e=>e===Object(e)&&!ge(e),me=e=>{if(fe(e)){for(var t in e)if(he.call(e,t))return!1;return!0}return!1},ye=e=>void 0===e,be=e=>"[object String]"==pe.call(e),we=e=>be(e)&&0===e.trim().length,Se=e=>null===e,xe=e=>ye(e)||Se(e),Ee=e=>"[object Number]"==pe.call(e)&&e==e,Pe=e=>Ee(e)&&e>0,Te=e=>"[object Boolean]"===pe.call(e),Ie=e=>e instanceof FormData,ke=e=>ue(Z,e),$e=e=>ue(ee,e),Re=[!0,"true",1,"1","yes"],Ce=e=>ue(Re,e),Oe=[!1,"false",0,"0","no"];function Ae(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Ee(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ae(r||i,t,i,s))}var Fe="Mobile",Me="iOS",Le="Android",De="Tablet",Ue=Le+" "+De,Ne="iPad",qe="Apple",Be=qe+" Watch",He="Safari",Ge="BlackBerry",ze="Samsung",Ve=ze+"Browser",je=ze+" Internet",We="Chrome",Ye=We+" OS",Ke=We+" "+Me,Je="Internet Explorer",Qe=Je+" "+Fe,Xe="Opera",Ze=Xe+" Mini",et="Edge",tt="Microsoft "+et,it="Firefox",st=it+" "+Me,rt="Nintendo",nt="PlayStation",ot="Xbox",at=Le+" "+Fe,lt=Fe+" "+He,_t="Windows",ut=_t+" Phone",dt="Nokia",ct="Ouya",ht="Generic",pt=ht+" "+Fe.toLowerCase(),gt=ht+" "+De.toLowerCase(),vt="Konqueror",ft="Oculus Browser",mt="Vivaldi",yt="Yandex",bt="Whale",wt="DuckDuckGo",St="Pale Moon",xt="Waterfox",Et="Brave",Pt="Google Search App",Tt="(\\d+(\\.\\d+)?)",It=new RegExp("Version/"+Tt),kt=new RegExp(ot,"i"),$t=new RegExp(nt+" \\w+","i"),Rt=new RegExp(rt+" \\w+","i"),Ct=new RegExp(Ge+"|PlayBook|BB10","i"),Ot={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},At=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?Et:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ue(e,"GSA/")?Pt:ue(e," OPR/")&&ue(e,"Mini")?Ze:ue(e," OPR/")?Xe:Ct.test(e)?Ge:ue(e,"IE"+Fe)||ue(e,"WPDesktop")?Qe:ue(e,"OculusBrowser")?ft:ue(e,Ve)?je:ue(e,et)||ue(e,"Edg/")?tt:ue(e,mt+"/")?mt:ue(e,"YaBrowser/")?yt:ue(e,bt+"/")?bt:ue(e,wt+"/")||ue(e,"Ddg/")?wt:ue(e,"FBIOS")?"Facebook "+Fe:ue(e,"UCWEB")||ue(e,"UCBrowser")?"UC Browser":ue(e,"CriOS")?Ke:ue(e,"CrMo")||ue(e,We)?We:ue(e,Le)&&ue(e,He)?at:ue(e,"FxiOS")?st:ue(e.toLowerCase(),vt.toLowerCase())?vt:ue(e,Et+"/")?Et:((e,t)=>t&&ue(t,qe)||function(e){return ue(e,He)&&!ue(e,We)&&!ue(e,Le)}(e))(e,t)?ue(e,Fe)?lt:He:ue(e,"PaleMoon/")?St:ue(e,xt+"/")?xt:ue(e,it)?it:ue(e,"MSIE")||ue(e,"Trident/")?Je:ue(e,"Gecko")?it:"")},Ft={[Qe]:[new RegExp("rv:"+Tt)],[tt]:[new RegExp(et+"?\\/"+Tt)],[We]:[new RegExp("("+We+"|CrMo)\\/"+Tt)],[Ke]:[new RegExp("CriOS\\/"+Tt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Tt)],[He]:[It],[lt]:[It],[Xe]:[new RegExp("(Opera|OPR)\\/"+Tt)],[it]:[new RegExp(it+"\\/"+Tt)],[st]:[new RegExp("FxiOS\\/"+Tt)],[vt]:[new RegExp("Konqueror[:/]?"+Tt,"i")],[Ge]:[new RegExp(Ge+" "+Tt),It],[at]:[new RegExp("android\\s"+Tt,"i")],[je]:[new RegExp(Ve+"\\/"+Tt)],[ft]:[new RegExp("OculusBrowser\\/"+Tt)],[mt]:[new RegExp(mt+"\\/"+Tt)],[yt]:[new RegExp("YaBrowser\\/"+Tt)],[bt]:[new RegExp(bt+"\\/"+Tt)],[Et]:[new RegExp(Et+"\\/"+Tt)],[wt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Tt)],[St]:[new RegExp("PaleMoon\\/"+Tt)],[xt]:[new RegExp(xt+"\\/"+Tt)],[Pt]:[new RegExp("GSA\\/"+Tt)],[Je]:[new RegExp("(rv:|MSIE )"+Tt)],Mozilla:[new RegExp("rv:"+Tt)]},Mt=function(e,t,i,s){var r=At(e,t,i,s),n=Ft[r];if(ye(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Lt=[[new RegExp(ot+"; "+ot+" (.*?)[);]","i"),e=>[ot,e&&e[1]||""]],[new RegExp(rt,"i"),[rt,""]],[new RegExp(nt,"i"),[nt,""]],[Ct,[Ge,""]],[new RegExp(_t,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ut,""];if(new RegExp(Fe).test(t)&&!/IEMobile\b/.test(t))return[_t+" "+Fe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Ot[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[_t,s]}return[_t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Me,[e[3],e[4],e[5]||"0"].join(".")]:[Me,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ye(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Le+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Le+")","i"),e=>e&&e[2]?[Le,[e[2],e[3],e[4]||"0"].join(".")]:[Le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ye,""]],[/Linux|debian/i,["Linux",""]]],Dt=function(e){return Rt.test(e)?rt:$t.test(e)?nt:kt.test(e)?ot:new RegExp(ct,"i").test(e)?ct:new RegExp("("+ut+"|WPDesktop)","i").test(e)?ut:/iPad/.test(e)?Ne:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Be:Ct.test(e)?Ge:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(dt,"i").test(e)?dt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Fe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Le:Ue:new RegExp("(pda|"+Fe+")","i").test(e)?pt:new RegExp(De,"i").test(e)&&!new RegExp(De+" pc","i").test(e)?gt:""},Ut=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Nt(e,t){return"string"==typeof(i=e)&&Ut.test(i)?e:t();var i}function qt(e){return e?e.split("#")[0]:e}var Bt=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(q&&(r.DEBUG||Q.POSTHOG_DEBUG||i)&&!ye(q.console)&&q.console){for(var s=("__rrweb_original__"in q.console[t]?q.console[t].__rrweb_original__:q.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Bt(e+" "+t,i)};return s},Ht=Bt("[PostHog.js]"),Gt=Ht.createLogger;function zt(e,t){ge(e)&&e.forEach(t)}function Vt(e,t){if(!xe(e))if(ge(e))e.forEach(t);else if(Ie(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)he.call(e,i)&&t(e[i],i)}var jt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Wt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Ht.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ht.critical(e)}}},Yt=function(e){var t={};return Vt(e,(function(e,i){(be(e)&&e.length>0||Ee(e))&&(t[i]=e)})),t};var Kt=["herokuapp.com","vercel.app","netlify.app"];function Jt(e){var t=null==e?void 0:e.hostname;if(!be(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Kt)if(i===s)return!1;return!0}function Qt(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ee(e)&&isFinite(e)&&Math.floor(e)===e});class Xt{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new Xt(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Xt(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Zt{constructor(){this._timestamp=0,this._counter=0,this._random=new ii}generate(){var e=this.generateOrAbort();if(ye(e)){this._timestamp=0;var t=this.generateOrAbort();if(ye(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Xt.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var ei,ti=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};q&&!ye(q.crypto)&&crypto.getRandomValues&&(ti=e=>crypto.getRandomValues(e));class ii{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(ti(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var si=()=>ri().toString(),ri=()=>(ei||(ei=new Zt)).generate(),ni="",oi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ai={_is_supported:()=>!!z,_error(e){Ht.error("cookieStore error: "+e)},_get(e){if(z){try{for(var t=e+"=",i=z.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(ai._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!z)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=z),ni)return ni;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+si();!ni&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ni=n)}return ni}(e);if(!i){var s=(e=>{var t=e.match(oi);return t?t[0]:""})(e);s!==i&&Ht.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(z.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var _=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return _.length>3686.4&&Ht.warn("cookieStore warning: large cookie, len="+_.length),z.cookie=_,!0}catch(e){return!1}},_remove(e,t){if(null!=z&&z.cookie)try{ai._set(e,"",-1,t)}catch(e){return}}},li=null,_i={_is_supported(){if(!Se(li))return li;var e=!0;if(ye(q))e=!1;else try{var t="__mplssupport__";_i._set(t,"xyz"),'"xyz"'!==_i._get(t)&&(e=!1),_i._remove(t)}catch(t){e=!1}return e||Ht.error("localStorage unsupported; falling back to cookie store"),li=e,e},_error(e){Ht.error("localStorage error: "+e)},_get(e){try{return null==q?void 0:q.localStorage.getItem(e)}catch(e){_i._error(e)}return null},_parse(e){try{return JSON.parse(_i._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==q||q.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){_i._error(e)}return!1},_remove(e){try{null==q||q.localStorage.removeItem(e)}catch(e){_i._error(e)}}},ui=[o,"distinct_id",c,h,E,x,m],di={},ci={_is_supported:()=>!0,_error(e){Ht.error("memoryStorage error: "+e)},_get:e=>di[e]||null,_parse:e=>di[e]||null,_set:(e,t)=>(di[e]=t,!0),_remove(e){delete di[e]}},hi=null,pi={_is_supported(){if(!Se(hi))return hi;if(hi=!0,ye(q))hi=!1;else try{var e="__support__";pi._set(e,"xyz"),'"xyz"'!==pi._get(e)&&(hi=!1),pi._remove(e)}catch(e){hi=!1}return hi},_error(e){Ht.error("sessionStorage error: ",e)},_get(e){try{return null==q?void 0:q.sessionStorage.getItem(e)}catch(e){pi._error(e)}return null},_parse(e){try{return JSON.parse(pi._get(e))||null}catch(e){}return null},_set(e,t){try{return null==q||q.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){pi._error(e)}return!1},_remove(e){try{null==q||q.sessionStorage.removeItem(e)}catch(e){pi._error(e)}}};class gi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===R||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===k}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Ce(e)?1:ue(Oe,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?_i:ai;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?ai:_i;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ce(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==G?void 0:G.doNotTrack,null==G?void 0:G.msDoNotTrack,Q.doNotTrack].some((e=>Ce(e)))}}var vi=["next","previous","prev",">","<","+","-","−","–"];Gt("[Dead Clicks]");var fi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(u)),s=e.instance.config.capture_dead_clicks;return Te(s)?s:!!fe(s)||i},mi=Gt("[SegmentIntegration]");var yi="posthog-js";function bi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,_,u,d,c;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class wi{constructor(e,t,i,s,r,n){this.name=yi,this.setupOnce=function(o){o(bi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Si{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Ht.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==q?void 0:q.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:_,maxContentY:u}=r;if(!(ye(n)||ye(o)||ye(a)||ye(l)||ye(_)||ye(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),_=Math.ceil(_),u=Math.ceil(u);var d=n>1?Ae(o/n,0,1,Ht):1,c=n>1?Ae(a/n,0,1,Ht):1,h=l>1?Ae(_/l,0,1,Ht):1,p=l>1?Ae(u/l,0,1,Ht):1;s=jt(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:_,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var xi=["flags","surveys"],Ei={[n]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[_]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[u]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[d]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[c]:{exposure:"hidden"},[h]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>Se(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[p]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!fe(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[g]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[v]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[f]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},[E]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[T]:{exposure:"event"},[I]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Pi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ti=e=>{var t=Ei[e];if(t)return t;for(var[i,s]of Pi)if(0===e.indexOf(i))return s},Ii=e=>{var t=null==z?void 0:z.createElement("a");return ye(t)?null:(t.href=e,t)},ki=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!ge(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Ht.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$i=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),_=[],u=0;l.length>u;u++){var d=l[u].split("=");ge(d)&&(t.includes(d[0])?_.push(d[0]+"="+i):_.push(l[u]))}var c=a;return null!=o&&(c+="?"+_.join("&")),null!=r&&(c+="#"+r),c},Ri="https?://(.*)",Ci=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ci],Ai="<masked>",Fi=["li_fat_id"];function Mi(e,t){var i=Oi.concat(t||[]),s={};return Vt(i,(function(t){var i=ki(e,t);s[t]=i||null})),s}function Li(e){var t=function(e){return e?0===e.search(Ri+"google.([^/?]*)")?"google":0===e.search(Ri+"bing.com")?"bing":0===e.search(Ri+"yahoo.com")?"yahoo":0===e.search(Ri+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Se(t)){s.$search_engine=t;var r=z?ki(z.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Di(){return navigator.language||navigator.userLanguage}var Ui="$direct";function Ni(){return(null==z?void 0:z.referrer)||Ui}function qi(e,t,i){void 0===i&&(i=!1);var s=e?[...Ci,...t||[]]:[],r=i?qt(null==V?void 0:V.href):null==V?void 0:V.href,n=null==r?void 0:r.substring(0,1e3);return{r:Ni().substring(0,1e3),u:n?$i(n,s,Ai):void 0}}function Bi(e,t){var i;void 0===t&&(t=!1);var{r:s,u:r}=e,n=t?qt(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==Ui?Ui:null==(i=Ii(s))?void 0:i.host};if(n){o.$current_url=n;var a=Ii(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Mi(n);jt(o,l)}if(s){var _=Li(s);jt(o,_)}return o}function Hi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Gi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var zi={flags:f,surveys:g},Vi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ji="main";class Wi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Ht.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),q){var r=()=>this.flush();Qt(q,"beforeunload",r,{capture:!1}),Qt(q,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ee(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Vi.indexOf(e.persistence.toLowerCase())&&(Ht.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ui,...e];return i({},_i,{_parse(e){try{var i={};try{i=ai._parse(e)||{}}catch(e){}var s,r=JSON.parse(_i._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];Se(a)||""===a||(n[o]=a)}s=jt(r,n)}else s=jt(i,r);return _i._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=_i._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ai._set(e,l,i,r,n,o)}catch(e){_i._error(e)}return a},_remove(e,t){try{null==q||q.localStorage.removeItem(e),ai._remove(e,t)}catch(e){_i._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&_i._is_supported()?(t=_i,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&pi._is_supported()?t=pi:"memory"===n?t=ci:"cookie"===n?t=ai:s._is_supported()?(t=s,r=!0):t=ai,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[f];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Vt(this.props,((t,i)=>{var s=Ti(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===p?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&jt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=jt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of xi){var t=_i._parse(this._groupEntryName(e));if(t&&!me(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||jt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=Ti(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=zi[e];if(!i)return!1;var s=t[i],r=this.props[i];return Ee(s)&&Ee(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=Ti(e))?void 0:t.storageGroup:void 0,s=i?_i._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?ye(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){ye(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,ji))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,ji),xi)){var s,r=t[i];(!me(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(_i,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of xi)t[i]={};return Vt(this.props,((i,s)=>{var r,n=null==(r=Ti(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===ji)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Vt(e,((e,t)=>{var s;i[t]=null!=(s=Ti(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===ji||r.dirty||ye(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==ji&&(r.persisted=!0),ye(n)||(r.fingerprint=n)):this._config.debug&&Ht.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(ye(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of xi)_i._remove(this._groupEntryName(i));t?delete this._slotState[ji]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(fe(e)){ye(t)&&(t="None"),this._expire_days=ye(i)?this._default_expiry:i;var s=!1;if(Vt(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(fe(e)){this._expire_days=ye(t)?this._default_expiry:t;var i=!1;if(Vt(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!z)return{};var s,r=t?[...Ci,...i||[]]:[],n=Mi($i(z.URL,r,Ai),e),o=(s={},Vt(Fi,(function(e){var t=ai._get(e);s[e]=t||null})),s);return jt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);me(Yt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==z?void 0:z.referrer)?Li(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ni(),$referring_domain:null!=z&&z.referrer&&(null==(e=Ii(z.referrer))?void 0:e.host)||Ui},void 0)}set_initial_person_info(){this.props[w]||this.props[S]||this.register_once({[x]:qi(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Vt([S,w],(t=>{var i=this.props[t];i&&Vt(i,(function(t,i){e["$initial_"+de(i)]=t}))}));var t=this.props[x];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=Bi(e,t),s={};return Vt(i,(function(e,t){s["$initial_"+de(t)]=e})),s}(t,this._config.disable_capture_url_hashes);jt(e,i)}return e}safe_merge(e){return Vt(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[_]||{};i[e]=t,this._setProp(_,i),this.save()}remove_event_timer(e){var t=this.props[_]||{},i=t[e];return ye(i)||(delete t[e],this._setProp(_,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=Ti(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=Ti(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Yi={Activation:"events",Cancellation:"cancelEvents"},Ki={Button:"button",Tab:"tab",Selector:"selector"},Ji={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Qi={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Xi={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Zi={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},es={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ts={Once:"once",Recurring:"recurring",Always:"always"},is={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ss={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",SURVEY_LANGUAGE:"$survey_language"},rs={Popover:"popover",Inline:"inline"},ns={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},os={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},as={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ls=Gt("[RateLimiter]");class _s{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ls.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ls.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(b))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(b,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var us=Gt("[RemoteConfig]");class ds{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=Q._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=Q.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=Q.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(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 us.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void us.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return us.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){us.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&z&&"hidden"!==z.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||us.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var cs=["fatal","error","warning","log","info","debug"],hs={GZipJS:"gzip-js",Base64:"base64"},ps=Uint8Array,gs=Uint16Array,vs=Uint32Array,fs=new ps([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]),ms=new ps([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]),ys=new ps([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bs=function(e,t){for(var i=new gs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new vs(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},ws=bs(fs,2),Ss=ws[1];ws[0][28]=258,Ss[258]=28;for(var xs=bs(ms,0)[1],Es=new gs(32768),Ps=0;32768>Ps;++Ps){var Ts=(43690&Ps)>>>1|(21845&Ps)<<1;Es[Ps]=((65280&(Ts=(61680&(Ts=(52428&Ts)>>>2|(13107&Ts)<<2))>>>4|(3855&Ts)<<4))>>>8|(255&Ts)<<8)>>>1}var Is=function(e,t,i){for(var s=e.length,r=0,n=new gs(t);s>r;++r)++n[e[r]-1];var o,a=new gs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new gs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var _=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,c=d|(1<<u)-1;c>=d;++d)o[Es[d]>>>l]=_}else for(o=new gs(s),r=0;s>r;++r)o[r]=Es[a[e[r]-1]++]>>>15-e[r];return o},ks=new ps(288);for(Ps=0;144>Ps;++Ps)ks[Ps]=8;for(Ps=144;256>Ps;++Ps)ks[Ps]=9;for(Ps=256;280>Ps;++Ps)ks[Ps]=7;for(Ps=280;288>Ps;++Ps)ks[Ps]=8;var $s=new ps(32);for(Ps=0;32>Ps;++Ps)$s[Ps]=5;var Rs=Is(ks,9,0),Cs=Is($s,5,0),Os=function(e){return(e/8>>0)+(7&e&&1)},As=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof gs?gs:e instanceof vs?vs:ps)(i-t);return s.set(e.subarray(t,i)),s},Fs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Ms=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Ls=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ps(0),0];if(1==r){var o=new ps(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],_=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[d].f>i[_].f?_++:d++],l=i[_!=u&&i[d].f>i[_].f?_++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new gs(c+1),p=Ds(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ps(h),p]},Ds=function(e,t,i){return-1==e.s?Math.max(Ds(e.l,t,i+1),Ds(e.r,t,i+1)):t[e.s]=i},Us=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new gs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&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(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Ns=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},qs=function(e,t,i){var s=i.length,r=Os(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Bs=function(e,t,i,s,r,n,o,a,l,_,u){Fs(t,u++,i),++r[256];for(var d=Ls(r,15),c=d[0],h=d[1],p=Ls(n,15),g=p[0],v=p[1],f=Us(c),m=f[0],y=f[1],b=Us(g),w=b[0],S=b[1],x=new gs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=Ls(x,7),T=P[0],I=P[1],k=19;k>4&&!T[ys[k-1]];--k);var R,C,O,A,F=_+5<<3,M=Ns(r,ks)+Ns(n,$s)+o,L=Ns(r,c)+Ns(n,g)+o+14+3*k+Ns(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&L>=F)return qs(t,u,e.subarray(l,l+_));if(Fs(t,u,1+(M>L)),u+=2,M>L){R=Is(c,h,0),C=c,O=Is(g,v,0),A=g;var D=Is(T,I,0);for(Fs(t,u,y-257),Fs(t,u+5,S-1),Fs(t,u+10,k-4),u+=14,E=0;k>E;++E)Fs(t,u+3*E,T[ys[E]]);u+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Fs(t,u,D[B=31&q[E]]),u+=T[B],B>15&&(Fs(t,u,q[E]>>>5&127),u+=q[E]>>>12)}}else R=Rs,C=ks,O=Cs,A=$s;for(E=0;a>E;++E)if(s[E]>255){var B;Ms(t,u,R[257+(B=s[E]>>>18&31)]),u+=C[B+257],B>7&&(Fs(t,u,s[E]>>>23&31),u+=fs[B]);var H=31&s[E];Ms(t,u,O[H]),u+=A[H],H>3&&(Ms(t,u,s[E]>>>5&8191),u+=ms[H])}else Ms(t,u,R[s[E]]),u+=C[s[E]];return Ms(t,u,R[256]),u+C[256]},Hs=new vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gs=function(){for(var e=new vs(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),zs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Vs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=Gs[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,_=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ps(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),_=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?_=qs(l,_,e.subarray(u,d)):(l[u]=!0,_=qs(l,_,e.subarray(u,o)))}else{for(var c=Hs[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new gs(32768),f=new gs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new vs(25e3),S=new gs(288),x=new gs(32),E=0,P=0,T=(u=0,0),I=0,k=0;o>u;++u){var R=b(u),C=32767&u,O=f[R];if(v[C]=O,f[R]=C,u>=I){var A=o-u;if((E>7e3||T>24576)&&A>423){_=Bs(e,l,0,w,S,x,P,T,k,u-k,_),T=E=P=0,k=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,L=0,D=p,U=C-O&32767;if(A>2&&R==b(u-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,u),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[u+M]==e[u+M-U]){for(var H=0;B>H&&e[u+H]==e[u+H-U];++H);if(H>M){if(M=H,L=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=u-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(L){w[T++]=268435456|Ss[M]<<18|xs[L];var W=31&Ss[M],Y=31&xs[L];P+=fs[W]+ms[Y],++S[257+W],++x[Y],I=u+M,++E}else w[T++]=e[u],++S[e[u]]}}_=Bs(e,l,!0,w,S,x,P,T,k,u-k,_)}return As(a,0,s+Os(_)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=_.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&zs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(_,t),zs(_,u-8,i.d()),zs(_,u-4,s),_}var js=!!W||!!j,Ws="text/plain",Ys=!1,Ks=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Js=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Vt(e,(function(e,t){ye(e)||ye(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return _&&l.push(_),n+"?"+l.join("&")},Qs=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Xs=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===hs.GZipJS){var s=Vs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ps(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ps(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return As(s,0,r)}(Qs(t)),{mtime:0});return{contentType:Ws,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===hs.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Qs(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Qs(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Qs(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Zs=e=>{var t,s,r=()=>({url:Ks(e.url,"compression"),encodedBody:Xs(i({},e,{compression:void 0,_encodedBody:void 0}))});try{t=Xs(e)}catch(t){if(se(e.compression,ki(e.url,"compression")))return Ht.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&se(e.compression,ki(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?ie(new Uint8Array(s)):ArrayBuffer.isView(s)&&ie(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Ys=!0,r()):{url:e.url,encodedBody:t}},er=e=>{try{return Zs(e)}catch(t){return Ht.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},tr=function(){var e=t((function*(e){var t=Qs(e.data),s=yield function(e,t,i){return ae.apply(this,arguments)}(t,r.DEBUG,{rethrow:!0});if(!s)return e;var n=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:Ws,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),ir=(e,t)=>Js(e,{_:(new Date).getTime().toString(),ver:r.JS_SDK_VERSION,compression:t}),sr=[];j&&sr.push({transport:"fetch",method(e){var t,s=er(e);if(s){var{url:r,encodedBody:n}=s,{contentType:o,body:a,estimatedSize:l}=null!=n?n:{},_=new Headers;Vt(e.headers,(function(e,t){_.append(t,e)})),o&&_.append("Content-Type",o);var u=null,d=null;if(Y){var c=new Y;u={signal:c.signal,timeout:setTimeout((()=>{var t,i;t=e.timeout,(i=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",c.abort(d=i)}),e.timeout)}}j(r,i({method:(null==e?void 0:e.method)||"GET",headers:_,keepalive:"POST"===e.method&&52428.8>(l||0),body:a,signal:null==(t=u)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Ht.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{t===d?Ht.warn(t):Ht.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}}),W&&sr.push({transport:"XHR",method(e){var t=er(e);if(t){var i=new W,{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);var{contentType:n,body:o}=null!=r?r:{};Vt(e.headers,(function(e,t){i.setRequestHeader(t,e)})),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}}}),null!=G&&G.sendBeacon&&sr.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Zs(e),{contentType:s,body:r}=null!=i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});G.sendBeacon(t,n)}catch(e){}}});var rr=3e3;class nr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ae((null==t?void 0:t.flush_interval_ms)||rr,250,5e3,Ht.createLogger("flush interval"),rr),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&ge(i.data)&&Vt(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequestSafely(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Ht.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Vt(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;ye(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var or=["retriesPerformedSoFar"];class ar{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!ye(q)&&"onLine"in q.navigator&&(this._areWeOnline=q.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Qt(q,"online",this._onlineListener),Qt(q,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,or);Pe(t)&&(s.url=Js(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Ht.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Ht.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,ye(q)||(this._onlineListener&&(q.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(q.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Ht.error(e)}this._queue=[]}}class lr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Qt(q,"scroll",this._updateScrollData,{capture:!0}),Qt(q,"scrollend",this._updateScrollData,{capture:!0}),Qt(q,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==q?void 0:q.document.documentElement;var e=ge(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==q?void 0:q.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return q?"y"===e?q.scrollY||q.pageYOffset||q.document.documentElement.scrollTop||0:q.scrollX||q.pageXOffset||q.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var _r=e=>qi(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class ur{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[y]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||_r,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[y]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Bi(t,this._instance.config.disable_capture_url_hashes):{$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 Vt(Yt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+de(i)]=t})),e}}class dr{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var cr=Gt("[SessionId]");class hr{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new dr,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Pe(e)||!Pe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===R)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||si,this._windowIdGenerator=i||si;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ae(this._config.session_idle_timeout_seconds||1800,60,36e3,cr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=pi._parse(this._window_id_storage_key),o=pi._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:pi._remove(this._window_id_storage_key),pi._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){cr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ye(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&pi._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&pi._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?pi._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Se(t)&&!Se(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[c]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Pe(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(c):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Se(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[c]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=Pe(e)?e:0,i=Pe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[c];return ge(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&q&&(q.removeEventListener(M,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&pi._remove(this._primary_window_exists_storage_key)},Qt(q,M,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===R)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=Pe(r)&&Math.abs(i-r)>864e5,l=!1,_=!1,u=!s,d=s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);c&&((c=this._isSessionIdleAfterCrossTabRefresh(i))||cr.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,r]=this._getSessionId()),u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),cr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(_=s!==d)&&(cr.info("adopted cross-tab session id",{sessionId:s,windowId:o}),l=!0));var h=Pe(n)&&e&&!a?n:i,p=Pe(r)?r:(new Date).getTime();this._setWindowId(o),this._setSessionId(s,h,p),e||this._resetIdleTimer();var g={noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a,crossTabAdoption:_};return l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,g))),{sessionId:s,windowId:o,sessionStartTimestamp:p,changeReason:l?g:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function pr(){return(pr=t((function*(){var e=null==G?void 0:G.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return be(i)&&i.length>0?i:void 0}catch(e){return void Ht.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}))).apply(this,arguments)}function gr(e,t,i){return Qs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var vr="custom",fr="i.posthog.com",mr=/^\/static\//;class yr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+fr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":vr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(mr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===vr)return this.apiHost+t;var s=fr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var br=Gt("[Surveys]"),wr={ignoreConditions:!1,ignoreDelay:!1,displayType:rs.Popover},Sr=Gt("[PostHog ExternalIntegrations]"),xr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Er{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=Q.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Sr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=Q.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(xr[t],(()=>{var i;null==(i=Q.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=Q.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=Q.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var Pr,Tr={},Ir=0,kr=()=>{},$r='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Rr="Surveys module not available",Cr="sanitize_properties is deprecated. Use before_send instead",Or="Invalid value for property_denylist config: ",Ar="posthog",Fr=!js&&-1===(null==J?void 0:J.indexOf("MSIE"))&&-1===(null==J?void 0:J.indexOf("Mozilla")),Mr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Jt(null==z?void 0:z.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:kr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:V&&be(null==V?void 0:V.search)&&-1!==V.search.indexOf("__posthog_debug=true")||!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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==q||null==(t=q.location)?void 0:t.protocol),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_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Ht.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:A,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:rr},error_tracking:{},_onCapture:kr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:vi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)}))(e))},Lr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Dr=e=>{var t={};for(var[i,s]of Lr)ye(e[i])||(t[s]=e[i]);var r=jt({},t,e),n=e.__preview_external_dependency_versioned_paths;return ye(n)||(ye(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),be(n)&&ye(e.asset_host)&&(r.asset_host=n)),ge(e.property_blacklist)&&(ye(e.property_denylist)?r.property_denylist=e.property_blacklist:ge(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ht.error(Or+e.property_denylist)),r};class Ur{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ht.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Nr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===R||this.config.cookieless_mode===k&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Ur,this._personProcessingSetOncePropertiesSent=!1,this.version=r.LIB_VERSION,this._internalEventEmitter=new dr,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mr(),this.SentryIntegration=wi,this.sentryIntegration=e=>function(e,t){var i=bi(e,t);return{name:yi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new lr(this),this.pageViewManager=new Si(this),this.rateLimiter=new _s(this),this.requestRouter=new yr(this),this.consent=new gi(this),this.externalIntegrations=new Er(this);var t=null!==(e=Nr.__defaultExtensionClasses)&&void 0!==e?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:(e,t,i)=>{var s=be(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=be(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Ht.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Ar){var s,r=null!==(s=Tr[i])&&void 0!==s?s:new Nr;return r._init(e,t,i),Tr[i]=r,Tr[Ar][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var n,o;void 0===t&&(t={});var l=be(e)?e.trim():"";if(!l)return Ht.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._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var _=Mr(t.defaults),u=Dr(t),d=jt({},_,u,{name:s,token:l});fe(_.rageclick)&&fe(u.rageclick)&&(d.rageclick=jt({},_.rageclick,u.rageclick)),fe(_.session_recording)&&fe(u.session_recording)&&(d.session_recording=jt({},_.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Ht.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:hs.GZipJS;var c=this._is_persistence_disabled();this.persistence=new Wi(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wi(i({},this.config,{persistence:"sessionStorage"}),c,!1);var h=i({},this.persistence.props),p=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new nr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new ar(this),this.__request_queue=[];var g=this._inCookielessMode();if(g||(this.sessionManager=new hr(this),this.sessionPropsManager=new ur(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ht.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(g)}),0)):(Ht.info("Initializing extensions synchronously"),this._initExtensions(g)),r.DEBUG=r.DEBUG||this.config.debug,r.DEBUG&&Ht.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:h,s:p}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var v=t.bootstrap.distinctID,f=this.get_distinct_id(),y=this.persistence.get_property(m);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===C)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==v&&y===O)Ht.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(si()),w=t.bootstrap.isIdentifiedID?b:v;this.persistence.set_property(m,t.bootstrap.isIdentifiedID?O:C),this.register({distinct_id:v,$device_id:w})}}if(g)this.register_once({distinct_id:P,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(si());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(m,C)}return Qt(q,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||si();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(m,O)),t()},r=i.user();"then"in r&&ve(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||mi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(mi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(mi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,L),identify:e=>t(e,U),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),ve(this.config._onCapture)&&this.config._onCapture!==kr&&(Ht.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Ht.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.config.disableDeviceModel||function(){return pr.apply(this,arguments)}().then((e=>{e&&this.register({[a]:e})})).catch(kr),this}_initExtensions(e){var t,s,r,n,o,a,l,_=performance.now(),u=i({},Nr.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new u.featureFlags(this)),u.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._extensions.push(this.autocapture=new u.autocapture(this)),u.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,fi)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Ht.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[T]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[I]:s}),this.config.__preview_deferred_init_extensions&&Ht.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!z||!z.body)return Ht.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,hs.GZipJS)?hs.GZipJS:ue(e.supportedCompression,hs.Base64)?hs.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:A}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Ht.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=V&&V.hostname){var e=V.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ds(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&zt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(D),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(D,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?Fr?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(ye(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=ir(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=sr.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===hs.GZipJS&&K&&"undefined"!=typeof Promise&&!Ys?tr(n).then((e=>{l(e)})).catch((t=>{if(re(t))return Ys=!0,void l(i({},n,{compression:void 0,url:ir(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return re(e)||t===te})(t)&&(Ys=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Ir++;try{var t,i=[],s=[],r=[];zt(e,(e=>{if(e)if(ge(t=e[0]))r.push(e);else if(ve(e))try{e.call(this)}catch(t){Ht.error("Error executing queued PostHog call",e,t)}else ge(e)&&"alias"===t?i.push(e):ge(e)&&-1!==t.indexOf("capture")&&ve(this[t])?r.push(e):s.push(e)}));var n=function(e,t){zt(e,(function(e){try{if(ge(e[0])){var i=t;Vt(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Ht.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Ir--}}push(e){if(Ir>0&&ge(e)&&be(e[0])){var t=Nr.prototype[e[0]];ve(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!ye(e)&&be(e)){var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var u=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!be(null==t?void 0:t.$current_url)&&(Ht.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Ht.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 d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Nt(null==s?void 0:s.uuid,si),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===L&&this.config.__preview_capture_bot_pageviews&&_&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g=null==s?void 0:s.$unset;g&&(p.$unset=g);var v,f,m,y=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==N,e===U);if(y&&(p.$set_once=y),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>be(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),ge(t)?(s=[],zt(t,(t=>{s.push(e(t))}))):(s={},Vt(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=c,ye(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===is.DISMISSED||e===is.SENT){var b=null==t?void 0:t[ss.SURVEY_ID],w=null==t?void 0:t[ss.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})("seenSurvey_",e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){br.error("Failed to persist survey seen state",e)}})({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(v={id:b,current_iteration:w},f=e===is.SENT?"responded":"dismissed",m="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(m="$survey_"+f+"/"+v.id+"/"+v.current_iteration),m)]:!0})}else e===is.SHOWN&&(p.$set=i({},p.$set,{[ss.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===os.SHOWN){var S=null==t?void 0:t[as.TOUR_TYPE];S&&(p.$set=i({},p.$set,{[as.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(me(x)||this.setPersonPropertiesForFlags(x),!xe(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;(p=E).uuid=Nt(p.uuid,si)}this._internalEventEmitter.emit("eventCaptured",p);var P={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(P):this._requestQueue.enqueue(P),p}Ht.critical("This capture call is ignored due to client rate limiting.")}}else Ht.error("No event name provided to posthog.capture")}else Ht.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,n,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var _=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=_.distinct_id,(!be(l.distinct_id)&&!Ee(l.distinct_id)||we(l.distinct_id))&&Ht.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(e,t,i,s){var n,o,a,l;if(void 0===s&&(s=!1),!J)return{};var _,u,d,c,h,p,g,v,f,m=e?[...Ci,...t||[]]:[],[y,b]=function(e){for(var t=0;Lt.length>t;t++){var[i,s]=Lt[t],r=i.exec(e),n=r&&(ve(s)?s(r,e):s);if(n)return n}return["",""]}(J),w=null!=(_="undefined"!=typeof navigator?navigator:void 0)&&_.brave?{brave:!0}:{},S={detectGoogleSearchApp:i},x=jt(Yt({$os:y,$os_version:b,$browser:At(J,navigator.vendor,w,S),$device:Dt(J),$device_type:(d=J,c={userAgentDataPlatform:null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,maxTouchPoints:null==(o=navigator)?void 0:o.maxTouchPoints,screenWidth:null==q||null==(a=q.screen)?void 0:a.width,screenHeight:null==q||null==(l=q.screen)?void 0:l.height,devicePixelRatio:null==q?void 0:q.devicePixelRatio},f=Dt(d),f===Ne||f===Ue||"Kobo"===f||"Kindle Fire"===f||f===gt?De:f===rt||f===ot||f===nt||f===ct?"Console":f===Be?"Wearable":f?Fe:"Android"===(null==c?void 0:c.userAgentDataPlatform)&&(null!==(h=null==c?void 0:c.maxTouchPoints)&&void 0!==h?h:0)>0?600>Math.min(null!==(p=null==c?void 0:c.screenWidth)&&void 0!==p?p:0,null!==(g=null==c?void 0:c.screenHeight)&&void 0!==g?g:0)/(null!==(v=null==c?void 0:c.devicePixelRatio)&&void 0!==v?v:1)?Fe:De:"Desktop"),$timezone:Hi(),$timezone_offset:Gi()}),{$current_url:$i(s?qt(null==V?void 0:V.href):null==V?void 0:V.href,m,Ai),$host:null==V?void 0:V.host,$pathname:null==V?void 0:V.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Mt(J,navigator.vendor,w,S),$browser_language:Di(),$browser_language_prefix:(u=Di(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==q?void 0:q.screen.height,$screen_width:null==q?void 0:q.screen.width,$viewport_height:null==q?void 0:q.innerHeight,$viewport_width:null==q?void 0:q.innerWidth,$lib:r.LIB_NAME,$lib_version:r.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return r.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=r.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=c,l.$window_id=h}this.sessionPropsManager&&jt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&jt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===vr&&(l.$lib_custom_api_host=this.config.api_host),u=e!==L||o?e!==D||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=jt(l,u),e===L&&z&&(l.title=z.title),!ye(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=jt({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),ge(this.config.property_denylist)?Vt(this.config.property_denylist,(function(e){delete l[e]})):Ht.error(Or+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Ht.error(Cr),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=jt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Ht.error(Cr),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),me(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.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:Rr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Rr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Rr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=wr),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Rr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Rr})}_validateIdentifyId(e){return!e||we(e)?(Ht.critical("Unique user id has not been set in posthog.identify"),!1):e===P?(Ht.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Ht.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.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Ht.uninitializedWarning("posthog.identify");if(Ee(e)&&(e=e.toString(),Ht.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(m)||C)===C;e!==s&&n?(this.persistence.set_property(m,O),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(U,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=gr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(v))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=gr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Ht.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(ge(e)?e:[e]).filter((e=>be(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(N,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Ht.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,l,_,u,c;if(Ht.info("reset"),!this.__loaded)return Ht.uninitializedWarning("posthog.reset");var h,p=this.get_property(o),g=this.get_property(a),v=this.get_property(d);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),ye(v)||null==(h=this.persistence)||h.register({[d]:v}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(l=this.conversations)||l.reset(),null==(_=this.logs)||_.reset(),null==(u=this.persistence)||u.set_property(m,C),null==(c=this.sessionManager)||c.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===R)this.register_once({distinct_id:P,$device_id:null},"");else{var f=this.config.get_device_id(si());this.register_once({distinct_id:f,$device_id:e?f:p},""),e||ye(g)||this.register({[a]:g})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(n)?(Ht.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(ye(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ht.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(fe(e)){var s,n,o,a,l,_,u,d,c,h,p;jt(this.config,Dr(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);Te(v)&&(this.config.debug=v),Te(this.config.debug)&&(this.config.debug?(r.DEBUG=!0,_i._is_supported()&&_i._set("ph_debug",!0),Ht.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(r.DEBUG=!1,_i._is_supported()&&_i._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){r.LIB_NAME=e,r.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Nr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Ar;return t!==Ar&&(t=Ar+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(m))===O||(null==(t=this.sessionPersistence)?void 0:t.get_property(m))===O}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===A&&!this._isIdentified()&&me(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[E]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ht.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(E,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==k)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==R){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new hr(this),this.pageViewManager=new Si(this),this.persistence&&(this.sessionPropsManager=new ur(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Nr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var _,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==k&&(null==(_=this.surveys)||_.loadIfEnabled()),(ye(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Ht.warn($r)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==R?(this.config.cookieless_mode===k&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===k&&(this.register({distinct_id:P,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Ht.warn($r)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===R||(this.config.cookieless_mode===k?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return G?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&_e(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>_e(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(G,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){z&&("visible"===z.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(L,{title:z.title},{send_instantly:!0}),this._visibilityStateListener&&(z.removeEventListener(F,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Qt(z,F,this._visibilityStateListener)))}debug(e){!1===e?(null==q||q.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==q||q.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ht.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=Ht,r=(t="advanced_disable_flags")in(e=o)&&!xe(e[t]),n=i in e&&!xe(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){var t;if(xe(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($e),s=ge(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),xe(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return ke(e.event)?Ht.warn(o+". This can cause unexpected behavior."):Ht.info(o),null}r.properties&&!me(r.properties)||Ht.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&xe(r.properties[a]))return Ht.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=Te(e)&&!e,i=_i._is_supported()&&"true"===_i._get("ph_debug");return!t&&(!!i||e)}}Nr.__defaultExtensionClasses={},Nr._noopLogger={trace:Pr=()=>{},debug:Pr,info:Pr,warn:Pr,error:Pr,fatal:Pr},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Wt(e.prototype[t[i]])}(Nr,["identify"]);var qr=function(){r.SDK_DIST_CHANNEL="npm";var e=Tr[Ar]=new Nr;return function(){function e(){e.done||(e.done=!0,Fr=!1,Vt(Tr,(function(e){e._dom_loaded()})))}null!=z&&z.addEventListener?"complete"===z.readyState?e():Qt(z,"DOMContentLoaded",e,{capture:!1}):q&&Ht.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{hs as Compression,ns as DEFAULT_PRODUCT_TOUR_APPEARANCE,rs as DisplaySurveyType,Nr as PostHog,os as ProductTourEventName,as as ProductTourEventProperties,is as SurveyEventName,ss as SurveyEventProperties,Yi as SurveyEventType,Ji as SurveyPosition,es as SurveyQuestionBranchingType,Zi as SurveyQuestionType,ts as SurveySchedule,Qi as SurveyTabPosition,Xi as SurveyType,Ki as SurveyWidgetType,qr as default,qr as posthog,cs as severityLevels};
2
2
  //# sourceMappingURL=module.slim.no-external.js.map