posthog-js 1.431.0 → 1.431.2

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 (44) 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.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.no-external.js +1 -1
  11. package/dist/customizations.full.js +1 -1
  12. package/dist/customizations.js +1 -1
  13. package/dist/default-extensions.js +1 -1
  14. package/dist/exception-autocapture.js +1 -1
  15. package/dist/exception-autocapture.js.map +1 -1
  16. package/dist/extension-bundles.js +1 -1
  17. package/dist/lazy-recorder.js +1 -1
  18. package/dist/lazy-recorder.js.map +1 -1
  19. package/dist/main.js +1 -1
  20. package/dist/module.full.cjs +1 -1
  21. package/dist/module.full.js +1 -1
  22. package/dist/module.full.js.map +1 -1
  23. package/dist/module.full.no-external.cjs +1 -1
  24. package/dist/module.full.no-external.js +1 -1
  25. package/dist/module.full.no-external.js.map +1 -1
  26. package/dist/module.js +1 -1
  27. package/dist/module.mjs +1 -1
  28. package/dist/module.no-external.cjs +1 -1
  29. package/dist/module.no-external.js +1 -1
  30. package/dist/module.slim.js +1 -1
  31. package/dist/module.slim.no-external.js +1 -1
  32. package/dist/posthog-recorder.js +1 -1
  33. package/dist/posthog-recorder.js.map +1 -1
  34. package/dist/product-tours.js +1 -1
  35. package/dist/recorder-v2.js +1 -1
  36. package/dist/recorder-v2.js.map +1 -1
  37. package/dist/recorder.js +1 -1
  38. package/dist/recorder.js.map +1 -1
  39. package/dist/rrweb.js +1 -1
  40. package/dist/rrweb.js.map +1 -1
  41. package/lib/package.json +1 -1
  42. package/lib/src/entrypoints/exception-autocapture.js +23 -14
  43. package/lib/src/entrypoints/exception-autocapture.js.map +1 -1
  44. package/package.json +6 -6
@@ -1,2 +1,2 @@
1
- var t,e=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function s(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var o=t.apply(e,i);function a(t){r(o,s,n,a,l,"next",t)}function l(t){r(o,s,n,a,l,"throw",t)}a(void 0)})}}var n="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:n,a=null==o?void 0:o.navigator,l=null==o?void 0:o.document,h=null==o?void 0:o.location,u=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,v=null==o?void 0:o.AbortController,c=null==o?void 0:o.CompressionStream,_=null==a?void 0:a.userAgent,p="undefined"!=typeof globalThis?globalThis:n;p&&"undefined"==typeof self&&(p.self=p),p&&"undefined"==typeof File&&(p.File=function(){});var f=null!=n?n:{},g="0.8.3",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"browser-common",JS_SDK_VERSION:g},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),w=["$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"],y=["token"];function x(t,e){return-1!==t.indexOf(e)}var S=function(t){return t.replace(/^\$/,"")},E=Object.prototype,T=E.hasOwnProperty,k=E.toString,P=Array.isArray||function(t){return"[object Array]"===k.call(t)},R=t=>"function"==typeof t,O=t=>t===Object(t)&&!P(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,D=t=>null===t,N=t=>C(t)||D(t),F=t=>"[object Number]"==k.call(t)&&t==t,U=t=>F(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>x(w,t),j=t=>x(y,t);function z(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Error)}}var W=[!0,"true",1,"1","yes"],q=t=>x(W,t),G=[!1,"false",0,"0","no"],H=["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","pinterestbot","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"],V=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return H.concat(e).some(t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)})};function J(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),F(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),J(null!=s?s:i,e,i,r))}var Y="Mobile",K="Android",X="Tablet",Q="Android Tablet",Z="iPad",tt="Apple Watch",et="Safari",it="BlackBerry",rt="Samsung Internet",st="Chrome",nt="Chrome iOS",ot="Internet Explorer",at="Internet Explorer Mobile",lt="Opera",ht="Microsoft Edge",ut="Firefox",dt="Firefox iOS",vt="Nintendo",ct="PlayStation",_t="Xbox",pt="Android Mobile",ft="Mobile Safari",gt="Windows",mt="Windows Phone",bt="Nokia",wt="Ouya",yt="Generic "+Y.toLowerCase(),$t="Generic "+X.toLowerCase(),xt="Konqueror",St="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",Ot="Waterfox",It="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Dt="Google Search App",Nt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ft=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ut=new RegExp(_t,"i"),Bt=new RegExp("PlayStation \\w+","i"),Lt=new RegExp("Nintendo \\w+","i"),jt=new RegExp("BlackBerry|PlayBook|BB10","i"),zt={"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"},Wt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?It:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?Dt:x(t," OPR/")&&x(t,"Mini")?"Opera Mini":x(t," OPR/")?lt:jt.test(t)?it:x(t,"IEMobile")||x(t,"WPDesktop")?at:x(t,"OculusBrowser")?St:x(t,"SamsungBrowser")?rt:x(t,"Edge")||x(t,"Edg/")?ht:x(t,"Vivaldi/")?Et:x(t,"YaBrowser/")?Tt:x(t,"Whale/")?kt:x(t,"DuckDuckGo/")||x(t,"Ddg/")?Pt:x(t,"Claude/")?Ct:x(t,"Codex/")?At:x(t,"ChatGPT/")?Mt:x(t,"FBIOS")?"Facebook Mobile":x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?nt:x(t,"CrMo")||x(t,st)?st:x(t,K)&&x(t,et)?pt:x(t,"FxiOS")?dt:x(t.toLowerCase(),xt.toLowerCase())?xt:x(t,"Brave/")?It:((t,e)=>e&&x(e,"Apple")||function(t){return x(t,et)&&!x(t,st)&&!x(t,K)}(t))(t,e)?x(t,Y)?ft:et:x(t,"PaleMoon/")?Rt:x(t,"Waterfox/")?Ot:x(t,ut)?ut:x(t,"MSIE")||x(t,"Trident/")?ot:x(t,"Gecko")?ut:"")},qt={[at]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ht]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[st]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[nt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[et]:[Nt],[ft]:[Nt],[lt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gt=function(t,e,i,r){var s=qt[Wt(t,e,i,r)];if(C(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Ht=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[_t,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[jt,[it,""]],[new RegExp(gt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mt,""];if(new RegExp(Y).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[gt,r]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[K,[t[2],t[3],t[4]||"0"].join(".")]:[K,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Vt=function(t){return Lt.test(t)?vt:Bt.test(t)?ct:Ut.test(t)?_t:new RegExp(wt,"i").test(t)?wt:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?Z:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?tt:jt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(bt,"i").test(t)?bt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Y).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?K:Q:new RegExp("(pda|Mobile)","i").test(t)?yt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Jt],[/\bFBAN\/EMA\b/i,"Facebook Lite",Jt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Jt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Kt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xt(t,e){return"string"==typeof(i=t)&&Kt.test(i)?t:e();var i}function Qt(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function Zt(t){return t?t.split("#")[0]:t}var te,ee=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ie="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw Qt(ie,"Native gzip produced invalid output: "+t)},ae=function(){var t=s(function*(t,e){18>t.size&&oe("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(i)&&8===i[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;te[t]=e>>>0}return te})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&oe("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(e,i){return t.apply(this,arguments)}}();function le(){return le=s(function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=s(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield ae(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}}),le.apply(this,arguments)}var he=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={N(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];n&&(m.DEBUG||n.POSTHOG_DEBUG||i)&&!C(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>he(t+" "+e,i)};return r},ue=he("[PostHog.js]"),de=ue.createLogger,ve=de("[ExternalScriptsLoader]"),ce=t=>{var e=null==l?void 0:l.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},_e=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ve.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=ce(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,i(t)}))}var n=()=>{if(!l)return i("document not found");if(ce(e))return _e(t,e,i);var r=l.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)l.head.appendChild(r);else{var s,n=l.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):l.body.appendChild(r)}};null!=l&&l.body?n():null==l||l.addEventListener("DOMContentLoaded",n)},pe={},fe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=pe[s];if("fallback"===r&&n){if(ce(n))return void _e(t,n,i);delete pe[s]}_e(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=fe(t,e);pe[s]=a;var l=ce(s);null==l||null==(o=l.parentNode)||o.removeChild(l),_e(t,a,i)}else i(void 0,n)}:i)}else _e(t,fe(t,e),i)}else _e(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),i)},f.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{_e(t,t.requestRouter.endpointFor("api",e),i)},m.DEBUG=!1,m.LIB_VERSION="1.431.0",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",we="$device_id",ye="$device_model",$e="__alias",xe="__cmpns",Se="$fbc",Ee="$fbc_persistence",Te="__timers",ke="$autocapture_disabled_server_side",Pe="$heatmaps_enabled_server_side",Re="$exception_capture_enabled_server_side",Oe="$error_tracking_suppression_rules",Ie="$error_tracking_capture_extension_exceptions",Ce="$web_vitals_enabled_server_side",Ae="$dead_clicks_enabled_server_side",Me="$product_tours_enabled_server_side",De="$logs_capture_enabled_server_side",Ne="$web_vitals_allowed_metrics",Fe="$session_recording_remote_config",Ue="$session_recording_enabled_server_side",Be="$replay_sample_rate",Le="$replay_override_sampling",je="$replay_override_linked_flag",ze="$replay_override_url_trigger",We="$replay_override_event_trigger",qe="$sesid",Ge="$session_is_sampled",He="$session_past_minimum_duration",Ve="$session_recording_url_trigger_activated_session",Je="$session_recording_event_trigger_activated_session",Ye="$debug_first_full_snapshot_timestamp",Ke="$sess_rec_flush_size",Xe="$enabled_feature_flags",Qe="$active_feature_flags",Ze="$early_access_features",ti="$feature_flag_details",ei="$feature_flag_payloads",ii="$feature_flag_request_id",ri="$minimal_flag_called_events",si="$override_feature_flags",ni="$override_feature_flag_payloads",oi="$stored_person_properties",ai="$stored_group_properties",li="$groups",hi="$surveys",ui="$surveys_loaded_at",di="$surveys_activated",vi="$surveys_activated_session",ci="$surveys_activated_timestamps",_i="ph_product_tours",pi="$product_tours_activated",fi="$product_tours_activated_session",gi="$conversations_widget_session_id",mi="$conversations_ticket_id",bi="$conversations_widget_state",wi="$conversations_user_traits",yi="$flag_call_reported",$i="$flag_call_reported_session_id",xi="$feature_flag_errors",Si="$feature_flag_evaluated_at",Ei="$user_state",Ti="$client_session_props",ki="$capture_rate_limit",Pi="$initial_campaign_params",Ri="$initial_referrer_info",Oi="$initial_person_info",Ii="$epp",Ci="$posthog_cookieless",Ai="$cookieless_mode",Mi="$sdk_debug_extensions_init_method",Di="$sdk_debug_extensions_init_time_ms",Ni="$sdk_debug_recording_script_not_loaded",Fi="$sdk_debug_replay_event_trigger_status",Ui="$sdk_debug_replay_linked_flag_trigger_status",Bi="$sdk_debug_replay_matched_recording_trigger_groups",Li="$sdk_debug_replay_pending_trigger_conditions",ji="$sdk_debug_replay_remote_trigger_matching_config",zi="$sdk_debug_replay_trigger_groups_count",Wi="$sdk_debug_replay_url_trigger_status",qi="$session_recording_start_reason",Gi="anonymous",Hi="identified",Vi="identified_only",Ji="visibilitychange",Yi="beforeunload",Ki="$pageview",Xi="$pageleave",Qi="$identify",Zi="$groupidentify";function tr(t,e){P(t)&&t.forEach(e)}function er(t,e){if(!N(t))if(P(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)T.call(t,i)&&e(t[i],i)}var ir=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},rr=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},sr=function(t){var e={};return er(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function nr(t){var e=i({},t);for(var r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch(t){}return e}var or=["herokuapp.com","vercel.app","netlify.app"];function ar(t){var e=null==t?void 0:t.hostname;if(!A(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of or)if(i===r)return!1;return!0}function lr(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var hr=t=>{if(l){try{for(var e=t+"=",i=l.cookie.split(";").filter(t=>t.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return F(t)&&isFinite(t)&&Math.floor(t)===t});var ur=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>i||0>r||0>s||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},dr=class{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Ct=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t,e=(t=Date.now(),F(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return ur.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new _r}},vr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};n&&!C(n.crypto)&&crypto.getRandomValues&&(vr=t=>crypto.getRandomValues(t));var cr,_r=class{nextUint32(){return this.Rt.length>this.$t||(vr(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},pr=()=>fr().toString(),fr=()=>(cr||(cr=new dr)).generate(),gr="",mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var br=null,wr={Et(){if(!D(br))return br;if(br=!1,l)try{var t="__ph_cookie_support_"+pr();wr.At(t,"xyz"),br='"xyz"'===hr(t),wr.Lt(t)}catch(t){br=!1}return br},Pt(t){ue.error("cookieStore error: "+t)},Ot:hr,Dt(t){var e;try{e=JSON.parse(wr.Ot(t))||{}}catch(t){}return e},At(t,e,i,r,s){if(!l)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=l),gr)return gr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+pr();!gr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",gr=n)}return gr}(t);if(!i){var r=(t=>{var e=t.match(mr);return e?e[0]:""})(t);r!==i&&ue.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(l.location.hostname,r);if(i){var h=new Date;h.setTime(h.getTime()+864e5*i),n="; expires="+h.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+u.length),l.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null!=l&&l.cookie)try{wr.At(t,"",-1,e)}catch(t){return}}},yr=null,$r={Et(){if(!D(yr))return yr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";$r.At(e,"xyz"),'"xyz"'!==$r.Ot(e)&&(t=!1),$r.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),yr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){$r.Pt(t)}return null},Dt(t){try{return JSON.parse($r.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){$r.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){$r.Pt(t)}}},xr=[oi,Qe,Xe,ti,ei,ii,Si,xi,yi],Sr=[we,be,qe,Ge,Ii,Oi,Ee,Ei],Er=t=>t+"_cpm",Tr=["__proto__","constructor","prototype"],kr=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Tr.indexOf(i)&&(e[i]=t[i])}),e},Pr=function(t,e){void 0===e&&(e=[]);var i={};return[...Sr,...e].forEach(e=>{var r=t[e];C(r)||D(r)||""===r||(i[e]=r)}),i},Rr=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Or=(t,e)=>({p:e,f:Rr(JSON.stringify(t))}),Ir=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=wr.Dt(Er(t)),r=(null==i?void 0:i.f)===Rr(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Cr=(t,e)=>e+"|"+(wr.Ot(Er(t))||""),Ar={},Mr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Ar?Ar[t]:null,Dt:t=>t in Ar?Ar[t]:null,At:(t,e)=>(Ar[t]=e,!0),Lt(t){delete Ar[t]}},Dr=null,Nr={Et(){if(!D(Dr))return Dr;if(Dr=!0,C(n))Dr=!1;else try{var t="__support__";Nr.At(t,"xyz"),'"xyz"'!==Nr.Ot(t)&&(Dr=!1),Nr.Lt(t)}catch(t){Dr=!1}return Dr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Nr.Pt(t)}return null},Dt(t){try{return JSON.parse(Nr.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Nr.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Nr.Pt(t)}}},Fr=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Po()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Ao(){var t=this.Fo.Ot(this.Oo);return q(t)?1:x(G,t)?0:-1}get Fo(){var t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?$r:wr,i=e.Et()?e:Mr;if(!this.Do||this.Do!==i){this.Do=i;var r="localStorage"===t?wr:$r;r.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(q(r.Ot(this.Oo))),r.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Po(){return!!this.Mr.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>q(t))}},Ur=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var Br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ae)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Lr=de("[SegmentIntegration]");function jr(t,e,r){void 0===r&&(r=!0);var s=t.config.segment;if(!s)return e();var n,o=(t=>R(t.register))(n=s)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(t,e,i,r){var s=e=>{var s=()=>e.anonymousId()||pr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ei,Hi)),i(r?void 0:e.anonymousId()||void 0)},n=e.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,a,r=>{a.register(function(t,e,r){var s=(void 0===r?{}:r).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Lr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(r,n)=>{if(!n)return r;var o=!!e&&r.event.anonymousId===e&&!r.event.userId;o||r.event.userId||r.event.anonymousId===t.get_distinct_id()||(Lr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(Lr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!N(s)){var l=r.event.properties||{},h={};for(var u of Object.keys(a))T.call(l,u)||(h[u]=a[u]);var d=((t,e)=>{var r=P(t)?t:[t],s=i({},e);for(var n of r)try{if(s=n(s),N(s))return null}catch(t){return Lr.error("Error in Segment filterProperties:",t),null}return s})(s,h);if(N(d))return r;a=d}return r.event.properties=Object.assign({},a,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,Ki)},identify(t){return n(t,Qi)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:l})).then(()=>{e()},t=>{Lr.error("Failed to register the Segment integration",t),e()})},r)}var zr="posthog-js";function Wr(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return e=>{var r,a,h,d,v,c;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var _=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=_,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(r=e.exception)?void 0:r.values)||[],f=p.map(t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>i({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}var qr=class{constructor(t,e,i,r,s,n){this.name=zr,this.setupOnce=function(o){o(Wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Gr=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.jo)}destroy(){var t;null==(t=this.zo)||t.call(this),this.zo=void 0}doPageView(t,e){var i,r=this.Uo(t,e);return this.Bo={pathname:null!==(i=null==n?void 0:n.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Uo(t,null==(e=this.Bo)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Bo)?void 0:t.pageViewId}}Uo(t,e){var i=this.Bo;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?J(o/n,0,1,ue):1,v=n>1?J(a/n,0,1,ue):1,c=l>1?J(h/l,0,1,ue):1,_=l>1?J(u/l,0,1,ue):1;r=ir(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}},Hr=["flags","surveys"],Vr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"event"},[Pe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Re]:{exposure:"event"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"event"},[Ce]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"hidden"},[Ne]:{exposure:"event"},[Fe]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Be]:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},[He]:{exposure:"event"},[Ve]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[Ze]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden",storageGroup:"flags"},[ii]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[hi]:{exposure:"hidden",storageGroup:"surveys"},[ui]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[di]:{exposure:"event"},[vi]:{exposure:"hidden"},[ci]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"event"},[mi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[yi]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[li]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Le]:{exposure:"event"},[je]:{exposure:"event"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Mi]:{exposure:"event"},[Di]:{exposure:"event"},[Ni]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[qi]:{exposure:"event"}},Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Yr=t=>{var e=Vr[t];if(e)return e;for(var i of Jr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Kr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,nr(e)),i.get(e)):"bigint"==typeof e?e.toString():e,e)}catch(e){return s=[],null!==(r=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(e))return"[Circular]";s.push(e)}return e}}))&&void 0!==r?r:"null"}var r,s},Xr=t=>{var e=null==l?void 0:l.createElement("a");return C(e)?null:(e.href=t,e)},Qr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!P(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");P(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],es=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ts],is="<masked>",rs=["li_fat_id"];function ss(t,e){var i=es.concat(e||[]),r={};return er(i,function(e){var i=Qr(t,e);r[e]=i||null}),r}function ns(t){var e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!D(e)){r.$search_engine=e;var s=l?Qr(l.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function os(){return navigator.language||navigator.userLanguage}var as="$direct";function ls(){return(null==l?void 0:l.referrer)||as}function hs(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...ts,...e||[]]:[],n=null==(r=i?Zt(null==h?void 0:h.href):null==h?void 0:h.href)?void 0:r.substring(0,1e3);return{r:ls().substring(0,1e3),u:n?Zr(n,s,is):void 0}}function us(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Zt(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==as?as:null==(i=Xr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Xr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ir(o,ss(n))}return r&&ir(o,ns(r)),o}function ds(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cs={flags:Si,surveys:ui},_s=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ps=t=>t+"_cookie_identity_change_pending",fs=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},gs="main",ms=[Xe,Qe,ti,ei,ii,Si,ri,oi],bs=t=>-1!==ms.indexOf(t),ws=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},ys=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},$s=(t,e)=>{er(t,(i,r)=>{var s=Yr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},xs=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=t,this.nl=r,this.props={},this.sl=void 0,this.rl=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();lr(n,"beforeunload",s,{capture:!1}),lr(n,"pagehide",s,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){var e=Hr.find(e=>t.key===this.hl(e));e&&this.cl(t.key,e)}}else this.cl(t.key,gs)},lr(n,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.Ko.get(e);if(bs(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(e,s)}else this.dl(e,!0)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&n&&(n.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=$r.Ot(t),D(s)){var n=this.vl(e);return n.storageValue=null,e!==gs&&(n.persisted=!1),!1}r=ys(s)}catch(t){return!1}var o=e===gs?r:$r.Dt(this.rl);if(o&&this.fl(o))return!1;var a=this.pl(r,e,i);return e===gs&&this.Zo&&!ws(this.gl().main,r)||this.ml(r,e,!0,s),a}fl(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}ml(t,e,i,r){var s=this.vl(e);s.storageValue=r,e!==gs&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){var r=!1;return ms.forEach(i=>{var s,n=null==(s=Yr(i))?void 0:s.storageGroup;if(!(e===gs&&this.Zo&&n||e!==gs&&n!==e)){var o=i in t,a=this.bl(i,o?t[i]:void 0),l=this.Ko.has(i)?i in this.props:o;l===i in this.props&&ws(a,this.props[i])||(l?this._l(i,a,!1):this.wl(i,!1),r=!0)}}),r&&i&&this.il.forEach(t=>t()),r}kl(){if(!this.Vo)return!1;try{this.tl=!1;var t,e=$r.Ot(this.rl),i=this.vl(gs),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=ys(e),this.tl=!this.Yo&&this.fl(t),this.tl)return!1;s=this.pl(t,gs,!1),!this.Zo||ws(this.gl().main,t)?this.ml(t,gs,!0,e):i.storageValue=e,r=!0}return this.Zo&&Hr.forEach(e=>{var i=$r.Ot(this.hl(e)),n=this.vl(e),o=t||{},a=r&&ms.some(t=>{var i;return(null==(i=Yr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.pl(o,e,!1)||s));var l=ys(i);s=this.pl(l,e,!1)||s,this.ml(l,e,!0,i)}}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);var i=Yr(t);null!=i&&i.volatile||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||gs).fingerprint=void 0,this.Sl(t))}xl(){ms.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{var t=$r.Ot(this.rl),e=ys(t);this.vl(gs).storageValue=t,ms.forEach(t=>{var i,r=this.Zo?null==(i=Yr(t))?void 0:i.storageGroup:void 0,s=r?$r.Ot(this.hl(r)):null;if(r){var n=this.vl(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?ys(s):e;t in this.props?this.Cl(t,o[t],this.props[t]):t in o&&this.dl(t,!0)})}catch(t){}}bl(t,e){var r=this.Ko.get(t);if(!r)return e;if(!0===r)return this.props[t];if("$active_feature_flags"===t){var s=new Set(P(e)?e:[]),n=new Set(P(this.props[t])?this.props[t]:[]);return r.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=O(e)?i({},e):{},a=O(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Cl(t,e,i){if(bs(t)){var r=this.Ko.get(t);if(!0!==r){var s=e;if(this.Vo)try{var n,o=this.Zo?null==(n=Yr(t))?void 0:n.storageGroup:void 0,a=o?this.hl(o):this.rl;s=ys($r.Ot(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!C(e)&&!P(e)||!C(s)&&!P(s)||!P(i))return void this.dl(t,!0);var h=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!O(i))return void(ws(s,i)?this.Ko.delete(t):this.dl(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.dl(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&ws(v[t],i[t])||l.add(t)}),l.forEach(t=>{t in c==t in i&&ws(c[t],i[t])&&l.delete(t)})}l.size?this.dl(t,l):this.Ko.delete(t)}}}$l(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{var e=Pr(t,this.Mr.cookie_persisted_properties||[]),i=Or(e,this.Mr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=wr.Ot(this.rl)||void 0;s&&Cr(this.rl,s)===r&&(this.Il=r,this.Ml=s)}catch(t){}else try{var n=wr.Ot(this.rl)||void 0;this.Il=n?Cr(this.rl,n):void 0,this.Ml=n}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=wr.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;var r,s=Cr(this.rl,i);try{r=kr(JSON.parse(i))}catch(t){return!1}if((wr.Ot(this.rl)||void 0)!==i)return!1;this.Il=s,this.Ml=i;var n=Ir(this.rl,i),o=[...Sr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),I(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[be],d=h[Ei],v=ir({},h);[...Sr,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var e=v[t];(n.isValid||-1===Sr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=ir(v,r),ms.forEach(t=>{var e=t in this.props;t in h===e&&ws(h[t],this.props[t])||(e?this.Cl(t,h[t],this.props[t]):this.dl(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this._l(Ei,Gi);var c=this.props[be],_=this.props[Ei];return!l||c===u&&_===d||(this.Yo=!0,this.Qo=!0,Nr.At(ps(this.rl),!0),this.wl(oi),this.wl(Qe),this.wl(Xe),this.wl(ti),this.wl(ei),this.wl(ii),this.wl(Si),this.wl(xi),this.wl(yi),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||($s(this.props,r),this.wl(ai)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.wl($e)),!0}consumeCookieIdentityChange(){var t=ps(this.rl),e=this.Qo||!!Nr.Ot(t);return this.Qo=!1,e&&Nr.Lt(t),e}Rl(t){return void 0===t&&(t=!1),!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Pl(){this.Jo&&(C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[gs],this.Fl(!0))}Ol(t){if(void 0===t&&(t=!0),this.Jo)try{t?this.Pl():C(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===_s.indexOf(t.persistence.toLowerCase())&&(ue.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Sr,...t];return i({},$r,{Dt(t){try{var i,s={};try{i=wr.Ot(t)||void 0,s=i?kr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse($r.Ot(t)||"{}");if(e){var a=Ir(t,i),l=[...Sr,...a.properties],h={};Object.keys(s).forEach(t=>{var e=s[t];D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(h[t]=e)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[be],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";r.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var e=o[t];(a.isValid||-1===Sr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Ei]=Gi),!u||("distinct_id"in h?h[be]:o[be])===v&&("$user_state"in h?h[Ei]:o[Ei])===c||(xr.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[be]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[li],delete o[ai]),delete o.__alias)}n=ir(o,h)}else n=ir(s,o);return $r.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var l=$r.At(i,r,void 0,void 0,a);try{var h=Pr(r,t);if(Object.keys(h).length){if(e){var u=Er(i),d=Or(h,t);if(wr.At(u,d,s,n,o,a),wr.Ot(u)!==JSON.stringify(d)){wr.Lt(u,n);var v=Pr(r);return wr.At(i,v,s,n,o,a),l}}wr.At(i,h,s,n,o,a)}}catch(t){$r.Pt(t)}return l},Lt(t,e){try{null==n||n.localStorage.removeItem(t),wr.Lt(t,e),wr.Lt(Er(t),e)}catch(t){$r.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&$r.Et()?(e=$r,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Nr.Et()?e=Nr:"memory"===a?e=Mr:"cookie"===a&&wr.Et()?(e=wr,s=!0):r.Et()?(e=r,o=!0,s=!0):wr.Et()?(e=wr,s=!0):e=Mr,this.Vo=o,this.Go=s,e}hl(t){return this.rl+"__"+t}ll(t){return this.Vo&&!!t.split_storage}properties(){var t={};return er(this.props,(e,i)=>{var r=Yr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}}),t}load(t){if(void 0===t&&(t=!1),!this.pi||t){var e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?$r.Dt(this.rl):null,r={};if(e)try{er(r=kr(wr.Dt(this.rl)),(t,e)=>{(C(t)||D(t)||""===t)&&delete r[e]})}catch(t){}var s=this.Fo.Dt(this.rl);if(s&&(this.props=ir({},s)),this.Zo&&this.Dl(),e&&s){var n,o,a=null==i?void 0:i[be],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",h=s[be],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.Qo=!0,Nr.At(ps(this.rl),!0);var d=ir({},this.props);xr.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(C(a)||h===a)||($s(d,r),delete d[ai]),this.props=d;var v=new Set;xr.forEach(t=>{var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};er(this.props,(i,r)=>{var s;(null==(s=Yr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),I(e)?($r.Lt(this.hl(t)),this.Wo[t]={}):$r.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Nr.Ot(ps(this.rl))&&(this.Qo=!0)}}Dl(){for(var t of Hr){var e=$r.Dt(this.hl(t));if(e&&!I(e)){var i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||ir(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Yr(e))?void 0:i.storageGroup)===t})}Nl(t,e){var i=cs[t];if(!i)return!1;var r=e[i],s=this.props[i];return F(r)&&F(s)&&s>r}refreshKey(t){var e;if(!(this.pi||"$fbc_persistence"===t&&this.el)){var i=this.Zo?null==(e=Yr(t))?void 0:e.storageGroup:void 0,r=i?$r.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(r&&t in r)this._l(t,r[t],!1);else{if(i){var s=this.Fo.Dt(this.rl);if(s&&t in s)return void this._l(t,s[t],!1)}this.wl(t,!1)}}}save(){if(!this.pi){var t=this.$l();t>0?C(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}}flush(){C(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t){if(void 0===t&&(t=!1),!(this.pi||this.Jo&&!t)){t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(Ee));var e=!t&&!this.Xo;e||(this.tl=!1);var i=!!e&&this.kl();if(this.tl)this.Mr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));var r=this.jl(this.Fo,this.rl,this.props,gs);"written"===r&&this.Tl(this.props),"failed"!==r&&(this.Ko.clear(),this.Yo=!1,this.el=!1),i&&this.il.forEach(t=>t())}}}ql(){var t=this,e=this.gl(),i=e.main,r=e.groups,s=this.jl(this.Fo,this.rl,i,gs);"written"===s&&this.Tl(i),"failed"!==s&&(this.Yo=!1,this.el=!1,ms.forEach(t=>{var e;null!=(e=Yr(t))&&e.storageGroup||this.Ko.delete(t)}));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.Wo[e])||!i.persisted))return ms.forEach(i=>{var r;(null==(r=Yr(i))?void 0:r.storageGroup)===e&&t.Ko.delete(i)}),1;var n=t.jl($r,t.hl(e),s,e);"failed"!==n&&ms.forEach(i=>{var r=Yr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.Ko.delete(i)})};for(var o of Hr)if(n(o))continue}gl(){var t={},e={flags:{},surveys:{}};return er(this.props,(i,r)=>{var s,n=null==(s=Yr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}yl(t,e){if(e===gs)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;var i={};return er(t,(t,e)=>{var r;i[e]=null!=(r=Yr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,r){var s,n=this.vl(r);if(r!==gs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.yl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,r!==gs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.Vo&&(n.storageValue=$r.Ot(e)),"written"):(this.Mr.debug&&ue.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.xl(),C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!i&&this.nl)for(var r of Hr)$r.Lt(this.hl(r));i?delete this.Wo[gs]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Bl=C(i)?this.Ul:i;var r=!1;if(er(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Bl=C(e)?this.Ul:e;var i=!1;if(er(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||P(e))&&(this._l(r,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.wl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==l?void 0:l.URL;if(t!==this.sl){var e=function(t,e,i){if(!l)return{};var r,s=e?[...ts,...i||[]]:[],n=ss(Zr(l.URL,s,is),t);return ir((r={},er(rs,function(t){var e=hr(t);r[t]=e||null}),r),n)}(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!I(sr(e));return i&&this.register(e),this.sl=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==l?void 0:l.referrer)?ns(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ls(),$referring_domain:null!=l&&l.referrer&&(null==(t=Xr(l.referrer))?void 0:t.host)||as},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=hs(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Oi]:this.Go?{r:fs(t.r),u:t.u?fs(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};er([Ri,Pi],e=>{var i=this.props[e];i&&er(i,function(e,i){t["$initial_"+S(i)]=e})});var e=this.props[Oi];return e&&ir(t,function(t,e){void 0===e&&(e=!1);var i=us(t,e),r={};return er(i,function(t,e){r["$initial_"+S(e)]=t}),r}(e,this.Mr.disable_capture_url_hashes)),t}safe_merge(t){return er(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every((t,e)=>t===r[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.pi&&!l;l||this.El(e,h),this.Mr=t,!l&&(s||n||a)&&(this.Il=void 0,this.Ml=void 0,this.El(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.ol(t):this.Fo;this.Wl();var d=this.ll(t),v=o||d!==this.Zo,c=!l&&(v||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Rl(h);this.Xo=v;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var _=this.props;this.clear(),this.Fo=u,this.Zo=d,this.props=_,this.save()}else a&&(this.Fo=u,l||(delete this.Wo[gs],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){var t=this.props[Oi];if(this.Go&&O(t)&&"string"==typeof t.r){var e=fs(t.r),r="string"==typeof t.u?fs(t.u):t.u;e===t.r&&r===t.u||this._l(Oi,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this._l(Te,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this._l(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),"$fbc_persistence"!==t||ws(s,e)||(this.el=!0),this.Cl(t,s,e),null!=(r=Yr(t))&&r.volatile||this.Sl(t))}wl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(bs(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}},Ss={GZipJS:"gzip-js",Base64:"base64"},Es={Activation:"events",Cancellation:"cancelEvents"},Ts={Button:"button",Tab:"tab",Selector:"selector"},ks={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"},Ps={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Os={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Is={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Cs={Once:"once",Recurring:"recurring",Always:"always"},As={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ms={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"},Ds={Popover:"popover",Inline:"inline"};function Ns(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var Fs={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},Us={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"},Bs={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=de("[RateLimiter]"),js=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Ls.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ls.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(F(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Vl(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ki,a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&null!=h&&h.pathname)return""+(null!==(t=h.origin)&&void 0!==t?t:"")+h.pathname}Vl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Zl(),o=this.Gl("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}},zs=de("[RemoteConfig]"),Ws=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=f._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ql(t){var e,i;null!=(e=f.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return zs.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zs.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return zs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){zs.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||zs.warn("Failed to fetch remote config from PostHog."):zs.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){zs.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){zs.error("Error loading feature flags",t)}}},qs=["fatal","error","warning","log","info","debug"],Gs=Uint8Array,Hs=Uint16Array,Vs=Uint32Array,Js=new Gs([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]),Ys=new Gs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ks=new Gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xs=function(t,e){for(var i=new Hs(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Qs=Xs(Js,2),Zs=Qs[1];Qs[0][28]=258,Zs[258]=28;for(var tn=Xs(Ys,0)[1],en=new Hs(32768),rn=0;32768>rn;++rn){var sn=(43690&rn)>>>1|(21845&rn)<<1;en[rn]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}var nn=function(t,e,i){for(var r=t.length,s=0,n=new Hs(e);r>s;++s)++n[t[s]-1];var o,a=new Hs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Hs(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[en[d]>>>l]=h}else for(o=new Hs(r),s=0;r>s;++s)o[s]=en[a[t[s]-1]++]>>>15-t[s];return o},on=new Gs(288);for(rn=0;144>rn;++rn)on[rn]=8;for(rn=144;256>rn;++rn)on[rn]=9;for(rn=256;280>rn;++rn)on[rn]=7;for(rn=280;288>rn;++rn)on[rn]=8;var an=new Gs(32);for(rn=0;32>rn;++rn)an[rn]=5;var ln=nn(on,9,0),hn=nn(an,5,0),un=function(t){return(t/8|0)+(7&t&&1)},dn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Hs?Hs:t instanceof Vs?Vs:Gs)(i-e);return r.set(t.subarray(e,i)),r},vn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},cn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},_n=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Gs(0),0];if(1==s){var o=new Gs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Hs(v+1),_=pn(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort(function(t,e){return c[e.s]-c[t.s]||t.f-e.f});s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var w=n[r].s;c[w]==e&&(--c[w],++p)}_=e}return[new Gs(c),_]},pn=function(t,e,i){return-1==t.s?Math.max(pn(t.l,e,i+1),pn(t.r,e,i+1)):e[t.s]=i},fn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Hs(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},gn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mn=function(t,e,i){var r=i.length,s=un(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},bn=function(t,e,i,r,s,n,o,a,l,h,u){vn(e,u++,i),++s[256];for(var d=_n(s,15),v=d[0],c=d[1],_=_n(n,15),p=_[0],f=_[1],g=fn(v),m=g[0],b=g[1],w=fn(p),y=w[0],x=w[1],S=new Hs(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;y.length>E;++E)S[31&y[E]]++;for(var T=_n(S,7),k=T[0],P=T[1],R=19;R>4&&!k[Ks[R-1]];--R);var O,I,C,A,M=h+5<<3,D=gn(s,on)+gn(n,an)+o,N=gn(s,v)+gn(n,p)+o+14+3*R+gn(S,k)+(2*S[16]+3*S[17]+7*S[18]);if(D>=M&&N>=M)return mn(e,u,t.subarray(l,l+h));if(vn(e,u,1+(D>N)),u+=2,D>N){O=nn(v,c,0),I=v,C=nn(p,f,0),A=p;var F=nn(k,P,0);for(vn(e,u,b-257),vn(e,u+5,x-1),vn(e,u+10,R-4),u+=14,E=0;R>E;++E)vn(e,u+3*E,k[Ks[E]]);u+=3*R;for(var U=[m,y],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)vn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(vn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else O=ln,I=on,C=hn,A=an;for(E=0;a>E;++E)if(r[E]>255){var j;cn(e,u,O[257+(j=r[E]>>>18&31)]),u+=I[j+257],j>7&&(vn(e,u,r[E]>>>23&31),u+=Js[j]);var z=31&r[E];cn(e,u,C[z]),u+=A[z],z>3&&(cn(e,u,r[E]>>>5&8191),u+=Ys[z])}else cn(e,u,O[r[E]]),u+=I[r[E]];return cn(e,u,O[256]),u+I[256]},wn=new Vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yn=new Gs(0),$n=function(){for(var t=new Vs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Sn(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=$n[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Gs(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=mn(l,h,t.subarray(u,d)):(l[u]=n,h=mn(l,h,t.subarray(u,o)))}else{for(var v=wn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Hs(32768),g=new Hs(p+1),m=Math.ceil(i/3),b=2*m,w=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},y=new Vs(25e3),x=new Hs(288),S=new Hs(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var O=w(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){h=bn(t,l,0,y,x,S,T,k,R,u-R,h),k=E=T=0,R=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var D=2,N=0,F=_,U=I-C&32767;if(A>2&&O==w(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&I!=C;){if(t[u+D]==t[u+D-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>D){if(D=z,N=U,z>B)break;var W=Math.min(U,z-2),q=0;for(M=0;W>M;++M){var G=u-U+M+32768&32767,H=G-f[G]+32768&32767;H>q&&(q=H,C=G)}}}U+=(I=C)-(C=f[I])+32768&32767}if(N){y[k++]=268435456|Zs[D]<<18|tn[N];var V=31&Zs[D],J=31&tn[N];T+=Js[V]+Ys[J],++x[257+V],++S[J],P=u+D,++E}else y[k++]=t[u],++x[t[u]]}}h=bn(t,l,n,y,x,S,T,k,R,u-R,h),n||(h=mn(l,h,yn))}return dn(a,0,r+un(h)+s)}(n=t,null==(o=e).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,!h)),d=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&xn(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),xn(u,d-8,i.d()),xn(u,d-4,r),u}var En=!!d||!!u,Tn=new WeakMap,kn="text/plain",Pn=!1,Rn=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==e).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},On=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),h=null!==(s=null==a?void 0:a.split("&").map(t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return er(t,function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)}),s.join(e)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},In=t=>{if(t.Yl)return t.Yl;var e=t.data,i=t.compression;if(e){if(i===Ss.GZipJS){var r=Sn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gs(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},n=0;e>n;++n){if(r+5>i.length){var o=new Gs(r+8+(e-n<<1));o.set(i),i=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return dn(i,0,r)}(Kr(e)),{mtime:0});return{contentType:kn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ss.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Kr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Kr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Kr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Cn=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:On(t.url,{compression:Ss.Base64}),encodedBody:In(i({},t,{compression:Ss.Base64,Yl:void 0}))}:{url:Rn(t.url,"compression"),encodedBody:In(i({},t,{compression:void 0,Yl:void 0}))};try{e=In(t)}catch(e){if(se(t.compression,Qr(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,Qr(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Pn=!0,s()):{url:t.url,encodedBody:e}},An=t=>{try{return Cn(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Mn=function(){var t=s(function*(t){var e=yield function(t,e,i){return le.apply(this,arguments)}(Kr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Yl:{contentType:kn,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Dn=/Failed to fetch|NetworkError|Load failed/i,Nn=t=>"TypeError"===(null==t?void 0:t.name)&&Dn.test((null==t?void 0:t.message)||""),Fn=t=>{var e=An(t);if(e){var i=new d;Tn.set(i,!0);var r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;er(t.headers,function(t,e){i.setRequestHeader(e,t)}),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}},Un=t=>{var e=An(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;er(t.headers,function(t,e){h.append(e,t)}),o&&h.append("Content-Type",o);var d=null,c=!1;if(v){var _=new v;d={signal:_.signal,timeout:setTimeout(()=>{var e;c=!0,_.abort(Qt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))},t.timeout)}}var p=e=>{c&&"AbortError"===(null==e?void 0:e.name)||Nn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;u(r,i({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.ta&&52428.8>(l||0),body:a,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){ue.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>d?clearTimeout(d.timeout):null)}catch(t){d&&clearTimeout(d.timeout),p(t)}}},Bn=t=>{try{var e,r=Cn(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},l=o.body,h=o.estimatedSize;if(!l)return;var d=l instanceof Blob?l:new Blob([l],{type:o.contentType});if(a.sendBeacon(s,d))return;var v=P(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(P(v)&&v.length>1&&(null!=h?h:0)>16384){var c=Math.ceil(v.length/2),_=e=>P(t.data)?e:i({},t.data,{batch:e});return Bn(i({},t,{data:_(v.slice(0,c))})),void Bn(i({},t,{data:_(v.slice(c))}))}ue.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to "+(u?"fetch":"XHR")),u?Un(i({},t,{ta:!0})):Fn(t)}catch(t){ue.warn("Beacon send failed",t)}},Ln=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return On(r===Ss.GZipJS?Rn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ss.GZipJS?{}:{compression:r}))},jn=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Un}),d&&t.push({transport:"XHR",method:Fn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:Bn}),t})(),zn=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();var t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(i({},t,{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){var t=this.aa();for(var e in t)this.ua(t[e])}},this.na))}ua(t){try{this.sa(t)}catch(t){ue.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){var t={};return er(this.ia,e=>{var r,s=e,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?":"+s.batchGroup:"");C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.ia=[],t}},Wn=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.da=n.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},lr(n,"online",this.va),lr(n,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){var r=t.retriesPerformedSoFar,s=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,e);U(r)&&(s.url=On(s.url,{retry_count:r})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=r?r:0))return void this.Ls(i({retriesPerformedSoFar:r},s));0===t.statusCode&&ue.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!=r?r:0)+" retries.")}null==s.callback||s.callback(t)}}))}Ls(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(e),r=Date.now()+i;this.ia.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){var t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,C(n)||(this.va&&(n.removeEventListener("online",this.va),this.va=void 0),this.pa&&(n.removeEventListener("offline",this.pa),this.pa=void 0)),this.ia)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.ia=[]}},qn=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,r;this.ba||(this.ba={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(n),this.ba.maxScrollY=Math.max(n,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(l,null!==(r=this.ba.maxContentHeight)&&void 0!==r?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){var t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){lr(n,"scroll",this.ya,{capture:!0}),lr(n,"scrollend",this.ya,{capture:!0}),lr(n,"resize",this.ya)}scrollElement(){var t;if(!this._a)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this._a)?this._a:[this._a]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}wa(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this._a){var s=this.scrollElement();return s&&s[r]||0}return n?"y"===t?n.scrollY||n.pageYOffset||(null==(e=n.document)||null==(e=e.documentElement)?void 0:e.scrollTop)||0:n.scrollX||n.pageXOffset||(null==(i=n.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}},Gn=t=>hs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes),Hn=class{constructor(t,e,i,r){this.je=t=>{var e=this.ka();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Ti]:i})}},this._instance=t,this.Ca=e,this.xa=i,this.Sa=r||Gn,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Ti]}getSetOnceProps(){var t,e=null==(t=this.ka())?void 0:t.props;return e?"r"in e?us(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return er(sr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+S(i)]=e}),t}},Vn=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.$a[t]||[])i(e);for(var r of this.$a["*"]||[])r(t,e)}constructor(){this.$a={}}},Jn=de("[SessionId]"),Yn=864e5,Kn=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var r;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Ra=void 0,this.Pa=!1,this.Ta=new Vn,this.Aa=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||pr,this.Da=i||pr;var s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*J(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Jn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){var n=Nr.Dt(this.Na),o=Nr.Dt(this.qa);n&&!o?this.Be=n:Nr.Lt(this.Na),Nr.At(this.qa,!0)}null!=(r=this.Mr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Nr.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Nr.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Nr.Dt(this.Na):null}Ua(t){var e=this.Ia;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!r||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[qe]:[e,t,i]}))}Va(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(qe):(this.xa.flush(),this.xa.load())}Za(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ia){this.Ga();var e=this.Qa();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[qe]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}}Ja(){var t=this.Qa()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){var t=this.xa.props[qe];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Jn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Jn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Pa=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Ra&&n&&(n.removeEventListener(Yi,this.Ra,{capture:!1}),this.Ra=void 0),this.Ea=[]}Ba(){this.Ra=()=>{this.Za(),this.ja()&&Nr.Lt(this.qa)},lr(n,Yi,this.Ra,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=r;else if(D(this.Ma)||this.Ma>r||r-this.Ma>=1e3){var n,o;null==(n=(o=this.xa).syncCookieProperties)||n.call(o),this.Ma=r}var a=this.Qa(),l=a[1],h=a[2],u=!C(s)&&l!==s,d=this.Ja(),v=this.za(),c=this.Fa,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Yn),p=c?_:U(h)&&Math.abs(r-h)>Yn,f=!1,g=u,m=!l||!!c,b=l,w=!m&&!t&&this.Aa(r,d);if(w){(w=this.Ka(r))||Jn.info("cross-tab refresh kept the session alive",{sessionId:l});var y=this.Qa();l=y[1],h=y[2]}if(m||w||p){g=!1;var x=c&&!_;l=x?c.sessionId:this.Oa(),v=this.Da(),Jn.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Fa=void 0,f=!0}else v||(v=this.Da(),f=!0),(g=g||l!==b)&&(Jn.info("adopted cross-tab session id",{sessionId:l,windowId:v}),f=!0);var S=U(d)&&t&&!p?d:r,E=U(h)?h:(new Date).getTime();this.Ha(v),this.Wa(l,S,E),t||this.La();var T={noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ea.forEach(t=>t(l,v,T)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}La(){this.Pa||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Pa)if(this.Ka((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};function Xn(){return(Xn=s(function*(){var t=null==a?void 0:a.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e,i=null==(e=yield t.getHighEntropyValues(["model"]))?void 0:e.model;return A(i)&&i.length>0?i:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Qn(t,e){var i="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(i="$survey_"+e+"/"+t.id+"/"+t.current_iteration),i}function Zn(t,e,i){return Kr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var to,eo="custom",io="i.posthog.com",ro=/^\/static\//,so=["/s/","/e/","/i/"],no=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+io,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[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":eo),this.Ya[this.apiHost]}tu(t){if(ro.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}eu(t){var e=Xr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Xr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&so.some(t=>0===e.indexOf(t))){var a=this.eu(r);if(a){var l,h=this.apiHost,u=this.nu;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.nu=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.tu(e);if(i)return this.iu(t,e,""+i+e)}if(this.region===eo)return this.iu(t,e,this.apiHost+e);var r=io+e;switch(t){case"assets":return this.iu(t,e,"https://"+this.region+"-assets."+r);case"api":return this.iu(t,e,"https://"+this.region+"."+r)}}},oo=de("[Surveys]"),ao={ignoreConditions:!1,ignoreDelay:!1,displayType:Ds.Popover},lo=de("[PostHog ExternalIntegrations]"),ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},uo=class{constructor(t){this._instance=t}No(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return lo.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=f.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.No(ho[n],()=>{var e;null==(e=f.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=f.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}},vo=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return s(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.su.set(t.name,t);try{var i=t.setup(e.po);i&&(yield i)}catch(i){var r=e.su.get(t.name)===t;r&&e.su.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(!this.So){this.So=!0;var t=Array.from(this.su.values()).reverse();for(var e of(this.su.clear(),t))this.ru(e)}}ru(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,e=>{this.$.error('Failed to dispose browser extension "'+t.name+'"',e)})}catch(e){this.$.error('Failed to dispose browser extension "'+t.name+'"',e)}}},co=class{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}},_o="extensionsRemoteConfig",po=class{constructor(t){this.instance=t,this.So=!1,this.$=ue,this.ou=t.lu,this.kv=new co(t),this.onEvent=t=>Ns(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return Ns(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(_o,e);return this.ou&&e(this.ou),Ns(i)},this.uu=new vo(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(we);return"string"==typeof t?t:void 0}get library(){return{name:ge.LIB_NAME,version:ge.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var r=this;return s(function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)})()}registerDynamicEventProperties(t){return Ns(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(_o,t))}sendRequest(t,e){var i=this;return s(function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?On(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?b.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,i.instance._send_request(n)})})()}dispose(){this.So||(this.So=!0,this.uu.dispose())}},fo={},go=0,mo=()=>{},bo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',wo="Surveys module not available",yo="sanitize_properties is deprecated. Use before_send instead",$o="Invalid value for property_denylist config: ",xo=/^[A-Za-z0-9_-]{1,400}$/,So=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Eo=["token","distinct_id",Ai],To="posthog",ko=!En&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),Po=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Ro=t=>{var e;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:ar(null==l?void 0:l.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:h&&A(null==h?void 0:h.search)&&-1!==h.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(e=n.location)?void 0:e.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(t){ue.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Vi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mo},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ur,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Po(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},Oo=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Io=t=>{var e={};for(var i of Oo){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=ir({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),A(o)&&C(t.asset_host)&&(n.asset_host=o)),P(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:P(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error($o+t.property_denylist)),n},Co=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ao=(t=class t{du(t){if(t){var e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}}vu(t,e){return this.du(t),this.su.push(e),null==e.initialize||e.initialize(),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(!(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.mu||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}yu(){if(!this.fu()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.bu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(pr());this.register({distinct_id:i,$device_id:i}),t.set_property(Ei,Gi)}this._u()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var e;this.wu=!1,this.ku=!1,this.webPerformance=new Co,this.Su=!1,this.version=ge.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Vn,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ro(),this.SentryIntegration=qr,this.sentryIntegration=t=>function(t,e){var i=Wr(t,e);return{name:zr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new qn(this),this.pageViewManager=new Gr(this),this.rateLimiter=new js(this),this.requestRouter=new no(this),this.consent=new Fr(this),this.externalIntegrations=new uo(this);var i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t))}init(e,i,r){if(r&&r!==To){var s,n=null!==(s=fo[r])&&void 0!==s?s:new t;return n._init(e,i,r),fo[r]=n,fo[To][r]=n,n}return this._init(e,i,r)}_init(t,e,r){var s,o,a;void 0===e&&(e={});var l,h=A(t)?t.trim():"";if(!h)return ue.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 h!==(null==(l=this.config)?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ro(e.defaults),e.debug=this.Ru(e.debug),this.Pu=e,this.Au=[],e.person_profiles?this.Mu=e.person_profiles:e.process_person&&(this.Mu=e.process_person);var u=Ro(e.defaults),d=Io(e),v=ir({},u,d,{name:r,token:h});O(u.rageclick)&&O(d.rageclick)&&(v.rageclick=ir({},u.rageclick,d.rageclick)),O(u.session_recording)&&O(d.session_recording)&&(v.session_recording=ir({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ss.GZipJS;var c=this.bu();if(this.persistence=new xs(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Nr.Et()){var _=Nr.Dt(this.Cu);P(_)&&_.forEach(t=>{A(t)&&this.xu.add(t)})}else Nr.Lt(this.Cu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new zn(t=>this.Ou(t),this.config.request_queue_config),this.Du=new Wn(this),this.__request_queue=[];var g=this.fu();g||(this.sessionManager=new Kn(this),this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(g)},0)):(ue.info("Initializing extensions synchronously"),this.qu(g)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&ue.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:f}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(o=e.bootstrap)?void 0:o.distinctID;if(this.mu=!!m&&!M(m),null!=(a=e.bootstrap)&&a.distinctID){var b=e.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Ei);if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===y)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===y)ue.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 x=this.config.get_device_id(pr()),S=e.bootstrap.isIdentifiedID?x:b;this.persistence.set_property(Ei,e.bootstrap.isIdentifiedID?Hi:Gi),this.register({distinct_id:b,$device_id:S})}}if(g)this.register_once({distinct_id:Ci,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(pr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Ei,Gi)}return lr(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),lr(n,"pageshow",()=>{var t;this.wu=!1,this.ku||null==(t=this.Du)||t.resume()}),e.segment?jr(this,()=>this.ju()):this.ju(),R(this.config._onCapture)&&this.config._onCapture!==mo&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ue.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 Xn.apply(this,arguments)}().then(t=>{t&&this.register({[ye]:t})}).catch(mo),this}Bu(t){var e=t;return A(e.name)&&R(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.su.push(t)}Nu(){var e,i,r,s,n,o,a=null!==(e=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==e?e:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.Uu)||o.call(this),this.Uu=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}qu(e){var r,s,n,o,a,l,h,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.su.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.su.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.su.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.su.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Hu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Hu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Hu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.su.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.su.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.su.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.su.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.su.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.su.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.su.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.su.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Wu){var t=this.Wu;this.Wu=void 0,this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.Vu(v,u)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Mi]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Di]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Kl(t){var e;if(!l||!l.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=x(r.supportedCompression,Ss.GZipJS)?Ss.GZipJS:x(r.supportedCompression,Ss.Base64)?Ss.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Vi}),null==(e=this.Gu)||e.handleRemoteConfig(t),this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}ju(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var t=h.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new Ws(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Fu)||t.enable())}_dom_loaded(){this.is_capturing()&&tr(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,r,s;this.wu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Xi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Fu)||r.unload(),null==(s=this.Du)||s.unload()):this.Ku()&&this.capture(Xi,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?ko?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(n.compression)&&n.data&&(n.compression=Ss.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(P(o=n.data)?o:[o]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),P(t)?t.map(t=>i({},t,{sent_at:e})):i({},t,{sent_at:e})}(n.data))),n.url=Ln(n.url,n.method,n.compression,n.timestampMode);var v=jn.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),_=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!_)throw new Error("No available transport method");var p=t=>{try{_(t)}catch(t){Nn(t)?ue.warn(t):ue.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ss.GZipJS&&c&&"undefined"!=typeof Promise&&!Pn?Mn(n).then(t=>{p(t)}).catch(e=>{if(ne(e))return Pn=!0,void p(i({},n,{compression:void 0,url:Ln(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return ne(t)||e===ie})(e)&&(Pn=!0),p(n)}):_(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){go++;try{var e,i=[],r=[],s=[];tr(t,t=>{if(t)if(P(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else P(t)&&"alias"===e?i.push(t):P(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)});var n=function(t,e){tr(t,function(t){try{if(P(t[0])){var i=e;er(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}})};n(i,this),n(r,this),n(s,this)}finally{go--}}push(e){if(go>0&&P(e)&&A(e[0])){var i=t.prototype[e[0]];R(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}Xu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(Ee);return A(e)&&So.test(e)?{value:e,delivered:!1}:O(e)&&A(e.value)&&So.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Yu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(Ee);var s=this.Xu();if(!r){if(i)return A(e)&&So.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[Ee]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ee);if(A(t)&&xo.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ee]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ee)}}th(t){if(this.persistence){this.persistence.refreshKey(Ee);var e=this.Xu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[Ee]:{value:t,delivered:!0}})}}capture(t,e,r){var s,n,o,a,l,h,u,d,v,c,_;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu){if(this.is_capturing())if(!C(t)&&A(t)){this.yu();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var f=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==f||!f.isRateLimited){var g;null!=e&&e.$current_url&&!A(null==e?void 0:e.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r._originatedFromCaptureException||ue.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&&(g=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 m=new Date,b=(null==r?void 0:r.timestamp)||m,w=Xt(null==r?void 0:r.uuid,pr),y={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},b,w)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&p&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),f&&(y.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);var x="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!x&&(y.$set=null==r?void 0:r.$set);var S=O(null==e?void 0:e.$set)?e.$set:void 0,E=!(null==r||!r.$set)&&"$fbc"in r.$set,T=E||!!S&&"$fbc"in S,k=E?null==r||null==(s=r.$set)?void 0:s[Se]:null==S?void 0:S[Se],R=P(null==e?void 0:e.$unset)?e.$unset:[],M=(null==r?void 0:r.$unset)||[],D=-1!==R.indexOf("$fbc")||-1!==M.indexOf("$fbc"),F=this.Yu(null==(n=g)?void 0:n.fbclid,k,T,D);F&&!0===y.properties.$process_person_profile&&F.pending&&!T&&!x&&(y.$set=i({[Se]:F.value},y.$set));var U=null==r?void 0:r.$unset;U&&(y.$unset=U);var B=x?void 0:this.ih(null==r?void 0:r.$set_once,t!==Zi,t===Qi);if(B&&(y.$set_once=B),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,v=y,c=t=>A(t)?t.slice(0,d):t,_=new Set,y=function t(e,i){if(e!==Object(e))return c?c(e):e;if(!_.has(e)){var r;if(_.add(e),P(e))r=[],tr(e,e=>{r.push(t(e))});else{var s={};er(z(e)?nr(e):e,(e,i)=>{_.has(e)||(s[i]=t(e,i))}),r=s}return r}}(v)),y.timestamp=b,C(null==r?void 0:r.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=m),x&&(y.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ee.forEach(r),e.forEach(r),i}(y.properties,Eo)),t===As.DISMISSED||t===As.SENT){var L=null==e?void 0:e[Ms.SURVEY_ID],j=null==e?void 0:e[Ms.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){oo.error("Failed to persist survey seen state",t)}})({id:L,current_iteration:j}),y.$set=i({},y.$set,{[Qn({id:L,current_iteration:j},t===As.SENT?"responded":"dismissed")]:!0})}else t===As.SHOWN&&(y.$set=i({},y.$set,{[Ms.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Us.SHOWN){var W=null==e?void 0:e[Bs.TOUR_TYPE];W&&(y.$set=i({},y.$set,{[Bs.TOUR_LAST_SEEN_DATE+"/"+W]:(new Date).toISOString()}))}var q=i({},y.properties.$set,y.$set);if(I(q)||this.setPersonPropertiesForFlags(q),!N(this.config.before_send)){var G=this.Os(y);if(!G)return;(y=G).uuid=Xt(y.uuid,pr)}var H=null!==(o=null==(a=y.$set)?void 0:a.$fbc)&&void 0!==o?o:O(null==(l=y.properties)?void 0:l.$set)?y.properties.$set.$fbc:void 0,V=null!=F&&F.pending&&H===F.value?F.value:void 0;this.au.emit("eventCaptured",y);var J,Y=null!==(h=null==r?void 0:r._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),K="recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(Y),X=i({method:"POST",url:Y,data:y,compression:"best-available",timestampMode:K?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},K&&null!=(u=y.properties)&&u.$session_id?{batchGroup:y.properties.$session_id}:{},null!=r&&r.transport?{transport:r.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(V)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||V?(!X.transport&&!X.callback&&I(null!==(J=this.config.request_headers)&&void 0!==J?J:{})&&this.wu&&(X.transport="sendBeacon"),this.Ou(X)):this.Fu.enqueue(X),y}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null==(e=this.Gu)?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new po(this)}hu(t){this.$u.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}}nh(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.xu.clear(),this.sh()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.nh();var a=o?void 0:this.persistence.remove_event_timer(t),u=i({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.fu()&&(u[Ai]=!0),"$snapshot"===t){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!A(u.distinct_id)&&!F(u.distinct_id)||M(u.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,c=function(t,e,i,r){var s,o,a,l;if(void 0===r&&(r=!1),!_)return{};var u,d=t?[...ts,...e||[]]:[],v=function(t){for(var e=0;Ht.length>e;e++){var i=Ht[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(_),c=v[0],p=v[1],f=function(t){for(var e=0;Yt.length>e;e++){var i,r=Yt[e],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(i=n&&t.match(n)||o)?void 0:i[1])||""]}return["",""]}(_),g=f[0],b=f[1],w=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},y={};C(i)||(y.detectGoogleSearchApp=i);var x={},S=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,T=null==n||null==(a=n.screen)?void 0:a.width,k=null==n||null==(l=n.screen)?void 0:l.height,P=null==n?void 0:n.devicePixelRatio;C(S)||(x.userAgentDataPlatform=S),C(E)||(x.maxTouchPoints=E),C(T)||(x.screenWidth=T),C(k)||(x.screenHeight=k),C(P)||(x.devicePixelRatio=P);var O,I,A,M,D,N,F,U,B=ir(sr({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,w,y),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(I=_,A=x,U=Vt(I),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===wt?"Console":U===tt?"Wearable":U?Y:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(M=null==A?void 0:A.maxTouchPoints)&&void 0!==M?M:0)>0?600>Math.min(null!==(D=null==A?void 0:A.screenWidth)&&void 0!==D?D:0,null!==(N=null==A?void 0:A.screenHeight)&&void 0!==N?N:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?Y:X:"Desktop"),$timezone:ds(),$timezone_offset:vs()}),{$current_url:Zr(r?Zt(null==h?void 0:h.href):null==h?void 0:h.href,d,is),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:Gt(_,navigator.vendor,w,y),$browser_language:os(),$browser_language_prefix:(O=os(),"string"==typeof O?O.split("-")[0]:void 0),$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(B.$sdk_dist_channel=m.SDK_DIST_CHANNEL),B}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),f=p.windowId;u.$session_id=p.sessionId,u.$window_id=f}this.sessionPropsManager&&ir(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ir(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Du)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===eo&&(u.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||o?"$pageleave"!==t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=ir(u,v),"$pageview"===t&&l&&(u.title=l.title),!C(a)){var b=r.getTime()-a;u.$duration=parseFloat((b/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var w=this.persistence.properties(),y=this.sessionPersistence.properties(),x=u.$groups,S=w.$groups;O(x)&&!I(x)&&(u.$groups=i({},O(S)?S:{},x)),er(["$referrer","$referring_domain"],t=>{t in w&&delete y[t]});var E={};if(this.$u.length>0)for(var T of this.$u.slice())try{ir(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=ir({},c,w,y,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?er(this.config.property_denylist,function(t){delete u[t]}):ue.error($o+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(yo),u=k(u,t));var D=this.rh();return u.$process_person_profile=D,D&&!o&&this.oh("_calculate_event_properties"),u}ih(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rh())return t;if(this.Su&&!i)return t;var s=ir({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(yo),s=n(s,"$set_once")),e&&(this.Su=!0),I(s)?void 0:s}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.nh(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.xu.delete(t),this.sh()}ah(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(this.Cu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Nr.Et())Nr.Lt(this.Cu);else{var e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Nr.At(this.Cu,e):Nr.Lt(this.Cu)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:wo}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:wo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:wo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=ao),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:wo}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:wo})}uh(t){return!t||M(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ue.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ue.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return ue.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.uh(t)&&this.oh("posthog.identify")){this.yu();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.nh(!1),o=this.persistence.Rl(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister($e),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===Gi,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Ei,Hi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Pl(),this.capture(Qi,c,{$set:e||{},$set_once:i||{}}),this.Eu=Zn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Ei,Hi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Pl(),this.capture("$set",{$set:_,$set_once:p}),this.Eu=Zn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(yi)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}}setPersonProperties(t,e){if((t||e)&&this.oh("posthog.setPersonProperties")){var i=Zn(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Eu=i):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(P(t)?t:[t]).filter(t=>A(t)&&t.length>0);0!==i.length&&this.oh("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.nh();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.rh()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(Zi,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ue.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.oh("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=B(t)?t:null==t?void 0:t.resetDeviceID,i=B(t)||null==t?void 0:t.bootstrap;this.hh(e,!1,i)}hh(t,e,r){var s,n,o,a;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var l=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Pu)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var h=this.get_property(we),u=this.get_property(ye),d=this.get_property(Fe);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var c=null==(a=this.persistence)||null==a.Rl?void 0:a.Rl(),_=!1;try{var p,f,g,m,b,w,y,x,S,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.xu.clear(),this.sh(),C(d)||null==(g=this.persistence)||g.register({[Fe]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Ei,Gi),null==(E=this.sessionManager)||E.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ci,$device_id:null},"");else{var R=this.config.get_device_id(pr());this.register_once({distinct_id:R,$device_id:t?R:h},""),t||C(u)||this.register({[ye]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.fu()&&(null==(P=this.persistence)||P.set_property(Ei,r.isIdentifiedID?Hi:Gi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(N(l)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(l,!0))){var O=i({},r);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var I;c&&(null==(I=this.persistence)||null==I.Ol||I.Ol(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a,l;if(e.__loaded){e.ku=!0,e.zu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.metrics)||s.dispose(),null==(n=e.Fu)||n.unload(),null==(o=e.Du)||o.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(a=e.persistence)||a.destroy(),null==(l=e.sessionPersistence)||l.destroy()}else ue.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property("$people_distinct_id")?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.ah($e,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(O(t)){var r,s,n,o,a,l,h,u,d,v,c,_,p,f;ir(this.config,Io(t));var g=this.bu();null==(r=this.persistence)||r.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.Ru(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,$r.Et()&&$r.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,$r.Et()&&$r.Lt("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.metrics)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._u(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&jr(this,mo,!1)}}_overrideSDKInfo(t,e){ge.LIB_NAME=t,ge.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},r,e))}catch(t){return}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var e,i;return null!==(e=null==(i=this.logs)?void 0:i.logger)&&void 0!==e?e:t.ph}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:To;return e!==To&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(e=this.sessionPersistence)?void 0:e.get_property("$user_state"))}rh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Ii,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e,i,r,s,n=this.bu();return this.is_capturing()||null==(t=this.logs)||t._onOptOut(),(null==(e=this.persistence)?void 0:e.pi)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.pi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.xu.clear(),this.sh()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Kn(this),this.pageViewManager=new Gr(this),this.persistence&&(this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.vu(this.sessionRecording,new v(this)),this.lu&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ue.warn(bo)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,e,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ci,$device_id:null}),this.du(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}else ue.warn(bo)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return a?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&V(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>V(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver}(a,this.config.custom_blocked_useragents):void 0}Qu(){l&&("visible"===l.visibilityState?this.Tu||(this.Tu=!0,this.capture(Ki,{title:l.title},{send_instantly:!0}),this.Iu&&(l.removeEventListener(Ji,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),lr(l,Ji,this.Iu)))}debug(t){!1===t?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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 t=this.Pu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ue.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):function(t,e,i,r,s){var n=e in t&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,ue)}Os(t){var e;if(N(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=P(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),N(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!I(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return ue.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&N(s.properties[a]))return ue.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Bo)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Ru(t){var e=B(t)&&!t,i=$r.Et()&&"true"===$r.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t.ph={trace:to=()=>{},debug:to,info:to,warn:to,error:to,fatal:to},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=rr(t.prototype[e[i]])}(Ao,["identify"]);var Mo=function(){ge.SDK_DIST_CHANNEL="npm";var t=fo[To]=new Ao;return function(){function t(){t.done||(t.done=!0,ko=!1,er(fo,function(t){t._dom_loaded()}))}null!=l&&l.addEventListener?"complete"===l.readyState?t():lr(l,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ss as Compression,Fs as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ds as DisplaySurveyType,Ao as PostHog,Us as ProductTourEventName,Bs as ProductTourEventProperties,As as SurveyEventName,Ms as SurveyEventProperties,Es as SurveyEventType,ks as SurveyPosition,Is as SurveyQuestionBranchingType,Os as SurveyQuestionType,Cs as SurveySchedule,Ps as SurveyTabPosition,Rs as SurveyType,Ts as SurveyWidgetType,Mo as default,Mo as posthog,qs as severityLevels};
1
+ var t,e=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function s(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var o=t.apply(e,i);function a(t){r(o,s,n,a,l,"next",t)}function l(t){r(o,s,n,a,l,"throw",t)}a(void 0)})}}var n="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:n,a=null==o?void 0:o.navigator,l=null==o?void 0:o.document,h=null==o?void 0:o.location,u=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,v=null==o?void 0:o.AbortController,c=null==o?void 0:o.CompressionStream,_=null==a?void 0:a.userAgent,p="undefined"!=typeof globalThis?globalThis:n;p&&"undefined"==typeof self&&(p.self=p),p&&"undefined"==typeof File&&(p.File=function(){});var f=null!=n?n:{},g="0.8.3",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"browser-common",JS_SDK_VERSION:g},b=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),w=["$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"],y=["token"];function x(t,e){return-1!==t.indexOf(e)}var S=function(t){return t.replace(/^\$/,"")},E=Object.prototype,T=E.hasOwnProperty,k=E.toString,P=Array.isArray||function(t){return"[object Array]"===k.call(t)},R=t=>"function"==typeof t,O=t=>t===Object(t)&&!P(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,A=t=>"[object String]"==k.call(t),M=t=>A(t)&&0===t.trim().length,D=t=>null===t,N=t=>C(t)||D(t),F=t=>"[object Number]"==k.call(t)&&t==t,U=t=>F(t)&&t>0,B=t=>"[object Boolean]"===k.call(t),L=t=>x(w,t),j=t=>x(y,t);function z(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Error)}}var W=[!0,"true",1,"1","yes"],q=t=>x(W,t),G=[!1,"false",0,"0","no"],H=["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","pinterestbot","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"],V=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return H.concat(e).some(t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)})};function J(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),F(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),J(null!=s?s:i,e,i,r))}var Y="Mobile",K="Android",X="Tablet",Q="Android Tablet",Z="iPad",tt="Apple Watch",et="Safari",it="BlackBerry",rt="Samsung Internet",st="Chrome",nt="Chrome iOS",ot="Internet Explorer",at="Internet Explorer Mobile",lt="Opera",ht="Microsoft Edge",ut="Firefox",dt="Firefox iOS",vt="Nintendo",ct="PlayStation",_t="Xbox",pt="Android Mobile",ft="Mobile Safari",gt="Windows",mt="Windows Phone",bt="Nokia",wt="Ouya",yt="Generic "+Y.toLowerCase(),$t="Generic "+X.toLowerCase(),xt="Konqueror",St="Oculus Browser",Et="Vivaldi",Tt="Yandex",kt="Whale",Pt="DuckDuckGo",Rt="Pale Moon",Ot="Waterfox",It="Brave",Ct="Claude",At="Codex",Mt="ChatGPT",Dt="Google Search App",Nt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ft=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ut=new RegExp(_t,"i"),Bt=new RegExp("PlayStation \\w+","i"),Lt=new RegExp("Nintendo \\w+","i"),jt=new RegExp("BlackBerry|PlayBook|BB10","i"),zt={"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"},Wt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?It:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?Dt:x(t," OPR/")&&x(t,"Mini")?"Opera Mini":x(t," OPR/")?lt:jt.test(t)?it:x(t,"IEMobile")||x(t,"WPDesktop")?at:x(t,"OculusBrowser")?St:x(t,"SamsungBrowser")?rt:x(t,"Edge")||x(t,"Edg/")?ht:x(t,"Vivaldi/")?Et:x(t,"YaBrowser/")?Tt:x(t,"Whale/")?kt:x(t,"DuckDuckGo/")||x(t,"Ddg/")?Pt:x(t,"Claude/")?Ct:x(t,"Codex/")?At:x(t,"ChatGPT/")?Mt:x(t,"FBIOS")?"Facebook Mobile":x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?nt:x(t,"CrMo")||x(t,st)?st:x(t,K)&&x(t,et)?pt:x(t,"FxiOS")?dt:x(t.toLowerCase(),xt.toLowerCase())?xt:x(t,"Brave/")?It:((t,e)=>e&&x(e,"Apple")||function(t){return x(t,et)&&!x(t,st)&&!x(t,K)}(t))(t,e)?x(t,Y)?ft:et:x(t,"PaleMoon/")?Rt:x(t,"Waterfox/")?Ot:x(t,ut)?ut:x(t,"MSIE")||x(t,"Trident/")?ot:x(t,"Gecko")?ut:"")},qt={[at]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ht]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[st]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[nt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[et]:[Nt],[ft]:[Nt],[lt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ut]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[xt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[it]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nt],[pt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[rt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Et]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[kt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ct]:[Ft],[At]:[Ft],[Mt]:[Ft],[Pt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ot]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gt=function(t,e,i,r){var s=qt[Wt(t,e,i,r)];if(C(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Ht=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[_t,t&&t[1]||""]],[new RegExp(vt,"i"),[vt,""]],[new RegExp(ct,"i"),[ct,""]],[jt,[it,""]],[new RegExp(gt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[mt,""];if(new RegExp(Y).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[gt,r]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[K,[t[2],t[3],t[4]||"0"].join(".")]:[K,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Vt=function(t){return Lt.test(t)?vt:Bt.test(t)?ct:Ut.test(t)?_t:new RegExp(wt,"i").test(t)?wt:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?mt:/iPad/.test(t)?Z:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?tt:jt.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(bt,"i").test(t)?bt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Y).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?K:Q:new RegExp("(pda|Mobile)","i").test(t)?yt:new RegExp(X,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?$t:""},Jt=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Jt],[/\bFBAN\/EMA\b/i,"Facebook Lite",Jt],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Jt],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Kt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Xt(t,e){return"string"==typeof(i=t)&&Kt.test(i)?t:e();var i}function Qt(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function Zt(t){return t?t.split("#")[0]:t}var te,ee=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ie="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,e)=>t===b.GZipJS||e===b.GZipJS||"gzip"===e,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw Qt(ie,"Native gzip produced invalid output: "+t)},ae=function(){var t=s(function*(t,e){18>t.size&&oe("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(i)&&8===i[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;te[t]=e>>>0}return te})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&oe("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(e,i){return t.apply(this,arguments)}}();function le(){return le=s(function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=s(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield ae(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}}),le.apply(this,arguments)}var he=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={N(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];n&&(m.DEBUG||n.POSTHOG_DEBUG||i)&&!C(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.N("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>he(t+" "+e,i)};return r},ue=he("[PostHog.js]"),de=ue.createLogger,ve=de("[ExternalScriptsLoader]"),ce=t=>{var e=null==l?void 0:l.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},_e=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ve.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=ce(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,i(t)}))}var n=()=>{if(!l)return i("document not found");if(ce(e))return _e(t,e,i);var r=l.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)l.head.appendChild(r);else{var s,n=l.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):l.body.appendChild(r)}};null!=l&&l.body?n():null==l||l.addEventListener("DOMContentLoaded",n)},pe={},fe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=pe[s];if("fallback"===r&&n){if(ce(n))return void _e(t,n,i);delete pe[s]}_e(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=fe(t,e);pe[s]=a;var l=ce(s);null==l||null==(o=l.parentNode)||o.removeChild(l),_e(t,a,i)}else i(void 0,n)}:i)}else _e(t,fe(t,e),i)}else _e(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),i)},f.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{_e(t,t.requestRouter.endpointFor("api",e),i)},m.DEBUG=!1,m.LIB_VERSION="1.431.2",m.LIB_NAME="web";var ge=m,me="$people_distinct_id",be="distinct_id",we="$device_id",ye="$device_model",$e="__alias",xe="__cmpns",Se="$fbc",Ee="$fbc_persistence",Te="__timers",ke="$autocapture_disabled_server_side",Pe="$heatmaps_enabled_server_side",Re="$exception_capture_enabled_server_side",Oe="$error_tracking_suppression_rules",Ie="$error_tracking_capture_extension_exceptions",Ce="$web_vitals_enabled_server_side",Ae="$dead_clicks_enabled_server_side",Me="$product_tours_enabled_server_side",De="$logs_capture_enabled_server_side",Ne="$web_vitals_allowed_metrics",Fe="$session_recording_remote_config",Ue="$session_recording_enabled_server_side",Be="$replay_sample_rate",Le="$replay_override_sampling",je="$replay_override_linked_flag",ze="$replay_override_url_trigger",We="$replay_override_event_trigger",qe="$sesid",Ge="$session_is_sampled",He="$session_past_minimum_duration",Ve="$session_recording_url_trigger_activated_session",Je="$session_recording_event_trigger_activated_session",Ye="$debug_first_full_snapshot_timestamp",Ke="$sess_rec_flush_size",Xe="$enabled_feature_flags",Qe="$active_feature_flags",Ze="$early_access_features",ti="$feature_flag_details",ei="$feature_flag_payloads",ii="$feature_flag_request_id",ri="$minimal_flag_called_events",si="$override_feature_flags",ni="$override_feature_flag_payloads",oi="$stored_person_properties",ai="$stored_group_properties",li="$groups",hi="$surveys",ui="$surveys_loaded_at",di="$surveys_activated",vi="$surveys_activated_session",ci="$surveys_activated_timestamps",_i="ph_product_tours",pi="$product_tours_activated",fi="$product_tours_activated_session",gi="$conversations_widget_session_id",mi="$conversations_ticket_id",bi="$conversations_widget_state",wi="$conversations_user_traits",yi="$flag_call_reported",$i="$flag_call_reported_session_id",xi="$feature_flag_errors",Si="$feature_flag_evaluated_at",Ei="$user_state",Ti="$client_session_props",ki="$capture_rate_limit",Pi="$initial_campaign_params",Ri="$initial_referrer_info",Oi="$initial_person_info",Ii="$epp",Ci="$posthog_cookieless",Ai="$cookieless_mode",Mi="$sdk_debug_extensions_init_method",Di="$sdk_debug_extensions_init_time_ms",Ni="$sdk_debug_recording_script_not_loaded",Fi="$sdk_debug_replay_event_trigger_status",Ui="$sdk_debug_replay_linked_flag_trigger_status",Bi="$sdk_debug_replay_matched_recording_trigger_groups",Li="$sdk_debug_replay_pending_trigger_conditions",ji="$sdk_debug_replay_remote_trigger_matching_config",zi="$sdk_debug_replay_trigger_groups_count",Wi="$sdk_debug_replay_url_trigger_status",qi="$session_recording_start_reason",Gi="anonymous",Hi="identified",Vi="identified_only",Ji="visibilitychange",Yi="beforeunload",Ki="$pageview",Xi="$pageleave",Qi="$identify",Zi="$groupidentify";function tr(t,e){P(t)&&t.forEach(e)}function er(t,e){if(!N(t))if(P(t))t.forEach(e);else if((t=>t instanceof FormData)(t))t.forEach((t,i)=>e(t,i));else for(var i in t)T.call(t,i)&&e(t[i],i)}var ir=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},rr=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},sr=function(t){var e={};return er(t,function(t,i){(A(t)&&t.length>0||F(t))&&(e[i]=t)}),e};function nr(t){var e=i({},t);for(var r of["name","message","stack","cause","errors"])try{r in t&&(e[r]=t[r])}catch(t){}return e}var or=["herokuapp.com","vercel.app","netlify.app"];function ar(t){var e=null==t?void 0:t.hostname;if(!A(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of or)if(i===r)return!1;return!0}function lr(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var hr=t=>{if(l){try{for(var e=t+"=",i=l.cookie.split(";").filter(t=>t.length),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return F(t)&&isFinite(t)&&Math.floor(t)===t});var ur=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>i||0>r||0>s||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},dr=class{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Ct=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t,e=(t=Date.now(),F(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return ur.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new _r}},vr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};n&&!C(n.crypto)&&crypto.getRandomValues&&(vr=t=>crypto.getRandomValues(t));var cr,_r=class{nextUint32(){return this.Rt.length>this.$t||(vr(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},pr=()=>fr().toString(),fr=()=>(cr||(cr=new dr)).generate(),gr="",mr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var br=null,wr={Et(){if(!D(br))return br;if(br=!1,l)try{var t="__ph_cookie_support_"+pr();wr.At(t,"xyz"),br='"xyz"'===hr(t),wr.Lt(t)}catch(t){br=!1}return br},Pt(t){ue.error("cookieStore error: "+t)},Ot:hr,Dt(t){var e;try{e=JSON.parse(wr.Ot(t))||{}}catch(t){}return e},At(t,e,i,r,s){if(!l)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=l),gr)return gr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+pr();!gr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",gr=n)}return gr}(t);if(!i){var r=(t=>{var e=t.match(mr);return e?e[0]:""})(t);r!==i&&ue.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(l.location.hostname,r);if(i){var h=new Date;h.setTime(h.getTime()+864e5*i),n="; expires="+h.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+u.length),l.cookie=u,!0}catch(t){return!1}},Lt(t,e){if(null!=l&&l.cookie)try{wr.At(t,"",-1,e)}catch(t){return}}},yr=null,$r={Et(){if(!D(yr))return yr;var t=!0;if(C(n))t=!1;else try{var e="__mplssupport__";$r.At(e,"xyz"),'"xyz"'!==$r.Ot(e)&&(t=!1),$r.Lt(e)}catch(e){t=!1}return t||ue.error("localStorage unsupported; falling back to cookie store"),yr=t,t},Pt(t){ue.error("localStorage error: "+t)},Ot(t){try{return null==n?void 0:n.localStorage.getItem(t)}catch(t){$r.Pt(t)}return null},Dt(t){try{return JSON.parse($r.Ot(t))||{}}catch(t){}return null},At(t,e){try{return null==n||n.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){$r.Pt(t)}return!1},Lt(t){try{null==n||n.localStorage.removeItem(t)}catch(t){$r.Pt(t)}}},xr=[oi,Qe,Xe,ti,ei,ii,Si,xi,yi],Sr=[we,be,qe,Ge,Ii,Oi,Ee,Ei],Er=t=>t+"_cpm",Tr=["__proto__","constructor","prototype"],kr=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach(i=>{-1===Tr.indexOf(i)&&(e[i]=t[i])}),e},Pr=function(t,e){void 0===e&&(e=[]);var i={};return[...Sr,...e].forEach(e=>{var r=t[e];C(r)||D(r)||""===r||(i[e]=r)}),i},Rr=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Or=(t,e)=>({p:e,f:Rr(JSON.stringify(t))}),Ir=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=wr.Dt(Er(t)),r=(null==i?void 0:i.f)===Rr(e)&&P(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Cr=(t,e)=>e+"|"+(wr.Ot(Er(t))||""),Ar={},Mr={Et:()=>!0,Pt(t){ue.error("memoryStorage error: "+t)},Ot:t=>t in Ar?Ar[t]:null,Dt:t=>t in Ar?Ar[t]:null,At:(t,e)=>(Ar[t]=e,!0),Lt(t){delete Ar[t]}},Dr=null,Nr={Et(){if(!D(Dr))return Dr;if(Dr=!0,C(n))Dr=!1;else try{var t="__support__";Nr.At(t,"xyz"),'"xyz"'!==Nr.Ot(t)&&(Dr=!1),Nr.Lt(t)}catch(t){Dr=!1}return Dr},Pt(t){ue.error("sessionStorage error: ",t)},Ot(t){try{return null==n?void 0:n.sessionStorage.getItem(t)}catch(t){Nr.Pt(t)}return null},Dt(t){try{return JSON.parse(Nr.Ot(t))||null}catch(t){}return null},At(t,e){try{return null==n||n.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Nr.Pt(t)}return!1},Lt(t){try{null==n||n.sessionStorage.removeItem(t)}catch(t){Nr.Pt(t)}}},Fr=class{constructor(t){this._instance=t}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(t){this.Fo.At(this.Oo,t?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Ao(){var t=this.Fo.Ot(this.Oo);return q(t)?1:x(G,t)?0:-1}get Fo(){var t=this.Mr.opt_out_capturing_persistence_type,e="localStorage"===t?$r:wr,i=e.Et()?e:Mr;if(!this.Do||this.Do!==i){this.Do=i;var r="localStorage"===t?wr:$r;r.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(q(r.Ot(this.Oo))),r.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,f.doNotTrack,null==a?void 0:a.globalPrivacyControl].some(t=>q(t))}},Ur=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var Br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ae)),r=t.instance.config.capture_dead_clicks;return B(r)?r:!!O(r)||i},Lr=de("[SegmentIntegration]");function jr(t,e,r){void 0===r&&(r=!0);var s=t.config.segment;if(!s)return e();var n,o=(t=>R(t.register))(n=s)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(t,e,i,r){var s=e=>{var s=()=>e.anonymousId()||pr();t.config.get_device_id=s,r&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property(Ei,Hi)),i(r?void 0:e.anonymousId()||void 0)},n=e.user();"then"in n&&R(n.then)?n.then(s):s(n)}(t,a,r=>{a.register(function(t,e,r){var s=(void 0===r?{}:r).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Lr.warn("This browser does not have Promise support, and can not use the segment integration");var n=(r,n)=>{if(!n)return r;var o=!!e&&r.event.anonymousId===e&&!r.event.userId;o||r.event.userId||r.event.anonymousId===t.get_distinct_id()||(Lr.info("No userId set, resetting PostHog"),t.reset()),o||(e=void 0),r.event.userId&&r.event.userId!==t.get_distinct_id()&&(Lr.info("UserId set, identifying with PostHog"),t.identify(r.event.userId));var a=t.calculateEventProperties(n,r.event.properties);if(!N(s)){var l=r.event.properties||{},h={};for(var u of Object.keys(a))T.call(l,u)||(h[u]=a[u]);var d=((t,e)=>{var r=P(t)?t:[t],s=i({},e);for(var n of r)try{if(s=n(s),N(s))return null}catch(t){return Lr.error("Error in Segment filterProperties:",t),null}return s})(s,h);if(N(d))return r;a=d}return r.event.properties=Object.assign({},a,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,Ki)},identify(t){return n(t,Qi)},screen(t){return n(t,"$screen")}}}(t,r,{filterProperties:l})).then(()=>{e()},t=>{Lr.error("Failed to register the Segment integration",t),e()})},r)}var zr="posthog-js";function Wr(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return e=>{var r,a,h,d,v,c;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var _=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=_,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(r=e.exception)?void 0:r.values)||[],f=p.map(t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>i({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}var qr=class{constructor(t,e,i,r,s,n){this.name=zr,this.setupOnce=function(o){o(Wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Gr=class{constructor(t){this.jo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}Ho(){var t;this.zo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.jo)}destroy(){var t;null==(t=this.zo)||t.call(this),this.zo=void 0}doPageView(t,e){var i,r=this.Uo(t,e);return this.Bo={pathname:null!==(i=null==n?void 0:n.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Uo(t,null==(e=this.Bo)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Bo)?void 0:t.pageViewId}}Uo(t,e){var i=this.Bo;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?J(o/n,0,1,ue):1,v=n>1?J(a/n,0,1,ue):1,c=l>1?J(h/l,0,1,ue):1,_=l>1?J(u/l,0,1,ue):1;r=ir(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}},Hr=["flags","surveys"],Vr={[me]:{exposure:"hidden"},[$e]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[ke]:{exposure:"event"},[Pe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Re]:{exposure:"event"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"event"},[Ce]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"hidden"},[Ne]:{exposure:"event"},[Fe]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Be]:{exposure:"event",shouldSkipFromEventProperties:t=>D(t)},[He]:{exposure:"event"},[Ve]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[Ze]:{exposure:"hidden"},[ti]:{exposure:"hidden",storageGroup:"flags"},[ei]:{exposure:"hidden",storageGroup:"flags"},[ii]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ri]:{exposure:"hidden",storageGroup:"flags"},[si]:{exposure:"hidden"},[ni]:{exposure:"hidden"},[oi]:{exposure:"hidden"},[ai]:{exposure:"hidden"},[hi]:{exposure:"hidden",storageGroup:"surveys"},[ui]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[di]:{exposure:"event"},[vi]:{exposure:"hidden"},[ci]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[gi]:{exposure:"event"},[mi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[yi]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[li]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ei]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[ki]:{exposure:"hidden"},[Pi]:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Le]:{exposure:"event"},[je]:{exposure:"event"},[ze]:{exposure:"event"},[We]:{exposure:"event"},[Mi]:{exposure:"event"},[Di]:{exposure:"event"},[Ni]:{exposure:"event"},[Fi]:{exposure:"event"},[Ui]:{exposure:"event"},[Bi]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[zi]:{exposure:"event"},[Wi]:{exposure:"event"},[qi]:{exposure:"event"}},Jr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Yr=t=>{var e=Vr[t];if(e)return e;for(var i of Jr){var r=i[1];if(0===t.indexOf(i[0]))return r}},Kr=(t,e)=>{try{var i;return JSON.stringify(t,(t,e)=>z(e)?(null!=i||(i=new WeakMap),i.has(e)||i.set(e,nr(e)),i.get(e)):"bigint"==typeof e?e.toString():e,e)}catch(e){return s=[],null!==(r=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(e))return"[Circular]";s.push(e)}return e}}))&&void 0!==r?r:"null"}var r,s},Xr=t=>{var e=null==l?void 0:l.createElement("a");return C(e)?null:(e.href=t,e)},Qr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!P(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");P(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},ts=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],es=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ts],is="<masked>",rs=["li_fat_id"];function ss(t,e){var i=es.concat(e||[]),r={};return er(i,function(e){var i=Qr(t,e);r[e]=i||null}),r}function ns(t){var e=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!D(e)){r.$search_engine=e;var s=l?Qr(l.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function os(){return navigator.language||navigator.userLanguage}var as="$direct";function ls(){return(null==l?void 0:l.referrer)||as}function hs(t,e,i){var r;void 0===i&&(i=!1);var s=t?[...ts,...e||[]]:[],n=null==(r=i?Zt(null==h?void 0:h.href):null==h?void 0:h.href)?void 0:r.substring(0,1e3);return{r:ls().substring(0,1e3),u:n?Zr(n,s,is):void 0}}function us(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Zt(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==as?as:null==(i=Xr(r))?void 0:i.host};if(n){o.$current_url=n;var a=Xr(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ir(o,ss(n))}return r&&ir(o,ns(r)),o}function ds(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cs={flags:Si,surveys:ui},_s=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ps=t=>t+"_cookie_identity_change_pending",fs=t=>{var e="",i=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(i+s>1e3)break;e+=r,i+=s}return e},gs="main",ms=[Xe,Qe,ti,ei,ii,Si,ri,oi],bs=t=>-1!==ms.indexOf(t),ws=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},ys=t=>{if(!t)return{};var e=JSON.parse(t);return O(e)?e:{}},$s=(t,e)=>{er(t,(i,r)=>{var s=Yr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]})},xs=class{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=t,this.nl=r,this.props={},this.sl=void 0,this.rl=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&ue.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),n){var s=()=>this.flush();lr(n,"beforeunload",s,{capture:!1}),lr(n,"pagehide",s,{capture:!1}),this.ul=t=>{if(this.Vo&&(!t.storageArea||t.storageArea===(null==n?void 0:n.localStorage))&&t.key)if(t.key!==this.rl){if(this.Zo){var e=Hr.find(e=>t.key===this.hl(e));e&&this.cl(t.key,e)}}else this.cl(t.key,gs)},lr(n,"storage",this.ul)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var e=t[0],i=t[1],r=this.Ko.get(e);if(bs(e)&&!0!==r)if(!0!==i){var s=new Set(r||[]);i.forEach(t=>s.add(t)),s.size&&this.dl(e,s)}else this.dl(e,!0)})}onCrossTabFeatureFlagChange(t){return this.il.add(t),()=>this.il.delete(t)}destroy(){this.ul&&n&&(n.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(t,e,i){if(void 0===i&&(i=!0),this.pi)return!1;var r,s;try{if(s=$r.Ot(t),D(s)){var n=this.vl(e);return n.storageValue=null,e!==gs&&(n.persisted=!1),!1}r=ys(s)}catch(t){return!1}var o=e===gs?r:$r.Dt(this.rl);if(o&&this.fl(o))return!1;var a=this.pl(r,e,i);return e===gs&&this.Zo&&!ws(this.gl().main,r)||this.ml(r,e,!0,s),a}fl(t){var e=this.props[be],i=t[be];return!C(e)&&!C(i)&&e!==i}ml(t,e,i,r){var s=this.vl(e);s.storageValue=r,e!==gs&&(s.persisted=i);try{s.fingerprint=this.yl(t,e)}catch(t){s.fingerprint=void 0}}pl(t,e,i){var r=!1;return ms.forEach(i=>{var s,n=null==(s=Yr(i))?void 0:s.storageGroup;if(!(e===gs&&this.Zo&&n||e!==gs&&n!==e)){var o=i in t,a=this.bl(i,o?t[i]:void 0),l=this.Ko.has(i)?i in this.props:o;l===i in this.props&&ws(a,this.props[i])||(l?this._l(i,a,!1):this.wl(i,!1),r=!0)}}),r&&i&&this.il.forEach(t=>t()),r}kl(){if(!this.Vo)return!1;try{this.tl=!1;var t,e=$r.Ot(this.rl),i=this.vl(gs),r=!1,s=!1;if(e!==i.storageValue)if(D(e))i.storageValue=null;else{if(t=ys(e),this.tl=!this.Yo&&this.fl(t),this.tl)return!1;s=this.pl(t,gs,!1),!this.Zo||ws(this.gl().main,t)?this.ml(t,gs,!0,e):i.storageValue=e,r=!0}return this.Zo&&Hr.forEach(e=>{var i=$r.Ot(this.hl(e)),n=this.vl(e),o=t||{},a=r&&ms.some(t=>{var i;return(null==(i=Yr(t))?void 0:i.storageGroup)===e&&t in o});if(i!==n.storageValue||a){if(D(i))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.pl(o,e,!1)||s));var l=ys(i);s=this.pl(l,e,!1)||s,this.ml(l,e,!0,i)}}),s}catch(t){return!1}}dl(t,e){this.Ko.set(t,e);var i=Yr(t);null!=i&&i.volatile||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||gs).fingerprint=void 0,this.Sl(t))}xl(){ms.forEach(t=>this.Ko.set(t,!0))}al(){if(this.Vo)try{var t=$r.Ot(this.rl),e=ys(t);this.vl(gs).storageValue=t,ms.forEach(t=>{var i,r=this.Zo?null==(i=Yr(t))?void 0:i.storageGroup:void 0,s=r?$r.Ot(this.hl(r)):null;if(r){var n=this.vl(r);n.storageValue=s,n.persisted=!D(s)}var o=r&&!D(s)?ys(s):e;t in this.props?this.Cl(t,o[t],this.props[t]):t in o&&this.dl(t,!0)})}catch(t){}}bl(t,e){var r=this.Ko.get(t);if(!r)return e;if(!0===r)return this.props[t];if("$active_feature_flags"===t){var s=new Set(P(e)?e:[]),n=new Set(P(this.props[t])?this.props[t]:[]);return r.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=O(e)?i({},e):{},a=O(this.props[t])?this.props[t]:{};return r.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Cl(t,e,i){if(bs(t)){var r=this.Ko.get(t);if(!0!==r){var s=e;if(this.Vo)try{var n,o=this.Zo?null==(n=Yr(t))?void 0:n.storageGroup:void 0,a=o?this.hl(o):this.rl;s=ys($r.Ot(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!C(e)&&!P(e)||!C(s)&&!P(s)||!P(i))return void this.dl(t,!0);var h=new Set(e||[]),u=new Set(s||[]),d=new Set(i);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!O(i))return void(ws(s,i)?this.Ko.delete(t):this.dl(t,!0));if(!C(e)&&!O(e)||C(e)&&I(i)&&C(s))return void this.dl(t,!0);var v=O(e)?e:{},c=O(s)?s:{};new Set([...Object.keys(v),...Object.keys(i)]).forEach(t=>{t in v==t in i&&ws(v[t],i[t])||l.add(t)}),l.forEach(t=>{t in c==t in i&&ws(c[t],i[t])&&l.delete(t)})}l.size?this.dl(t,l):this.Ko.delete(t)}}}$l(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return F(e)&&e>0?e:0}Tl(t){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(t)try{var e=Pr(t,this.Mr.cookie_persisted_properties||[]),i=Or(e,this.Mr.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=wr.Ot(this.rl)||void 0;s&&Cr(this.rl,s)===r&&(this.Il=r,this.Ml=s)}catch(t){}else try{var n=wr.Ot(this.rl)||void 0;this.Il=n?Cr(this.rl,n):void 0,this.Ml=n}catch(t){}}syncCookieProperties(){return this.El(this.Mr)}El(t,e){if(void 0===e&&(e=!1),this.pi&&!e||this.Jo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=wr.Ot(this.rl)||void 0}catch(t){}if(!i||i===this.Ml)return!1;var r,s=Cr(this.rl,i);try{r=kr(JSON.parse(i))}catch(t){return!1}if((wr.Ot(this.rl)||void 0)!==i)return!1;this.Il=s,this.Ml=i;var n=Ir(this.rl,i),o=[...Sr,...n.properties],a={};if(Object.keys(r).forEach(t=>{var e=r[t];(C(e)||D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete r[t])}),I(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[be],d=h[Ei],v=ir({},h);[...Sr,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var e=v[t];(n.isValid||-1===Sr.indexOf(t)||!1!==e&&0!==e)&&delete v[t]}}),this.props=ir(v,r),ms.forEach(t=>{var e=t in this.props;t in h===e&&ws(h[t],this.props[t])||(e?this.Cl(t,h[t],this.props[t]):this.dl(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this._l(Ei,Gi);var c=this.props[be],_=this.props[Ei];return!l||c===u&&_===d||(this.Yo=!0,this.Qo=!0,Nr.At(ps(this.rl),!0),this.wl(oi),this.wl(Qe),this.wl(Xe),this.wl(ti),this.wl(ei),this.wl(ii),this.wl(Si),this.wl(xi),this.wl(yi),"anonymous"!==_||"identified"!==d&&"anonymous"!==r.$user_state&&(C(u)||c===u)||($s(this.props,r),this.wl(ai)),"identified"===_?this.props.$user_id=c:delete this.props.$user_id,this.wl($e)),!0}consumeCookieIdentityChange(){var t=ps(this.rl),e=this.Qo||!!Nr.Ot(t);return this.Qo=!1,e&&Nr.Lt(t),e}Pl(t){return void 0===t&&(t=!1),!(this.Jo||this.pi&&!t||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[gs],this.Fl(!0))}Ol(t){if(void 0===t&&(t=!0),this.Jo)try{t?this.Rl():C(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(t){-1===_s.indexOf(t.persistence.toLowerCase())&&(ue.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Sr,...t];return i({},$r,{Dt(t){try{var i,s={};try{i=wr.Ot(t)||void 0,s=i?kr(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse($r.Ot(t)||"{}");if(e){var a=Ir(t,i),l=[...Sr,...a.properties],h={};Object.keys(s).forEach(t=>{var e=s[t];D(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(h[t]=e)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[be],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";r.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var e=o[t];(a.isValid||-1===Sr.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Ei]=Gi),!u||("distinct_id"in h?h[be]:o[be])===v&&("$user_state"in h?h[Ei]:o[Ei])===c||(xr.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[be]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[li],delete o[ai]),delete o.__alias)}n=ir(o,h)}else n=ir(s,o);return $r.At(t,n),n}catch(t){}return null},At(i,r,s,n,o,a){var l=$r.At(i,r,void 0,void 0,a);try{var h=Pr(r,t);if(Object.keys(h).length){if(e){var u=Er(i),d=Or(h,t);if(wr.At(u,d,s,n,o,a),wr.Ot(u)!==JSON.stringify(d)){wr.Lt(u,n);var v=Pr(r);return wr.At(i,v,s,n,o,a),l}}wr.At(i,h,s,n,o,a)}}catch(t){$r.Pt(t)}return l},Lt(t,e){try{null==n||n.localStorage.removeItem(t),wr.Lt(t,e),wr.Lt(Er(t),e)}catch(t){$r.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,o=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&$r.Et()?(e=$r,o=!0):"localstorage+cookie"===a&&r.Et()?(e=r,o=!0,s=!0):"sessionstorage"===a&&Nr.Et()?e=Nr:"memory"===a?e=Mr:"cookie"===a&&wr.Et()?(e=wr,s=!0):r.Et()?(e=r,o=!0,s=!0):wr.Et()?(e=wr,s=!0):e=Mr,this.Vo=o,this.Go=s,e}hl(t){return this.rl+"__"+t}ll(t){return this.Vo&&!!t.split_storage}properties(){var t={};return er(this.props,(e,i)=>{var r=Yr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}}),t}load(t){if(void 0===t&&(t=!1),!this.pi||t){var e=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=e?$r.Dt(this.rl):null,r={};if(e)try{er(r=kr(wr.Dt(this.rl)),(t,e)=>{(C(t)||D(t)||""===t)&&delete r[e]})}catch(t){}var s=this.Fo.Dt(this.rl);if(s&&(this.props=ir({},s)),this.Zo&&this.Dl(),e&&s){var n,o,a=null==i?void 0:i[be],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",h=s[be],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.Qo=!0,Nr.At(ps(this.rl),!0);var d=ir({},this.props);xr.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(C(a)||h===a)||($s(d,r),delete d[ai]),this.props=d;var v=new Set;xr.forEach(t=>{var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&v.add(i)}),v.forEach(t=>{var e={};er(this.props,(i,r)=>{var s;(null==(s=Yr(r))?void 0:s.storageGroup)===t&&(e[r]=i)}),I(e)?($r.Lt(this.hl(t)),this.Wo[t]={}):$r.At(this.hl(t),e)&&(this.Wo[t]={persisted:!0,fingerprint:this.yl(e,t)})})}}Nr.Ot(ps(this.rl))&&(this.Qo=!0)}}Dl(){for(var t of Hr){var e=$r.Dt(this.hl(t));if(e&&!I(e)){var i=this.vl(t);i.persisted=!0,this.Ll(t)||(i.fingerprint=this.yl(e,t)),this.Nl(t,e)||ir(this.props,e)}}}Ll(t){return Object.keys(this.props).some(e=>{var i;return(null==(i=Yr(e))?void 0:i.storageGroup)===t})}Nl(t,e){var i=cs[t];if(!i)return!1;var r=e[i],s=this.props[i];return F(r)&&F(s)&&s>r}refreshKey(t){var e;if(!(this.pi||"$fbc_persistence"===t&&this.el)){var i=this.Zo?null==(e=Yr(t))?void 0:e.storageGroup:void 0,r=i?$r.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(r&&t in r)this._l(t,r[t],!1);else{if(i){var s=this.Fo.Dt(this.rl);if(s&&t in s)return void this._l(t,s[t],!1)}this.wl(t,!1)}}}save(){if(!this.pi){var t=this.$l();t>0?C(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},t)):this.Fl()}}flush(){C(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(t){if(void 0===t&&(t=!1),!(this.pi||this.Jo&&!t)){t||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(Ee));var e=!t&&!this.Xo;e||(this.tl=!1);var i=!!e&&this.kl();if(this.tl)this.Mr.debug&&ue.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Zo)return this.ql(),void(i&&this.il.forEach(t=>t()));var r=this.jl(this.Fo,this.rl,this.props,gs);"written"===r&&this.Tl(this.props),"failed"!==r&&(this.Ko.clear(),this.Yo=!1,this.el=!1),i&&this.il.forEach(t=>t())}}}ql(){var t=this,e=this.gl(),i=e.main,r=e.groups,s=this.jl(this.Fo,this.rl,i,gs);"written"===s&&this.Tl(i),"failed"!==s&&(this.Yo=!1,this.el=!1,ms.forEach(t=>{var e;null!=(e=Yr(t))&&e.storageGroup||this.Ko.delete(t)}));var n=function(e){var i,s=r[e];if(I(s)&&(null==(i=t.Wo[e])||!i.persisted))return ms.forEach(i=>{var r;(null==(r=Yr(i))?void 0:r.storageGroup)===e&&t.Ko.delete(i)}),1;var n=t.jl($r,t.hl(e),s,e);"failed"!==n&&ms.forEach(i=>{var r=Yr(i);(null==r?void 0:r.storageGroup)!==e||"written"!==n&&r.volatile||t.Ko.delete(i)})};for(var o of Hr)if(n(o))continue}gl(){var t={},e={flags:{},surveys:{}};return er(this.props,(i,r)=>{var s,n=null==(s=Yr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i}),{main:t,groups:e}}yl(t,e){if(e===gs)return JSON.stringify(t)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;var i={};return er(t,(t,e)=>{var r;i[e]=null!=(r=Yr(e))&&r.volatile?"__volatile__":t}),JSON.stringify(i)}jl(t,e,i,r){var s,n=this.vl(r);if(r!==gs&&!n.dirty&&!C(n.fingerprint))return"skipped";try{if((s=this.yl(i,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.At(e,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,r!==gs&&(n.persisted=!0),C(s)||(n.fingerprint=s),this.Vo&&(n.storageValue=$r.Ot(e)),"written"):(this.Mr.debug&&ue.warn('failed to persist storage entry "'+e+'"; will retry on next save'),"failed")}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(this.xl(),C(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!i&&this.nl)for(var r of Hr)$r.Lt(this.hl(r));i?delete this.Wo[gs]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.Bl=C(i)?this.Ul:i;var r=!1;if(er(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this._l(i,t),r=!0)}),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.Bl=C(e)?this.Ul:e;var i=!1;if(er(t,(e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||P(e))&&(this._l(r,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.wl(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==l?void 0:l.URL;if(t!==this.sl){var e=function(t,e,i){if(!l)return{};var r,s=e?[...ts,...i||[]]:[],n=ss(Zr(l.URL,s,is),t);return ir((r={},er(rs,function(t){var e=hr(t);r[t]=e||null}),r),n)}(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!I(sr(e));return i&&this.register(e),this.sl=t,i?e:void 0}}update_search_keyword(){var t;this.register((t=null==l?void 0:l.referrer)?ns(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ls(),$referring_domain:null!=l&&l.referrer&&(null==(t=Xr(l.referrer))?void 0:t.host)||as},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=hs(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Oi]:this.Go?{r:fs(t.r),u:t.u?fs(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};er([Ri,Pi],e=>{var i=this.props[e];i&&er(i,function(e,i){t["$initial_"+S(i)]=e})});var e=this.props[Oi];return e&&ir(t,function(t,e){void 0===e&&(e=!1);var i=us(t,e),r={};return er(i,function(t,e){r["$initial_"+S(e)]=t}),r}(e,this.Mr.disable_capture_url_hashes)),t}safe_merge(t){return er(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every((t,e)=>t===r[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.pi&&!l;l||this.El(e,h),this.Mr=t,!l&&(s||n||a)&&(this.Il=void 0,this.Ml=void 0,this.El(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var u=o||a?this.ol(t):this.Fo;this.Wl();var d=this.ll(t),v=o||d!==this.Zo,c=!l&&(v||t.cross_subdomain_cookie!==this.Hl||t.secure_cookie!==this.zl)&&this.Pl(h);this.Xo=v;try{if(this.Ul=this.Bl=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var _=this.props;this.clear(),this.Fo=u,this.Zo=d,this.props=_,this.save()}else a&&(this.Fo=u,l||(delete this.Wo[gs],this.Fl()))}finally{this.Xo=!1,c&&this.Ol()}}Wl(){var t=this.props[Oi];if(this.Go&&O(t)&&"string"==typeof t.r){var e=fs(t.r),r="string"==typeof t.u?fs(t.u):t.u;e===t.r&&r===t.u||this._l(Oi,i({},t,{r:e,u:r}))}}set_disabled(t){this.pi=t,this.pi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Hl&&(this.Hl=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.zl&&(this.zl=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props.__timers||{};i[t]=e,this._l(Te,i),this.save()}remove_event_timer(t){var e=this.props.__timers||{},i=e[t];return C(i)||(delete e[t],this._l(Te,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this._l(t,e),this.save()}_l(t,e,i){var r;void 0===i&&(i=!0);var s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.Yo=!0),"$fbc_persistence"!==t||ws(s,e)||(this.el=!0),this.Cl(t,s,e),null!=(r=Yr(t))&&r.volatile||this.Sl(t))}wl(t,e){void 0===e&&(e=!0),delete this.props[t],e&&(bs(t)&&this.dl(t,!0),"$fbc_persistence"===t&&(this.el=!0),this.Sl(t))}Sl(t){var e,i=null==(e=Yr(t))?void 0:e.storageGroup;i&&(this.vl(i).dirty=!0)}vl(t){return this.Wo[t]||(this.Wo[t]={})}},Ss={GZipJS:"gzip-js",Base64:"base64"},Es={Activation:"events",Cancellation:"cancelEvents"},Ts={Button:"button",Tab:"tab",Selector:"selector"},ks={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"},Ps={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Rs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Os={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Is={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Cs={Once:"once",Recurring:"recurring",Always:"always"},As={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ms={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"},Ds={Popover:"popover",Inline:"inline"};function Ns(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&R(i.then)&&i.then(void 0,()=>{})}}}}var Fs={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},Us={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"},Bs={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=de("[RateLimiter]"),js=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Ls.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ls.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(F(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Vl(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ki,a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(t){var e=this.instance.config.property_denylist;return!P(e)||!e.includes(t)}Zl(){var t;if(this.Gl("$current_url")&&this.Gl("$pathname")&&null!=h&&h.pathname)return""+(null!==(t=h.origin)&&void 0!==t?t:"")+h.pathname}Vl(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Zl(),o=this.Gl("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}},zs=de("[RemoteConfig]"),Ws=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=f._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ql(t){var e,i;null!=(e=f.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Jl(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return zs.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zs.warn("Remote config is disabled. Falling back to local config.");this.Ql(t=>{if(!t)return zs.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(t)})}catch(t){zs.error("Error loading remote config",t),this.Kl()}}Kl(t,e){!t&&e&&(0===e.statusCode?e.error||zs.warn("Failed to fetch remote config from PostHog."):zs.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(t?{ok:!0,config:t}:{ok:!1})}catch(t){zs.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){zs.error("Error loading feature flags",t)}}},qs=["fatal","error","warning","log","info","debug"],Gs=Uint8Array,Hs=Uint16Array,Vs=Uint32Array,Js=new Gs([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]),Ys=new Gs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ks=new Gs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xs=function(t,e){for(var i=new Hs(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Qs=Xs(Js,2),Zs=Qs[1];Qs[0][28]=258,Zs[258]=28;for(var tn=Xs(Ys,0)[1],en=new Hs(32768),rn=0;32768>rn;++rn){var sn=(43690&rn)>>>1|(21845&rn)<<1;en[rn]=((65280&(sn=(61680&(sn=(52428&sn)>>>2|(13107&sn)<<2))>>>4|(3855&sn)<<4))>>>8|(255&sn)<<8)>>>1}var nn=function(t,e,i){for(var r=t.length,s=0,n=new Hs(e);r>s;++s)++n[t[s]-1];var o,a=new Hs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Hs(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[en[d]>>>l]=h}else for(o=new Hs(r),s=0;r>s;++s)o[s]=en[a[t[s]-1]++]>>>15-t[s];return o},on=new Gs(288);for(rn=0;144>rn;++rn)on[rn]=8;for(rn=144;256>rn;++rn)on[rn]=9;for(rn=256;280>rn;++rn)on[rn]=7;for(rn=280;288>rn;++rn)on[rn]=8;var an=new Gs(32);for(rn=0;32>rn;++rn)an[rn]=5;var ln=nn(on,9,0),hn=nn(an,5,0),un=function(t){return(t/8|0)+(7&t&&1)},dn=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Hs?Hs:t instanceof Vs?Vs:Gs)(i-e);return r.set(t.subarray(e,i)),r},vn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},cn=function(t,e,i){var r=e/8|0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},_n=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Gs(0),0];if(1==s){var o=new Gs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Hs(v+1),_=pn(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort(function(t,e){return c[e.s]-c[t.s]||t.f-e.f});s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var b=n[r].s;e>c[b]?p-=1<<e-c[b]++-1:++r}for(;r>=0&&p;--r){var w=n[r].s;c[w]==e&&(--c[w],++p)}_=e}return[new Gs(c),_]},pn=function(t,e,i){return-1==t.s?Math.max(pn(t.l,e,i+1),pn(t.r,e,i+1)):e[t.s]=i},fn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Hs(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},gn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},mn=function(t,e,i){var r=i.length,s=un(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},bn=function(t,e,i,r,s,n,o,a,l,h,u){vn(e,u++,i),++s[256];for(var d=_n(s,15),v=d[0],c=d[1],_=_n(n,15),p=_[0],f=_[1],g=fn(v),m=g[0],b=g[1],w=fn(p),y=w[0],x=w[1],S=new Hs(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;y.length>E;++E)S[31&y[E]]++;for(var T=_n(S,7),k=T[0],P=T[1],R=19;R>4&&!k[Ks[R-1]];--R);var O,I,C,A,M=h+5<<3,D=gn(s,on)+gn(n,an)+o,N=gn(s,v)+gn(n,p)+o+14+3*R+gn(S,k)+(2*S[16]+3*S[17]+7*S[18]);if(D>=M&&N>=M)return mn(e,u,t.subarray(l,l+h));if(vn(e,u,1+(D>N)),u+=2,D>N){O=nn(v,c,0),I=v,C=nn(p,f,0),A=p;var F=nn(k,P,0);for(vn(e,u,b-257),vn(e,u+5,x-1),vn(e,u+10,R-4),u+=14,E=0;R>E;++E)vn(e,u+3*E,k[Ks[E]]);u+=3*R;for(var U=[m,y],B=0;2>B;++B){var L=U[B];for(E=0;L.length>E;++E)vn(e,u,F[j=31&L[E]]),u+=k[j],j>15&&(vn(e,u,L[E]>>>5&127),u+=L[E]>>>12)}}else O=ln,I=on,C=hn,A=an;for(E=0;a>E;++E)if(r[E]>255){var j;cn(e,u,O[257+(j=r[E]>>>18&31)]),u+=I[j+257],j>7&&(vn(e,u,r[E]>>>23&31),u+=Js[j]);var z=31&r[E];cn(e,u,C[z]),u+=A[z],z>3&&(cn(e,u,r[E]>>>5&8191),u+=Ys[z])}else cn(e,u,O[r[E]]),u+=I[r[E]];return cn(e,u,O[256]),u+I[256]},wn=new Vs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yn=new Gs(0),$n=function(){for(var t=new Vs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),xn=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Sn(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=$n[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Gs(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=mn(l,h,t.subarray(u,d)):(l[u]=n,h=mn(l,h,t.subarray(u,o)))}else{for(var v=wn[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Hs(32768),g=new Hs(p+1),m=Math.ceil(i/3),b=2*m,w=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&p},y=new Vs(25e3),x=new Hs(288),S=new Hs(32),E=0,T=0,k=(u=0,0),P=0,R=0;o>u;++u){var O=w(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=P){var A=o-u;if((E>7e3||k>24576)&&A>423){h=bn(t,l,0,y,x,S,T,k,R,u-R,h),k=E=T=0,R=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var D=2,N=0,F=_,U=I-C&32767;if(A>2&&O==w(u-U))for(var B=Math.min(c,A)-1,L=Math.min(32767,u),j=Math.min(258,A);L>=U&&--F&&I!=C;){if(t[u+D]==t[u+D-U]){for(var z=0;j>z&&t[u+z]==t[u+z-U];++z);if(z>D){if(D=z,N=U,z>B)break;var W=Math.min(U,z-2),q=0;for(M=0;W>M;++M){var G=u-U+M+32768&32767,H=G-f[G]+32768&32767;H>q&&(q=H,C=G)}}}U+=(I=C)-(C=f[I])+32768&32767}if(N){y[k++]=268435456|Zs[D]<<18|tn[N];var V=31&Zs[D],J=31&tn[N];T+=Js[V]+Ys[J],++x[257+V],++S[J],P=u+D,++E}else y[k++]=t[u],++x[t[u]]}}h=bn(t,l,n,y,x,S,T,k,R,u-R,h),n||(h=mn(l,h,yn))}return dn(a,0,r+un(h)+s)}(n=t,null==(o=e).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,!h)),d=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&xn(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),xn(u,d-8,i.d()),xn(u,d-4,r),u}var En=!!d||!!u,Tn=new WeakMap,kn="text/plain",Pn=!1,Rn=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==e).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},On=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),h=null!==(s=null==a?void 0:a.split("&").map(t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return er(t,function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)}),s.join(e)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},In=t=>{if(t.Yl)return t.Yl;var e=t.data,i=t.compression;if(e){if(i===Ss.GZipJS){var r=Sn(function(t){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var i=new Gs(t.length+(t.length>>>1)),r=0,s=function(t){i[r++]=t},n=0;e>n;++n){if(r+5>i.length){var o=new Gs(r+8+(e-n<<1));o.set(i),i=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return dn(i,0,r)}(Kr(e)),{mtime:0});return{contentType:kn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Ss.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:Kr(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(Kr(e)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=Kr(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Cn=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:On(t.url,{compression:Ss.Base64}),encodedBody:In(i({},t,{compression:Ss.Base64,Yl:void 0}))}:{url:Rn(t.url,"compression"),encodedBody:In(i({},t,{compression:void 0,Yl:void 0}))};try{e=In(t)}catch(e){if(se(t.compression,Qr(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&se(t.compression,Qr(t.url,"compression"))&&!((r=e.body)instanceof ArrayBuffer?re(new Uint8Array(r)):ArrayBuffer.isView(r)&&re(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Pn=!0,s()):{url:t.url,encodedBody:e}},An=t=>{try{return Cn(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Mn=function(){var t=s(function*(t){var e=yield function(t,e,i){return le.apply(this,arguments)}(Kr(t.data),ge.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return i({},t,{Yl:{contentType:kn,body:r,estimatedSize:r.byteLength}})});return function(e){return t.apply(this,arguments)}}(),Dn=/Failed to fetch|NetworkError|Load failed/i,Nn=t=>"TypeError"===(null==t?void 0:t.name)&&Dn.test((null==t?void 0:t.message)||""),Fn=t=>{var e=An(t);if(e){var i=new d;Tn.set(i,!0);var r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;er(t.headers,function(t,e){i.setRequestHeader(e,t)}),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}},Un=t=>{var e=An(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;er(t.headers,function(t,e){h.append(e,t)}),o&&h.append("Content-Type",o);var d=null,c=!1;if(v){var _=new v;d={signal:_.signal,timeout:setTimeout(()=>{var e;c=!0,_.abort(Qt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))},t.timeout)}}var p=e=>{c&&"AbortError"===(null==e?void 0:e.name)||Nn(e)?ue.warn(e):ue.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;u(r,i({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.ta&&52428.8>(l||0),body:a,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then(e=>e.text().then(i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){ue.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>d?clearTimeout(d.timeout):null)}catch(t){d&&clearTimeout(d.timeout),p(t)}}},Bn=t=>{try{var e,r=Cn(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},l=o.body,h=o.estimatedSize;if(!l)return;var d=l instanceof Blob?l:new Blob([l],{type:o.contentType});if(a.sendBeacon(s,d))return;var v=P(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(P(v)&&v.length>1&&(null!=h?h:0)>16384){var c=Math.ceil(v.length/2),_=e=>P(t.data)?e:i({},t.data,{batch:e});return Bn(i({},t,{data:_(v.slice(0,c))})),void Bn(i({},t,{data:_(v.slice(c))}))}ue.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to "+(u?"fetch":"XHR")),u?Un(i({},t,{ta:!0})):Fn(t)}catch(t){ue.warn("Beacon send failed",t)}},Ln=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return On(r===Ss.GZipJS?Rn(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===Ss.GZipJS?{}:{compression:r}))},jn=(()=>{var t=[];return u&&t.push({transport:"fetch",method:Un}),d&&t.push({transport:"XHR",method:Fn}),null!=a&&a.sendBeacon&&t.push({transport:"sendBeacon",method:Bn}),t})(),zn=class{constructor(t,e){this.ea=!0,this.ia=[],this.na=J((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,ue.createLogger("flush interval"),3e3),this.sa=t}enqueue(t){this.ia.push(t),this.ra||this.oa()}unload(){this.la();var t=this.ia.length>0?this.aa():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.ua(i({},t,{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){var t=this.aa();for(var e in t)this.ua(t[e])}},this.na))}ua(t){try{this.sa(t)}catch(t){ue.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){var t={};return er(this.ia,e=>{var r,s=e,n=((s?s.batchKey:null)||s.url)+(s.batchGroup?":"+s.batchGroup:"");C(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)}),this.ia=[],t}},Wn=class{constructor(t){this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!C(n)&&"onLine"in n.navigator){if(this.da=n.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},lr(n,"online",this.va),lr(n,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(t){var r=t.retriesPerformedSoFar,s=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,e);U(r)&&(s.url=On(s.url,{retry_count:r})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=r?r:0))return void this.Ls(i({retriesPerformedSoFar:r},s));0===t.statusCode&&ue.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!=r?r:0)+" retries.")}null==s.callback||s.callback(t)}}))}Ls(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(e),r=Date.now()+i;this.ia.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){var t=Date.now(),e=[],i=this.ia.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.ia=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,C(n)||(this.va&&(n.removeEventListener("online",this.va),this.va=void 0),this.pa&&(n.removeEventListener("offline",this.pa),this.pa=void 0)),this.ia)){var e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.ia=[]}},qn=class{constructor(t){this._instance=t,this.ya=()=>{var t,e,i,r;this.ba||(this.ba={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(n),this.ba.maxScrollY=Math.max(n,null!==(t=this.ba.maxScrollY)&&void 0!==t?t:0),this.ba.maxScrollHeight=Math.max(o,null!==(e=this.ba.maxScrollHeight)&&void 0!==e?e:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(l,null!==(r=this.ba.maxContentHeight)&&void 0!==r?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){var t=this.ba;return this.ba=void 0,setTimeout(this.ya,0),t}startMeasuringScrollPosition(){lr(n,"scroll",this.ya,{capture:!0}),lr(n,"scrollend",this.ya,{capture:!0}),lr(n,"resize",this.ya)}scrollElement(){var t;if(!this._a)return null==n||null==(t=n.document)?void 0:t.documentElement;for(var e of P(this._a)?this._a:[this._a]){var i,r=null==n||null==(i=n.document)?void 0:i.querySelector(e);if(r)return r}}wa(t){var e,i,r="y"===t?"scrollTop":"scrollLeft";if(this._a){var s=this.scrollElement();return s&&s[r]||0}return n?"y"===t?n.scrollY||n.pageYOffset||(null==(e=n.document)||null==(e=e.documentElement)?void 0:e.scrollTop)||0:n.scrollX||n.pageXOffset||(null==(i=n.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}},Gn=t=>hs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes),Hn=class{constructor(t,e,i,r){this.je=t=>{var e=this.ka();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Sa(this._instance)};this.xa.register({[Ti]:i})}},this._instance=t,this.Ca=e,this.xa=i,this.Sa=r||Gn,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[Ti]}getSetOnceProps(){var t,e=null==(t=this.ka())?void 0:t.props;return e?"r"in e?us(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return er(sr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+S(i)]=e}),t}},Vn=class{on(t,e){return this.$a[t]||(this.$a[t]=[]),this.$a[t].push(e),()=>{this.$a[t]=this.$a[t].filter(t=>t!==e)}}emit(t,e){for(var i of this.$a[t]||[])i(e);for(var r of this.$a["*"]||[])r(t,e)}constructor(){this.$a={}}},Jn=de("[SessionId]"),Yn=864e5,Kn=class{on(t,e){return this.Ta.on(t,e)}constructor(t,e,i){var r;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Vn,this.Aa=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=e||pr,this.Da=i||pr;var s=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*J(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Jn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+s+"_window_id",this.qa="ph_"+s+"_primary_window_exists",this.ja()){var n=Nr.Dt(this.Na),o=Nr.Dt(this.qa);n&&!o?this.Be=n:Nr.Lt(this.Na),Nr.At(this.qa,!0)}null!=(r=this.Mr.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.Ea)&&(this.Ea=[]),this.Ea.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(e=>e!==t)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&Nr.Et()}Ha(t){t!==this.Be&&(this.Be=t,this.ja()&&Nr.At(this.Na,t))}za(){return this.Be?this.Be:this.ja()?Nr.Dt(this.Na):null}Ua(t){var e=this.Ia;return!D(e)&&!D(t)&&5e3>Math.abs(t-e)}Wa(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!r||s&&this.Ua(e)||(this.Ia=e,this.xa.register({[qe]:[e,t,i]}))}Va(){var t,e=null==(t=this.Mr)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0}Ga(){this.Va()?this.xa.refreshKey(qe):(this.xa.flush(),this.xa.load())}Za(){var t;if(!D(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ia){this.Ga();var e=this.Qa();e[1]===this.Xt&&e[2]===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[qe]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xa.flush())}}Ja(){var t=this.Qa()[0],e=U(t)?t:0,i=U(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Ka(t){return this.Ga(),this.Aa(t,this.Ja())}Qa(){var t=this.xa.props[qe];return P(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Jn.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Jn.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.Fa={sessionId:t,sessionStartTimestamp:i}:this.Wa(t,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&n&&(n.removeEventListener(Yi,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&Nr.Lt(this.qa)},lr(n,Yi,this.Pa,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),"always"===this.Mr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this.Xt;if(i)this.Ma=r;else if(D(this.Ma)||this.Ma>r||r-this.Ma>=1e3){var n,o;null==(n=(o=this.xa).syncCookieProperties)||n.call(o),this.Ma=r}var a=this.Qa(),l=a[1],h=a[2],u=!C(s)&&l!==s,d=this.Ja(),v=this.za(),c=this.Fa,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Yn),p=c?_:U(h)&&Math.abs(r-h)>Yn,f=!1,g=u,m=!l||!!c,b=l,w=!m&&!t&&this.Aa(r,d);if(w){(w=this.Ka(r))||Jn.info("cross-tab refresh kept the session alive",{sessionId:l});var y=this.Qa();l=y[1],h=y[2]}if(m||w||p){g=!1;var x=c&&!_;l=x?c.sessionId:this.Oa(),v=this.Da(),Jn.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Fa=void 0,f=!0}else v||(v=this.Da(),f=!0),(g=g||l!==b)&&(Jn.info("adopted cross-tab session id",{sessionId:l,windowId:v}),f=!0);var S=U(d)&&t&&!p?d:r,E=U(h)?h:(new Date).getTime();this.Ha(v),this.Wa(l,S,E),t||this.La();var T={noSessionId:m,activityTimeout:w,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ea.forEach(t=>t(l,v,T)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:f?T:void 0,lastActivityTimestamp:d}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:t})}else this.La()},1.1*this.sessionTimeoutMs))}};function Xn(){return(Xn=s(function*(){var t=null==a?void 0:a.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e,i=null==(e=yield t.getHighEntropyValues(["model"]))?void 0:e.model;return A(i)&&i.length>0?i:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Qn(t,e){var i="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(i="$survey_"+e+"/"+t.id+"/"+t.current_iteration),i}function Zn(t,e,i){return Kr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var to,eo="custom",io="i.posthog.com",ro=/^\/static\//,so=["/s/","/e/","/i/"],no=class{constructor(t){this.Ya={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+io,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ya[this.apiHost]||(this.Ya[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":eo),this.Ya[this.apiHost]}tu(t){if(ro.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}eu(t){var e=Xr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}iu(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Xr(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&so.some(t=>0===e.indexOf(t))){var a=this.eu(r);if(a){var l,h=this.apiHost,u=this.nu;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.nu=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.nu,i=this.eu(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.iu(t,e,this.uiHost+e);if("flags"===t)return this.iu(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.tu(e);if(i)return this.iu(t,e,""+i+e)}if(this.region===eo)return this.iu(t,e,this.apiHost+e);var r=io+e;switch(t){case"assets":return this.iu(t,e,"https://"+this.region+"-assets."+r);case"api":return this.iu(t,e,"https://"+this.region+"."+r)}}},oo=de("[Surveys]"),ao={ignoreConditions:!1,ignoreDelay:!1,displayType:Ds.Popover},lo=de("[PostHog ExternalIntegrations]"),ho={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},uo=class{constructor(t){this._instance=t}No(t,e){var i;null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,t=>{if(t)return lo.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=f.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.No(ho[n],()=>{var e;null==(e=f.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=f.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}},vo=class{constructor(t,e){this.$=t,this.po=e,this.su=new Map,this.So=!1}add(t){var e=this;return s(function*(){if(e.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.su.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.su.set(t.name,t);try{var i=t.setup(e.po);i&&(yield i)}catch(i){var r=e.su.get(t.name)===t;r&&e.su.delete(t.name),e.$.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.ru(t)}})()}getExtension(t){return this.su.get(t)}dispose(){if(!this.So){this.So=!0;var t=Array.from(this.su.values()).reverse();for(var e of(this.su.clear(),t))this.ru(e)}}ru(t){try{var e=null==t.dispose?void 0:t.dispose();e&&R(e.then)&&e.then(void 0,e=>{this.$.error('Failed to dispose browser extension "'+t.name+'"',e)})}catch(e){this.$.error('Failed to dispose browser extension "'+t.name+'"',e)}}},co=class{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}},_o="extensionsRemoteConfig",po=class{constructor(t){this.instance=t,this.So=!1,this.$=ue,this.ou=t.lu,this.kv=new co(t),this.onEvent=t=>Ns(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.So)return Ns(()=>{});var e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.au.on(_o,e);return this.ou&&e(this.ou),Ns(i)},this.uu=new vo(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(we);return"string"==typeof t?t:void 0}get library(){return{name:ge.LIB_NAME,version:ge.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.uu.add(t)}getExtension(t){return this.uu.getExtension(t)}capture(t,e,i){var r=this;return s(function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)})()}registerDynamicEventProperties(t){return Ns(this.instance.hu(t))}handleRemoteConfig(t){this.So||(this.ou=t,this.instance.au.emit(_o,t))}sendRequest(t,e){var i=this;return s(function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?On(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?b.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,i.instance._send_request(n)})})()}dispose(){this.So||(this.So=!0,this.uu.dispose())}},fo={},go=0,mo=()=>{},bo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',wo="Surveys module not available",yo="sanitize_properties is deprecated. Use before_send instead",$o="Invalid value for property_denylist config: ",xo=/^[A-Za-z0-9_-]{1,400}$/,So=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Eo=["token","distinct_id",Ai],To="posthog",ko=!En&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),Po=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Ro=t=>{var e;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:ar(null==l?void 0:l.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:h&&A(null==h?void 0:h.search)&&-1!==h.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,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(e=n.location)?void 0:e.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(t){ue.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Vi,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mo},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Ur,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Po(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},Oo=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Io=t=>{var e={};for(var i of Oo){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=ir({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),A(o)&&C(t.asset_host)&&(n.asset_host=o)),P(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:P(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error($o+t.property_denylist)),n},Co=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Ao=(t=class t{du(t){if(t){var e=this.su.indexOf(t);-1!==e&&this.su.splice(e,1)}}vu(t,e){return this.du(t),this.su.push(e),null==e.initialize||e.initialize(),e}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){if(!(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())){var t,e,i,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.mu||(r?(t="persistence is set to '"+this.config.persistence+"'",e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",e="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+e+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}yu(){if(!this.fu()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.bu()||t.load(!0);var e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){var i=this.config.get_device_id(pr());this.register({distinct_id:i,$device_id:i}),t.set_property(Ei,Gi)}this._u()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var e;this.wu=!1,this.ku=!1,this.webPerformance=new Co,this.Su=!1,this.version=ge.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Vn,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ro(),this.SentryIntegration=qr,this.sentryIntegration=t=>function(t,e){var i=Wr(t,e);return{name:zr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new qn(this),this.pageViewManager=new Gr(this),this.rateLimiter=new js(this),this.requestRouter=new no(this),this.consent=new Fr(this),this.externalIntegrations=new uo(this);var i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=A(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t))}init(e,i,r){if(r&&r!==To){var s,n=null!==(s=fo[r])&&void 0!==s?s:new t;return n._init(e,i,r),fo[r]=n,fo[To][r]=n,n}return this._init(e,i,r)}_init(t,e,r){var s,o,a;void 0===e&&(e={});var l,h=A(t)?t.trim():"";if(!h)return ue.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 h!==(null==(l=this.config)?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ro(e.defaults),e.debug=this.Pu(e.debug),this.Ru=e,this.Au=[],e.person_profiles?this.Mu=e.person_profiles:e.process_person&&(this.Mu=e.process_person);var u=Ro(e.defaults),d=Io(e),v=ir({},u,d,{name:r,token:h});O(u.rageclick)&&O(d.rageclick)&&(v.rageclick=ir({},u.rageclick,d.rageclick)),O(u.session_recording)&&O(d.session_recording)&&(v.session_recording=ir({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Ss.GZipJS;var c=this.bu();if(this.persistence=new xs(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Nr.Et()){var _=Nr.Dt(this.Cu);P(_)&&_.forEach(t=>{A(t)&&this.xu.add(t)})}else Nr.Lt(this.Cu);var p=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new zn(t=>this.Ou(t),this.config.request_queue_config),this.Du=new Wn(this),this.__request_queue=[];var g=this.fu();g||(this.sessionManager=new Kn(this),this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(g)},0)):(ue.info("Initializing extensions synchronously"),this.qu(g)),ge.DEBUG=ge.DEBUG||this.config.debug,ge.DEBUG&&ue.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:f}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(o=e.bootstrap)?void 0:o.distinctID;if(this.mu=!!m&&!M(m),null!=(a=e.bootstrap)&&a.distinctID){var b=e.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Ei);if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===y)this.identify(b);else if(e.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===y)ue.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 x=this.config.get_device_id(pr()),S=e.bootstrap.isIdentifiedID?x:b;this.persistence.set_property(Ei,e.bootstrap.isIdentifiedID?Hi:Gi),this.register({distinct_id:b,$device_id:S})}}if(g)this.register_once({distinct_id:Ci,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(pr());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Ei,Gi)}return lr(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),lr(n,"pageshow",()=>{var t;this.wu=!1,this.ku||null==(t=this.Du)||t.resume()}),e.segment?jr(this,()=>this.ju()):this.ju(),R(this.config._onCapture)&&this.config._onCapture!==mo&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ue.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 Xn.apply(this,arguments)}().then(t=>{t&&this.register({[ye]:t})}).catch(mo),this}Bu(t){var e=t;return A(e.name)&&R(e.setup)}Hu(t,e){this.Bu(t)?e.push(()=>{this.zu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)})}):this.su.push(t)}Nu(){var e,i,r,s,n,o,a=null!==(e=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==e?e:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.Uu)||o.call(this),this.Uu=void 0,this.featureFlags=new a(this)),R(this.featureFlags.onReloading)&&R(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}qu(e){var r,s,n,o,a,l,h,u=performance.now(),d=i({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.su.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new d.exceptions(this)),d.historyAutocapture&&this.su.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.su.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.su.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!e&&this.su.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Hu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Hu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.Hu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.su.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.su.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.su.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.su.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.su.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Br)),d.toolbar&&this.su.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.su.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.su.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Wu){var t=this.Wu;this.Wu=void 0,this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}}),this.Vu(v,u)}Vu(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,e)},0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Mi]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Di]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Kl(t){var e;if(!l||!l.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=x(r.supportedCompression,Ss.GZipJS)?Ss.GZipJS:x(r.supportedCompression,Ss.Base64)?Ss.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Vi}),null==(e=this.Gu)||e.handleRemoteConfig(t),this.su.forEach(e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t))}ju(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var t=h.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new Ws(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Fu)||t.enable())}_dom_loaded(){this.is_capturing()&&tr(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,e,i,r,s;this.wu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(Xi),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Fu)||r.unload(),null==(s=this.Du)||s.unload()):this.Ku()&&this.capture(Xi,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?ko?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(n.compression)&&n.data&&(n.compression=Ss.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(P(o=n.data)?o:[o]).map(t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),P(t)?t.map(t=>i({},t,{sent_at:e})):i({},t,{sent_at:e})}(n.data))),n.url=Ln(n.url,n.method,n.compression,n.timestampMode);var v=jn.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),_=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(e(t[i]))return t[i]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!_)throw new Error("No available transport method");var p=t=>{try{_(t)}catch(t){Nn(t)?ue.warn(t):ue.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ss.GZipJS&&c&&"undefined"!=typeof Promise&&!Pn?Mn(n).then(t=>{p(t)}).catch(e=>{if(ne(e))return Pn=!0,void p(i({},n,{compression:void 0,url:Ln(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return ne(t)||e===ie})(e)&&(Pn=!0),p(n)}):_(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){go++;try{var e,i=[],r=[],s=[];tr(t,t=>{if(t)if(P(e=t[0]))s.push(t);else if(R(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else P(t)&&"alias"===e?i.push(t):P(t)&&-1!==e.indexOf("capture")&&R(this[e])?s.push(t):r.push(t)});var n=function(t,e){tr(t,function(t){try{if(P(t[0])){var i=e;er(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}})};n(i,this),n(r,this),n(s,this)}finally{go--}}push(e){if(go>0&&P(e)&&A(e[0])){var i=t.prototype[e[0]];R(i)&&i.apply(this,e.slice(1))}else this._execute_array([e])}Xu(){var t,e=null==(t=this.persistence)?void 0:t.get_property(Ee);return A(e)&&So.test(e)?{value:e,delivered:!1}:O(e)&&A(e.value)&&So.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}Yu(t,e,i,r){if(this.persistence){this.persistence.refreshKey(Ee);var s=this.Xu();if(!r){if(i)return A(e)&&So.test(e)?(e!==(null==s?void 0:s.value)&&this.persistence.register({[Ee]:{value:e,delivered:!1}}),{value:e,pending:e!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ee);if(A(t)&&xo.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ee]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ee)}}th(t){if(this.persistence){this.persistence.refreshKey(Ee);var e=this.Xu();(null==e?void 0:e.value)!==t||e.delivered||this.persistence.register({[Ee]:{value:t,delivered:!0}})}}capture(t,e,r){var s,n,o,a,l,h,u,d,v,c,_;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu){if(this.is_capturing())if(!C(t)&&A(t)){this.yu();var p=!this.config.opt_out_useragent_filter&&this._is_bot();if(!p||this.config.__preview_capture_bot_pageviews){var f=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==f||!f.isRateLimited){var g;null!=e&&e.$current_url&&!A(null==e?void 0:e.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r._originatedFromCaptureException||ue.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&&(g=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 m=new Date,b=(null==r?void 0:r.timestamp)||m,w=Xt(null==r?void 0:r.uuid,pr),y={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},b,w)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&p&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),f&&(y.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);var x="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!x&&(y.$set=null==r?void 0:r.$set);var S=O(null==e?void 0:e.$set)?e.$set:void 0,E=!(null==r||!r.$set)&&"$fbc"in r.$set,T=E||!!S&&"$fbc"in S,k=E?null==r||null==(s=r.$set)?void 0:s[Se]:null==S?void 0:S[Se],R=P(null==e?void 0:e.$unset)?e.$unset:[],M=(null==r?void 0:r.$unset)||[],D=-1!==R.indexOf("$fbc")||-1!==M.indexOf("$fbc"),F=this.Yu(null==(n=g)?void 0:n.fbclid,k,T,D);F&&!0===y.properties.$process_person_profile&&F.pending&&!T&&!x&&(y.$set=i({[Se]:F.value},y.$set));var U=null==r?void 0:r.$unset;U&&(y.$unset=U);var B=x?void 0:this.ih(null==r?void 0:r.$set_once,t!==Zi,t===Qi);if(B&&(y.$set_once=B),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,v=y,c=t=>A(t)?t.slice(0,d):t,_=new Set,y=function t(e,i){if(e!==Object(e))return c?c(e):e;if(!_.has(e)){var r;if(_.add(e),P(e))r=[],tr(e,e=>{r.push(t(e))});else{var s={};er(z(e)?nr(e):e,(e,i)=>{_.has(e)||(s[i]=t(e,i))}),r=s}return r}}(v)),y.timestamp=b,C(null==r?void 0:r.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=m),x&&(y.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return ee.forEach(r),e.forEach(r),i}(y.properties,Eo)),t===As.DISMISSED||t===As.SENT){var L=null==e?void 0:e[Ms.SURVEY_ID],j=null==e?void 0:e[Ms.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){oo.error("Failed to persist survey seen state",t)}})({id:L,current_iteration:j}),y.$set=i({},y.$set,{[Qn({id:L,current_iteration:j},t===As.SENT?"responded":"dismissed")]:!0})}else t===As.SHOWN&&(y.$set=i({},y.$set,{[Ms.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Us.SHOWN){var W=null==e?void 0:e[Bs.TOUR_TYPE];W&&(y.$set=i({},y.$set,{[Bs.TOUR_LAST_SEEN_DATE+"/"+W]:(new Date).toISOString()}))}var q=i({},y.properties.$set,y.$set);if(I(q)||this.setPersonPropertiesForFlags(q),!N(this.config.before_send)){var G=this.Os(y);if(!G)return;(y=G).uuid=Xt(y.uuid,pr)}var H=null!==(o=null==(a=y.$set)?void 0:a.$fbc)&&void 0!==o?o:O(null==(l=y.properties)?void 0:l.$set)?y.properties.$set.$fbc:void 0,V=null!=F&&F.pending&&H===F.value?F.value:void 0;this.au.emit("eventCaptured",y);var J,Y=null!==(h=null==r?void 0:r._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),K="recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(Y),X=i({method:"POST",url:Y,data:y,compression:"best-available",timestampMode:K?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},K&&null!=(u=y.properties)&&u.$session_id?{batchGroup:y.properties.$session_id}:{},null!=r&&r.transport?{transport:r.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.th(V)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||V?(!X.transport&&!X.callback&&I(null!==(J=this.config.request_headers)&&void 0!==J?J:{})&&this.wu&&(X.transport="sendBeacon"),this.Ou(X)):this.Fu.enqueue(X),y}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null==(e=this.Gu)?void 0:e.getExtension(t)}zu(){var t;return null!==(t=this.Gu)&&void 0!==t?t:this.Gu=new po(this)}hu(t){this.$u.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.$u.indexOf(t);-1!==i&&this.$u.splice(i,1)}}}nh(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.xu.clear(),this.sh()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.nh();var a=o?void 0:this.persistence.remove_event_timer(t),u=i({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.fu()&&(u[Ai]=!0),"$snapshot"===t){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!A(u.distinct_id)&&!F(u.distinct_id)||M(u.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,c=function(t,e,i,r){var s,o,a,l;if(void 0===r&&(r=!1),!_)return{};var u,d=t?[...ts,...e||[]]:[],v=function(t){for(var e=0;Ht.length>e;e++){var i=Ht[e],r=i[1],s=i[0].exec(t),n=s&&(R(r)?r(s,t):r);if(n)return n}return["",""]}(_),c=v[0],p=v[1],f=function(t){for(var e=0;Yt.length>e;e++){var i,r=Yt[e],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(i=n&&t.match(n)||o)?void 0:i[1])||""]}return["",""]}(_),g=f[0],b=f[1],w=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},y={};C(i)||(y.detectGoogleSearchApp=i);var x={},S=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,T=null==n||null==(a=n.screen)?void 0:a.width,k=null==n||null==(l=n.screen)?void 0:l.height,P=null==n?void 0:n.devicePixelRatio;C(S)||(x.userAgentDataPlatform=S),C(E)||(x.maxTouchPoints=E),C(T)||(x.screenWidth=T),C(k)||(x.screenHeight=k),C(P)||(x.devicePixelRatio=P);var O,I,A,M,D,N,F,U,B=ir(sr({$os:c,$os_version:p,$browser:Wt(_,navigator.vendor,w,y),$webview_app:g,$webview_app_version:b,$device:Vt(_),$device_type:(I=_,A=x,U=Vt(I),U===Z||U===Q||"Kobo"===U||"Kindle Fire"===U||U===$t?X:U===vt||U===_t||U===ct||U===wt?"Console":U===tt?"Wearable":U?Y:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(M=null==A?void 0:A.maxTouchPoints)&&void 0!==M?M:0)>0?600>Math.min(null!==(D=null==A?void 0:A.screenWidth)&&void 0!==D?D:0,null!==(N=null==A?void 0:A.screenHeight)&&void 0!==N?N:0)/(null!==(F=null==A?void 0:A.devicePixelRatio)&&void 0!==F?F:1)?Y:X:"Desktop"),$timezone:ds(),$timezone_offset:vs()}),{$current_url:Zr(r?Zt(null==h?void 0:h.href):null==h?void 0:h.href,d,is),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:Gt(_,navigator.vendor,w,y),$browser_language:os(),$browser_language_prefix:(O=os(),"string"==typeof O?O.split("-")[0]:void 0),$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(B.$sdk_dist_channel=m.SDK_DIST_CHANNEL),B}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),f=p.windowId;u.$session_id=p.sessionId,u.$window_id=f}this.sessionPropsManager&&ir(u,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ir(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(g=this.Du)?void 0:g.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===eo&&(u.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||o?"$pageleave"!==t||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),u=ir(u,v),"$pageview"===t&&l&&(u.title=l.title),!C(a)){var b=r.getTime()-a;u.$duration=parseFloat((b/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var w=this.persistence.properties(),y=this.sessionPersistence.properties(),x=u.$groups,S=w.$groups;O(x)&&!I(x)&&(u.$groups=i({},O(S)?S:{},x)),er(["$referrer","$referring_domain"],t=>{t in w&&delete y[t]});var E={};if(this.$u.length>0)for(var T of this.$u.slice())try{ir(E,T())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=ir({},c,w,y,i({},E,u))).$is_identified=this._isIdentified(),P(this.config.property_denylist)?er(this.config.property_denylist,function(t){delete u[t]}):ue.error($o+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(ue.error(yo),u=k(u,t));var D=this.rh();return u.$process_person_profile=D,D&&!o&&this.oh("_calculate_event_properties"),u}ih(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rh())return t;if(this.Su&&!i)return t;var s=ir({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ue.error(yo),s=n(s,"$set_once")),e&&(this.Su=!0),I(s)?void 0:s}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.nh(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach(t=>this.xu.add(t)),this.sh()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.xu.delete(t),this.sh()}ah(t,e){this.register({[t]:e})}Lu(){this.xu.forEach(t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(this.Cu)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.pi||!Nr.Et())Nr.Lt(this.Cu);else{var e=[];this.xu.forEach(t=>e.push(t)),e.length>0?Nr.At(this.Cu,e):Nr.Lt(this.Cu)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.au.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:wo}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:wo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:wo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=ao),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:wo}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:wo})}uh(t){return!t||M(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ue.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(ue.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return ue.uninitializedWarning("posthog.identify");if(F(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.uh(t)&&this.oh("posthog.identify")){this.yu();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.nh(!1),o=this.persistence.Pl(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister($e),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===Gi,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Ei,Hi),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(Qi,c,{$set:e||{},$set_once:i||{}}),this.Eu=Zn(t,e,i),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Ei,Hi);var _=e||{},p=i||{};this.setPersonPropertiesForFlags({$set:_,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:_,$set_once:p}),this.Eu=Zn(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(yi)):d&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}}setPersonProperties(t,e){if((t||e)&&this.oh("posthog.setPersonProperties")){var i=Zn(this.get_distinct_id(),t,e);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Eu=i):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(P(t)?t:[t]).filter(t=>A(t)&&t.length>0);0!==i.length&&this.oh("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.nh();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),(o||r)&&this.rh()){var a={$group_type:t,$group_key:e};r&&(a.$group_set=r),this.capture(Zi,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else ue.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.oh("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=B(t)?t:null==t?void 0:t.resetDeviceID,i=B(t)||null==t?void 0:t.bootstrap;this.hh(e,!1,i)}hh(t,e,r){var s,n,o,a;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var l=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Ru)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var h=this.get_property(we),u=this.get_property(ye),d=this.get_property(Fe);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),e||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var c=null==(a=this.persistence)||null==a.Pl?void 0:a.Pl(),_=!1;try{var p,f,g,m,b,w,y,x,S,E,T,k,P;if(null==(p=this.persistence)||p.clear(),null==(f=this.sessionPersistence)||f.clear(),this.xu.clear(),this.sh(),C(d)||null==(g=this.persistence)||g.register({[Fe]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Ei,Gi),null==(E=this.sessionManager)||E.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Ci,$device_id:null},"");else{var R=this.config.get_device_id(pr());this.register_once({distinct_id:R,$device_id:t?R:h},""),t||C(u)||this.register({[ye]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(r.distinctID&&!this.fu()&&(null==(P=this.persistence)||P.set_property(Ei,r.isIdentifiedID?Hi:Gi),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(N(l)||null!=(k=this.sessionManager)&&k.setBootstrapSessionId(l,!0))){var O=i({},r);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var I;c&&(null==(I=this.persistence)||null==I.Ol||I.Ol(_))}this.reloadFeatureFlags()}shutdown(t){var e=this;return s(function*(){var t,i,r,s,n,o,a,l;if(e.__loaded){e.ku=!0,e.zu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.metrics)||s.dispose(),null==(n=e.Fu)||n.unload(),null==(o=e.Du)||o.unload();try{var h;null==(h=e.featureFlags)||h.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}null==(a=e.persistence)||a.destroy(),null==(l=e.sessionPersistence)||l.destroy()}else ue.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property("$people_distinct_id")?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.ah($e,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(O(t)){var r,s,n,o,a,l,h,u,d,v,c,_,p,f;ir(this.config,Io(t));var g=this.bu();null==(r=this.persistence)||r.update_config(this.config,e,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xs(i({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.Pu(this.config.debug);B(m)&&(this.config.debug=m),B(this.config.debug)&&(this.config.debug?(ge.DEBUG=!0,$r.Et()&&$r.At("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(ge.DEBUG=!1,$r.Et()&&$r.Lt("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.metrics)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(_=this.deadClicksAutocapture)||_.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._u(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&jr(this,mo,!1)}}_overrideSDKInfo(t,e){ge.LIB_NAME=t,ge.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},r,e))}catch(t){return}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var e,i;return null!==(e=null==(i=this.logs)?void 0:i.logger)&&void 0!==e?e:t.ph}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:To;return e!==To&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(e=this.sessionPersistence)?void 0:e.get_property("$user_state"))}rh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(e=this.persistence)||null==(e=e.props)||!e.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Ii,!0),!0)}bu(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_u(){var t,e,i,r,s,n=this.bu();return this.is_capturing()||null==(t=this.logs)||t._onOptOut(),(null==(e=this.persistence)?void 0:e.pi)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.pi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.xu.clear(),this.sh()),n}opt_in_capturing(e){var i,r,s;if("always"!==this.config.cookieless_mode){if(this.fu()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Kn(this),this.pageViewManager=new Gr(this),this.persistence&&(this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.vu(this.sessionRecording,new v(this)),this.lu&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(C(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ue.warn(bo)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,e,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Ci,$device_id:null}),this.du(i),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}else ue.warn(bo)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._u()}_is_bot(){return a?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&V(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>V(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver}(a,this.config.custom_blocked_useragents):void 0}Qu(){l&&("visible"===l.visibilityState?this.Tu||(this.Tu=!0,this.capture(Ki,{title:l.title},{send_instantly:!0}),this.Iu&&(l.removeEventListener(Ji,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),lr(l,Ji,this.Iu)))}debug(t){!1===t?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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 t=this.Ru||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ue.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):function(t,e,i,r,s){var n=e in t&&!N(t[e]),o=i in t&&!N(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,ue)}Os(t){var e;if(N(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(j),r=P(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),N(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return L(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!I(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return ue.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&N(s.properties[a]))return ue.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Bo)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Pu(t){var e=B(t)&&!t,i=$r.Et()&&"true"===$r.Ot("ph_debug");return!e&&(!!i||t)}},t.__defaultExtensionClasses={},t.ph={trace:to=()=>{},debug:to,info:to,warn:to,error:to,fatal:to},t);!function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=rr(t.prototype[e[i]])}(Ao,["identify"]);var Mo=function(){ge.SDK_DIST_CHANNEL="npm";var t=fo[To]=new Ao;return function(){function t(){t.done||(t.done=!0,ko=!1,er(fo,function(t){t._dom_loaded()}))}null!=l&&l.addEventListener?"complete"===l.readyState?t():lr(l,"DOMContentLoaded",t,{capture:!1}):n&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{Ss as Compression,Fs as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ds as DisplaySurveyType,Ao as PostHog,Us as ProductTourEventName,Bs as ProductTourEventProperties,As as SurveyEventName,Ms as SurveyEventProperties,Es as SurveyEventType,ks as SurveyPosition,Is as SurveyQuestionBranchingType,Os as SurveyQuestionType,Cs as SurveySchedule,Ps as SurveyTabPosition,Rs as SurveyType,Ts as SurveyWidgetType,Mo as default,Mo as posthog,qs as severityLevels};
2
2
  //# sourceMappingURL=module.slim.js.map