@mcpjam/inspector 3.27.0 → 3.27.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/client/assets/{CaniuseCapabilityPage-CXmikV_v.js → CaniuseCapabilityPage-BGCx_CV1.js} +4 -4
  2. package/dist/client/assets/{CaniuseLoadingScreen-CISUL_K4.js → CaniuseLoadingScreen-CnLJTk-6.js} +2 -2
  3. package/dist/client/assets/{PosthogUtils-E_cG1Twh.js → PosthogUtils-BnkWsJl1.js} +1 -1
  4. package/dist/client/assets/{PosthogUtils-DE_PkwDN.js → PosthogUtils-CreNC30F.js} +2 -2
  5. package/dist/client/assets/{access-link-C0MWhbv8.js → access-link-CiqZlBT_.js} +2 -2
  6. package/dist/client/assets/{app-bootstrap-DfSpCiag.js → app-bootstrap-Dihy9pBm.js} +328 -328
  7. package/dist/client/assets/{app-navigation-BQGUR9cb.js → app-navigation-BzZWduTQ.js} +2 -2
  8. package/dist/client/assets/{bundle-mjs-DKP7sq7T.js → bundle-mjs-C4gHyVze.js} +2 -2
  9. package/dist/client/assets/{caniuse-bootstrap-D6d1Susz.js → caniuse-bootstrap-DClGA--s.js} +3 -3
  10. package/dist/client/assets/{chunk-D32TOXHM-D2CUPCH8.js → chunk-D32TOXHM-BM6p8aoA.js} +5 -5
  11. package/dist/client/assets/{dead-clicks-autocapture-DvbdThCp.js → dead-clicks-autocapture-DMIvXYDI.js} +2 -2
  12. package/dist/client/assets/{error-reporting-B_hxqtsN.js → error-reporting-BufzMdax.js} +1 -1
  13. package/dist/client/assets/{error-reporting-CJClTLWK.js → error-reporting-C3V1rL02.js} +2 -2
  14. package/dist/client/assets/{exception-autocapture-CkcPU7XW.js → exception-autocapture-D42Ql1CZ.js} +2 -2
  15. package/dist/client/assets/{feature-flags-BUIQpHKT.js → feature-flags-9Kzm95Iy.js} +3 -3
  16. package/dist/client/assets/{first-run-oauth-return-l9GCZrqg.js → first-run-oauth-return-DBF8M446.js} +2 -2
  17. package/dist/client/assets/{highlighted-body-KQOG7T2V-uT92T9zL.js → highlighted-body-KQOG7T2V-BDDk3j-o.js} +2 -2
  18. package/dist/client/assets/{index-ByP2kceG.js → index-CB2B0gyI.js} +3 -3
  19. package/dist/client/assets/{jszip.min-C5LLiUXa.js → jszip.min-D0H-wysy.js} +2 -2
  20. package/dist/client/assets/{mcp-init-BIoRq6yl.js → mcp-init-D384t3us.js} +3 -3
  21. package/dist/client/assets/{mermaid-MCJ5UELQ-BCP5Oj92.js → mermaid-MCJ5UELQ-DXZIWzsB.js} +1 -1
  22. package/dist/client/assets/{module-Wq_OenZL.js → module-BHBrpZ4U.js} +2 -2
  23. package/dist/client/assets/{module-D3s7YCoh.js → module-CmXaunIz.js} +1 -1
  24. package/dist/client/assets/posthog-bundled-extensions-CrY82kI1.js +3 -0
  25. package/dist/client/assets/{posthog-bundled-extensions-BIjySVP-.js → posthog-bundled-extensions-DUscOFM-.js} +1 -1
  26. package/dist/client/assets/{posthog-recorder-DTh3r-Ko.js → posthog-recorder-PnXQoK1P.js} +2 -2
  27. package/dist/client/assets/{preload-helper-BN6vHXe1.js → preload-helper-Dk-R02bM.js} +1 -1
  28. package/dist/client/assets/{project-route-CjZmQY5n.js → project-route-CwOywjoT.js} +2 -2
  29. package/dist/client/assets/{react-dom-DtL8G3gn.js → react-dom-s4nupq_N.js} +2 -2
  30. package/dist/client/assets/{rolldown-runtime-KtSMB9jY.js → rolldown-runtime-Df2-koJ7.js} +1 -1
  31. package/dist/client/assets/{server-feature-flags-wgvQSqd5.js → server-feature-flags-ByZjY7fi.js} +2 -2
  32. package/dist/client/assets/{server-feature-flags-BBH-SYjw.js → server-feature-flags-CqB4sk67.js} +1 -1
  33. package/dist/client/assets/{session-revoked-HpzxsCkX.js → session-revoked-B_iZLaTD.js} +2 -2
  34. package/dist/client/assets/{surveys-BYfLymeD.js → surveys-B4xlE-Cz.js} +2 -2
  35. package/dist/client/assets/telemetry-files-620cc3a6060f3829.js +1 -0
  36. package/dist/client/assets/{trace-timeline-BFtz0cI8.js → trace-timeline-BEzP_FzL.js} +1 -1
  37. package/dist/client/assets/{trace-timeline-CRxEZYCU.js → trace-timeline-BWWuYM0j.js} +2 -2
  38. package/dist/client/assets/{web-vitals-C1IvwuFq.js → web-vitals-jdhe8VpD.js} +2 -2
  39. package/dist/client/index.html +12 -12
  40. package/dist/server/harness-install-cli.js +3 -3
  41. package/dist/server/index.js +2 -2
  42. package/package.json +2 -2
  43. package/dist/client/assets/posthog-bundled-extensions-CQjB_Dfr.js +0 -3
  44. package/dist/client/assets/telemetry-files-5758eea65e761de9.js +0 -1
@@ -1,5 +1,5 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.27.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1ba1863e-a2b1-47ac-96b4-1f21b42bb103",e._sentryDebugIdIdentifier="sentry-dbid-1ba1863e-a2b1-47ac-96b4-1f21b42bb103")}catch{}})();var b="u">typeof window?window:void 0,ge="u">typeof globalThis?globalThis:b,he=ge?.navigator,x=ge?.document,te=ge?.location,ui=ge?.fetch,wr=ge?.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,Gr=ge?.AbortController,Kl=ge?.CompressionStream,me=he?.userAgent;function ko(){return!(!b||b.navigator.onLine===!1)}var jt=typeof globalThis<"u"?globalThis:b;jt&&typeof self>"u"&&(jt.self=jt),jt&&typeof File>"u"&&(jt.File=function(){});var C=b??{},Jr="0.9.0",We={DEBUG:!1,LIB_VERSION:Jr,LIB_NAME:"browser-common",JS_SDK_VERSION:Jr},De=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Vs=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Xl=["$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"],Ql=["token"];function F(e,t){return e.indexOf(t)!==-1}var is=function(e){return e.trim()},Ws=function(e){return e.replace(/^\$/,"")};function So(e){var t;const i=[];return(t=JSON.stringify(e,function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(r))return"[Circular]";i.push(r)}return r}}))!==null&&t!==void 0?t:"null"}var $o=Object.prototype,Er=$o.hasOwnProperty,ss=$o.toString,A=Array.isArray||function(e){return ss.call(e)==="[object Array]"},ce=e=>typeof e=="function",N=e=>e===Object(e)&&!A(e),xe=e=>{if(N(e)){for(const t in e)if(Er.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,L=e=>ss.call(e)=="[object String]",Xt=e=>L(e)&&e.trim().length===0,ie=e=>e===null,M=e=>E(e)||ie(e),ne=e=>ss.call(e)=="[object Number]"&&e==e,qe=e=>ne(e)&&e>0,be=e=>ss.call(e)==="[object Boolean]",Zl=e=>F(Xl,e),eu=e=>F(Ql,e);function Io(e){return e===null||typeof e!="object"}function Di(e,t){return{}.toString.call(e)===`[object ${t}]`}function Nt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Po(e,Error)}}function xr(e){return"u">typeof Event&&Po(e,Event)}function Po(e,t){try{return e instanceof t}catch{return!1}}var tu=[!0,"true",1,"1","yes"],us=e=>F(tu,e),iu=[!1,"false",0,"0","no"];function Yr(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(u){i(u);return}a.done?t(l):Promise.resolve(l).then(s,r)}function Q(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(l){Yr(n,s,r,o,a,"next",l)}function a(l){Yr(n,s,r,o,a,"throw",l)}o(void 0)})}}var su=["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"],Kr=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return su.concat(t).some(s=>{const r=s.toLowerCase();return i.indexOf(r)!==-1})};function Ne(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),ne(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ne(r??i,t,i,s))}var ru=class{constructor(e){this.C={},this.I=e.I,this.R=Ne(e.bucketSize,0,100,e.A),this.$=Ne(e.refillRate,0,this.R,e.A),this.O=Ne(e.refillInterval,0,864e5,e.A)}F(e,t){const i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.$,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}},Ft="Mobile",ci="Android",Ni="Tablet",Oo="Android Tablet",To="iPad",Co="Apple Watch",Oi="Safari",rs="BlackBerry",Ro="Samsung Internet",Ti="Chrome",Fo="Chrome iOS",Ao="Internet Explorer",Mo="Internet Explorer Mobile",Lo="Opera",Do="Microsoft Edge",Ci="Firefox",No="Firefox iOS",ji="Nintendo",Bi="PlayStation",ns="Xbox",jo="Android Mobile",Bo="Mobile Safari",cs="Windows",Uo="Windows Phone",Xr="Nokia",Gs="Ouya",nu="Generic "+Ft.toLowerCase(),qo="Generic "+Ni.toLowerCase(),Js="Konqueror",zo="Oculus Browser",Ho="Vivaldi",Vo="Yandex",Wo="Whale",Go="DuckDuckGo",Jo="Pale Moon",Yo="Waterfox",Ys="Brave",Ko="Claude",Xo="Codex",Qo="ChatGPT",Zo="Google Search App",hs=new RegExp("Version/(\\d+(\\.\\d+)?)"),ds=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ou=new RegExp(ns,"i"),au=new RegExp("PlayStation \\w+","i"),lu=new RegExp("Nintendo \\w+","i"),kr=new RegExp("BlackBerry|PlayBook|BB10","i"),uu={"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"},ea=function(e,t,i,s){return t=t||"",(function(r){return r?.brave?Ys:null})(i)||(s?.detectGoogleSearchApp&&F(e,"GSA/")?Zo:F(e," OPR/")&&F(e,"Mini")?"Opera Mini":F(e," OPR/")?Lo:kr.test(e)?rs:F(e,"IEMobile")||F(e,"WPDesktop")?Mo:F(e,"OculusBrowser")?zo:F(e,"SamsungBrowser")?Ro:F(e,"Edge")||F(e,"Edg/")?Do:F(e,"Vivaldi/")?Ho:F(e,"YaBrowser/")?Vo:F(e,"Whale/")?Wo:F(e,"DuckDuckGo/")||F(e,"Ddg/")?Go:F(e,"Claude/")?Ko:F(e,"Codex/")?Xo:F(e,"ChatGPT/")?Qo:F(e,"FBIOS")?"Facebook Mobile":F(e,"UCWEB")||F(e,"UCBrowser")?"UC Browser":F(e,"CriOS")?Fo:F(e,"CrMo")||F(e,Ti)?Ti:F(e,ci)&&F(e,Oi)?jo:F(e,"FxiOS")?No:F(e.toLowerCase(),Js.toLowerCase())?Js:F(e,"Brave/")?Ys:((r,n)=>n&&F(n,"Apple")||(function(o){return F(o,Oi)&&!F(o,Ti)&&!F(o,ci)})(r))(e,t)?F(e,Ft)?Bo:Oi:F(e,"PaleMoon/")?Jo:F(e,"Waterfox/")?Yo:F(e,Ci)?Ci:F(e,"MSIE")||F(e,"Trident/")?Ao:F(e,"Gecko")?Ci:"")},cu={[Mo]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Do]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Oi]:[hs],[Bo]:[hs],[Lo]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[No]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Js]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[rs]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),hs],[jo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ro]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[zo]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ho]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Vo]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Wo]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ys]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ko]:[ds],[Xo]:[ds],[Qo]:[ds],[Go]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Jo]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Yo]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Zo]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Ao]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},hu=function(e,t,i,s){const r=ea(e,t,i,s),n=cu[r];if(E(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Qr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ns,e&&e[1]||""]],[new RegExp(ji,"i"),[ji,""]],[new RegExp(Bi,"i"),[Bi,""]],[kr,[rs,""]],[new RegExp(cs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Uo,""];if(new RegExp(Ft).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=uu[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[cs,s]}return[cs,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ci,[e[2],e[3],e[4]||"0"].join(".")]:[ci,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],ta=function(e){for(let t=0;Qr.length>t;t++){const[i,s]=Qr[t],r=i.exec(e),n=r&&(ce(s)?s(r,e):s);if(n)return n}return["",""]},ia=function(e){return lu.test(e)?ji:au.test(e)?Bi:ou.test(e)?ns:new RegExp(Gs,"i").test(e)?Gs:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Uo:/iPad/.test(e)?To:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Co:kr.test(e)?rs:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Xr,"i").test(e)?Xr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Ft).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ci:Oo:new RegExp("(pda|Mobile)","i").test(e)?nu:new RegExp(Ni,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?qo:""},du=function(e,t){var i;const s=ia(e);return s===To||s===Oo||s==="Kobo"||s==="Kindle Fire"||s===qo?Ni:s===ji||s===ns||s===Bi||s===Gs?"Console":s===Co?"Wearable":s?Ft:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((r=t?.screenWidth)!==null&&r!==void 0?r:0,(n=t?.screenHeight)!==null&&n!==void 0?n:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Ft:Ni:"Desktop";var r,n,o},vs=/\bFBAV\/(\d+(?:\.\d+)*)/i,Zr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",vs],[/\bFBAN\/EMA\b/i,"Facebook Lite",vs],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",vs],[/\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"]],Ks="[Truncated]",mi="[Unserializable]";function Tt(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const r=e.charCodeAt(i+1);56320>r||r>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function sa(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(const s of i){let r;try{r=t[s]}catch{r=mi}Object.defineProperty(e,s,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}var Ri=3e5,ra=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Ri);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+Ri))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Ri,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},vu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function en(e,t){return typeof(i=e)=="string"&&vu.test(i)?e:t();var i}function na(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function ot(e){return e&&e.split("#")[0]}function tn(e){try{return e()}catch{return}}function oa(e,t){const i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function sn(e,t,i){return aa.apply(this,arguments)}function aa(){return(aa=Q(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((r,n)=>{s=oa(()=>{try{i?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var wi,rn,ps;function pu(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return ps&&i.length===rn||(rn=i.length,ps=i.reduce((s,r)=>{wi||(wi={});const n=wi[r];if(n)s[n[0]]=n[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],u=l?.filename,c=t[r];if(u&&c){s[u]=c,wi[r]=[u,c];break}}}return s},{})),ps}function Qt(e){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(e)}function fu(e,t,i){return(t=(function(s){var r=(function(n){if(Qt(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Qt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(s);return Qt(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function nn(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function p(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(i),!0).forEach(function(s){fu(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nn(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var gu=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Q(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&A(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return p(p({},e),{},{cause:s,stack:r,errors:(i=e.errors)===null||i===void 0?void 0:i.map(n=>this.parseStacktrace(n,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Q(function*(){let i=e;for(const s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){const i=[],s=(r,n,o)=>{var a;const l=i.length,u=n===void 0?p(p({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:r.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:r.synthetic,exception_id:l,parent_id:n},c={type:r.type,value:r.value,mechanism:u};r.stack&&(c.stacktrace={type:"raw",frames:r.stack}),i.push(c),r.cause&&s(r.cause,l,"cause");for(const d of(a=r.errors)!==null&&a!==void 0?a:[])s(d,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:pu(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Nt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const r=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof r=="function"&&r.name==="AggregateError"){const n=e.errors;return A(n)?n:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,r=0,n=!1;const o=new Set,a=[],l={},u=(h,v,g=0)=>{const m=c(v,g),_=m.apply;if(m.apply=k=>{a.push(h);try{return _(k)}finally{a.pop()}},g>4||g>0&&a.indexOf(h)!==-1)return this.coerceFallback(m);const f=typeof h=="object"&&h!==null||typeof h=="function";if(g===0&&s>=50||f&&o.has(h))return;f&&o.add(h),g===0&&s++;const y=this.getAggregateErrors(h);let w,P;n||(n=!!y);try{if(w=this.applyCoercers(h,m),!w)throw l}catch(k){if(k===l)return void(g===0&&s--);if(!n)throw k;w=this.coerceFallback(m)}if(!y||s>=50)return w;try{P=y.length}catch{return w}if(!Number.isInteger(P)||0>P||P>4294967295)return w;const $=[];for(let k=0;50>s&&1e3>r&&P>k;k++){let T;r++;try{T=m.next(y[k])}catch{s++,T=this.coerceFallback(c(v+1))}T&&$.push(T)}return p(p({},w),{},{errors:$})},c=(h,v=0)=>p(p({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(g){const m=u(g,h,v+1);if(!m)throw l;return m},next:g=>u(g,h+1)}),d=c(i);return p(p({},d),{},{apply:h=>{var v;return(v=u(h,i))!==null&&v!==void 0?v:this.coerceFallback(d)}})}},_u=/^([a-z][a-z0-9.+-]+):/i,mu=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function yu(e){if(!e||e==="<anonymous>")return!1;const t=_u.exec(e);return!t||mu.includes(t[1].toLowerCase())}function Xs(e,t,i,s,r){const n={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:yu(t)};return E(s)||(n.lineno=s),E(r)||(n.colno=r),n}var la=(e,t)=>{const i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},bu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Eu=/\((\S*)(?::(\d+))(?::(\d+))\)/,xu=(e,t)=>{const i=bu.exec(e);if(i){const[,r,n,o]=i;return Xs(t,r,"?",+n,+o)}const s=wu.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=Eu.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[r,n]=la(s[1]||"?",s[2]);return Xs(t,n,r,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ku=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Su=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$u=(e,t)=>{const i=ku.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const n=Su.exec(i[3]);n&&(i[1]=i[1]||"eval",i[3]=n[1],i[4]=n[2],i[5]="")}let s=i[3],r=i[1]||"?";return[r,s]=la(r,s),Xs(t,s,r,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},on=/\(error: (.*)\)/;function Sr(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Iu(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!Sr(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let r=0;t>r;r++)e[i+r]=e[i+t+r];return e.length=i+t,{start:i,length:t}}}}function Pu(e,t){const i=t.start+t.length,s=ca(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function ua(e,t){let i=t.start;for(;i>0&&Sr(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function ca(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Sr(e[s],e[s-t.length]);)s++;return s-i}function Ou(e,t){const i=t[0];let s=e.length-(i?ua(e,i):0);for(const r of t)s-=ca(e,r);return s}function Tu(e,t,i){for(let s=0;e.length>s;s++){const r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1}var Cu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Di(e,"DOMException")}isDOMError(e){return Di(e,"DOMError")}},Ru=class{match(e){return Nt(e)}coerce(e,t){var i;const s=this.getStack(e),r=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,n=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??r,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},Fu=class{match(e){return!!Di(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);const s=t.apply(e.message);return p(p({},s),{},{stack:(i=this.lr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ar(e){return L(e.message)&&e.message.length>0}lr(e){var t,i;const s=e,r=(t=s.lineno)!==null&&t!==void 0?t:0,n=(i=s.colno)!==null&&i!==void 0?i:0;if(L(s.filename)&&s.filename.length!==0&&r!==0)return`Error
1
+ (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.27.2"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1ba1863e-a2b1-47ac-96b4-1f21b42bb103",e._sentryDebugIdIdentifier="sentry-dbid-1ba1863e-a2b1-47ac-96b4-1f21b42bb103")}catch{}})();var b="u">typeof window?window:void 0,ge="u">typeof globalThis?globalThis:b,he=ge?.navigator,x=ge?.document,te=ge?.location,ui=ge?.fetch,wr=ge?.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,Gr=ge?.AbortController,Kl=ge?.CompressionStream,me=he?.userAgent;function ko(){return!(!b||b.navigator.onLine===!1)}var jt=typeof globalThis<"u"?globalThis:b;jt&&typeof self>"u"&&(jt.self=jt),jt&&typeof File>"u"&&(jt.File=function(){});var C=b??{},Jr="0.9.0",We={DEBUG:!1,LIB_VERSION:Jr,LIB_NAME:"browser-common",JS_SDK_VERSION:Jr},De=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Vs=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Xl=["$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"],Ql=["token"];function F(e,t){return e.indexOf(t)!==-1}var is=function(e){return e.trim()},Ws=function(e){return e.replace(/^\$/,"")};function So(e){var t;const i=[];return(t=JSON.stringify(e,function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(r))return"[Circular]";i.push(r)}return r}}))!==null&&t!==void 0?t:"null"}var $o=Object.prototype,Er=$o.hasOwnProperty,ss=$o.toString,A=Array.isArray||function(e){return ss.call(e)==="[object Array]"},ce=e=>typeof e=="function",N=e=>e===Object(e)&&!A(e),xe=e=>{if(N(e)){for(const t in e)if(Er.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,L=e=>ss.call(e)=="[object String]",Xt=e=>L(e)&&e.trim().length===0,ie=e=>e===null,M=e=>E(e)||ie(e),ne=e=>ss.call(e)=="[object Number]"&&e==e,qe=e=>ne(e)&&e>0,be=e=>ss.call(e)==="[object Boolean]",Zl=e=>F(Xl,e),eu=e=>F(Ql,e);function Io(e){return e===null||typeof e!="object"}function Di(e,t){return{}.toString.call(e)===`[object ${t}]`}function Nt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Po(e,Error)}}function xr(e){return"u">typeof Event&&Po(e,Event)}function Po(e,t){try{return e instanceof t}catch{return!1}}var tu=[!0,"true",1,"1","yes"],us=e=>F(tu,e),iu=[!1,"false",0,"0","no"];function Yr(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(u){i(u);return}a.done?t(l):Promise.resolve(l).then(s,r)}function Q(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(l){Yr(n,s,r,o,a,"next",l)}function a(l){Yr(n,s,r,o,a,"throw",l)}o(void 0)})}}var su=["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"],Kr=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return su.concat(t).some(s=>{const r=s.toLowerCase();return i.indexOf(r)!==-1})};function Ne(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),ne(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ne(r??i,t,i,s))}var ru=class{constructor(e){this.C={},this.I=e.I,this.R=Ne(e.bucketSize,0,100,e.A),this.$=Ne(e.refillRate,0,this.R,e.A),this.O=Ne(e.refillInterval,0,864e5,e.A)}F(e,t){const i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.$,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}},Ft="Mobile",ci="Android",Ni="Tablet",Oo="Android Tablet",To="iPad",Co="Apple Watch",Oi="Safari",rs="BlackBerry",Ro="Samsung Internet",Ti="Chrome",Fo="Chrome iOS",Ao="Internet Explorer",Mo="Internet Explorer Mobile",Lo="Opera",Do="Microsoft Edge",Ci="Firefox",No="Firefox iOS",ji="Nintendo",Bi="PlayStation",ns="Xbox",jo="Android Mobile",Bo="Mobile Safari",cs="Windows",Uo="Windows Phone",Xr="Nokia",Gs="Ouya",nu="Generic "+Ft.toLowerCase(),qo="Generic "+Ni.toLowerCase(),Js="Konqueror",zo="Oculus Browser",Ho="Vivaldi",Vo="Yandex",Wo="Whale",Go="DuckDuckGo",Jo="Pale Moon",Yo="Waterfox",Ys="Brave",Ko="Claude",Xo="Codex",Qo="ChatGPT",Zo="Google Search App",hs=new RegExp("Version/(\\d+(\\.\\d+)?)"),ds=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ou=new RegExp(ns,"i"),au=new RegExp("PlayStation \\w+","i"),lu=new RegExp("Nintendo \\w+","i"),kr=new RegExp("BlackBerry|PlayBook|BB10","i"),uu={"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"},ea=function(e,t,i,s){return t=t||"",(function(r){return r?.brave?Ys:null})(i)||(s?.detectGoogleSearchApp&&F(e,"GSA/")?Zo:F(e," OPR/")&&F(e,"Mini")?"Opera Mini":F(e," OPR/")?Lo:kr.test(e)?rs:F(e,"IEMobile")||F(e,"WPDesktop")?Mo:F(e,"OculusBrowser")?zo:F(e,"SamsungBrowser")?Ro:F(e,"Edge")||F(e,"Edg/")?Do:F(e,"Vivaldi/")?Ho:F(e,"YaBrowser/")?Vo:F(e,"Whale/")?Wo:F(e,"DuckDuckGo/")||F(e,"Ddg/")?Go:F(e,"Claude/")?Ko:F(e,"Codex/")?Xo:F(e,"ChatGPT/")?Qo:F(e,"FBIOS")?"Facebook Mobile":F(e,"UCWEB")||F(e,"UCBrowser")?"UC Browser":F(e,"CriOS")?Fo:F(e,"CrMo")||F(e,Ti)?Ti:F(e,ci)&&F(e,Oi)?jo:F(e,"FxiOS")?No:F(e.toLowerCase(),Js.toLowerCase())?Js:F(e,"Brave/")?Ys:((r,n)=>n&&F(n,"Apple")||(function(o){return F(o,Oi)&&!F(o,Ti)&&!F(o,ci)})(r))(e,t)?F(e,Ft)?Bo:Oi:F(e,"PaleMoon/")?Jo:F(e,"Waterfox/")?Yo:F(e,Ci)?Ci:F(e,"MSIE")||F(e,"Trident/")?Ao:F(e,"Gecko")?Ci:"")},cu={[Mo]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Do]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Fo]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Oi]:[hs],[Bo]:[hs],[Lo]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[No]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Js]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[rs]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),hs],[jo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ro]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[zo]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ho]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Vo]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Wo]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ys]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ko]:[ds],[Xo]:[ds],[Qo]:[ds],[Go]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Jo]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Yo]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Zo]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Ao]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},hu=function(e,t,i,s){const r=ea(e,t,i,s),n=cu[r];if(E(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Qr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ns,e&&e[1]||""]],[new RegExp(ji,"i"),[ji,""]],[new RegExp(Bi,"i"),[Bi,""]],[kr,[rs,""]],[new RegExp(cs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Uo,""];if(new RegExp(Ft).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=uu[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[cs,s]}return[cs,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ci,[e[2],e[3],e[4]||"0"].join(".")]:[ci,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],ta=function(e){for(let t=0;Qr.length>t;t++){const[i,s]=Qr[t],r=i.exec(e),n=r&&(ce(s)?s(r,e):s);if(n)return n}return["",""]},ia=function(e){return lu.test(e)?ji:au.test(e)?Bi:ou.test(e)?ns:new RegExp(Gs,"i").test(e)?Gs:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Uo:/iPad/.test(e)?To:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Co:kr.test(e)?rs:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Xr,"i").test(e)?Xr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Ft).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ci:Oo:new RegExp("(pda|Mobile)","i").test(e)?nu:new RegExp(Ni,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?qo:""},du=function(e,t){var i;const s=ia(e);return s===To||s===Oo||s==="Kobo"||s==="Kindle Fire"||s===qo?Ni:s===ji||s===ns||s===Bi||s===Gs?"Console":s===Co?"Wearable":s?Ft:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((r=t?.screenWidth)!==null&&r!==void 0?r:0,(n=t?.screenHeight)!==null&&n!==void 0?n:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Ft:Ni:"Desktop";var r,n,o},vs=/\bFBAV\/(\d+(?:\.\d+)*)/i,Zr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",vs],[/\bFBAN\/EMA\b/i,"Facebook Lite",vs],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",vs],[/\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"]],Ks="[Truncated]",mi="[Unserializable]";function Tt(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const r=e.charCodeAt(i+1);56320>r||r>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function sa(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(const s of i){let r;try{r=t[s]}catch{r=mi}Object.defineProperty(e,s,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}var Ri=3e5,ra=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Ri);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+Ri))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Ri,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},vu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function en(e,t){return typeof(i=e)=="string"&&vu.test(i)?e:t();var i}function na(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function ot(e){return e&&e.split("#")[0]}function tn(e){try{return e()}catch{return}}function oa(e,t){const i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function sn(e,t,i){return aa.apply(this,arguments)}function aa(){return(aa=Q(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((r,n)=>{s=oa(()=>{try{i?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var wi,rn,ps;function pu(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return ps&&i.length===rn||(rn=i.length,ps=i.reduce((s,r)=>{wi||(wi={});const n=wi[r];if(n)s[n[0]]=n[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],u=l?.filename,c=t[r];if(u&&c){s[u]=c,wi[r]=[u,c];break}}}return s},{})),ps}function Qt(e){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(e)}function fu(e,t,i){return(t=(function(s){var r=(function(n){if(Qt(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Qt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(s);return Qt(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function nn(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function p(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(i),!0).forEach(function(s){fu(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):nn(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var gu=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Q(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&A(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return p(p({},e),{},{cause:s,stack:r,errors:(i=e.errors)===null||i===void 0?void 0:i.map(n=>this.parseStacktrace(n,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Q(function*(){let i=e;for(const s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){const i=[],s=(r,n,o)=>{var a;const l=i.length,u=n===void 0?p(p({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:r.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:r.synthetic,exception_id:l,parent_id:n},c={type:r.type,value:r.value,mechanism:u};r.stack&&(c.stacktrace={type:"raw",frames:r.stack}),i.push(c),r.cause&&s(r.cause,l,"cause");for(const d of(a=r.errors)!==null&&a!==void 0?a:[])s(d,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:pu(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Nt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const r=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof r=="function"&&r.name==="AggregateError"){const n=e.errors;return A(n)?n:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,r=0,n=!1;const o=new Set,a=[],l={},u=(h,v,g=0)=>{const m=c(v,g),_=m.apply;if(m.apply=k=>{a.push(h);try{return _(k)}finally{a.pop()}},g>4||g>0&&a.indexOf(h)!==-1)return this.coerceFallback(m);const f=typeof h=="object"&&h!==null||typeof h=="function";if(g===0&&s>=50||f&&o.has(h))return;f&&o.add(h),g===0&&s++;const y=this.getAggregateErrors(h);let w,P;n||(n=!!y);try{if(w=this.applyCoercers(h,m),!w)throw l}catch(k){if(k===l)return void(g===0&&s--);if(!n)throw k;w=this.coerceFallback(m)}if(!y||s>=50)return w;try{P=y.length}catch{return w}if(!Number.isInteger(P)||0>P||P>4294967295)return w;const $=[];for(let k=0;50>s&&1e3>r&&P>k;k++){let T;r++;try{T=m.next(y[k])}catch{s++,T=this.coerceFallback(c(v+1))}T&&$.push(T)}return p(p({},w),{},{errors:$})},c=(h,v=0)=>p(p({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(g){const m=u(g,h,v+1);if(!m)throw l;return m},next:g=>u(g,h+1)}),d=c(i);return p(p({},d),{},{apply:h=>{var v;return(v=u(h,i))!==null&&v!==void 0?v:this.coerceFallback(d)}})}},_u=/^([a-z][a-z0-9.+-]+):/i,mu=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function yu(e){if(!e||e==="<anonymous>")return!1;const t=_u.exec(e);return!t||mu.includes(t[1].toLowerCase())}function Xs(e,t,i,s,r){const n={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:yu(t)};return E(s)||(n.lineno=s),E(r)||(n.colno=r),n}var la=(e,t)=>{const i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},bu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,wu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Eu=/\((\S*)(?::(\d+))(?::(\d+))\)/,xu=(e,t)=>{const i=bu.exec(e);if(i){const[,r,n,o]=i;return Xs(t,r,"?",+n,+o)}const s=wu.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=Eu.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[r,n]=la(s[1]||"?",s[2]);return Xs(t,n,r,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ku=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Su=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$u=(e,t)=>{const i=ku.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const n=Su.exec(i[3]);n&&(i[1]=i[1]||"eval",i[3]=n[1],i[4]=n[2],i[5]="")}let s=i[3],r=i[1]||"?";return[r,s]=la(r,s),Xs(t,s,r,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},on=/\(error: (.*)\)/;function Sr(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Iu(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!Sr(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let r=0;t>r;r++)e[i+r]=e[i+t+r];return e.length=i+t,{start:i,length:t}}}}function Pu(e,t){const i=t.start+t.length,s=ca(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function ua(e,t){let i=t.start;for(;i>0&&Sr(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function ca(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Sr(e[s],e[s-t.length]);)s++;return s-i}function Ou(e,t){const i=t[0];let s=e.length-(i?ua(e,i):0);for(const r of t)s-=ca(e,r);return s}function Tu(e,t,i){for(let s=0;e.length>s;s++){const r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1}var Cu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Di(e,"DOMException")}isDOMError(e){return Di(e,"DOMError")}},Ru=class{match(e){return Nt(e)}coerce(e,t){var i;const s=this.getStack(e),r=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,n=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??r,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},Fu=class{match(e){return!!Di(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);const s=t.apply(e.message);return p(p({},s),{},{stack:(i=this.lr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ar(e){return L(e.message)&&e.message.length>0}lr(e){var t,i;const s=e,r=(t=s.lineno)!==null&&t!==void 0?t:0,n=(i=s.colno)!==null&&i!==void 0?i:0;if(L(s.filename)&&s.filename.length!==0&&r!==0)return`Error
2
2
  at ${s.filename}:${r}:${n}`}},Au=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Mu=class{match(e){return typeof e=="string"}coerce(e,t){var i;const[s,r]=this.getInfos(e);return{type:s??"Error",value:r??e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Au);return s&&(t=s[1],i=s[2]),[t,i]}},Lu=["fatal","error","warning","log","info","debug"];function ha(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){const r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?`${r.slice(0,t)}...`:r}return""}var Du=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;const r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(xr(e))return e.constructor.name;const t="name"in e?e.name:void 0;return L(t)&&!Xt(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${ha(e)}`}isSeverityLevel(e){return L(e)&&!Xt(e)&&Lu.indexOf(e)>=0}getStack(e){try{return L(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:L(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(Nt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Nu=class{match(e){return xr(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${ha(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},ju=class{match(e){return Io(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Bu=class{match(e){return Di(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!xr(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return Io(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Ui="$message",qi="$timestamp",Uu=new Set([Ui,qi]),fs={enabled:!0,max_bytes:32768};function zi(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:fs.enabled,max_bytes:zu(e.max_bytes,fs.max_bytes)}:p({},fs)}var qu=class{constructor(e){this.ns=[],this.ss=0,this.Ir=zi(e)}setConfig(e){this.Ir=zi(e),this.rs()}add(e){const t=(function(s){let r;try{r=So(s)}catch{return}try{const n=JSON.parse(r);if(!N(n))return;const o=n,a=o[Ui],l=o[qi];return!L(a)||a.trim().length===0||!L(l)&&!ne(l)?void 0:{step:o,json:r}}catch{return}})(e);if(!t)return;const i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;const r=encodeURIComponent(s);let n=0;for(let o=0;r.length>o;o++)r[o]==="%"?(n+=1,o+=2):n+=1;return n})(t.json);i>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function zu(e,t){if(!ne(e)||e===1/0||e===-1/0)return t;const i=Math.floor(e);return 0>i?t:i}var an=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function ln(e){return typeof e=="string"||e}function un(e){return typeof e=="string"?e:void 0}var Hu=["$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"],da="NativeGzipValidationError",Qs=e=>e.length>=2&&e[0]===31&&e[1]===139,cn=(e,t)=>e===Vs.GZipJS||t===Vs.GZipJS||t==="gzip",hn=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Bt,Ei=e=>{throw na(da,`Native gzip produced invalid output: ${e}`)},Vu=(dn=Q(function*(e,t){18>e.size&&Ei("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Qs(i)&&i[2]===8||Ei("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(n=>{const o=(()=>{if(Bt)return Bt;Bt=[];for(let l=0;256>l;l++){let u=l;for(let c=0;8>c;c++)u=1&u?3988292384^u>>>1:u>>>1;Bt[l]=u>>>0}return Bt})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&Ei("invalid-crc");const r=t.length>>>0;s.getUint32(4,!0)!==r&&Ei("invalid-size")}),function(e,t){return dn.apply(this,arguments)}),dn;function Zs(){return Zs=Q(function*(e,t=!0,i){try{const r=new TextEncoder().encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((s=Q(function*(c){try{yield o.abort(c)}catch{}throw c}),function(c){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield Vu(u,r),u}catch(r){if(i?.rethrow)throw r;return t&&console.error("Failed to gzip compress data",r),null}var s}),Zs.apply(this,arguments)}function va(e,t){if(e==null)return{};var i,s,r=(function(o,a){if(o==null)return{};var l={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(a.includes(u))continue;l[u]=o[u]}return l})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;n.length>s;s++)t.includes(i=n[s])||{}.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var Wu={}.propertyIsEnumerable;function Hi(e,t){try{return pa(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function $r(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Ks};if(i.remainingNodes--,be(e))return{boolValue:e};if(typeof e=="bigint")return(function(r,n){const o=r.toString(),a=BigInt("9223372036854775808");return r>=a||-a>r?(n?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const r=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${r} is outside the int64 range; encoding it as a string`),{stringValue:r}):{intValue:r}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Tt(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Ks};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?Tt(n):String(n)}}i.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return $r(r.call(e),t,i,s+1)}catch{}return A(e)?{arrayValue:{values:Gu(e,t,i,s+1)}}:{kvlistValue:{values:pa(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Tt(String(e))}}function Gu(e,t,i,s){const r=[],n=Math.min(e.length,1e3);let o=0;for(;n>o&&i.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(M(a))continue;r.push($r(a,t,i,s))}catch{r.push({stringValue:mi})}return e.length>o&&r.push({stringValue:Ks}),r}function pa(e,t,i,s){const r=[];for(const n in e)if(Wu.call(e,n)){if(!n){t?.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=i.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[n];if(ie(o)||E(o))continue;r.push({key:Tt(n),value:$r(o,t,i,s)})}catch{r.push({key:Tt(n),value:{stringValue:mi}})}}return r}function fa(e,t,i){return p(p(p(p({},sa({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}var Ju=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ga(e,t){const i=sa({},e),s={};for(const r of Ju)({}).hasOwnProperty.call(i,r)&&(s[r]=i[r],delete i[r]);return[...Hi(i,t),...Hi(s,t)]}var vn={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},_a={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Yu=_a.info;function Ku(e){try{return Tt(String(e))}catch{return mi}}function Xu(e,t,i,s){const r=e.level||"info",{text:n,number:o}=_a[r]||Yu,a=(function(h=Date.now()){return String(h)+"000000"})(ne(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),M(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),M(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const u=p({},l),c=e.attributes;if(c){let h=[];try{h=Object.keys(c)}catch{h=[]}for(const v of h){let g;try{g=c[v]}catch{g=mi}Object.defineProperty(u,v,{value:g,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:Ku(e.body)},attributes:Hi(u,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),E(e.trace_flags)||(d.flags=e.trace_flags),d}function ma(e,t,i){return fa(e,t,i)}function ya(e,t,i,s){return{resourceLogs:[{resource:{attributes:ga(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var ba=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=oa(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function wa(){return .75+.5*Math.random()}function Ea(e,t,i,s){const r=Math.min(Math.max(0,t-1),6),n=e*Math.pow(2,r);return Math.round((s===void 0?n:Math.min(n,Math.max(s,e)))*i)}var Qu=class{constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Ir=t,this.A=i,this.cs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new ba(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ra,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(De.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const s=this.Os(e);if(s===null)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Xu(s,(i=t?.context)!==null&&i!==void 0?i:this.cs(),this.A,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const i=A(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;s=n}catch(n){return this.A.error("Error in beforeSend function for log:",n),null}return s}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Q(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Q(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(De.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;const s=i.length;let r=0;for(;i.length>0&&s>r;){var n,o;const a=e._s;e.bs=0;const l=Math.min(i.length,e.Es),u=i.slice(0,l),c=ya(u.map(h=>h.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance.js(c);if(e._s!==a)return;if(d.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.A.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(d),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),d.kind==="retry-later"||(d.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):d.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),i=(o=e._instance.getPersistedProperty(De.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,d.kind==="fatal"))throw d.error}})()}Bs(e){var t=this;return Q(function*(){var i;const s=Math.max(0,e-t.bs),r=(i=t._instance.getPersistedProperty(De.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(De.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){return ma(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const i=(t=this._instance.getPersistedProperty(De.LogsQueue))!==null&&t!==void 0?t:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(De.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Ea(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(De.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Q(function*(){t.ps.clear();const i=t.flush().catch(()=>{});e!==void 0?yield sn(i,e):yield i})()}flushWithTimeout(e){var t=this;return Q(function*(){const i=t.flush();yield sn(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=wa(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},gs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pn(e){return String(e)+"000000"}function fn(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(n=>`${JSON.stringify(n)}:${JSON.stringify(s[n])}`).join(",")),`${e}\0${t}\0${i??""}\0${r}`}var Zu=class{constructor(e,t,i){this._instance=e,this.Ir=t,this.A=i,this.zs=new Map,this.ps=new ba(()=>this.flush().catch(s=>{this.A.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ra,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Zs({name:e,type:"count",value:t,unit:i?.unit,attributes:i?.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:i?.unit,attributes:i?.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:i?.unit,attributes:i?.attributes})}flush(){var e=this;const t=this.ys,i=(function(){var s=Q(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?p({},t.attributes):void 0,s=fn(t.type,t.name,t.unit,i)}catch(o){this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o);return}let r=this.zs.get(s);if(!r){if(!this.Ks())return;r={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(s,r)}const n=this.Ws.get(t.name);n===void 0?this.Ws.set(t.name,t.type):n===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${n}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(gs.length+1).fill(0)});const s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(r,n){for(let o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length})(t,gs)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const i=A(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;s=n}catch(n){return this.A.error("Error in beforeSend function for metric:",n),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ea(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Q(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=wa()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":e.ho(t),e.ps.armNoEarlierThan(e.Hs());return;case"too-large":e.A.warn("Metrics batch exceeded the server size limit and was dropped");return;case"fatal":e.A.error("Failed to send metrics batch:",s.error);return}})()}Js(e){return t=this.co(e),i=(function(n,o,a){return fa(n,o,a)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ga(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]};var t,i,s,r}co(e){const t=pn(Date.now()),i=new Map;for(const o of e.values()){var s;const a=fn(o.type,o.name,o.unit,void 0);let l=i.get(a);l||(l=p({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));const u=Hi((s=o.attributes)!==null&&s!==void 0?s:{},this.A),c=pn(o.windowStartMs);if(o.type==="count"){var r;const d={attributes:u,startTimeUnixNano:c,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0};l.sum.dataPoints.push(d)}else if(o.type==="gauge"){var n;const d={attributes:u,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0};l.gauge.dataPoints.push(d)}else o.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:gs})}return Array.from(i.values())}ho(e){for(const[s,r]of e){const n=this.zs.get(s);if(n)switch(n.windowStartMs=Math.min(n.windowStartMs,r.windowStartMs),n.type){case"count":var t,i;n.total=((t=n.total)!==null&&t!==void 0?t:0)+((i=r.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(r.hist)if(n.hist){n.hist.count+=r.hist.count,n.hist.sum+=r.hist.sum,n.hist.min=Math.min(n.hist.min,r.hist.min),n.hist.max=Math.max(n.hist.max,r.hist.max);for(let o=0;n.hist.bucketCounts.length>o;o++)n.hist.bucketCounts[o]+=r.hist.bucketCounts[o]}else n.hist=r.hist}else this.Ks()&&this.zs.set(s,r)}}},xa=(e,{debugEnabled:t}={})=>{const i={N(s,...r){b&&(We.DEBUG||b.POSTHOG_DEBUG||t)&&!E(b.console)&&b.console&&("__rrweb_original__"in b.console[s]?b.console[s].__rrweb_original__:b.console[s])(e,...r)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,r)=>xa(`${e} ${s}`,r)};return i},S=xa("[PostHog.js]"),re=S.createLogger,ec=re("[ExternalScriptsLoader]"),Vi=e=>{const t=x?.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},dt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ec.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Vi(t);if(s){if(s.__posthog_loading_callback_fired)return i();const n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}const r=()=>{if(!x)return i("document not found");if(Vi(t))return dt(e,t,i);let n=x.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=a=>{n.__posthog_loading_callback_fired=!0,i(void 0,a)},n.onerror=a=>{n.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")x.head.appendChild(n);else{const a=x.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):x.body.appendChild(n)}};x?.body?r():x?.addEventListener("DOMContentLoaded",r)},_s={},gn=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};C.__PosthogExtensions__=C.__PosthogExtensions__||{},C.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){const r=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);dt(e,r,i);return}const s=e.config.strict_script_versioning;if(s){const r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=_s[r];if(s==="fallback"&&n){if(Vi(n))return void dt(e,n,i);delete _s[r]}dt(e,r,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;const u=gn(e,t);_s[r]=u;const c=Vi(r);c==null||(l=c.parentNode)===null||l===void 0||l.removeChild(c),dt(e,u,i)}else i(void 0,a)}:i);return}dt(e,gn(e,t),i)},C.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{const s=e.requestRouter.endpointFor("api",t);dt(e,s,i)},We.DEBUG=!1,We.LIB_VERSION="1.435.3",We.LIB_NAME="web";var ae=We,tc="$people_distinct_id",Ce="distinct_id",Ir="$device_id",ms="$device_model",Wi="__alias",ic="__cmpns",_n="$fbc",Ct="$fbc_persistence",mn="$fbp",Zt="$fbp_persistence",er="__timers",ka="$autocapture_disabled_server_side",tr="$heatmaps_enabled_server_side",ir="$exception_capture_enabled_server_side",Sa="$error_tracking_suppression_rules",sr="$error_tracking_capture_extension_exceptions",rr="$web_vitals_enabled_server_side",Pr="$dead_clicks_enabled_server_side",Or="$product_tours_enabled_server_side",$a="$logs_capture_enabled_server_side",Ia="$web_vitals_allowed_metrics",ei="$session_recording_remote_config",sc="$session_recording_enabled_server_side",rc="$replay_sample_rate",nc="$replay_override_sampling",oc="$replay_override_linked_flag",ac="$replay_override_url_trigger",lc="$replay_override_event_trigger",$t="$sesid",Pa="$session_is_sampled",uc="$session_past_minimum_duration",cc="$session_recording_url_trigger_activated_session",hc="$session_recording_event_trigger_activated_session",dc="$debug_first_full_snapshot_timestamp",vc="$sess_rec_flush_size",Re="$enabled_feature_flags",He="$active_feature_flags",nr="$early_access_features",ft="$feature_flag_details",tt="$feature_flag_payloads",gt="$feature_flag_request_id",ti="$minimal_flag_called_events",Le="$override_feature_flags",vt="$override_feature_flag_payloads",it="$stored_person_properties",st="$stored_group_properties",Oa="$groups",Jt="$surveys",Gi="$surveys_loaded_at",Ta="$surveys_activated",Ca="$surveys_activated_session",Ra="$surveys_activated_timestamps",or="ph_product_tours",pc="$product_tours_activated",fc="$product_tours_activated_session",gc="$conversations_widget_session_id",_c="$conversations_ticket_id",mc="$conversations_widget_state",yc="$conversations_user_traits",rt="$flag_call_reported",Yt="$flag_call_reported_session_id",hi="$feature_flag_errors",nt="$feature_flag_evaluated_at",ye="$user_state",ar="$client_session_props",bc="$capture_rate_limit",Fa="$initial_campaign_params",Aa="$initial_referrer_info",It="$initial_person_info",Tr="$epp",ys="$posthog_cookieless",Ma="$cookieless_mode",La="$sdk_debug_extensions_init_method",Da="$sdk_debug_extensions_init_time_ms",Cr="$sdk_debug_recording_script_not_loaded",Rr="$sdk_debug_replay_stale_config",Na="$sdk_debug_replay_event_trigger_status",ja="$sdk_debug_replay_linked_flag_trigger_status",Ba="$sdk_debug_replay_matched_recording_trigger_groups",Ua="$sdk_debug_replay_pending_trigger_conditions",qa="$sdk_debug_replay_remote_trigger_matching_config",za="$sdk_debug_replay_trigger_groups_count",Ha="$sdk_debug_replay_url_trigger_status",wc="$session_recording_start_reason",Fr="PostHog loadExternalDependency extension not found.",Ve="anonymous",Fi="identified",Va="identified_only",di="visibilitychange",Ji="beforeunload",Ar="$pageview",yn="$pageleave",Wa="$identify",bn="$groupidentify";function Pt(e,t){A(e)&&e.forEach(t)}function G(e,t){if(!M(e))if(A(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(const i in e)Er.call(e,i)&&t(e[i],i)}var X=function(e,...t){for(const i of t)for(const s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function Ai(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var Ec=function(e){return function(...t){try{return e.apply(this,t)}catch(i){S.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),S.critical(i)}}},Mr=function(e){const t={};return G(e,function(i,s){(L(i)&&i.length>0||ne(i))&&(t[s]=i)}),t};function Ga(e){const t=p({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var xc=["herokuapp.com","vercel.app","netlify.app"];function kc(e){const t=e?.hostname;if(!L(t))return!1;const i=t.split(".").slice(-2).join(".");for(const s of xc)if(i===s)return!1;return!0}function V(e,t,i,s){const{capture:r=!1,passive:n=!0}=s??{};e?.addEventListener(t,i,{capture:r,passive:n})}function lr(e){return e.name==="ph_toolbar_internal"}var ii=e=>{if(x){try{const t=e+"=",i=x.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let r=i[s];for(;r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ne(e)&&isFinite(e)&&Math.floor(e)===e});var Sc=class ur{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");const n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new ur(n)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ur(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){const s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},$c=class{generate(){const e=this.generateOrAbort();if(!E(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return ne(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 Sc.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 Ic}},Ja=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};b&&!E(b.crypto)&&crypto.getRandomValues&&(Ja=e=>crypto.getRandomValues(e));var Ic=class{nextUint32(){return this.Rt.length>this.At||(Ja(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}},wn,Fe=()=>Pc().toString(),Pc=()=>(wn||(wn=new $c)).generate(),Ut="",Oc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,mt=null,ee={Et(){if(!ie(mt))return mt;if(mt=!1,x)try{const e=`__ph_cookie_support_${Fe()}`;ee.$t(e,"xyz"),mt=ii(e)==='"xyz"',ee.Lt(e)}catch{mt=!1}return mt},Pt(e){S.error("cookieStore error: "+e)},Ot:ii,Dt(e){let t;try{t=JSON.parse(ee.Ot(e))||{}}catch{}return t},$t(e,t,i,s,r){if(!x)return!1;try{let n="",o="";const a=(function(u,c){if(c){let d=(function(h,v=x){if(Ut)return Ut;if(!v||["localhost","127.0.0.1"].includes(h))return"";const g=h.split(".");let m=Math.min(g.length,8);const _="dmn_chk_"+Fe();for(;!Ut&&m--;){const f=g.slice(m).join("."),y=_+"=1;domain=."+f+";path=/";v.cookie=y+";max-age=3",v.cookie.includes(_)&&(v.cookie=y+";max-age=0",Ut=f)}return Ut})(u);if(!d){const h=(v=>{const g=v.match(Oc);return g?g[0]:""})(u);h!==d&&S.info("Warning: cookie subdomain discovery mismatch",h,d),d=h}return d?"; domain=."+d:""}return""})(x.location.hostname,s);if(i){const u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&S.warn("cookieStore warning: large cookie, len="+l.length),x.cookie=l,!0}catch{return!1}},Lt(e,t){if(x?.cookie&&(!t||!ie(ii(e))))try{ee.$t(e,"",-1,t)}catch{return}}},bs=null,U={Et(){if(!ie(bs))return bs;let e=!0;if(E(b))e=!1;else try{const t="__mplssupport__";U.$t(t,"xyz"),U.Ot(t)!=='"xyz"'&&(e=!1),U.Lt(t)}catch{e=!1}return e||S.error("localStorage unsupported; falling back to cookie store"),bs=e,e},Pt(e){S.error("localStorage error: "+e)},Ot(e){try{return b?.localStorage.getItem(e)}catch(t){U.Pt(t)}return null},Dt(e){try{return JSON.parse(U.Ot(e))||{}}catch{}return null},$t(e,t){try{return b?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){U.Pt(i)}return!1},Lt(e){try{b?.localStorage.removeItem(e)}catch(t){U.Pt(t)}}},ws=[it,He,Re,ft,tt,gt,nt,hi,rt],pt=[Ir,Ce,$t,Pa,Tr,It,Ct,ye],Yi=e=>e+"_cpm",Tc=["__proto__","constructor","prototype"],Es=e=>{if(!N(e))return{};const t={};return Object.keys(e).forEach(i=>{Tc.indexOf(i)===-1&&(t[i]=e[i])}),t},xs=(e,t=[])=>{const i={};return[...pt,...t].forEach(s=>{const r=e[s];E(r)||ie(r)||r===""||(i[s]=r)}),i},Ya=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},En=(e,t)=>({p:t,f:Ya(JSON.stringify(e))}),xn=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=ee.Dt(Yi(e)),s=i?.f===Ya(t)&&A(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},ks=(e,t)=>t+"|"+(ee.Ot(Yi(e))||""),yt={},cr={Et:()=>!0,Pt(e){S.error("memoryStorage error: "+e)},Ot:e=>e in yt?yt[e]:null,Dt:e=>e in yt?yt[e]:null,$t:(e,t)=>(yt[e]=t,!0),Lt(e){delete yt[e]}},lt=null,Y={Et(){if(!ie(lt))return lt;if(lt=!0,E(b))lt=!1;else try{const e="__support__";Y.$t(e,"xyz"),Y.Ot(e)!=='"xyz"'&&(lt=!1),Y.Lt(e)}catch{lt=!1}return lt},Pt(e){S.error("sessionStorage error: ",e)},Ot(e){try{return b?.sessionStorage.getItem(e)}catch(t){Y.Pt(t)}return null},Dt(e){try{return JSON.parse(Y.Ot(e))||null}catch{}return null},$t(e,t){try{return b?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){Y.Pt(i)}return!1},Lt(e){try{b?.sessionStorage.removeItem(e)}catch(t){Y.Pt(t)}}},Cc=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return us(e)?1:F(iu,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?U:ee,i=t.Et()?t:cr;if(!this.jo||this.jo!==i){this.jo=i;const s=e==="localStorage"?ee:U;s.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(us(s.Ot(this.qo))),s.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[he?.doNotTrack,he?.msDoNotTrack,C.doNotTrack,he?.globalPrivacyControl].some(e=>us(e))}};function Ka(e,t){var i;const s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!ce(s))return t;try{const r=s(t);return L(r)&&r?r:t}catch(r){return S.error("Error in get_current_url, falling back to window.location.href",r),t}}function kn(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function je(e){return!!e&&e.nodeType===1}function pe(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Xa(e){return!!e&&e.nodeType===3}function Lr(e){return!!e&&e.nodeType===11&&je(e.host)}function Dr(e){return e?is(e).split(/\s+/):[]}function Sn(e,t){const i=(function(s){var r;const n=b==null||(r=b.location)===null||r===void 0?void 0:r.href;return E(n)?void 0:Ka(s,n)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function At(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Dr(t)}function Qa(e){return M(e)?null:is(e).split(/(\s+)/).filter(t=>ri(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function vi(e){let t="";return Rt(e)&&!pi(e)&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(i){var s;Xa(i)&&i.textContent&&(t+=(s=Qa(i.textContent))!==null&&s!==void 0?s:"")}),is(t)}function si(e){var t;return E(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Nr=["a","button","form","input","select","textarea","label"];function hr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function dr(e,t){if(E(t))return!0;for(const i of e)if(t.some(s=>hr(i,s)))return!0;return!1}function Za(e){const t=e.parentNode;return!(!t||!je(t))&&t}var Ss=[".ph-no-autocapture","[data-ph-no-autocapture]"],el=["next","previous","prev",">","<"],Rc=[...el,"+","-","−","–"],$n=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,In=[".ph-no-rageclick",".ph-no-capture"],Fc=["","text","search","email","password","url","tel","number"];function tl(e,t){if(!b||jr(e))return!1;let i,s,r;var n,o;if(be(t)?(i=!!t&&In,s=void 0,r=!1):(i=(n=t?.css_selector_ignorelist)!==null&&n!==void 0?n:In,s=t?.content_ignorelist,r=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||r&&(function(l){return!(!l||!je(l))&&(!!pe(l,"textarea")||(pe(l,"input")?F(Fc,(l.getAttribute("type")||"").toLowerCase()):(function(u){var c;if(u.isContentEditable)return!0;const d=(c=u.getAttribute)===null||c===void 0?void 0:c.call(u,"contenteditable");return d==="true"||d===""})(l)))})(e))return!1;const{targetElementList:a}=il(e,!1);return!(function(l,u){if(l===!1||E(l))return!1;let c;if(l===!0)c=el;else{if(!A(l))return!1;if(l.length>10)return S.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(d=>d.toLowerCase())}return u.some(({safeText:d,ariaLabel:h})=>c.some(v=>$n(d,v)||$n(h,v)))})(s,a.map(l=>{var u;return{safeText:vi(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!dr(a,i)}var jr=e=>!e||pe(e,"html")||!je(e),il=(e,t)=>{if(!b||jr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1;const s=[e];let r=e;for(;r.parentNode&&!pe(r,"body");){if(Lr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const n=Za(r);if(!n)break;if(t||Nr.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{const o=b.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function Rt(e){const t=new Set;let i=0;for(let n=e;n.parentNode&&!pe(n,"body");n=n.parentNode){if(i++>=1e3||t.has(n))return!1;t.add(n);const o=At(n);if(F(o,"ph-sensitive")||F(o,"ph-no-capture"))return!1}if(F(At(e),"ph-include"))return!0;const s=e.type||"";if(L(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const r=e.name||e.id||"";return!L(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function pi(e){return!!(pe(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||pe(e,"select")||pe(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Pn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),On=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ac=[16,15,14,13],Mc=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Tn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Cn=/[0-9A-Za-z_]/;function Lc(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;i&&(r*=2,r>9&&(r-=9)),t+=r,i=!i}return t%10==0}function ri(e,t=!0){return!(M(e)||L(e)&&(e=is(e),(t?Pn.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(On.lastIndex=0;s=On.exec(i);){const r=s[2];if(!r)continue;const n=r.replace(/[- ]/g,"");for(let o=0;n.length>o;o++)for(const a of Ac){const l=o+a;if(n.length>=l){const u=n.slice(o,l);if(Pn.test(u)&&Lc(u))return!0}}}return!1})(e))||(t?Mc.test(e):(function(i){let s;for(Tn.lastIndex=0;s=Tn.exec(i);){const r=s[1],n=s[3];if(!(r&&n&&Cn.test(r)&&Cn.test(n)))return!0}return!1})(e))))}function Rn(e){let t=vi(e);return t=`${t} ${sl(e)}`.trim(),ri(t)?t:""}function sl(e){let t="";return e&&e.childNodes&&e.childNodes.length&&G(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{const r=vi(i);t=`${t} ${r}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${sl(i)}`.trim())}catch(r){S.error("[AutoCapture]",r)}}),t}function Fn(e){return e.replace(/"|\\"/g,'\\"')}function Dc(e){const t=e.attr__class;if(t)return A(t)?t:Dr(t)}var xi=re("[Dead Clicks]"),Nc=()=>!0,jc=e=>{var t;const i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Pr)),s=e.instance.config.capture_dead_clicks;return be(s)?s:!!N(s)||i},An=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Pr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(e){var t,i,s;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",r=>{r?xi.error("failed to load script",r):e()})}zo(){var e;if(x){if(!this.Bo&&(!((e=C.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=N(this.instance.config.capture_dead_clicks)?p({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(x),xi.info("starting...")}}else xi.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,xi.info("stopping..."))}},qt=re("[SegmentIntegration]");function Mn(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:r,filterProperties:n}=(a=>ce(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,u,c){const d=v=>{const g=()=>v.anonymousId()||Fe();a.config.get_device_id=g,c&&v.id()&&(a.register({distinct_id:v.id(),$device_id:g()}),a.persistence.set_property(ye,Fi)),u(c?void 0:v.anonymousId()||void 0)},h=l.user();"then"in h&&ce(h.then)?h.then(d):d(h)})(e,r,a=>{r.register(((l,u,{filterProperties:c}={})=>{typeof Promise<"u"&&Promise.resolve||qt.warn("This browser does not have Promise support, and can not use the segment integration");const d=(h,v)=>{if(!v)return h;const g=!!u&&h.event.anonymousId===u&&!h.event.userId;g||h.event.userId||h.event.anonymousId===l.get_distinct_id()||(qt.info("No userId set, resetting PostHog"),l.reset()),g||(u=void 0),h.event.userId&&h.event.userId!==l.get_distinct_id()&&(qt.info("UserId set, identifying with PostHog"),l.identify(h.event.userId));let m=l.calculateEventProperties(v,h.event.properties);if(!M(c)){const _=h.event.properties||{},f={};for(const w of Object.keys(m))Er.call(_,w)||(f[w]=m[w]);const y=((w,P)=>{const $=A(w)?w:[w];let k=p({},P);for(const T of $)try{if(k=T(k),M(k))return null}catch(I){return qt.error("Error in Segment filterProperties:",I),null}return k})(c,f);if(M(y))return h;m=y}return h.event.properties=Object.assign({},m,h.event.properties),h};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(h){return d(h,h.event.event)},page(h){return d(h,Ar)},identify(h){return d(h,Wa)},screen(h){return d(h,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{qt.error("Failed to register the Segment integration",l),t()})},i)}var rl="posthog-js";function nl(e,{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,c,d;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const v=((a=o.exception)===null||a===void 0?void 0:a.values)||[],g=v.map(f=>p(p({},f),{},{stacktrace:f.stacktrace?p(p({},f.stacktrace),{},{type:"raw",frames:(f.stacktrace.frames||[]).map(y=>p(p({},y),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=v[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=v[0])===null||u===void 0?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((c=v[0])===null||c===void 0?void 0:c.value)||o.message,$sentry_exception_type:(d=v[0])===null||d===void 0?void 0:d.type,$sentry_tags:o.tags};var _;return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&((_=e.exceptions)===null||_===void 0||_.sendExceptionEvent(m)),o}}var Bc=class{constructor(e,t,i,s,r,n){this.name=rl,this.setupOnce=function(o){o(nl(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},Ln=class{constructor(e){this.Uo=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(S.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var i;const s=this.Zo(e,t);return this.Wo={pathname:(i=b?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Zo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,t){const i=this.Wo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(E(n)||E(o)||E(a)||E(l)||E(u)||E(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);const d=n>1?Ne(o/n,0,1,S):1,h=n>1?Ne(a/n,0,1,S):1,v=l>1?Ne(u/l,0,1,S):1,g=l>1?Ne(c/l,0,1,S):1;s=X(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},zt=["flags","surveys"],Uc={[tc]:{exposure:"hidden"},[Wi]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[er]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[Zt]:{exposure:"hidden"},[ka]:{exposure:"event"},[tr]:{exposure:"hidden"},[$a]:{exposure:"hidden"},[ir]:{exposure:"event"},[Sa]:{exposure:"hidden"},[sr]:{exposure:"event"},[rr]:{exposure:"event"},[Pr]:{exposure:"event"},[Or]:{exposure:"hidden"},[Ia]:{exposure:"event"},[ei]:{exposure:"hidden"},[sc]:{exposure:"hidden"},[$t]:{exposure:"hidden"},[Pa]:{exposure:"event"},[rc]:{exposure:"event",shouldSkipFromEventProperties:e=>ie(e)},[uc]:{exposure:"event"},[cc]:{exposure:"event"},[hc]:{exposure:"event"},[dc]:{exposure:"event"},[vc]:{exposure:"hidden"},[Re]:{exposure:"hidden",storageGroup:"flags"},[He]:{exposure:"hidden",storageGroup:"flags"},[nr]:{exposure:"hidden"},[ft]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ti]:{exposure:"hidden",storageGroup:"flags"},[Le]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[st]:{exposure:"hidden"},[Jt]:{exposure:"hidden",storageGroup:"surveys"},[Gi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Ta]:{exposure:"event"},[Ca]:{exposure:"hidden"},[Ra]:{exposure:"hidden"},[or]:{exposure:"hidden"},[pc]:{exposure:"hidden"},[fc]:{exposure:"hidden"},[gc]:{exposure:"event"},[_c]:{exposure:"event"},[mc]:{exposure:"event"},[yc]:{exposure:"event"},[rt]:{exposure:"hidden"},[Yt]:{exposure:"hidden"},[Oa]:{exposure:"event"},[hi]:{exposure:"hidden"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ye]:{exposure:"hidden"},[ar]:{exposure:"hidden"},[bc]:{exposure:"hidden"},[Fa]:{exposure:"hidden"},[Aa]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Tr]:{exposure:"hidden"},[nc]:{exposure:"event"},[oc]:{exposure:"event"},[ac]:{exposure:"event"},[lc]:{exposure:"event"},[La]:{exposure:"event"},[Da]:{exposure:"event"},[Cr]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Na]:{exposure:"hidden"},[ja]:{exposure:"hidden"},[Ba]:{exposure:"hidden"},[Ua]:{exposure:"hidden"},[qa]:{exposure:"hidden"},[za]:{exposure:"hidden"},[Ha]:{exposure:"hidden"},[wc]:{exposure:"event"}},qc=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],de=e=>{const t=Uc[e];if(t)return t;for(const[i,s]of qc)if(e.indexOf(i)===0)return s},Ot=(e,t)=>{try{let i;return JSON.stringify(e,(s,r)=>{var n;return Nt(r)?((n=i)!==null&&n!==void 0||(i=new WeakMap),i.has(r)||i.set(r,Ga(r)),i.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return So(e)}},Ge=e=>{const t=x?.createElement("a");return E(t)?null:(t.href=e,t)},Mt=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let r=0;i.length>r;r++){const n=i[r].split("=");if(n[0]===t){s=n;break}}if(!A(s)||2>s.length)return"";{let r=s[1];try{r=decodeURIComponent(r)}catch{S.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")}},fi=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let d=0;l.length>d;d++){const h=l[d].split("=");A(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[d]))}let c=a;return o!=null&&(c+="?"+u.join("&")),r!=null&&(c+="#"+r),c},Ki=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ol=(e,t)=>e>=t&&ko(),al=(e,t,i,s)=>{if(e===0){if(ko()){const r=t+1;return r===i&&s(),r}return t}return 0},Lt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],zc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Lt],gi="<masked>",Hc=["li_fat_id"];function ll(e,t,i){if(!x)return{};const s=t?[...Lt,...i||[]]:[],r=ul(fi(x.URL,s,gi),e),n=(function(){const o={};return G(Hc,function(a){const l=ii(a);o[a]=l||null}),o})();return X(n,r)}function ul(e,t){const i=zc.concat(t||[]),s={};return G(i,function(r){const n=Mt(e,r);s[r]=n||null}),s}function cl(e){const t=(function(r){return r?r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!ie(t)){s.$search_engine=t;const r=x?Mt(x.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function hl(){return navigator.language||navigator.userLanguage}function Vc(){const e=hl();return typeof e=="string"?e.split("-")[0]:void 0}var Xi="$direct";function dl(){return x?.referrer||Xi}function vl(e,t,i=!1){const s=e?[...Lt,...t||[]]:[],r=i?ot(te?.href):te?.href,n=r?.substring(0,1e3);return{r:dl().substring(0,1e3),u:n?fi(n,s,gi):void 0}}function pl(e,t=!1){var i;const{r:s,u:r}=e,n=t?ot(r):r,o={$referrer:s,$referring_domain:s==null?void 0:s==Xi?Xi:(i=Ge(s))===null||i===void 0?void 0:i.host};if(n){o.$current_url=n;const a=Ge(n);o.$host=a?.host,o.$pathname=a?.pathname;const l=ul(n);X(o,l)}if(s){const a=cl(s);X(o,a)}return o}function fl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Wc(){try{return new Date().getTimezoneOffset()}catch{return}}var Gc={flags:nt,surveys:Gi},Jc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ki=e=>`${e}_cookie_identity_change_pending`,Si=e=>{let t="",i=0;for(const s of e){const r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},oe="main",ze=[Re,He,ft,tt,gt,nt,ti,it],$s=e=>ze.indexOf(e)!==-1,gl=[Ct,Zt],Dn=e=>gl.indexOf(e)!==-1,Qe=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},bt=e=>{if(!e)return{};const t=JSON.parse(e);return N(t)?t:{}},Nn=(e,t)=>{G(e,(i,s)=>{const r=de(s);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},Is=class{constructor(e,t,i=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=i,this.props={},this.la=void 0,this.ua=(s=>{let r="";return s.token&&(r=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+r+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&S.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,t),this.save(),b){const s=()=>this.flush();V(b,"beforeunload",s,{capture:!1}),V(b,"pagehide",s,{capture:!1}),this.va=r=>{if(this.Jo&&(!r.storageArea||r.storageArea===b?.localStorage)&&r.key)if(r.key!==this.ua){if(this.Xo){const n=zt.find(o=>r.key===this.fa(o));n&&this.pa(r.key,n)}}else this.pa(r.key,oe)},V(b,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{const s=this.ea.get(t);if(!$s(t)||s===!0)return;if(i===!0)return void this.ga(t,!0);const r=new Set(s||[]);i.forEach(n=>r.add(n)),r.size&&this.ga(t,r)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&b&&(b.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,i=!0){if(this.hi)return!1;let s,r;try{if(r=U.Ot(e),ie(r)){const a=this.ma(t);return a.storageValue=null,t!==oe&&(a.persisted=!1),!1}s=bt(r)}catch{return!1}const n=t===oe?s:U.Dt(this.ua);if(n&&this.ya(n))return!1;const o=this.ba(s,t,i);return t===oe&&this.Xo&&!Qe(this._a().main,s)||this.wa(s,t,!0,r),o}ya(e){const t=this.props[Ce],i=e[Ce];return!E(t)&&!E(i)&&t!==i}wa(e,t,i,s){const r=this.ma(t);r.storageValue=s,t!==oe&&(r.persisted=i);try{r.fingerprint=this.ka(e,t)}catch{r.fingerprint=void 0}}ba(e,t,i){let s=!1;return ze.forEach(r=>{var n;const o=(n=de(r))===null||n===void 0?void 0:n.storageGroup;if(t===oe&&this.Xo&&o||t!==oe&&o!==t)return;const a=r in e,l=this.Sa(r,a?e[r]:void 0),u=this.ea.has(r)?r in this.props:a;u===r in this.props&&Qe(l,this.props[r])||(u?this.xa(r,l,!1):this.Ca(r,!1),s=!0)}),s&&i&&this.oa.forEach(r=>r()),s}$a(){if(!this.Jo)return!1;try{this.sa=!1;const e=U.Ot(this.ua),t=this.ma(oe);let i,s=!1,r=!1;if(e!==t.storageValue)if(ie(e))t.storageValue=null;else{if(i=bt(e),this.sa=!this.na&&this.ya(i),this.sa)return!1;r=this.ba(i,oe,!1),!this.Xo||Qe(this._a().main,i)?this.wa(i,oe,!0,e):t.storageValue=e,s=!0}return this.Xo&&zt.forEach(n=>{const o=U.Ot(this.fa(n)),a=this.ma(n),l=i||{},u=s&&ze.some(d=>{var h;return((h=de(d))===null||h===void 0?void 0:h.storageGroup)===n&&d in l});if(o===a.storageValue&&!u)return;if(ie(o))return a.storageValue=null,a.persisted=!1,void(u&&(r=this.ba(l,n,!1)||r));const c=bt(o);r=this.ba(c,n,!1)||r,this.wa(c,n,!0,o)}),r}catch{return!1}}ga(e,t){this.ea.set(e,t);const i=de(e);i!=null&&i.volatile||(this.ma((this.Xo?i?.storageGroup:void 0)||oe).fingerprint=void 0,this.Ta(e))}Ia(){ze.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=U.Ot(this.ua),t=bt(e);this.ma(oe).storageValue=e,ze.forEach(i=>{var s;const r=this.Xo?(s=de(i))===null||s===void 0?void 0:s.storageGroup:void 0,n=r?U.Ot(this.fa(r)):null;if(r){const a=this.ma(r);a.storageValue=n,a.persisted=!ie(n)}const o=r&&!ie(n)?bt(n):t;i in this.props?this.Ma(i,o[i],this.props[i]):i in o&&this.ga(i,!0)})}catch{}}Sa(e,t){const i=this.ea.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(A(t)?t:[]),o=new Set(A(this.props[e])?this.props[e]:[]);return i.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const s=N(t)?p({},t):{},r=N(this.props[e])?this.props[e]:{};return i.forEach(n=>{n in r?s[n]=r[n]:delete s[n]}),s}Ma(e,t,i){if(!$s(e))return;const s=this.ea.get(e);if(s===!0)return;let r=t;if(this.Jo)try{var n;const a=this.Xo?(n=de(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.fa(a):this.ua;r=bt(U.Ot(l))[e]}catch{}const o=new Set(s||[]);if(e==="$active_feature_flags"){if(!E(t)&&!A(t)||!E(r)&&!A(r)||!A(i))return void this.ga(e,!0);const a=new Set(t||[]),l=new Set(r||[]),u=new Set(i);new Set([...a,...u]).forEach(c=>{a.has(c)!==u.has(c)&&o.add(c)}),o.forEach(c=>{l.has(c)===u.has(c)&&o.delete(c)})}else{if(!N(i))return void(Qe(r,i)?this.ea.delete(e):this.ga(e,!0));{if(!E(t)&&!N(t)||E(t)&&xe(i)&&E(r))return void this.ga(e,!0);const a=N(t)?t:{},l=N(r)?r:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(u=>{u in a==u in i&&Qe(a[u],i[u])||o.add(u)}),o.forEach(u=>{u in l==u in i&&Qe(l[u],i[u])&&o.delete(u)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ne(t)&&t>0?t:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=xs(e,this.Ir.cookie_persisted_properties||[]),i=En(t,this.Ir.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=ee.Ot(this.ua)||void 0;r&&ks(this.ua,r)===s&&(this.Ra=s,this.Aa=r)}catch{}else try{const t=ee.Ot(this.ua)||void 0;this.Ra=t?ks(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=ee.Ot(this.ua)||void 0}catch{}if(!i||i===this.Aa)return!1;const s=ks(this.ua,i);let r;try{r=Es(JSON.parse(i))}catch{return!1}if((ee.Ot(this.ua)||void 0)!==i)return!1;this.Ra=s,this.Aa=i;const n=xn(this.ua,i),o=[...pt,...n.properties],a={};if(Object.keys(r).forEach(m=>{const _=r[m];(E(_)||ie(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(a[m]=!0,delete r[m])}),xe(r))return!1;const l="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",u=this.props,c=u[Ce],d=u[ye],h=X({},u);[...pt,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(n.isValid||pt.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=X(h,r),ze.forEach(m=>{const _=m in this.props;m in u===_&&Qe(u[m],this.props[m])||(_?this.Ma(m,u[m],this.props[m]):this.ga(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.xa(ye,Ve);const v=this.props[Ce],g=this.props[ye];return!l||v===c&&g===d||(this.na=!0,this.Yo=!0,Y.$t(ki(this.ua),!0),this.Ca(it),this.Ca(He),this.Ca(Re),this.Ca(ft),this.Ca(tt),this.Ca(gt),this.Ca(nt),this.Ca(hi),this.Ca(rt),g!=="anonymous"||d!=="identified"&&r.$user_state!=="anonymous"&&(E(c)||v===c)||(Nn(this.props,r),this.Ca(st)),g==="identified"?this.props.$user_id=v:delete this.props.$user_id,this.Ca(Wi)),!0}consumeCookieIdentityChange(){const e=ki(this.ua),t=this.Yo||!!Y.Ot(e);return this.Yo=!1,t&&Y.Lt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(E(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[oe],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():E(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){Jc.indexOf(e.persistence.toLowerCase())===-1&&(S.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const l=[...pt,...o];return p(p({},U),{},{Dt(u){try{let d,h={};try{d=ee.Ot(u)||void 0,h=d?Es(JSON.parse(d)):{}}catch{}const v=JSON.parse(U.Ot(u)||"{}");let g;if(a){const m=xn(u,d),_=[...pt,...m.properties],f={};Object.keys(h).forEach(w=>{const P=h[w];ie(P)||P===""||w==="$user_state"&&P!=="anonymous"&&P!=="identified"||(f[w]=P)});const y="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var c;const w=v[Ce],P=(c=v.$user_state)!==null&&c!==void 0?c:Ve;l.forEach($=>{if(_.indexOf($)!==-1&&!($ in h)&&(y||$!=="distinct_id"&&$!=="$user_state")){const k=v[$];(m.isValid||pt.indexOf($)===-1||k!==!1&&k!==0)&&delete v[$]}}),!y||"$user_state"in h||"$user_state"in v||(v[ye]=Ve),!y||("distinct_id"in f?f[Ce]:v[Ce])===w&&("$user_state"in f?f[ye]:v[ye])===P||(ws.forEach($=>delete v[$]),f.$user_state==="identified"&&"distinct_id"in f?v.$user_id=f[Ce]:delete v.$user_id,f.$user_state!=="identified"&&(delete v[Oa],delete v[st]),delete v.__alias)}g=X(v,f)}else g=X(h,v);return U.$t(u,g),g}catch{}return null},$t(u,c,d,h,v,g){const m=U.$t(u,c,void 0,void 0,g);try{const _=xs(c,o);if(Object.keys(_).length){if(a){const f=Yi(u),y=En(_,o);if(ee.$t(f,y,d,h,v,g),ee.Ot(f)!==JSON.stringify(y)){ee.Lt(f,h);const w=xs(c);return ee.$t(u,w,d,h,v,g),m}}ee.$t(u,_,d,h,v,g)}}catch(_){U.Pt(_)}return m},Lt(u,c){try{b?.localStorage.removeItem(u),ee.Lt(u,c),ee.Lt(Yi(u),c)}catch(d){U.Pt(d)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let i,s=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&U.Et()?(i=U,r=!0):n==="localstorage+cookie"&&t.Et()?(i=t,r=!0,s=!0):n==="sessionstorage"&&Y.Et()?i=Y:n==="memory"?i=cr:n==="cookie"&&ee.Et()?(i=ee,s=!0):t.Et()?(i=t,r=!0,s=!0):ee.Et()?(i=ee,s=!0):i=cr,this.Jo=r,this.Ko=s,i}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){const e={};return G(this.props,(t,i)=>{const s=de(i);if(!s||s.exposure==="event"){var r;if(!(s==null||(r=s.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",i=t?U.Dt(this.ua):null;let s={};if(t)try{s=Es(ee.Dt(this.ua)),G(s,(a,l)=>{(E(a)||ie(a)||a==="")&&delete s[l]})}catch{}const r=this.No.Dt(this.ua);if(r&&(this.props=X({},r)),this.Xo&&this.ja(),t&&r){var n,o;const a=i?.[Ce],l=(n=i?.$user_state)!==null&&n!==void 0?n:Ve,u=r[Ce],c=(o=r.$user_state)!==null&&o!==void 0?o:Ve;if(u!==a||c!==l){this.Yo=!0,Y.$t(ki(this.ua),!0);const d=X({},this.props);ws.forEach(v=>delete d[v]),c!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(E(a)||u===a)||(Nn(d,s),delete d[st]),this.props=d;const h=new Set;ws.forEach(v=>{var g;const m=(g=de(v))===null||g===void 0?void 0:g.storageGroup;m&&h.add(m)}),h.forEach(v=>{const g={};G(this.props,(m,_)=>{var f;((f=de(_))===null||f===void 0?void 0:f.storageGroup)===v&&(g[_]=m)}),xe(g)?(U.Lt(this.fa(v)),this.Qo[v]={}):U.$t(this.fa(v),g)&&(this.Qo[v]={persisted:!0,fingerprint:this.ka(g,v)})})}}Y.Ot(ki(this.ua))&&(this.Yo=!0)}ja(){for(const e of zt){const t=U.Dt(this.fa(e));if(t&&!xe(t)){const i=this.ma(e);i.persisted=!0,this.Ba(e)||(i.fingerprint=this.ka(t,e)),this.Ha(e,t)||X(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var i;return((i=de(t))===null||i===void 0?void 0:i.storageGroup)===e})}Ha(e,t){const i=Gc[e];if(!i)return!1;const s=t[i],r=this.props[i];return ne(s)&&ne(r)&&r>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;const i=this.Xo?(t=de(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?U.Dt(this.fa(i)):this.No.Dt(this.ua);if(s&&e in s)this.xa(e,s[e],!1);else{if(i){const r=this.No.Dt(this.ua);if(r&&e in r)return void this.xa(e,r[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?E(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){E(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||gl.forEach(r=>this.refreshKey(r)));const t=!e&&!this.ia;t||(this.sa=!1);const i=!!t&&this.$a();if(this.sa)return void(this.Ir.debug&&S.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(i&&this.oa.forEach(r=>r()));const s=this.Ua(this.No,this.ua,this.props,oe);s==="written"&&this.Pa(this.props),s!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(r=>r())}za(){const{main:e,groups:t}=this._a(),i=this.Ua(this.No,this.ua,e,oe);i==="written"&&this.Pa(e),i!=="failed"&&(this.na=!1,this.ra.clear(),ze.forEach(r=>{var n;(n=de(r))!==null&&n!==void 0&&n.storageGroup||this.ea.delete(r)}));for(const r of zt){var s;const n=t[r];if(xe(n)&&!(!((s=this.Qo[r])===null||s===void 0)&&s.persisted)){ze.forEach(a=>{var l;((l=de(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.ea.delete(a)});continue}const o=this.Ua(U,this.fa(r),n,r);o!=="failed"&&ze.forEach(a=>{const l=de(a);l?.storageGroup!==r||o!=="written"&&l.volatile||this.ea.delete(a)})}}_a(){const e={},t={flags:{},surveys:{}};return G(this.props,(i,s)=>{var r;const n=(r=de(s))===null||r===void 0?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}ka(e,t){if(t===oe)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const i={};return G(e,(s,r)=>{var n;i[r]=!((n=de(r))===null||n===void 0)&&n.volatile?"__volatile__":s}),JSON.stringify(i)}Ua(e,t,i,s){const r=this.ma(s);if(s!==oe&&!r.dirty&&!E(r.fingerprint))return"skipped";let n;try{if(n=this.ka(i,s),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.$t(t,i,this.Wa,this.Va,this.Ga,this.Ir.debug)?(r.dirty=!1,s!==oe&&(r.persisted=!0),E(n)||(r.fingerprint=n),this.Jo&&(r.storageValue=U.Ot(t)),"written"):(this.Ir.debug&&S.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),E(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(const t of zt)U.Lt(this.fa(t));e?delete this.Qo[oe]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(N(e)){this.syncCookieProperties(),E(t)&&(t="None"),this.Wa=E(i)?this.Za:i;let s=!1;if(G(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.xa(n,r),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(N(e)){this.syncCookieProperties(),this.Wa=E(t)?this.Za:t;let i=!1;if(G(e,(s,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==s||N(s)||A(s))&&(this.xa(r,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let i=!1;for(const s of t)s in this.props&&(this.Ca(s),i=!0);i&&this.save()}update_campaign_params(){const e=x?.URL;if(e===this.la)return;const t=ll(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),i=!xe(Mr(t));return i&&this.register(t),this.la=e,i?t:void 0}update_search_keyword(){this.register((function(){const e=x?.referrer;return e?cl(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:dl(),$referring_domain:x?.referrer&&((e=Ge(x.referrer))===null||e===void 0?void 0:e.host)||Xi},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=vl(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[It]:this.Ko?{r:Si(e.r),u:e.u?Si(e.u):void 0}:e},void 0)}get_initial_props(){const e={};G([Aa,Fa],i=>{const s=this.props[i];s&&G(s,function(r,n){e["$initial_"+Ws(n)]=r})});const t=this.props[It];if(t){const i=(function(s,r=!1){const n=pl(s,r),o={};return G(n,function(a,l){o[`$initial_${Ws(l)}`]=a}),o})(t,this.Ir.disable_capture_url_hashes);X(e,i)}return e}safe_merge(e){return G(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,r=!((v,g)=>{if(v.length!==g.length)return!1;const m=[...v].sort(),_=[...g].sort();return m.every((f,y)=>f===_[y])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(t,l),this.Ir=e,!a&&(s||r||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(p(p({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const u=n||o?this.ha(e):this.No;this.Qa();const c=this.ca(e),d=n||c!==this.Xo,h=!a&&(d||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=d;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const v=this.props;this.clear(),this.No=u,this.Xo=c,this.props=v,this.save()}else o&&(this.No=u,a||(delete this.Qo[oe],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Qa(){const e=this.props[It];if(!this.Ko||!N(e)||typeof e.r!="string")return;const t=Si(e.r),i=typeof e.u=="string"?Si(e.u):e.u;t===e.r&&i===e.u||this.xa(It,p(p({},e),{},{r:t,u:i}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this.xa(er,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return E(i)||(delete t[e],this.xa(er,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,i=!0){var s;const r=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||r===t||(this.na=!0),Dn(e)&&!Qe(r,t)&&this.ra.add(e),this.Ma(e,r,t),(s=de(e))!==null&&s!==void 0&&s.volatile||this.Ta(e))}Ca(e,t=!0){delete this.props[e],t&&($s(e)&&this.ga(e,!0),Dn(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;const i=(t=de(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.ma(i).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}},$e={GZipJS:"gzip-js",Base64:"base64"},Ht={Activation:"events",Cancellation:"cancelEvents"},yd={Button:"button",Tab:"tab",Selector:"selector"},bd={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"},wd={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ps={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ed={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},xd={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},kd={Once:"once",Recurring:"recurring",Always:"always"},Se={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Os={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"},vr={Popover:"popover",Inline:"inline"};function $i(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&ce(i.then)&&i.then(void 0,()=>{})}}}}var Sd={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},Yc={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"},jn={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"},Bn=re("[RateLimiter]"),Kc=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{Bn.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){Bn.warn(`could not rate limit - continuing. Error: "${s?.message}"`,{text:i});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const u=(ne(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ja(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(e){const t=this.instance.config.property_denylist;return!A(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&te?.pathname)return`${(e=te.origin)!==null&&e!==void 0?e:""}${te.pathname}`}Ja(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Xa(),o=this.Ka("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} 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 ${r} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Ze=re("[RemoteConfig]"),_l=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,i,s;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return Ze.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void Ze.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return Ze.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){Ze.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||Ze.warn("Failed to fetch remote config from PostHog."):Ze.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(s){Ze.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){Ze.error("Error loading feature flags",s)}}},$d=["fatal","error","warning","log","info","debug"],Ie=Uint8Array,we=Uint16Array,Dt=Uint32Array,Br=new Ie([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]),Ur=new Ie([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]),Un=new Ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ml=function(e,t){for(var i=new we(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Dt(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},yl=ml(Br,2),pr=yl[1];yl[0][28]=258,pr[258]=28;for(var qn=ml(Ur,0)[1],fr=new we(32768),se=0;32768>se;++se){var wt=(43690&se)>>>1|(21845&se)<<1;fr[se]=((65280&(wt=(61680&(wt=(52428&wt)>>>2|(13107&wt)<<2))>>>4|(3855&wt)<<4))>>>8|(255&wt)<<8)>>>1}var ni=function(e,t,i){for(var s=e.length,r=0,n=new we(t);s>r;++r)++n[e[r]-1];var o,a=new we(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new we(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],d=a[e[r]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[fr[d]>>>l]=u}else for(o=new we(s),r=0;s>r;++r)o[r]=fr[a[e[r]-1]++]>>>15-e[r];return o},_t=new Ie(288);for(se=0;144>se;++se)_t[se]=8;for(se=144;256>se;++se)_t[se]=9;for(se=256;280>se;++se)_t[se]=7;for(se=280;288>se;++se)_t[se]=8;var Qi=new Ie(32);for(se=0;32>se;++se)Qi[se]=5;var Xc=ni(_t,9,0),Qc=ni(Qi,5,0),bl=function(e){return(e/8|0)+(7&e&&1)},wl=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof we?we:e instanceof Dt?Dt:Ie)(i-t);return s.set(e.subarray(t,i)),s},Be=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Vt=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Ts=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Ie(0),0];if(r==1){var o=new Ie(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function($,k){return $.f-k.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=c&&i[d].f>i[u].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(s=1;r>s;++s)n[s].s>h&&(h=n[s].s);var v=new we(h+1),g=gr(i[c-1],v,0);if(g>t){s=0;var m=0,_=g-t,f=1<<_;for(n.sort(function($,k){return v[k.s]-v[$.s]||$.f-k.f});r>s;++s){var y=n[s].s;if(t>=v[y])break;m+=f-(1<<g-v[y]),v[y]=t}for(m>>>=_;m>0;){var w=n[s].s;t>v[w]?m-=1<<t-v[w]++-1:++s}for(;s>=0&&m;--s){var P=n[s].s;v[P]==t&&(--v[P],++m)}g=t}return[new Ie(v),g]},gr=function(e,t,i){return e.s==-1?Math.max(gr(e.l,t,i+1),gr(e.r,t,i+1)):t[e.s]=i},zn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new we(++t),s=0,r=e[0],n=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Wt=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Mi=function(e,t,i){var s=i.length,r=bl(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Hn=function(e,t,i,s,r,n,o,a,l,u,c){Be(t,c++,i),++r[256];for(var d=Ts(r,15),h=d[0],v=d[1],g=Ts(n,15),m=g[0],_=g[1],f=zn(h),y=f[0],w=f[1],P=zn(m),$=P[0],k=P[1],T=new we(19),I=0;y.length>I;++I)T[31&y[I]]++;for(I=0;$.length>I;++I)T[31&$[I]]++;for(var O=Ts(T,7),j=O[0],q=O[1],z=19;z>4&&!j[Un[z-1]];--z);var J,R,B,D,K=u+5<<3,H=Wt(r,_t)+Wt(n,Qi)+o,Z=Wt(r,h)+Wt(n,m)+o+14+3*z+Wt(T,j)+(2*T[16]+3*T[17]+7*T[18]);if(H>=K&&Z>=K)return Mi(t,c,e.subarray(l,l+u));if(Be(t,c,1+(H>Z)),c+=2,H>Z){J=ni(h,v,0),R=h,B=ni(m,_,0),D=m;var ve=ni(j,q,0);for(Be(t,c,w-257),Be(t,c+5,k-1),Be(t,c+10,z-4),c+=14,I=0;z>I;++I)Be(t,c+3*I,j[Un[I]]);c+=3*z;for(var le=[y,$],fe=0;2>fe;++fe){var ke=le[fe];for(I=0;ke.length>I;++I)Be(t,c,ve[ue=31&ke[I]]),c+=j[ue],ue>15&&(Be(t,c,ke[I]>>>5&127),c+=ke[I]>>>12)}}else J=Xc,R=_t,B=Qc,D=Qi;for(I=0;a>I;++I)if(s[I]>255){var ue;Vt(t,c,J[257+(ue=s[I]>>>18&31)]),c+=R[ue+257],ue>7&&(Be(t,c,s[I]>>>23&31),c+=Br[ue]);var Pe=31&s[I];Vt(t,c,B[Pe]),c+=D[Pe],Pe>3&&(Vt(t,c,s[I]>>>5&8191),c+=Ur[Pe])}else Vt(t,c,J[s[I]]),c+=R[s[I]];return Vt(t,c,J[256]),c+R[256]},Zc=new Dt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eh=new Ie(0),th=(function(){for(var e=new Dt(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Cs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function ih(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(v){for(var g=h,m=0;v.length>m;++m)g=th[255&g^v[m]]^g>>>8;h=g},d(){return 4294967295^h}}})(),s=e.length;i.p(e);var r,n,o,a,l,u,c=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,(function(h,v,g,m,_,f){var y=h.length,w=new Ie(m+y+5*(1+Math.floor(y/7e3))+_),P=w.subarray(m,w.length-_),$=0;if(!v||8>y)for(var k=0;y>=k;k+=65535){var T=k+65535;y>T?$=Mi(P,$,h.subarray(k,T)):(P[k]=f,$=Mi(P,$,h.subarray(k,y)))}else{for(var I=Zc[v-1],O=I>>>13,j=8191&I,q=(1<<g)-1,z=new we(32768),J=new we(q+1),R=Math.ceil(g/3),B=2*R,D=function(ls){return(h[ls]^h[ls+1]<<R^h[ls+2]<<B)&q},K=new Dt(25e3),H=new we(288),Z=new we(32),ve=0,le=0,fe=(k=0,0),ke=0,ue=0;y>k;++k){var Pe=D(k),Je=32767&k,Ye=J[Pe];if(z[Je]=Ye,J[Pe]=Je,k>=ke){var at=y-k;if((ve>7e3||fe>24576)&&at>423){$=Hn(h,P,0,K,H,Z,le,fe,ue,k-ue,$),fe=ve=le=0,ue=k;for(var Ee=0;286>Ee;++Ee)H[Ee]=0;for(Ee=0;30>Ee;++Ee)Z[Ee]=0}var Ae=2,bi=0,Vl=j,Ke=Je-Ye&32767;if(at>2&&Pe==D(k-Ke))for(var Wl=Math.min(O,at)-1,Gl=Math.min(32767,k),Jl=Math.min(258,at);Gl>=Ke&&--Vl&&Je!=Ye;){if(h[k+Ae]==h[k+Ae-Ke]){for(var Xe=0;Jl>Xe&&h[k+Xe]==h[k+Xe-Ke];++Xe);if(Xe>Ae){if(Ae=Xe,bi=Ke,Xe>Wl)break;var Yl=Math.min(Ke,Xe-2),zr=0;for(Ee=0;Yl>Ee;++Ee){var as=k-Ke+Ee+32768&32767,Hr=as-z[as]+32768&32767;Hr>zr&&(zr=Hr,Ye=as)}}}Ke+=(Je=Ye)-(Ye=z[Je])+32768&32767}if(bi){K[fe++]=268435456|pr[Ae]<<18|qn[bi];var Vr=31&pr[Ae],Wr=31&qn[bi];le+=Br[Vr]+Ur[Wr],++H[257+Vr],++Z[Wr],ke=k+Ae,++ve}else K[fe++]=h[k],++H[h[k]]}}$=Hn(h,P,f,K,H,Z,le,fe,ue,k-ue,$),f||($=Mi(P,$,eh))}return wl(w,0,m+bl($)+_)})(n=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!u)),d=c.length;return(function(h,v){var g=v.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>v.level?4:v.level==9?2:0,h[9]=3,v.mtime!=0&&Cs(h,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),g){h[3]=8;for(var m=0;g.length>=m;++m)h[m+10]=g.charCodeAt(m)}})(c,t),Cs(c,d-8,i.d()),Cs(c,d-4,s),c}var sh=!!wr||!!ui,El=new WeakMap,xl="text/plain",Rs=0,Li=!1,kl=(e,t)=>{const[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;const o=n.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${s?`#${s}`:""}`},yi=(e,t,i=!0)=>{var s;const[r,n]=e.split("?"),o=p({},t),a=(s=n?.split("&").map(u=>{var c;const[d,h]=u.split("="),v=i&&(c=o[d])!==null&&c!==void 0?c:h;return delete o[d],`${d}=${v}`}))!==null&&s!==void 0?s:[],l=(function(u,c="&"){let d,h;const v=[];return G(u,function(g,m){E(g)||E(m)||m==="undefined"||(d=encodeURIComponent((_=>_ instanceof File)(g)?g.name:g.toString()),h=encodeURIComponent(m),v[v.length]=h+"="+d)}),v.join(c)})(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Fs=e=>{if(e.nl)return e.nl;const{data:t,compression:i}=e;if(!t)return;if(i===$e.GZipJS){const r=ih((function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Ie(n.length+(n.length>>>1)),l=0,u=function(v){a[l++]=v},c=0;o>c;++c){if(l+5>a.length){var d=new Ie(l+8+(o-c<<1));d.set(a),a=d}var h=n.charCodeAt(c);128>h?u(h):2048>h?(u(192|h>>>6),u(128|63&h)):h>55295&&57344>h?(u(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++c))>>>18),u(128|h>>>12&63),u(128|h>>>6&63),u(128|63&h)):(u(224|h>>>12),u(128|h>>>6&63),u(128|63&h))}return wl(a,0,l)})(Ot(t)),{mtime:0});return{contentType:xl,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===$e.Base64){const r=(n=>"data="+encodeURIComponent(typeof n=="string"?n:Ot(n)))((function(n){return n&&btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(o,a)=>String.fromCharCode(parseInt(a,16))))})(Ot(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const s=Ot(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},Sl=e=>{const t=()=>e.transport==="sendBeacon"?{url:yi(e.url,{compression:$e.Base64}),encodedBody:Fs(p(p({},e),{},{compression:$e.Base64,nl:void 0}))}:{url:kl(e.url,"compression"),encodedBody:Fs(p(p({},e),{},{compression:void 0,nl:void 0}))};let i;try{i=Fs(e)}catch(r){if(cn(e.compression,Mt(e.url,"compression")))return S.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return i&&cn(e.compression,Mt(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?Qs(new Uint8Array(s)):ArrayBuffer.isView(s)&&Qs(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Li=!0,t()):{url:e.url,encodedBody:i};var s},$l=e=>{try{return Sl(e)}catch(i){var t;S.error(i),(t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i});return}},rh=(function(){var e=Q(function*(t){const i=yield(function(r){return Zs.apply(this,arguments)})(Ot(t.data),ae.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return p(p({},t),{},{nl:{contentType:xl,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),nh=/Failed to fetch|NetworkError|Load failed/i,Il=e=>e?.name==="TypeError"&&nh.test(e?.message||""),Pl=e=>{try{const t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;const r=i.trim(),n=/^\d+\s*,/.test(r)?r.slice(0,r.indexOf(",")).trim():r;if(/^\d+$/.test(n)){const l=1e3*Math.min(Number(n),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const o=/^\w{3} \w{3} /.test(n)?n+" GMT":n,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,Ri):void 0})(e());return E(t)?void 0:Math.min(t,3e4)}catch{return}},Ol=e=>{const t=$l(e);if(!t)return;const i=new wr;El.set(i,!0);const{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);const{contentType:n,body:o}=r??{};G(e.headers,function(a,l){i.setRequestHeader(l,a)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;const l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,Pl(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},Tl=e=>{const t=$l(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=s??{},a=new Headers;G(e.headers,function(g,m){a.append(m,g)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(Gr){const g=new Gr;l={signal:g.signal,timeout:setTimeout(()=>{u=!0;try{g.abort(na("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(_){d(_)}var m},e.timeout)}}let c=!1;const d=g=>{var m;c||(c=!0,u&&g?.name==="AbortError"||Il(g)?S.warn(g):S.error(g),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:g}))};let h=0;const v=()=>{Rs-=h,h=0,l&&clearTimeout(l.timeout)};try{const g=p({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:l?.signal},e.fetchOptions),m=o??(E(n)?0:void 0);g.keepalive=g.method==="POST"&&!e.sl&&g.keepalive!==!1&&g.body===n&&!E(m)&&m>=0&&52428.8>Rs+m,g.keepalive&&(h=m,Rs+=h),ui(i,g).then(_=>_.text().then(f=>{var y;if(c)return;const w={statusCode:_.status,text:f};if(_.status===200)try{w.json=JSON.parse(f)}catch(P){S.error(P)}c=!0,v(),(y=e.callback)===null||y===void 0||y.call(e,w,Pl(()=>_.headers.get("Retry-After")))})).catch(_=>{v(),d(_)}).finally(v)}catch(g){v(),d(g)}},_r=e=>{try{var t;const{url:i,encodedBody:s}=Sl(e),{contentType:r,body:n,estimatedSize:o}=s??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(he.sendBeacon(i,a))return;const l=A(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(A(l)&&l.length>1&&(o??0)>16384){const u=Math.ceil(l.length/2),c=d=>A(e.data)?d:p(p({},e.data),{},{batch:d});_r(p(p({},e),{},{data:c(l.slice(0,u))})),_r(p(p({},e),{},{data:c(l.slice(u))}));return}S.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${ui?"fetch":"XHR"}`),ui?Tl(p(p({},e),{},{sl:!0})):Ol(e)}catch(i){S.warn("Beacon send failed",i)}},Vn=(e,t,i,s)=>{const r=s==="query"?t==="POST"?"sent_at":"_":void 0;return yi(i===$e.GZipJS?kl(e,"compression"):e,p(p({},r?{[r]:Date.now().toString()}:{}),i===$e.GZipJS?{}:{compression:i}))},oh=(()=>{const e=[];return ui&&e.push({transport:"fetch",method:Tl}),wr&&e.push({transport:"XHR",method:Ol}),he!=null&&he.sendBeacon&&e.push({transport:"sendBeacon",method:_r}),e})(),Cl=!sh&&me?.indexOf("MSIE")===-1&&me?.indexOf("Mozilla")===-1;function Rl(e,t,i){var s,r,n;i&&(t=p(p({},t),{},{callback:o=>i(o)})),e.__loaded?Cl?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=p(p({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(E(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,u,c;const d=p(p({},o),{},{callback:a??(_=>{var f;return(f=o.callback)===null||f===void 0?void 0:f.call(o,_)})});d.timeout=d.timeout||6e4;const h=(l=d.transport)!==null&&l!==void 0?l:"fetch";h==="sendBeacon"&&E(d.compression)&&d.data&&(d.compression=$e.Base64),d.method==="POST"&&d.data&&(d.timestampMode==="capture-body"?d.data=(_=>{var f,y;const w=(A(_)?_:[_]).map($=>p(p({},$),$.timestamp instanceof Date&&!isNaN($.timestamp.getTime())?{timestamp:$.timestamp.toISOString()}:{})),P=w[0];return{api_key:(f=P==null||(y=P.properties)===null||y===void 0?void 0:y.token)!==null&&f!==void 0?f:P?.token,batch:w,sent_at:new Date().toISOString()}})(d.data):d.timestampMode==="body"&&(d.data=((_,f=new Date().toISOString())=>A(_)?_.map(y=>p(p({},y),{},{sent_at:f})):p(p({},_),{},{sent_at:f}))(d.data))),d.url=Vn(d.url,d.method,d.compression,d.timestampMode);const v=oh.filter(_=>!d.disableTransport||!_.transport||!d.disableTransport.includes(_.transport)),g=(u=(c=(function(_,f){for(let y=0;_.length>y;y++)if(f(_[y]))return _[y]})(v,_=>_.transport===h))===null||c===void 0?void 0:c.method)!==null&&u!==void 0?u:v[0].method;if(!g)throw new Error("No available transport method");const m=_=>{try{g(_)}catch(y){var f;Il(y)?S.warn(y):S.error(y),(f=d.callback)===null||f===void 0||f.call(d,{statusCode:0,error:y})}};h!=="sendBeacon"&&!d.preferSyncCompression&&d.data&&d.compression===$e.GZipJS&&Kl&&typeof Promise<"u"&&!Li?rh(d).then(_=>{m(_)}).catch(_=>{if(hn(_))return Li=!0,void m(p(p({},d),{},{compression:void 0,url:Vn(o.url,o.method,void 0,o.timestampMode)}));(f=>{if(!f||typeof f!="object")return!1;const y="name"in f?String(f.name):"";return hn(f)||y===da})(_)&&(Li=!0),m(d)}):m(d)})(t,(o,a)=>{var l,u,c;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(u=e.config).on_request_error)===null||l===void 0||l.call(u,o),i?i(o,a):(c=t.callback)===null||c===void 0||c.call(t,o)})):t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:0}))}var ah=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=Ne(t?.flush_interval_ms||3e3,250,5e3,S.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();const e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.vl(i,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){const e=this.dl();for(const t in e)this.vl(e[t])}},this.al))}vl(e,t){try{this.ll(e,t)}catch(i){S.error(i)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return G(this.ol,t=>{var i;const s=t,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");E(e[r])&&(e[r]=p(p({},s),{},{data:[]})),(i=e[r].data)===null||i===void 0||i.push(s.data)}),this.ol=[],e}},lh=["retriesPerformedSoFar"],uh=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!E(b)&&"onLine"in b.navigator){if(this.gl=b.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},V(b,"online",this.ml),V(b,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=va(e,lh);qe(i)&&(s.url=yi(s.url,{retry_count:i})),Rl(this._instance,t?p(p({},s),{},{transport:t}):s,(r,n)=>{var o;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(i??0))return void this.Ls(p({retriesPerformedSoFar:i},s),n);r.statusCode===0&&S.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,r)})}Ls(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const s=Math.max((function(o){const a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(i),t??0),r=Date.now()+s;this.ol.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${s}`;navigator.onLine||(n+=" (Browser is offline)"),S.warn(n),this.fl||(this.fl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.fl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}yl(){const e=Date.now(),t=[],i=this.ol.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.ol=t,i.length>0)for(const{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,E(b)||(this.ml&&(b.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(b.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(p(p({},e),{},{transport:"sendBeacon"}))}catch(t){S.error(t)}this.ol=[]}},ch=class{constructor(e){this._instance=e,this.kl=()=>{var t,i,s,r;this.Sl||(this.Sl={});const n=this.scrollElement(),o=this.scrollY(),a=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=o+(n?.clientHeight||0),u=n?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(o),this.Sl.maxScrollY=Math.max(o,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(a,(i=this.Sl.maxScrollHeight)!==null&&i!==void 0?i:0),this.Sl.lastContentY=l,this.Sl.maxContentY=Math.max(l,(s=this.Sl.maxContentY)!==null&&s!==void 0?s:0),this.Sl.maxContentHeight=Math.max(u,(r=this.Sl.maxContentHeight)!==null&&r!==void 0?r:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){V(b,"scroll",this.kl,{capture:!0}),V(b,"scrollend",this.kl,{capture:!0}),V(b,"resize",this.kl)}scrollElement(){if(this.xl){const i=A(this.xl)?this.xl:[this.xl];for(const s of i){var e;const r=b==null||(e=b.document)===null||e===void 0?void 0:e.querySelector(s);if(r)return r}return}var t;return b==null||(t=b.document)===null||t===void 0?void 0:t.documentElement}Cl(e){var t,i;const s=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const r=this.scrollElement();return r&&r[s]||0}return b?e==="y"?b.scrollY||b.pageYOffset||((t=b.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:b.scrollX||b.pageXOffset||((i=b.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}},hh=e=>vl(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),Wn=class{constructor(e,t,i,s){this.qe=r=>{const n=this.$l();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.Tl(this._instance)};this.Il.register({[ar]:o})},this._instance=e,this.Ml=t,this.Il=i,this.Tl=s||hh,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[ar]}getSetOnceProps(){var e;const t=(e=this.$l())===null||e===void 0?void 0:e.props;return t?"r"in t?pl(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return G(Mr(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${Ws(i)}`]=t}),e}},Zi=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(i=>i!==t)}}emit(e,t){for(const i of this.El[e]||[])i(t);for(const i of this.El["*"]||[])i(e,t)}constructor(){this.El={}}},Et=re("[SessionId]"),Gn=864e5,Jn=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,i){var s;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new Zi,this.Ll=(n,o)=>!(!qe(n)||!qe(o))&&Math.abs(n-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||Fe,this.jl=i||Fe;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*Ne(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Et.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+r+"_window_id",this.zl="ph_"+r+"_primary_window_exists",this.Ul()){const n=Y.Dt(this.Hl),o=Y.Dt(this.zl);n&&!o?this.je=n:Y.Lt(this.Hl),Y.$t(this.zl,!0)}(s=this.Ir.bootstrap)!==null&&s!==void 0&&s.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Ir.persistence!=="memory"&&!this.Il.hi&&Y.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Y.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Y.Dt(this.Hl):null}Zl(e){const t=this.Rl;return!ie(t)&&!ie(e)&&5e3>Math.abs(e-t)}Ql(e,t,i){const s=t!==this._sessionActivityTimestamp,r=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,r&&!s||r&&this.Zl(t)||(this.Rl=t,this.Il.register({[$t]:[t,e,i]}))}Jl(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return qe(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey($t):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ie(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,t,i]=this.Yl();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[$t]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),t=qe(e)?e:0,i=qe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[$t];return A(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((s,r=new Date().getTime())=>{try{const n=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return n>r+6e4?void Et.error("Bootstrap sessionID cannot be in the future"):n}catch(n){Et.error("Invalid sessionID in bootstrap",n);return}})(e);return!E(i)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:i}:this.Ql(e,new Date().getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&b&&(b.removeEventListener(Ji,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Y.Lt(this.zl)},V(b,Ji,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||new Date().getTime(),r=this.Xt;if(i)this.Al=s;else if(ie(this.Al)||this.Al>s||s-this.Al>=1e3){var n,o;(n=(o=this.Il).syncCookieProperties)===null||n===void 0||n.call(o),this.Al=s}let[,a,l]=this.Yl();const u=!E(r)&&a!==r,c=this.tu();let d=this.Gl();const h=this.Nl,v=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Gn),g=h?v:qe(l)&&Math.abs(s-l)>Gn;let m=!1,_=u,f=!a||!!h;const y=a;let w=!f&&!e&&this.Ll(s,c);if(w&&(w=this.eu(s),w||Et.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),w||(f=!a||!!h)),f||w||g){_=!1;const T=h&&!v;a=T?h.sessionId:this.ql(),d=this.jl(),Et.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!T,changeReason:{noSessionId:f,activityTimeout:w,sessionPastMaximumLength:g}}),l=T?h.sessionStartTimestamp:s,this.Nl=void 0,m=!0}else d||(d=this.jl(),m=!0),_=_||a!==y,_&&(Et.info("adopted cross-tab session id",{sessionId:a,windowId:d}),m=!0);const P=qe(c)&&e&&!g?c:s,$=qe(l)?l:new Date().getTime();this.Vl(d),this.Ql(a,P,$),e||this.Bl();const k={noSessionId:f,activityTimeout:w,sessionPastMaximumLength:g,crossTabAdoption:_};return m&&this.Fl.forEach(T=>T(a,d,k)),{sessionId:a,windowId:d,sessionStartTimestamp:$,changeReason:m?k:void 0,lastActivityTimestamp:c}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}},Fl=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&Kr(i,t))return!0;try{const s=e?.userAgentData;if(s?.brands&&s.brands.some(r=>Kr(r?.brand,t)))return!0}catch{}return!!e.webdriver};function Al(){return(Al=Q(function*(){const e=he?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=t?.model;return L(i)&&i.length>0?i:void 0}catch(t){S.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t);return}})).apply(this,arguments)}function dh(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Ml(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var es=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ii=e=>e.toLowerCase(),Ll={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>es(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!es(i,s))),icontains:(e,t)=>t.map(Ii).some(i=>e.map(Ii).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Ii).every(i=>e.map(Ii).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s>parseFloat(r))}),lt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s<parseFloat(r))})};function Dl(e,t){return!e||Object.entries(e).every(([i,s])=>{const r=t?.[i];if(r==null)return!1;const n=Ll[s.operator];return!!n&&n(s.values.map(String),[String(r)])})}function As(e,t,i){return Ot({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var mr="custom",Yn="i.posthog.com",vh=/^\/static\//,ph=["/s/","/e/","/i/"],fh=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${Yn}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[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":mr),this.nu[this.apiHost]}su(e){if(!vh.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){const t=Ge(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,i){if(e==="ui")return i;let s=i;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=Ge(i))===null||n===void 0?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&e==="api"&&ph.some(o=>t.indexOf(o)===0)){const o=this.ru(s);if(o){const a=this.apiHost;let l=this.au;l?.apiHost===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.au=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){const t=this.au,i=this.ru(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){const s=this.su(t);if(s)return this.ou(e,t,`${s}${t}`)}if(this.region===mr)return this.ou(e,t,this.apiHost+t);const i=Yn+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${i}`);case"api":return this.ou(e,t,`https://${this.region}.${i}`)}}},W=re("[Surveys]"),Nl=e=>{try{const t=(i=>((s,r)=>`seenSurvey_${(function(n){return n.current_iteration&&n.current_iteration>0?`${n.id}_${n.current_iteration}`:n.id})(r)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){W.error("Failed to persist survey seen state",t)}},gh=[Ps.Popover,Ps.Widget,Ps.API],_h={ignoreConditions:!1,ignoreDelay:!1,displayType:vr.Popover},mh=re("[PostHog ExternalIntegrations]"),yh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bh=class{constructor(e){this._instance=e}Ho(e,t){var i,s;(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,r=>{if(r)return mh.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e;for(const[r,n]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;n&&!((t=C.__PosthogExtensions__)!==null&&t!==void 0&&(t=t.integrations)!==null&&t!==void 0&&t[r])&&this.Ho(yh[r],()=>{var o;(o=C.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[r])===null||o===void 0||o.start(this._instance)}),!n&&(i=C.__PosthogExtensions__)!==null&&i!==void 0&&(i=i.integrations)!==null&&i!==void 0&&i[r]&&((s=C.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[r])===null||s===void 0||s.stop())}}},wh=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return Q(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{const i=e.setup(t.bo);i&&(yield i)}catch(i){const s=t.lu.get(e.name)===e;s&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const t of e)this.uu(t)}uu(e){try{var t;const i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&ce(i.then)&&i.then(void 0,s=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this.A.error(`Failed to dispose browser extension "${e.name}"`,i)}}},Eh=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const i={};for(const s of e){const r=t?.get_property(s);E(r)||(i[s]=r)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},Kn="extensionsRemoteConfig",xh=class{constructor(e){this.instance=e,this.To=!1,this.A=S,this.hu=e.cu,this.kv=new Eh(e),this.onEvent=t=>$i(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this.A.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.To)return $i(()=>{});const i=r=>{try{t(r)}catch(n){this.A.error("Browser extension remote config listener failed",n)}},s=this.instance.du.on(Kn,i);return this.hu&&i(this.hu),$i(s)},this.vu=new wh(S.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(Ir);return typeof e=="string"?e:void 0}get library(){return{name:ae.LIB_NAME,version:ae.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=r?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=r?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=r?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return $i(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(Kn,e))}sendRequest(e){var t=this;return Q(function*(i,s={}){var r;const n=t.instance.requestRouter.endpointFor((r=s.target)!==null&&r!==void 0?r:"api",i),o={method:s.method,url:s.query?yi(n,s.query):n,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?Vs.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}},oi={},Ms=0,ai=()=>{},Xn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',xt="Surveys module not available",Qn="sanitize_properties is deprecated. Use before_send instead",jl="Invalid value for property_denylist config: ",kh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Sh=["$feature_flag_called","$$heatmap","$snapshot"],Zn=e=>e.charAt(0)==="$"&&!F(Sh,e),$h=/^[A-Za-z0-9_-]{1,400}$/,eo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,to=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Ih=["token","distinct_id",Ma],Kt="posthog",Ph=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ls=e=>{var t;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:kc(x?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ai,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:te&&L(te?.search)&&te.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(b==null||(t=b.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){S.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Va,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ai},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:Rc,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:Ph(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},Oh=[["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=e=>{const t={};for(const[r,n]of Oh)E(e[r])||(t[n]=e[r]);const i=X({},t,e),s=e.__preview_external_dependency_versioned_paths;return E(s)||(E(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),L(s)&&E(e.asset_host)&&(i.asset_host=s)),A(e.property_blacklist)&&(E(e.property_denylist)?i.property_denylist=e.property_blacklist:A(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:S.error(jl+e.property_denylist)),i},Th=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){S.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},li=class et{gu(t){if(!t)return;const i=this.lu.indexOf(t);i!==-1&&this.lu.splice(i,1)}mu(t,i){var s;return this.gu(t),this.lu.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let i,s,r;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, 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. ${r}`)}ku(){if(this.yu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.Su()||t.load(!0);const i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){const s=this.config.get_device_id(Fe());this.register({distinct_id:s,$device_id:s}),t.set_property(ye,Ve)}this.xu()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Cu=!1,this.$u=!1,this.webPerformance=new Th,this.Tu=!1,this.version=ae.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new Zi,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ls(),this.SentryIntegration=Bc,this.sentryIntegration=s=>(function(r,n){const o=nl(r,n);return{name:rl,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new ch(this),this.pageViewManager=new Ln(this),this.rateLimiter=new Kc(this),this.requestRouter=new fh(this),this.consent=new Cc(this),this.externalIntegrations=new bh(this);const i=(t=et.__defaultExtensionClasses)!==null&&t!==void 0?t:{};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:(s,r,n)=>{const o=L(s)?{[s]:r}:s;this.setPersonProperties(o),n?.({})},set_once:(s,r,n)=>{const o=L(s)?{[s]:r}:s;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",s=>S.info(`send "${s?.event}"`,s))}init(t,i,s){if(s&&s!==Kt){var r;const n=(r=oi[s])!==null&&r!==void 0?r:new et;return n._init(t,i,s),oi[s]=n,oi[Kt][s]=n,n}return this._init(t,i,s)}_init(t,i={},s){var r,n,o;const a=L(t)?t.trim():"";if(!a)return S.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?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('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ls(i.defaults),i.debug=this.Du(i.debug),this.Lu=i,this.Nu=[],i.person_profiles?this.Fu=i.person_profiles:i.process_person&&(this.Fu=i.process_person);const u=Ls(i.defaults),c=io(i),d=X({},u,c,{name:s,token:a});N(u.rageclick)&&N(c.rageclick)&&(d.rageclick=X({},u.rageclick,c.rageclick)),N(u.session_recording)&&N(c.session_recording)&&(d.session_recording=X({},u.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&S.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:$e.GZipJS;const h=this.Su();if(this.persistence=new Is(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Is(p(p({},this.config),{},{persistence:"sessionStorage"}),h,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&Y.Et()){const f=Y.Dt(this.Mu);A(f)&&f.forEach(y=>{L(y)&&this.Iu.add(y)})}else Y.Lt(this.Mu);const v=p({},this.persistence.props),g=p({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new ah((f,y)=>this.ju(f,y),this.config.request_queue_config),this.Bu=new uh(this),this.__request_queue=[];const m=this.yu();m||(this.sessionManager=new Jn(this),this.sessionPropsManager=new Wn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((f,y,w)=>{(w!=null&&w.activityTimeout||w!=null&&w.sessionPastMaximumLength||w!=null&&w.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(S.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(m)},0)):(S.info("Initializing extensions synchronously"),this.Uu(m)),ae.DEBUG=ae.DEBUG||this.config.debug,ae.DEBUG&&S.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:v,s:g}),this.config.identity_distinct_id&&!((r=i.bootstrap)!==null&&r!==void 0&&r.distinctID)&&(i.bootstrap=p(p({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=(n=i.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.wu=!!_&&!Xt(_),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){const f=i.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(ye);if(i.bootstrap.isIdentifiedID&&y!=null&&y!==f&&w==="anonymous")this.identify(f);else if(i.bootstrap.isIdentifiedID&&y!=null&&y!==f&&w==="identified")S.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{const P=this.config.get_device_id(Fe()),$=i.bootstrap.isIdentifiedID?P:f;this.persistence.set_property(ye,i.bootstrap.isIdentifiedID?Fi:Ve),this.register({distinct_id:f,$device_id:$})}}if(m)this.register_once({distinct_id:ys,$device_id:null},"");else if(!this.get_distinct_id()){const f=this.config.get_device_id(Fe());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(ye,Ve)}return V(b,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),V(b,"pageshow",()=>{var f;this.Cu=!1,this.$u||(f=this.Bu)===null||f===void 0||f.resume()}),i.segment?Mn(this,()=>this.Wu()):this.Wu(),ce(this.config._onCapture)&&this.config._onCapture!==ai&&(S.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",f=>this.config._onCapture(f.event,f))),this.config.ip&&S.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 Al.apply(this,arguments)})().then(f=>{f&&this.register({[ms]:f})}).catch(ai),this}Vu(t){const i=t;return L(i.name)&&ce(i.setup)}Gu(t,i){this.Vu(t)?i.push(()=>{this.Zu().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{S.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.lu.push(t)}zu(){var t,i,s;const r=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=et.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var n,o,a;r&&(this.featureFlags&&this.featureFlags instanceof r||((n=this.Qu)===null||n===void 0||n.call(this),this.Qu=void 0,this.featureFlags=new r(this)),ce(this.featureFlags.onReloading)&&ce(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Uu(t){const i=performance.now(),s=p(p({},et.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,u,c,d;s.exceptions&&this.lu.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new s.exceptions(this)),s.historyAutocapture&&this.lu.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.lu.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.lu.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Gu(this.autocapture=new s.autocapture(this),r),s.surveys&&this.Gu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),r),s.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),r),s.metrics&&this.lu.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.lu.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new s.conversations(this)),s.productTours&&this.lu.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.lu.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.lu.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,jc)),s.toolbar&&this.lu.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new s.toolbar(this)),s.experiments&&this.lu.push(this.experiments=(d=this.experiments)!==null&&d!==void 0?d:new s.experiments(this)),this.lu.forEach(h=>{h.initialize&&r.push(()=>{var v;(v=h.initialize)===null||v===void 0||v.call(h)})}),r.push(()=>{if(this.Ju){const h=this.Ju;this.Ju=void 0,this.lu.forEach(v=>{var g;return(g=v.onRemoteConfig)===null||g===void 0?void 0:g.call(v,h)})}}),this.Ku(r,i)}Ku(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,i)},0);const r=t.shift();if(r)try{r()}catch(n){S.error("Error initializing extension:",n)}}const s=Math.round(performance.now()-i);this.register_for_session({[La]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Da]:s}),this.config.__preview_deferred_init_extensions&&S.info(`PostHog extensions initialized (${s}ms)`)}el(t){var i;if(!x||!x.body)return S.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.cu=t,this.compression=void 0,t.ok){var s;const r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=F(r.supportedCompression,$e.GZipJS)?$e.GZipJS:F(r.supportedCompression,$e.Base64)?$e.Base64:void 0),(s=r.analytics)!==null&&s!==void 0&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Va}),(i=this.Xu)===null||i===void 0||i.handleRemoteConfig(t),this.lu.forEach(r=>{var n;return(n=r.onRemoteConfig)===null||n===void 0?void 0:n.call(r,t)})}Wu(){try{this.config.loaded(this)}catch(t){S.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&te?.hostname){const t=te.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.th()},1),this.eh=new _l(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Pt(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,i,s,r,n,o;this.Cu=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(yn),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.qu)===null||n===void 0||n.unload(),(o=this.Bu)===null||o===void 0||o.unload()):this.ih()&&this.capture(yn,null,{transport:"sendBeacon"})}_send_request(t){Rl(this,t)}ju(t,i){this.Bu?this.Bu.retriableRequest(t,i):this._send_request(i?p(p({},t),{},{transport:i}):t)}_execute_array(t){Ms++;try{let i;const s=[],r=[],n=[];Pt(t,a=>{if(a)if(i=a[0],A(i))n.push(a);else if(ce(a))try{a.call(this)}catch(l){S.error("Error executing queued PostHog call",a,l)}else A(a)&&i==="alias"?s.push(a):A(a)&&i.indexOf("capture")!==-1&&ce(this[i])?n.push(a):r.push(a)});const o=function(a,l){Pt(a,function(u){try{if(A(u[0])){let c=l;G(u,function(d){c=c[d[0]].apply(c,d.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){S.error("Error executing queued PostHog call",u,c)}})};o(s,this),o(r,this),o(n,this)}finally{Ms--}}push(t){if(Ms>0&&A(t)&&L(t[0])){const i=et.prototype[t[0]];ce(i)&&i.apply(this,t.slice(1));return}this._execute_array([t])}get nh(){return{property:_n,persistenceKey:Ct,cookieName:"_fbc",pattern:eo,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Ct]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Ct)}}}get sh(){return{property:mn,persistenceKey:Zt,cookieName:"_fbp",pattern:to,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Zt]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Zt)}}}rh(t){var i;const s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return L(s)&&t.pattern.test(s)?{value:s,delivered:!1}:N(s)&&L(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}oh(t,i,s){return i===s?.value?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.yu())return;const i=ii(t.cookieName);return L(i)&&t.pattern.test(i)?i:void 0}uh(t,i,s,r){if(!this.persistence)return;const n=this.nh;this.persistence.refreshKey(n.persistenceKey);const o=this.rh(n);if(r)return void n.unregister();if(s)return L(i)&&eo.test(i)?this.oh(n,i,o):void n.unregister();const a=L(t)&&$h.test(t)?t:void 0,l=this.ah(n);return l&&((u,c,d)=>{const h=u.split(".");if(c)return h[3]===c;if(!d)return!0;const v=d.value.split(".");return h[3]===v[3]||Number(h[2])>Number(v[2])})(l,a,o)?this.oh(n,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.oh(n,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}hh(t,i,s){if(!this.persistence)return;const r=this.sh;this.persistence.refreshKey(r.persistenceKey);const n=this.rh(r);if(s)return void r.unregister();if(i)return L(t)&&to.test(t)?this.oh(r,t,n):void r.unregister();const o=this.ah(r);return o?this.oh(r,o,n):n?{value:n.value,pending:!n.delivered}:void 0}dh(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const s=this.rh(t);s?.value!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var r,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void S.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(E(t)||!L(t))return void S.error("No event name provided to posthog.capture");this.ku();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void S.critical("This capture call is ignored due to client rate limiting.");let l;i!=null&&i.$current_url&&!L(i?.$current_url)&&(S.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s!=null&&s.fh||S.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&&(l=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();const u=new Date,c=s?.timestamp||u,d=en(s?.uuid,Fe);let h={uuid:d,event:t,properties:this.calculateEventProperties(t,i||{},c,d)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const v=t==="$feature_flag_called"&&h.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s!=null&&s.$set&&!v&&(h.$set=s?.$set);const g=N(i?.$set)?i.$set:void 0,m=A(i?.$unset)?i.$unset:[],_=s?.$unset||[],f=R=>{var B;const D=!!s?.$set&&R in s.$set;return{hasProvided:D||!!g&&R in g,provided:D?s==null||(B=s.$set)===null||B===void 0?void 0:B[R]:g?.[R],unset:m.indexOf(R)!==-1||_.indexOf(R)!==-1}},y=f(_n),w=f(mn),P=[{channel:this.nh,hasProvided:y.hasProvided,update:this.uh(l?.fbclid,y.provided,y.hasProvided,y.unset)},{channel:this.sh,hasProvided:w.hasProvided,update:this.hh(w.provided,w.hasProvided,w.unset)}];for(const{channel:R,hasProvided:B,update:D}of P)D&&h.properties.$process_person_profile===!0&&D.pending&&!B&&!v&&(h.$set=p({[R.property]:D.value},h.$set));const $=s?.$unset;$&&(h.$unset=$);const k=v?void 0:this.ph(s?.$set_once,t!==bn,t===Wa);if(k&&(h.$set_once=k),s!=null&&s._noTruncate||(T=this.config.properties_string_max_length,h=(function(R,B){const D=new Set;return(function K(H,Z){if(H!==Object(H))return B?B(H):H;if(D.has(H))return;let ve;if(D.add(H),A(H))ve=[],Pt(H,le=>{ve.push(K(le))});else{const le={};G(Nt(H)?Ga(H):H,(fe,ke)=>{D.has(fe)||(le[ke]=K(fe,ke))}),ve=le}return ve})(R)})(h,R=>L(R)?R.slice(0,T):R)),h.timestamp=c,E(s?.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=u),v&&(h.properties=((R,B=[])=>{const D={},K=H=>{R[H]!==void 0&&(D[H]=R[H])};return Hu.forEach(K),B.forEach(K),D})(h.properties,Ih)),t===Se.DISMISSED||t===Se.SENT){const R=i?.[Os.SURVEY_ID],B=i?.[Os.SURVEY_ITERATION];Nl({id:R,current_iteration:B}),h.$set=p(p({},h.$set),{},{[dh({id:R,current_iteration:B},t===Se.SENT?"responded":"dismissed")]:!0})}else t===Se.SHOWN&&(h.$set=p(p({},h.$set),{},{[Os.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var T;if(t===Yc.SHOWN){const R=i?.[jn.TOUR_TYPE];R&&(h.$set=p(p({},h.$set),{},{[`${jn.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const I=p(p({},h.properties.$set),h.$set);if(xe(I)||this.setPersonPropertiesForFlags(I),!M(this.config.before_send)){const R=this.Os(h);if(!R)return;h=R,h.uuid=en(h.uuid,Fe)}this.sessionRecording&&!this.Pu&&Zn(t)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const O=P.filter(({channel:R,update:B})=>{var D,K,H;const Z=(D=(K=h.$set)===null||K===void 0?void 0:K[R.property])!==null&&D!==void 0?D:N((H=h.properties)===null||H===void 0?void 0:H.$set)?h.properties.$set[R.property]:void 0;return B?.pending&&Z===B.value});this.du.emit("eventCaptured",h);const j=(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),q=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(j),z=p(p(p({method:"POST",url:j,data:h,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:q?"body":"capture-body",batchKey:s?._batchKey},q&&(!((n=h.properties)===null||n===void 0)&&n.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),O.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:B,update:D}of O)this.dh(B,D.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||O.length){var J;let R;!z.transport&&!z.callback&&xe((J=this.config.request_headers)!==null&&J!==void 0?J:{})&&this.Cu&&(R="sendBeacon"),this.ju(z,R)}else this.qu.enqueue(z);return h}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.Xu)===null||i===void 0?void 0:i.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new xh(this)}fu(t){this.Eu.push(t);let i=!0;return()=>{if(!i)return;i=!1;const s=this.Eu.indexOf(t);s!==-1&&this.Eu.splice(s,1)}}gh(t=!0){var i,s,r;return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.Iu.clear(),this.mh()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=p({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[Ma]=!0),t==="$snapshot"){const y=p(p({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=y.distinct_id,(!L(a.distinct_id)&&!ne(a.distinct_id)||Xt(a.distinct_id))&&S.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=(function(y,w,P,$=!1){var k,T,I,O;if(!me)return{};const j=y?[...Lt,...w||[]]:[],[q,z]=ta(me),[J,R]=(function(ue){for(let Pe=0;Zr.length>Pe;Pe++){const[Je,Ye,at]=Zr[Pe],Ee=ue.match(Je);if(Ee){const Ae=at&&ue.match(at)||Ee;return[Ye,Ae?.[1]||""]}}return["",""]})(me),B=(function(){const ue="u">typeof navigator?navigator:void 0;return ue?.brave?{brave:!0}:{}})(),D={};E(P)||(D.detectGoogleSearchApp=P);const K={},H=(k=navigator)===null||k===void 0||(k=k.userAgentData)===null||k===void 0?void 0:k.platform,Z=(T=navigator)===null||T===void 0?void 0:T.maxTouchPoints,ve=b==null||(I=b.screen)===null||I===void 0?void 0:I.width,le=b==null||(O=b.screen)===null||O===void 0?void 0:O.height,fe=b?.devicePixelRatio;E(H)||(K.userAgentDataPlatform=H),E(Z)||(K.maxTouchPoints=Z),E(ve)||(K.screenWidth=ve),E(le)||(K.screenHeight=le),E(fe)||(K.devicePixelRatio=fe);const ke=X(Mr({$os:q,$os_version:z,$browser:ea(me,navigator.vendor,B,D),$webview_app:J,$webview_app_version:R,$device:ia(me),$device_type:du(me,K),$timezone:fl(),$timezone_offset:Wc()}),{$current_url:fi($?ot(te?.href):te?.href,j,gi),$host:te?.host,$pathname:te?.pathname,$raw_user_agent:me.length>1e3?me.substring(0,997)+"...":me,$browser_version:hu(me,navigator.vendor,B,D),$browser_language:hl(),$browser_language_prefix:Vc(),$screen_height:b?.screen.height,$screen_width:b?.screen.width,$viewport_height:b?.innerHeight,$viewport_width:b?.innerWidth,$lib:We.LIB_NAME,$lib_version:We.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return We.SDK_DIST_CHANNEL&&(ke.$sdk_dist_channel=We.SDK_DIST_CHANNEL),ke})(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){const{sessionId:y,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0);a.$session_id=y,a.$window_id=w}this.sessionPropsManager&&X(a,this.sessionPropsManager.getSessionProps());try{var u;if(this.sessionRecording){const y=this.sessionRecording.sdkDebugProperties,w=!this.Pu&&Zn(t);for(const P in y)(w||F(kh,P))&&(a[P]=y[P])}a.$sdk_debug_retry_queue_size=(u=this.Bu)===null||u===void 0?void 0:u.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}let c;if(this.requestRouter.region===mr&&(a.$lib_custom_api_host=this.config.api_host),c=t!=="$pageview"||n?t!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),a=X(a,c),t==="$pageview"&&x&&(a.title=x.title),!E(o)){const y=s.getTime()-o;a.$duration=parseFloat((y/1e3).toFixed(3))}me&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const d=this.persistence.properties(),h=this.sessionPersistence.properties(),v=a.$groups,g=d.$groups;N(v)&&!xe(v)&&(a.$groups=p(p({},N(g)?g:{}),v)),G(["$referrer","$referring_domain"],y=>{y in d&&delete h[y]});const m={};if(this.Eu.length>0)for(const y of this.Eu.slice())try{X(m,y())}catch(w){S.error("Failed to produce browser extension event properties",w)}a=X({},l,d,h,p(p({},m),a)),a.$is_identified=this._isIdentified(),A(this.config.property_denylist)?G(this.config.property_denylist,function(y){delete a[y]}):S.error(jl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const _=this.config.sanitize_properties;_&&(S.error(Qn),a=_(a,t));const f=this.yh();return a.$process_person_profile=f,f&&!n&&this.bh("_calculate_event_properties"),a}ph(t,i=!0,s=!1){var r;if(!this.persistence||!this.yh()||this.Tu&&!s)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=X({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&(S.error(Qn),a=l(a,"$set_once")),i&&(this.Tu=!0),xe(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(r=>this.Iu.add(r)),this.mh()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.Iu.delete(t),this.mh()}_h(t,i){this.register({[t]:i})}Hu(){this.Iu.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.Iu.clear(),this.mh()}mh(){var t;if(!this.Mu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!Y.Et())return void Y.Lt(this.Mu);const i=[];this.Iu.forEach(s=>i.push(s)),i.length>0?Y.$t(this.Mu,i):Y.Lt(this.Mu)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,r;return(s=(r=this.featureFlags)===null||r===void 0?void 0:r.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.du.on(t,i)}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:xt}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:xt})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:xt})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:xt}),()=>{})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=_h){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:xt}}canRenderSurveyAsync(t,i=!1){var s,r;return(s=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:xt})}wh(t){return!t||Xt(t)?(S.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(S.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())||(S.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,i,s){if(!this.__loaded||!this.persistence)return S.uninitializedWarning("posthog.identify");if(ne(t)&&(t=t.toString(),S.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t)||!this.bh("posthog.identify"))return;this.ku();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.gh(!1),a=this.persistence.Oa();let l=!1;try{const c=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},""),t!==c&&t!==this.get_property("__alias")&&(this.unregister(Wi),this.register({distinct_id:t}));const d=(this.persistence.get_property("$user_state")||"anonymous")===Ve,h=t!==c,v=!h&&d;if(h&&d){var u;const g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:c};this.persistence.set_property(ye,Fi),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",g,{$set:i||{},$set_once:s||{}})&&(this.Ou=As(t,i,s)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:c)}else if(v){this.persistence.set_property(ye,Fi);const g=i||{},m=s||{};this.setPersonPropertiesForFlags({$set:g,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:g,$set_once:m})&&(this.Ou=As(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);h||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(rt)):v&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.qa(l)}}setPersonProperties(t,i){if(!t&&!i||!this.bh("posthog.setPersonProperties"))return;const s=As(this.get_distinct_id(),t,i);this.Ou!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Ou=s)):S.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const s=(A(t)?t:[t]).filter(r=>L(r)&&r.length>0);s.length!==0&&this.bh("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Ou=null)}group(t,i,s){var r;if(!t||!i)return void S.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.gh();const n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p(p({},n),{},{[t]:i})}),(o||s)&&this.yh()){const a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(bn,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this.bh("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){const i=be(t)?t:t?.resetDeviceID,s=be(t)||t==null?void 0:t.bootstrap;this.kh(i,!1,s)}kh(t,i=!1,s){var r,n,o,a,l,u;if(S.info("reset"),!this.__loaded)return S.uninitializedWarning("posthog.reset");const c=s?.sessionID;this.config.bootstrap=s||((r=this.Lu)===null||r===void 0?void 0:r.bootstrap)||{},(n=this.featureFlags)===null||n===void 0||(o=n.updateConfig)===null||o===void 0||o.call(n,this.config,this.il());const d=this.get_property(Ir),h=this.get_property(ms),v=this.get_property(ei);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const g=this.is_capturing();this.consent.reset(),i||!g||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.");const m=(l=this.persistence)===null||l===void 0||(u=l.Oa)===null||u===void 0?void 0:u.call(l);let _=!1;try{var f,y,w,P,$,k,T,I,O,j,q,z,J;if((f=this.persistence)===null||f===void 0||f.clear(),(y=this.sessionPersistence)===null||y===void 0||y.clear(),this.Iu.clear(),this.mh(),E(v)||(j=this.persistence)===null||j===void 0||j.register({$session_recording_remote_config:v}),(w=this.surveys)===null||w===void 0||w.reset(),(P=this.featureFlags)===null||P===void 0||P.reset(),($=this.conversations)===null||$===void 0||$.reset(),(k=this.logs)===null||k===void 0||k.reset(),(T=this.metrics)===null||T===void 0||T.reset(),(I=this.persistence)===null||I===void 0||I.set_property("$user_state","anonymous"),(O=this.sessionManager)===null||O===void 0||O.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ys,$device_id:null},"");else{const D=this.config.get_device_id(Fe());this.register_once({distinct_id:D,$device_id:t?D:d},""),t||E(h)||this.register({[ms]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.yu()&&((J=this.persistence)===null||J===void 0||J.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(q=this.featureFlags)===null||q===void 0||q.initialize(),!M(c)&&!(!((z=this.sessionManager)===null||z===void 0)&&z.setBootstrapSessionId(c,!0)))){const D=p({},s);delete D.sessionID,this.config.bootstrap=D}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var R,B;m&&((R=this.persistence)===null||R===void 0||(B=R.qa)===null||B===void 0||B.call(R,_))}this.reloadFeatureFlags()}shutdown(t){var i=this;return Q(function*(){var s,r,n,o,a,l,u,c;if(i.__loaded){i.$u=!0,i.Zu().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(r=i.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=i.metrics)===null||n===void 0||n.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i.qu)===null||a===void 0||a.unload(),(l=i.Bu)===null||l===void 0||l.unload();try{var d;(d=i.featureFlags)===null||d===void 0||d.destroy()}catch(h){S.error("Error while destroying feature flags",h)}(u=i.persistence)===null||u===void 0||u.destroy(),(c=i.sessionPersistence)===null||c===void 0||c.destroy()}else S.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.Sh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let r=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t?.withTimestamp&&s){var n;const o=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(S.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(E(i)&&(i=this.get_distinct_id()),t!==i?(this._h(Wi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(S.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=p({},this.config);if(N(t)){var s,r,n,o,a,l,u,c,d,h,v,g,m,_;X(this.config,io(t));const y=this.Su();(s=this.persistence)===null||s===void 0||s.update_config(this.config,i,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Is(p(p({},this.config),{},{persistence:"sessionStorage"}),y,!1);const w=this.Du(this.config.debug);var f;be(w)&&(this.config.debug=w),be(this.config.debug)&&(this.config.debug?(ae.DEBUG=!0,U.Et()&&U.$t("ph_debug",!0),S.info("set_config",{config:t,oldConfig:i,newConfig:p({},this.config)})):(ae.DEBUG=!1,U.Et()&&U.Lt("ph_debug"))),(r=this.featureFlags)===null||r===void 0||(n=r.updateConfig)===null||n===void 0||n.call(r,this.config,this.il()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.metrics)===null||l===void 0||l.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(d=this.autocapture)===null||d===void 0||d.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((f=this.historyAutocapture)===null||f===void 0||f.startIfEnabledOrStop()),(v=this.exceptionObserver)===null||v===void 0||v.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)===null||g===void 0||g.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.xu(),(_=this.externalIntegrations)===null||_===void 0||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Mn(this,ai,!1)}}_overrideSDKInfo(t,i){ae.LIB_NAME=t,ae.LIB_VERSION=i}startSessionRecording(t){const i=t===!0,s={sampling:i||!!t?.sampling,linked_flag:i||!!t?.linked_flag,url_trigger:i||!!t?.url_trigger,event_trigger:i||!!t?.event_trigger};var r,n,o,a,l;Object.values(s).some(Boolean)&&((r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;const s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(p(p({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:et.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:Kt;return i!==Kt&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}yh(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&xe(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return this.config.person_profiles==="never"?(S.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this._h(Tr,!0),!0)}Su(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,i;const s=this.Su();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.$h(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==s&&((n=this.persistence)===null||n===void 0||n.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.hi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),s&&(this.Iu.clear(),this.mh()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.yu()){var s,r,n,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new Jn(this),this.pageViewManager=new Ln(this),this.persistence&&(this.sessionPropsManager=new Wn(this,this.sessionManager,this.persistence));const v=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=et.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,c;v&&(this.sessionRecording=this.mu(this.sessionRecording,new v(this)),this.cu&&((u=this.sessionRecording)===null||u===void 0||(c=u.onRemoteConfig)===null||c===void 0||c.call(u,this.cu)))}var d,h;this.consent.optInOut(!0),this.xu(),this.Yu(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((d=this.surveys)===null||d===void 0||d.loadIfEnabled()),(E(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t?.captureEventName)!==null&&h!==void 0?h:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else S.warn(Xn)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void S.warn(Xn);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var i,s;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ys,$device_id:null}),this.gu(t),this.sessionRecording=void 0,(i=this.sessionManager)===null||i===void 0||i.destroy(),(s=this.pageViewManager)===null||s===void 0||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return he?Fl(he,this.config.custom_blocked_useragents):void 0}th(){x&&(x.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(Ar,{title:x.title},{send_instantly:!0}),this.Au&&(x.removeEventListener(di,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),V(x,di,this.Au)))}debug(t){t===!1?(b?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(b?.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}))}il(){const t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(S.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(i,s,r,n,o){const a=s in i&&!M(i[s]),l=r in i&&!M(i[r]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${r}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[r])})(t,"advanced_disable_flags","advanced_disable_decide",0,S)}Os(t){var i;if(M(this.config.before_send))return t;const s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(eu),r=A(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const o of r)try{if(n=o(n),M(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return Zl(t.event)?S.warn(`${a}. This can cause unexpected behavior.`):S.info(a),null}n.properties&&!xe(n.properties)||S.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return S.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of s)if(n.properties&&M(n.properties[o]))return S.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Du(t){const i=be(t)&&!t,s=U.Et()&&U.Ot("ph_debug")==="true";return!i&&(!!s||t)}};li.__defaultExtensionClasses={},li.Ch=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Ec(e.prototype[t[i]])})(li,["identify"]);var Bl=class{constructor(e){this.disabled=e===!1;const t=N(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},Ds="$copy_autocapture",Ns=re("[AutoCapture]");function js(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ch(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!je(t));return t}function Rh(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!je(e))return{props:{}};const u=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!pe(d,"body")&&1e3>u.length;){if(Lr(d.parentNode)){const k=d.parentNode.host;if(c.has(k))break;c.add(k),u.push(k),d=k;continue}if(!je(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}const h=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(k=>pe(k,"button")||pe(k,"a")):-1;h>0&&(s=s||u.slice(0,h+1).some(k=>!Rt(k)||pi(k)));const v=[],g={};let m,_=!1,f=!1;if(G(u,k=>{const T=Rt(k);if(pe(k,"a")&&!i&&!r?.includes("href")){const I=k.getAttribute("href");_=!!(T&&I&&ri(I))&&(o?ot(I):I)}F(At(k),"ph-no-capture")&&(f=!0),v.push((function(I,O,j,q,z=!1){const J=I.tagName.toLowerCase(),R={tag_name:J};Nr.indexOf(J)>-1&&!j&&(R.$el_text=J.toLowerCase()==="a"||J.toLowerCase()==="button"?js(1024,Rn(I)):js(1024,vi(I)));const B=At(I);O||q!=null&&q.includes("class")||0>=B.length||(R.classes=B.filter(function(Z){return Z!==""})),G(I.attributes,function(Z){var ve;if((!pi(I)||["name","id","class","aria-label"].indexOf(Z.name)!==-1)&&!q?.includes(Z.name)&&!O&&ri(Z.value)&&(!L(ve=Z.name)||ve.substring(0,10)!=="_ngcontent"&&ve.substring(0,7)!=="_nghost")){let le=Z.value;Z.name==="class"&&(le=Dr(le).join(" ")),R["attr__"+Z.name]=js(1024,Z.name==="href"&&z?ot(le):le)}});let D=1,K=1,H=I;for(;H=Ch(H);)D++,H.tagName===I.tagName&&K++;return R.nth_child=D,R.nth_of_type=K,R})(k,i,s,r,o)),G((function(I){if(!Rt(I))return{};const O={};return G(I.attributes,function(j){if(j.name&&j.name.indexOf("data-ph-capture-attribute")===0){const q=j.name.replace("data-ph-capture-attribute-",""),z=j.value;q&&z&&ri(z)&&(O[q]=z)}}),O})(k),(I,O)=>{({}).hasOwnProperty.call(g,O)||(g[O]=I)})}),f)return{props:{},explicitNoCapture:f};if(h>0&&(e=u[h],v.splice(0,h)),s||(v[0].$el_text=pe(e,"a")||pe(e,"button")?Rn(e):vi(e)),_){var y,w;v[0].attr__href=_;const k=(y=Ge(_))===null||y===void 0?void 0:y.host,T=b==null||(w=b.location)===null||w===void 0?void 0:w.host;k&&T&&k!==T&&(m=_)}return{props:X(($=t.type,{$event_type:$,$ce_version:1}),n?{}:{$elements:v},{$elements_chain:(P=v,A(P)?(function(k){return k.map(T=>{var I,O;let j="";if(T.tag_name&&(j+=T.tag_name),T.attr_class){T.attr_class.sort();for(const J of T.attr_class)j+=`.${J.replace(/"/g,"")}`}const q=p(p(p(p({},T.text?{text:T.text}:{}),{},{"nth-child":(I=T.nth_child)!==null&&I!==void 0?I:0,"nth-of-type":(O=T.nth_of_type)!==null&&O!==void 0?O:0},T.href?{href:T.href}:{}),T.attr_id?{attr_id:T.attr_id}:{}),T.attributes),z={};return Ai(q).sort(([J],[R])=>(function(B,D){return D>B?-1:B>D?1:0})(J,R)).forEach(([J,R])=>z[Fn(J.toString())]=Fn(R.toString())),j+=":",j+=Ai(z).map(([J,R])=>`${J}="${R}"`).join(""),j}).join(";")})((function(k){return k.map(T=>{var I,O;const j={text:(I=T.$el_text)===null||I===void 0?void 0:I.slice(0,400),tag_name:T.tag_name,href:(O=T.attr__href)===null||O===void 0?void 0:O.slice(0,2048),attr_class:Dc(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return Ai(T).filter(([q])=>q.indexOf("attr__")===0).forEach(([q,z])=>j.attributes[q]=z),j})})(P)):"")},!((a=v[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=v[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},g),target:e};var P,$}var Fh=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!Rt(e))return!0;const i=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:Ss,s=new Set;let r=e;for(;r;){if(s.size>=1e3||s.has(r))return!0;s.add(r);const n=r,o=At(n);if(F(o,"ph-no-capture")||F(o,"ph-sensitive")||pi(n)||i.some(l=>hr(n,l)))return!0;const a=r.parentNode;r=Lr(a)?a.host:a&&je(a)?a:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const s=si(e);var t;e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&je(s)&&(this.vo={target:s,excluded:this.po(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId});return}const i=this.vo;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.do():e.type==="pointerup"&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;const i=this.vo;this.do();const s=si(e);if(i?.released&&i.target.isConnected&&i.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(pe(s,"html")||pe(s,"body"))){var r;if(i.excluded)return null;const n=(r=this.mo().css_selector_ignorelist)!==null&&r!==void 0?r:Ss;return[s,x?.documentElement,x?.body].some(o=>{if(!o)return!1;const a=At(o);return F(a,"ph-no-capture")||F(a,"ph-sensitive")||!Rt(o)||pi(o)||n.some(l=>hr(o,l))})?null:i.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new Bl(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,t;return this.mo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Ir.url_ignorelist=(t=this.Ir.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Ir}Ro(){if(!this.isBrowserSupported())return void Ns.info("Disabling Automatic Event Collection because this browser is not supported");if(!b||!x)return;const e=this.Ao=t=>{t=t||b?.event;try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);const i=t.type==="click"?this._o(t):void 0;if(ie(i))return;this.Fo(t,"$autocapture",i)}catch(i){Ns.error("Failed to capture event",i)}};if(V(b,"blur",e),V(x,"submit",e,{capture:!0}),V(x,"change",e,{capture:!0}),V(x,"click",e,{capture:!0}),G(["pointerdown","pointermove","pointerup","pointercancel"],t=>{V(x,t,e,{capture:!0})}),this.mo().capture_copied_text){const t=this.Oo=i=>{i=i||b?.event;try{this.Fo(i,Ds)}catch(s){Ns.error("Failed to capture clipboard event",s)}};V(x,"copy",t,{capture:!0}),V(x,"cut",t,{capture:!0}),V(x,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(b?.removeEventListener("blur",this.Ao),G(["pointerdown","pointermove","pointerup","pointercancel"],e=>{x?.removeEventListener(e,this.Ao,!0)}),x?.removeEventListener("submit",this.Ao,!0),x?.removeEventListener("change",this.Ao,!0),x?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(x?.removeEventListener("copy",this.Oo,!0),x?.removeEventListener("cut",this.Oo,!0),x?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.$o=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;be(i)&&((s=this.bo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.So=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.Co.set(t,new Set(e)):this.Co.delete(t);const i=new Set;this.Co.forEach(s=>{s.forEach(r=>i.add(r))}),this.Io=i}getElementSelectors(e,t){var i;const s=[];return(i=this.Io)===null||i===void 0||i.forEach(r=>{x?.querySelectorAll(r)?.forEach(n=>{e!==n&&t!==n||F(s,r)||s.push(r)})}),s}get isEnabled(){var e,t;if(this.To)return!1;const i=(e=this.bo)===null||e===void 0?void 0:e.kv.get(ka),s=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;const n=r.remoteRequestsDisabled&&!this.xo;if(ie(s)&&!be(i)&&!n)return!1;const o=(t=this.So)!==null&&t!==void 0?t:!!i;return!!r.enabled&&!o}Fo(e,t="$autocapture",i){if(!this.isEnabled)return void this.do();let s=i||si(e);Xa(s)&&(s=s.parentNode||null);const r=this.Mo();var n;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&tl(s,r.rageclick)&&this.Fo(e,"$rageclick",i);const o=t===Ds,a=o?p(p({},r),{},{dom_event_allowlist:void 0}):r;if(s&&(function(d,h,v,g,m,_){var f;if(!b||jr(d)||v?.url_allowlist&&!Sn(v.url_allowlist,_)||v?.url_ignorelist&&Sn(v.url_ignorelist,_))return!1;if(v?.dom_event_allowlist){const $=v.dom_event_allowlist;if($&&!$.some(k=>h.type===k))return!1}const{parentIsUsefulElement:y,targetElementList:w}=il(d,g);if(!(function($,k){const T=k?.element_allowlist;if(E(T))return!0;for(const I of $)if(T.some(O=>I.tagName.toLowerCase()===O))return!0;return!1})(w,v)||!dr(w,v?.css_selector_allowlist)||dr(w,(f=v?.css_selector_ignorelist)!==null&&f!==void 0?f:Ss))return!1;try{const $=b.getComputedStyle(d);if($&&$.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const P=d.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return y?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Nr.indexOf(P)>-1||d.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:d,explicitNoCapture:h,target:v}=Rh(s,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const g=this.getElementSelectors(s,v);if(g&&g.length>0&&(d.$element_selectors=g),t===Ds){const m=e.type||"clipboard";if(m!=="paste"){var u,c;const _=b==null||(u=b.getSelection())===null||u===void 0?void 0:u.toString(),f=Qa(_);if(!f)return!1;d.$selected_content=f,d.$clipboard_text_length=(c=_?.length)!==null&&c!==void 0?c:0}d.$copy_type=m}return(l=this.bo)===null||l===void 0||l.capture(t,d),!0}}isBrowserSupported(){return ce(x?.querySelectorAll)}},Ah=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=N(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=i?.url_allowlist,e.url_ignorelist=i?.url_ignorelist,e.dom_event_allowlist=i?.dom_event_allowlist,e.element_allowlist=i?.element_allowlist,e.css_selector_allowlist=i?.css_selector_allowlist,e.css_selector_ignorelist=i?.css_selector_ignorelist,e.element_attribute_ignorelist=i?.element_attribute_ignorelist,e.capture_copied_text=i?.capture_copied_text}},Gt=re("[ExceptionAutocapture]"),so=()=>{},ro=e=>{var t;if(ce(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function _i(e,t,i){try{if(!(t in e))return so;const s={next:e[t]},r=i(function(...n){return s.next.apply(this,n)});return ce(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);let n=e[t],o=ro(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=ro(n)}}}catch{return so}}var Mh=re("[TracingHeaders]"),ut=re("[Web Vitals]"),no=9e5,oo=["CLS","FCP","INP","LCP"],Lh=["INP","LCP"],Dh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Bs="disabled",ao="lazy_loading",Ue=re("[SessionRecording]"),Nh=[Cr,Rr,Na,ja,Ba,Ua,qa,za,Ha],jh=re("[Heatmaps]");function Us(e){return N(e)&&"clientX"in e&&"clientY"in e&&ne(e.clientX)&&ne(e.clientY)}var Pi=re("[Product Tours]"),qs=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Or))},Bh=["$set_once","$set"],Me=re("[SiteApps]"),lo="Error while initializing PostHog app with config id ",Ul=(e,t)=>e?.then?e.then(t):t(e),kt="SDK is not enabled or survey functionality is not yet loaded",uo="Disabled. Not loading surveys.",Uh=class{constructor(e,t){this.wo=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=i=>{if(this.To||this.Ir.disableSurveys)return;if(!i.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),W.warn("Remote config unavailable. Not loading surveys.");const s=i.config.surveys;if(M(s))return W.warn("Flags not loaded yet. Not loading surveys.");this.Dh=be(s)?s:s.length>0,W.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=i=>{this.Ph.slice().forEach(s=>this.Lh(s,i))}}setup(e){if(!this.To)return this.Nh=e,Ul(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,r;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Eh=[],this.Ph.forEach(n=>{n.active=!1}),this.Ph=[],(r=this.qh)===null||r===void 0||r.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(n=>clearTimeout(n)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const s=[];for(let r=0;r<localStorage.length;r++){const n=localStorage.key(r);(n!=null&&n.startsWith("seenSurvey_")||n!=null&&n.startsWith("inProgressSurvey_"))&&s.push(n)}s.forEach(r=>localStorage.removeItem(r))}catch{}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void W.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void W.info(uo);if(e.cookielessMode&&this.wo.isOptedOut())return void W.info("Not loading surveys in cookieless mode without consent.");const t=this.wo.getExtensions();if(!t)return void this.jh("PostHog Extensions not found.");if(E(this.Dh)&&!e.advancedEnableSurveys)return;const i=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{const s=t.generateSurveys;if(s)return this.Bh(s,i),void(this.Ih=!1);const r=t.loadExternalDependency;if(!r)return this.jh(Fr),void(this.Ih=!1);r(n=>{try{if(this.To)return;const o=this.wo.getExtensions();n||!o?.generateSurveys?this.jh("Could not load surveys script",n):this.Bh(o.generateSurveys,i)}finally{this.Ih=!1}})}catch(s){throw this.Ih=!1,this.jh("Error initializing surveys",s),s}}Bh(e,t){var i,s;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);const r=(i=(s=this.bo)!==null&&s!==void 0?s:this.Th)===null||i===void 0?void 0:i.kv.get(Jt);r&&this.Hh(r),W.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,t){this.Mh=!0,W.error(e,t),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;const s=(i=this.bo)!==null&&i!==void 0?i:this.Th;if(!s||this.To)return;if(this.Ir.disableSurveys)return W.info(uo),e([]);const r=s.kv.get(Jt);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:a,context:l})=>{this.To||e(a,l)}).catch(a=>W.error("Error in survey callback",a));const n=this.Vh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(a=>{try{return this.Gh(s,a)}catch(l){return W.error("Error processing surveys response",l),this.Gh(s,{statusCode:0,error:l})}},a=>this.Gh(s,{statusCode:0,error:a}));this.Rh=n;const o=()=>{this.Rh===n&&(this.Rh=null)};n.then(a=>{o(),this.To||(this.Oh(a.context),e(a.surveys,a.context))},o).catch(a=>W.error("Error in survey callback",a))}Vh(e,t){const i=this.bo;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(kt)}))}Gh(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:kt}};const i=t.statusCode;if(i!==200||!t.json){const r=`Surveys API could not be loaded, status: ${i}`;return i!==0?W.error(r):t.error||W.warn(r),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Ah=null;const s=t.json.surveys||[];return e.kv.set({[Jt]:s,[Gi]:Date.now()}),this.Hh(s),{surveys:s,context:{isLoaded:!0}}}Hh(e){var t;const i=e.filter(s=>(function(r){return!(!r.start_date||r.end_date)})(s)&&(Ml(s)||(function(r){var n;return!!(!((n=r.conditions)===null||n===void 0||(n=n.actions)===null||n===void 0||(n=n.values)===null||n===void 0)&&n.length)})(s)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(i)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,t;const i=(e=(t=this.bo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(Gi);return ne(i)&&Date.now()-i>3e5}Qh(){return ne(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};Nl(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oh()}Uh(e){for(const t of this.Eh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){W.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!M(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);W.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,i;if(this.To)return()=>{};const s={callback:e,active:!0,revision:0};this.Ph.push(s),this.zh();const r=(t=(i=this.bo)!==null&&i!==void 0?i:this.Th)===null||t===void 0?void 0:t.kv.get(Jt);return this.Ir.disableSurveys||!this._surveyManager&&this.Mh&&!this.Ih||!r&&!M(this.Ah)&&!this.Rh?this.Lh(s,{isLoaded:!1}):this._surveyManager&&this.Lh(s),()=>{var n;s.active=!1,this.Ph=this.Ph.filter(o=>o!==s),this.Ph.length===0&&((n=this.qh)===null||n===void 0||n.call(this),this.qh=void 0)}}zh(){var e,t,i;this._surveyManager&&this.Ph.length>0&&((e=this.qh)!==null&&e!==void 0||(this.qh=(t=(i=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(i,this.Oh)))}Lh(e,t){if(this.To||!e.active)return;const i=++e.revision,s=r=>{if(!this.To&&e.active&&i===e.revision)try{const n=t??{isLoaded:!0},o=JSON.stringify([r,n]);if(o===e.lastResult)return;e.lastResult=o,e.callback(r,n)}catch(n){W.error("Error in active matching surveys callback",n)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(r){W.error("Error in active matching surveys callback",r)}}Jh(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(r=>r.id===e))!==null&&s!==void 0?s:null}),t}Kh(e){if(M(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(M(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.Jh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(M(this._surveyManager))return W.warn("init was not called"),{visible:!1,disabledReason:kt};const t=this.Xh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return M(this._surveyManager)?(W.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kt})):new Promise(i=>{this.getSurveys(s=>{var r;const n=(r=s.find(o=>o.id===e))!==null&&r!==void 0?r:null;if(n){const o=this.Xh(n);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.wo.isCapturing())return;if(M(this._surveyManager))return void W.warn("init was not called");const r=typeof e=="string"?this.Jh(e):e;if(!r?.id)return void W.warn("Survey not found");if(!gh.includes(r.type))return void W.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const n=x?.querySelector(t);if(n){if(!((s=r.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){W.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,l;this.Fh.delete(o),!this.To&&this.wo.isCapturing()&&(W.info(`Rendering survey ${r.id} with delay of ${(a=r.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(r,n,i),W.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);this.Fh.add(o);return}this._surveyManager.renderSurvey(r,n,i)}else W.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.wo.isCapturing())return;if(M(this._surveyManager))return void W.warn("init was not called");const s=this.Jh(e);if(!s)return void W.warn("Survey not found");let r=s;if((i=s.appearance)!==null&&i!==void 0&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=p(p({},s),{},{appearance:p(p({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==vr.Popover&&t.initialResponses&&W.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const n=this.Kh(s);if(!n.eligible)return void W.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==vr.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){M(this._surveyManager)?W.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function St(e,t,i){if(M(e))return!1;switch(i){case"exact":return e===t;case"contains":{const s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var qh=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new Zi,this.nc=(t,i)=>this.sc(t,i)&&this.rc(t,i)&&this.oc(t,i)&&this.ac(t,i),this.sc=(t,i)=>!i?.event||t?.event===i?.event}init(){var e,t;E((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.lc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e,t;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ec=new Zi}register(e){var t,i;if(!E((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var r;this.Yh.add(s),(r=s.steps)===null||r===void 0||r.forEach(n=>{this.tc.add(n?.event||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){const s=new Set;this.Yh.forEach(r=>{var n;(n=r.steps)===null||n===void 0||n.forEach(o=>{o!=null&&o.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.tc.has(e)||this.tc.has(t.event))&&this.Yh.forEach(i=>{this.uc(t,i)&&this.ec.emit("actionCaptured",i.name)})}hc(e){this.onAction("actionCaptured",t=>e(t))}uc(e,t){if(t?.steps==null)return!1;for(const i of t.steps)if(this.nc(e,i))return!0;return!1}onAction(e,t){return this.ec.on(e,t)}rc(e,t){if(t?.url){var i;const s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!St(s,t.url,t.url_matching||"contains"))return!1}return!0}oc(e,t){return!!this.cc(e,t)&&!!this.dc(e,t)&&!!this.vc(e,t)}cc(e,t){var i;if(!t?.href)return!0;const s=this.fc(e);if(s.length>0)return s.some(n=>St(n.href,t.href,t.href_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&St((function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(r),t.href,t.href_matching||"exact")}dc(e,t){var i;if(!t?.text)return!0;const s=this.fc(e);if(s.length>0)return s.some(l=>St(l.text,t.text,t.text_matching||"exact")||St(l.$el_text,t.text,t.text_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&(n=(function(l){const u=[],c=/(?::|")text="(.*?)"/g;let d;for(;!M(d=c.exec(l));)u.includes(d[1])||u.push(d[1]);return u})(r),o=t.text,a=t.text_matching||"exact",n.some(l=>St(l,o,a)));var n,o,a}vc(e,t){var i,s;if(!t?.selector)return!0;const r=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(r?.includes(t.selector))return!0;const n=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}fc(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}ac(e,t){return!t?.properties||t.properties.length===0||Dl(t.properties.reduce((i,s)=>{const r=A(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:r,operator:s.operator||"exact"},i},{}),e?.properties)}},zh=class{constructor(e,t){var i,s;this.gc=[],this._instance=e,this.mc=t,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=(i=this._instance)===null||i===void 0||(s=i.onSessionId)===null||s===void 0?void 0:s.call(i,r=>this.kc(r))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,t){return!!e&&Dl(e.propertyFilters,t?.properties)}Ic(e,t){const i=new Map;return e.forEach(s=>{var r;(r=s.conditions)===null||r===void 0||(r=r[t])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(n=>{if(n?.name){const o=i.get(n.name)||[];o.push(s.id),i.set(n.name,o)}})}),i}Mc(e,t,i){const s=(i===Ht.Activation?this.yc:this.bc).get(e);let r=[];return this.Ec(n=>{r=n.filter(o=>s?.includes(o.id))}),r.filter(n=>{var o;const a=(o=n.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.Tc(a,t)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,t){var i;E((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this.Rc(e,t),this.Ac(e,t))}Ac(e,t){const i=e.filter(n=>{var o;return(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this._c.clear(),i.length===0)return void(t&&((s=this.Fc)===null||s===void 0||s.replace([])));this.Fc||(this.Fc=new qh(this._instance),this.Fc.init(),this.Fc.hc(n=>this.onAction(n)));const r=[];i.forEach(n=>{var o;(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(r.push(a),a.name){var l;const u=(l=this._c.get(a.name))!==null&&l!==void 0?l:[];u.includes(n.id)||u.push(n.id),this._c.set(a.name,u)}})}),t?this.Fc.replace(r):this.Fc.register(r)}Oc(e,t){t.forEach((i,s)=>{var r;const n=(r=e.get(s))!==null&&r!==void 0?r:[];i.forEach(o=>{n.includes(o)||n.push(o)}),e.set(s,n)})}Rc(e,t){var i,s;const r=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.events)&&((c=l.conditions)===null||c===void 0||(c=c.events)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),n=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((c=l.conditions)===null||c===void 0||(c=c.cancelEvents)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),o=this.Ic(e,Ht.Activation),a=this.Ic(e,Ht.Cancellation);t?(this.yc=o,this.bc=a):(this.Oc(this.yc,o),this.Oc(this.bc,a)),(r.length!==0||n.length!==0||e.some(l=>{var u;return(u=l.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length}))&&((i=this.lc)!==null&&i!==void 0||(this.lc=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,u)=>{this.onEvent(l,u)})))}onEvent(e,t){var i,s;const r=this.Dc(),n=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){const a=this.Lc(e,n,t);if(a==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.Nc([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.qc(n),void this.jc([n])}if(this.bc.has(e)){const a=this.Mc(e,t,Ht.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.Nc(a.map(l=>l.id)),a.forEach(l=>this.Bc(l.id)))}if(!this.yc.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.yc.get(e)});const o=this.Mc(e,t,Ht.Activation);this.Hc(o.map(a=>a.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(e){var t,i;if(e.length===0)return;const s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),r=[];for(const n of e)s&&this.Sc(n)?this.qc(n)&&this.zc(n):r.push(n);r.length>0&&(this.gc=[...new Set([...this.gc,...r])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(i=>i!==e);const t=this.Wc();return!t.includes(e)&&(this.Vc([...t,e]),this.Gc(),!0)}Nc(e){const t=new Set(e);this.gc=this.gc.filter(r=>!t.has(r));const i=this.Zc(),s=i.filter(r=>!t.has(r));s.length!==i.length&&(this.Vc(s),s.length===0&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;(e=this.mc)===null||e===void 0||e.call(this)}catch(t){this.Dc().error("Error while handling activated items change",t)}}Jc(){var e;const t=this.xc();if(!t)return{};const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}zc(e){if(!this.xc())return;const t=this.Jc();this.Cc(p(p({},t),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;const t=this.Jc(),i={};let s=!1;for(const[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(xe(i)?this.$c():this.Cc(i))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;const t=this.Jc()[e];return ne(t)?t:void 0}Zc(){var e;const t=this.Xc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Wc(){var e,t,i;const s=this.Zc();if(s.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Yc()],n=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return n&&r===n?s:[]}Gc(){var e,t;const i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this.td(i)}Qc(){this.ed()}kc(e){var t;const i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Yc()];if(i&&i!==e){const s=this.Zc(),r=this.Jc();s.length>0&&(this.Vc([]),s.filter(n=>ne(r[n])).forEach(n=>this.Bc(n))),this.Qc(),this.Kc(),s.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,t,i;(e=this.wc)===null||e===void 0||e.call(this),this.wc=void 0,(t=this.lc)===null||t===void 0||t.call(this),this.lc=void 0,(i=this.Fc)===null||i===void 0||i.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},Hh=class extends zh{constructor(e,t){super(e,t)}Xc(){return Ta}Yc(){return Ca}xc(){return Ra}Cc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}$c(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}Sc(e){var t;let i;this.Ec(r=>{i=r.find(n=>n.id===e)});const s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return ne(s)&&s>0}rd(){return Se.SHOWN}Ec(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Bc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Dc(){return W}Vc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}td(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}ed(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,t,i){var s;if(e===Se.SENT&&(i==null||(s=i.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let r;return this.Ec(n=>{r=n.find(o=>o.id===t)}),!r||(function(n){var o;return Ml(n)&&!!(!((o=n.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||n.schedule==="always"})(r)?e===Se.SHOWN?"consume":"ignore":e===Se.SHOWN?"persist":e===Se.DISMISSED||e===Se.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Vh=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const i of e){const s=this._instance.get_property(i);E(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Wh=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=C?.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(e){return new Hh(this._instance,e)}onMatchingConditionsChanged(e){const t=this._instance._addCaptureHook(n=>{n!=="$pageview"&&n!==Se.SHOWN&&n!==Se.DISMISSED&&n!==Se.SENT||e()}),i=()=>e();V(b,"PHSurveyShown",i);let s=!1;const r=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),r(),b?.removeEventListener("PHSurveyShown",i)}}},Gh=b?.location?Ki(b.location.hash,"__posthog")||Ki(location.hash,"state"):null,co="_postHogToolbarParams",ho=re("[Toolbar]"),vo=re("[FeatureFlags]"),Jh=class{constructor(e,t=!1){this.od=!1,this.update(e,t)}update(e,t){this.ad=((i,s)=>{var r,n,o,a,l,u,c,d;return{bootstrap:{featureFlags:(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:E(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(u=i.feature_flag_request_max_retries)!==null&&u!==void 0?u:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(c=(d=i.evaluation_contexts)!==null&&d!==void 0?d:i.evaluation_environments)!==null&&c!==void 0?c:[],flagKeys:A(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.od||(vo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),E(e.flag_keys)||A(e.flag_keys)||vo.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}},po=re("[FeatureFlags]"),ct=re("[FeatureFlags]",{debugEnabled:!0}),zs=`" failed. Feature flags didn't load in time.`,Yh=[502,504],fo=["click","keydown","wheel","touchstart","pointerdown"],go="connection_error",_o=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},mo=e=>{const t={};for(const[i,s]of Ai(e||{}))s&&(t[i]=s);return t},yo=e=>Nt(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Te=re("[Error tracking]"),yr="webkit-masked-url:",Kh=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Xh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",yr],Qh=["__firefox__","__gCrWeb"],bo="Refusing to render web experiment since the viewer is a likely bot",Zh={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>es(t,e),not_regex:(e,t)=>!es(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Oe=re("[Conversations]"),ht="Conversations not available yet.";function wo(e,t){var i,s,r,n,o,a,l;const u=(i=e?.flushIntervalMs)!==null&&i!==void 0?i:3e3,c=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,d=t?.consoleCapture?void 0:(r=e?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,h=E(d)?Math.max(c,2048):Math.max(c,d),v=p(p({},(function(){let g="",m="";try{const _=he?.userAgent;_&&([g,m]=ta(_))}catch{}return(function(_,f){const y=(function(w){if(w)return{}.hasOwnProperty.call(vn,w)?vn[w]:w})(_);return p(p({},y?{"os.name":y}:{}),f?{"os.version":f}:{})})(g,m)})()),e?.resourceAttributes);return{serviceName:(n=(o=v?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&n!==void 0?n:t?.serviceNameDefault,serviceVersion:(a=v?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=v?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:v,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var ed=["debug","log","warn","error","info"],td=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Eo="console",ql="__posthogHandledLogsRequestError",Hs=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[ql]=!0,i},xo=e=>!!e&&typeof e=="object"&&e[ql]===!0,ts=re("[NetworkMetrics]"),qr=()=>{var e;return!(b==null||(e=b.performance)===null||e===void 0)&&e.now?b.performance.now():Date.now()},id={"http:":80,"https:":443},sd=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),zl=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:((i=Ge(s))===null||i===void 0?void 0:i.href)||s}},br=(e,t,i,s,r,n,o=!1)=>{try{var a,l;const u=r();if(!u)return;const c=i||void 0,d=qr()-s,h=Ge(t.url);if(h&&h.protocol!=="http:"&&h.protocol!=="https:")return;const v={url:h?.href||t.url,method:t.method},g=ce(u.name)?u.name(v):L(u.name)?u.name:"http.client.request.duration";if(!g)return;const m=o&&!c?void 0:((f,y)=>f?400>f?void 0:String(f):y?.name||"_OTHER")(c,n),_=p(p(p(p(p({},(f=>{const y=sd.has(f)?f:"_OTHER";return p({"http.request.method":y},y==="_OTHER"&&f!==y?{"http.request.method_original":f}:{})})(v.method)),h?(f=>{return{"server.address":f.hostname.startsWith("[")&&f.hostname.endsWith("]")?f.hostname.slice(1,-1):f.hostname,"server.port":Number(f.port)||id[f.protocol],"url.scheme":f.protocol.slice(0,-1),"url.template":(y=f.pathname,y.split("/").map(w=>(P=>/^\d+$/.test(P)||P.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(P))(w)?":id":w).join("/"))};var y})(h):{}),c?{"http.response.status_code":c}:{}),m?{"error.type":m}:{}),(a=u.attributes)===null||a===void 0?void 0:a.call(u,v,{status:c,durationMs:d}));(l=e.metrics)===null||l===void 0||l.histogram(g,d,{unit:"ms",attributes:_})}catch(u){ts.error("Failed to record network metric",u)}},Hl=()=>{},rd=(e,t)=>ce(b?.fetch)?_i(b,"fetch",i=>function(...s){const r=qr(),n=i.apply(this,s);if(!t())return n;try{var o,a,l;const[u,c]=s,d=zl((o=(a=c?.method)!==null&&a!==void 0?a:u?.method)!==null&&o!==void 0?o:"GET",(l=u?.url)!==null&&l!==void 0?l:u);return n.then(h=>(br(e,d,h?.status,r,t,void 0,!0),h),h=>{throw br(e,d,void 0,r,t,h),h})}catch(u){return ts.error("Failed to observe fetch",u),n}}):Hl,nd=(e,t)=>{var i;const s=b==null||(i=b.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return Hl;const r=new WeakMap,n=_i(s,"open",a=>function(...l){try{El.has(this)||r.set(this,zl(l[0],l[1]))}catch(u){ts.error("Failed to observe XHR open",u)}return a.apply(this,l)}),o=_i(s,"send",a=>function(...l){let u;try{const c=r.get(this);if(c&&t()){const d=qr();u=()=>{this.removeEventListener("loadend",u),br(e,c,this.status,d,t)},V(this,"loadend",u)}}catch(c){ts.error("Failed to observe XHR send",c)}try{return a.apply(this,l)}catch(c){throw u&&this.removeEventListener("loadend",u),c}});return()=>{n(),o()}},os={featureFlags:class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=po,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const t=this.kd();this._d=0,t&&this.reloadFeatureFlags()},this.Sd=()=>{var t,i;const s=this.xd,r=(t=this.Cd)!==null&&t!==void 0?t:s;E(s)||E(r)||this.Ir.remoteRequestsDisabled||!x||x.visibilityState==="hidden"||Date.now()-((i=this.$d)!==null&&i!==void 0?i:0)<r||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?s:Math.min(2*r,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{x?.visibilityState==="visible"&&this.Md()},"get"in e?this.wo=e:(this._instance=e,this.Ed=new Jh(e.config,e.il()),this.wo=this.Ed)}updateConfig(e,t){var i;(i=this.Ed)===null||i===void 0||i.update(e,t),this.bo&&this.Pd()}setup(e){return this.Nh=e,this.A=e.logger.createLogger("[FeatureFlags]"),Ul(e.kv.initialize(),()=>{this.Nh===e&&(this.Nh=void 0,this.bo=e,this.Rd(e))})}Rd(e){var t;if(this.bo===e)return b&&V(b,"online",this.rn),this.Pd(),this.Ad=e.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){const e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&x&&!E(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.Cd=t),t!==this.xd&&(this.qd(),E(t)||(this.xd=t,this.Cd=t,this.Td(),x!=null&&x.addEventListener&&(V(x,di,this.sn),Pt(fo,i=>{V(x,i,this.Id,{capture:!0})}))))}Td(){E(this.xd)||(E(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var e;E(this.jd)||(clearInterval(this.jd),this.jd=void 0,x==null||(e=x.removeEventListener)===null||e===void 0||e.call(x,"visibilitychange",this.sn),Pt(fo,t=>{var i;x==null||(i=x.removeEventListener)===null||i===void 0||i.call(x,t,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var e,t;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),(e=this.Ad)===null||e===void 0||e.dispose(),this.Ad=void 0,(t=this.Od)===null||t===void 0||t.call(this),this.Od=void 0,this.dd=[],b?.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(e){var t;return this.Ud&&e in this.Ud?this.Ud[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var e;return!E((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Gd(e,t,i){var s;if(!(!((s=this._instance)===null||s===void 0)&&s.persistence)||!e.$enabled_feature_flags)return;const r=this.zd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,f])=>!f?.failed).map(([f])=>f):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!A(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),c=this.zd("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?u:Array.from(new Set([...Object.keys(c),...Object.keys(d)])),v=!l&&!i,g=!!v||u,m=!!v||h,_={[He]:g,[Re]:g,[tt]:m};e.$feature_flag_details&&(_[ft]=g);for(const f of[gt,nt,ti])E(e[f])||(_[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}Lt(e){this.Vd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Vd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Ld(){const e={};for(const s of[He,tt,gt,Le]){const r=this.zd(s);E(r)||(e[s]=r)}this.ud=e;const t=p({},e),i=this.zd(Re);if(i)for(const[s,r]of Object.entries(i))t[`$feature/${s}`]=r;this.hd=t}Fd(){const e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;const t=this.zd(nt);return typeof t!="number"||Date.now()-t>e}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){const e=this.Ir.evaluationContexts;return e?.length?e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Jd(){const e=this.Ir.flagKeys;if(!E(e))return e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;const i=this.Ir,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var r,n;const o=(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(s).filter(u=>!E(s[u])).reduce((u,c)=>(u[c]=s[c],u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Kd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,r;const n=i?.merge&&(s=this.zd("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i?.merge&&(r=this.zd("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=p(p({},n),e),l=p(p({},o),t),u={};for(const[c,d]of Object.entries(a))u[c]={key:c,enabled:ln(d),variant:un(d),reason:void 0,metadata:E(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.Kd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.zd(ft),t=this.zd(Le),i=this.zd(vt);if(!i&&!t)return e||{};const s=X({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const a of r){var n;const l=s[a],u=t?.[a],c=E(u)?(n=l?.enabled)!==null&&n!==void 0&&n:!!u,d=E(u)?l?.variant:typeof u=="string"?u:void 0,h=i?.[a],v=p(p({},l),{},{enabled:c,variant:c?d??l?.variant:void 0});var o;c!==l?.enabled&&(v.original_enabled=l?.enabled),d!==l?.variant&&(v.original_variant=l?.variant),h&&(v.metadata=p(p({},l?.metadata),{},{payload:h,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=v}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:ln(s),variant:un(s),payload:an(t[i])}})}getFlagVariants(){const e=this.zd(Re),t=this.zd(Le);if(!t)return e||{};const i=X({},e||{}),s=Object.keys(t);for(let r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ld=!0),i}getFlagPayloads(){const e=this.zd(tt),t=this.zd(vt);if(!t)return e||{};const i=X({},e||{}),s=Object.keys(t);for(let r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ld=!0),i}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.gd=e}resetFlagCallReported(){this.Lt(rt)}Yd(e){this.Hd();const t=this.bo;if(!t||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:p(p(p({},t.initialPersonProperties),this.zd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.zd(st),timezone:fl()};E(t.deviceId)||(i.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Ir.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this.Qd();s.length&&(i.evaluation_contexts=s);const r=this.Jd();E(r)||(i.flag_keys=r);const n=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.pd;this.fd=!0;const l=()=>{this.md&&(this.md=!1,this.Yd())},u=g=>{var m,_;const f=(m=g.json)!==null&&m!==void 0?m:{},y=g.statusCode!==200;if(this.fd=!1,a!==this.pd)return void l();if(this.tv(g.statusCode),y||this.md||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.md)return;this.yd=!y;const w=[];g.error?w.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?go:"unknown_error"):g.statusCode!==200&&w.push(`api_error_${g.statusCode}`),f.errorsWhileComputingFlags&&w.push("errors_while_computing_flags");const P=!!(!((_=f.quotaLimited)===null||_===void 0)&&_.includes("feature_flags"));P&&w.push("quota_limited"),this.$t({[hi]:w}),P?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):i.disable_flags||this.Kd(f,y,{partialResponse:n}),l()},c=g=>{this.fd=!1,a===this.pd&&(this.$t({[hi]:[go]}),this.A.error("Feature flag request failed",g),this.Wd()&&this.Nd(!0)),l()};let d=this.Ir.requestMaxRetries;const h=()=>d>0&&a===this.pd,v=()=>{if(a!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void l();try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(g=>{if((m=>Yh.includes(m.statusCode)||(_=>_.statusCode===0&&_.error instanceof Error&&_.error.name==="AbortError")(m))(g)&&h())return d--,void setTimeout(v,500);u(g)}).catch(c)}catch(g){c(g)}};v()}kd(){return ol(this._d,3)}tv(e){this._d=al(e,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+zs);if(this.Zd())return;const s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+zs);if(this.Zd())return;const i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.zd("$feature_flag_request_id")||void 0,l=this.zd("$feature_flag_evaluated_at")||void 0;let u,c=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var d;const O=(d=this.bo)===null||d===void 0?void 0:d.session.sessionId,j=this.zd(Yt);O&&O!==j&&(c={},u=O)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(o))u&&this.$t({[rt]:c,[Yt]:u});else{var h,v,g,m,_,f,y,w,P,$,k,T;A(c[e])?c[e].push(o):c[e]=[o],this.$t(p({[rt]:c},u?{[Yt]:u}:{}));const O=this.getFeatureFlagDetails(e),j=[...(h=this.zd("$feature_flag_errors"))!==null&&h!==void 0?h:[]];E(r)&&j.push("flag_missing");const q={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(v=(g=this.Ir.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&v!==void 0?v:null,$feature_flag_bootstrapped_payload:(m=(_=this.Ir.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.yd};E(O==null||(f=O.metadata)===null||f===void 0?void 0:f.has_experiment)||(q.$feature_flag_has_experiment=O.metadata.has_experiment),E(O==null||(y=O.metadata)===null||y===void 0?void 0:y.version)||(q.$feature_flag_version=O.metadata.version);const z=(w=O==null||(P=O.reason)===null||P===void 0?void 0:P.description)!==null&&w!==void 0?w:O==null||($=O.reason)===null||$===void 0?void 0:$.code;var I;z&&(q.$feature_flag_reason=z),O!=null&&(k=O.metadata)!==null&&k!==void 0&&k.id&&(q.$feature_flag_id=O.metadata.id),E(O?.original_variant)&&E(O?.original_enabled)||(q.$feature_flag_original_response=E(O.original_variant)?O.original_enabled:O.original_variant),O!=null&&(T=O.metadata)!==null&&T!==void 0&&T.original_payload&&(q.$feature_flag_original_payload=O==null||(I=O.metadata)===null||I===void 0?void 0:I.original_payload),j.length&&(q.$feature_flag_error=j.join(",")),this.ev(q)}else u&&this.$t({[rt]:c,[Yt]:u});return s?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:an(n)}:void 0}ev(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.A.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.iv(e,t)}iv(e,t){var i=this;return Q(function*(){const s=i.bo;if(!s)return;const r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=i.Qd();n.length&&(r.evaluation_contexts=n);const o=i.Jd();let a;E(o)||(r.flag_keys=o);try{var l;const u=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:i.Ir.compression,sentAt:"body",timeoutMs:i.Ir.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=u?.[e]||void 0}catch(u){i.A.error("Remote config feature flag request failed",u);return}try{t(a)}catch(u){i.A.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.yd)return t.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+zs),t.defaultValue;const i=this.getFeatureFlag(e,t);return E(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Kd(e,t,i)}Kd(e,t,i){if(!this.bo)return;this.vd=!0;const s=((r,n={},o={},a={},l,u=po)=>{const c=((w,P)=>{const $=w.flags;if($){const k=Object.fromEntries(Object.keys($).map(I=>{var O;return[I,(O=$[I].variant)!==null&&O!==void 0?O:$[I].enabled]})),T=Object.fromEntries(Object.keys($).filter(I=>$[I].enabled).filter(I=>{var O;return!E((O=$[I].metadata)===null||O===void 0?void 0:O.payload)}).map(I=>{var O;return[I,(O=$[I].metadata)===null||O===void 0?void 0:O.payload]}));return p(p({},w),{},{featureFlags:k,featureFlagPayloads:T})}return w.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(r,u),d=c.flags,h=c.featureFlags,v=c.featureFlagPayloads;if(!h)return;const g=r.requestId,m=r.evaluatedAt;if(A(h)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const w={};if(h)for(let P=0;h.length>P;P++)w[h[P]]=!0;return{[He]:h,[Re]:w,[ti]:!1}}let _=h,f=v,y=d;if(l?.partialResponse){const w=Object.keys(_),P=f||{};_=p(p({},n),_),f=p(p({},o),P),w.forEach($=>{$ in P||f==null||delete f[$]}),y=p(p({},a),y)}else if(r.errorsWhileComputingFlags)if(d){const w=new Set(Object.keys(d).filter($=>{var k;return!(!((k=d[$])===null||k===void 0)&&k.failed)}));_=p(p({},n),Object.fromEntries(Object.entries(_).filter(([$])=>w.has($))));const P=Object.fromEntries(Object.entries(f||{}).filter(([$])=>w.has($)));f=p(p({},o),P),w.forEach($=>{$ in P||f==null||delete f[$]}),y=p(p({},a),Object.fromEntries(Object.entries(y||{}).filter(([$])=>w.has($))))}else _=p(p({},n),_),f=p(p({},o),f),y=p(p({},a),y);return p(p({[He]:Object.keys(mo(_)),[Re]:_||{},[tt]:f||{},[ft]:y||{},[ti]:r.minimalFlagCalledEvents===!0},g?{[gt]:g}:{}),m?{[nt]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(s)if(i?.persist===!1){const r=!E(this.bo.kv.get(Re));this.Ud=s,r||this.$t(s)}else this.Dd(),this.Gd(s,e,!!i?.partialResponse),this.$t(s);else t&&this.Wd();t||(this.bd=!1),this.Nd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.nv(e)}nv(e){if(this.bo){if(e===!1)return this.Lt([Le,vt]),this.Nd(),void ct.info("All overrides cleared");if(A(e))return this.$t({[Le]:_o(e)}),this.Nd(),void ct.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const i=e;this.ld=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);const s={},r=i.flags,n=i.payloads;r&&(s[Le]=A(r)?_o(r):r),n&&(s[vt]=n),Object.keys(s).length&&this.$t(s),r===!1&&n===!1?this.Lt([Le,vt]):r===!1?this.Lt(Le):n===!1&&this.Lt(vt),this.Nd(),r===!1?ct.info("Flag overrides cleared"):r&&ct.info("Flag overrides set",{flags:r}),n===!1?ct.info("Payload overrides cleared"):n&&ct.info("Payload overrides set",{payloads:n});return}if(e&&typeof e=="object")return this.$t({[Le]:e}),this.Nd(),void ct.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.vd){const{flags:t,flagVariants:i}=this.sv();try{e(t,i)}catch(s){this.A.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const r=(this.zd("$early_access_features")||[]).find(u=>u.flagKey===e),n={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i);const a=p(p({},this.getFlagVariants()),{},{[e]:t});(s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(n)}),this.$t({[He]:Object.keys(mo(a)),[Re]:a,[it]:p(p({},this.zd("$stored_person_properties")||{}),n)}),this.Nd();try{var l;(l=this.bo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(u){this.A.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,i){const s=this.zd(nr);!s||t?this.rv(e,i):e(s)}rv(e,t){var i=this;return Q(function*(){const s=i.bo;if(!s)return;const r=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let n;try{const o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n=o.json.earlyAccessFeatures,i.$t({[nr]:n})}catch(o){i.A.error("Early access feature request failed",o);return}try{e(n)}catch(o){i.A.error("Early access feature callback failed",o)}})()}sv(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Nd(e){this.Ld();const{flags:t,flagVariants:i}=this.sv();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(r){this.A.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,t=!0){this.ov(e,t)}ov(e,t=!0){const i=this.zd("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,n={};if(r)for(const o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this.$t({[it]:p(p(p({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=p({},this.zd("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.$t({[it]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(it),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this.zd("$stored_group_properties")||{},s=p({},i);for(const r of Object.keys(e))s[r]=p(p({},i[r]),e[r]);this.$t({[st]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.zd("$stored_group_properties")||{};this.$t({[st]:p(p({},t),{},{[e]:{}})})}else this.Lt(st)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},od={sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.av)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.lv==="awaiting_config"||this.lv==="missing_config"?this.lv:(e=(t=this.av)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.lv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.lv=Bs,this.uv=void 0,this.hv=!1,this.Je=(()=>{var t,i;if(!x?.visibilityState||x.visibilityState==="visible")return!0;const s=b==null||(t=b.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!s?.length||s.some(r=>r.name==="visible")})(),this.sn=()=>{var t,i;x?.visibilityState==="visible"&&(this.Je=!0,(t=this.av)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw Ue.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');x!=null&&x.addEventListener&&V(x,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.hv=!0,x==null||(t=x.removeEventListener)===null||t===void 0||t.call(x,"visibilitychange",this.sn),e?this.dv(!0):this.stopRecording()}get vv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Ir.disable_session_recording,s=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return b&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.hv||this.vv&&(!((t=this.av)===null||t===void 0)&&t.isStarted))return;const i=!E(Object.assign)&&!E(Array.from);this.vv&&i?(this.fv(e),Ue.info("starting")):(this.lv=Bs,this.stopRecording())}fv(e){var t,i;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=ao),(C==null||(t=C.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=C.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this.pv(e);else{var s,r;const n=this._instance.sessionManager;(s=C.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this._instance,this.gv,o=>{if(!this.hv&&this.vv&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Ue.error("could not load recorder",o)):void this.pv(e);this.lv="disabled"})}}stopRecording(){var e,t;(e=this.uv)===null||e===void 0||e.call(this),this.uv=void 0,(t=this.av)===null||t===void 0||t.stop()}dv(e=!1){var t,i;(t=this.uv)===null||t===void 0||t.call(this),this.uv=void 0,(i=this.av)===null||i===void 0||i.discard({discardProducerEvents:e})}mv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}yv(e,t){if(M(e))return null;const i=ne(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(Ue.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}bv(e){if(this.Il){var t,i;const s=this.Il,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.yv((n=this.Ir.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.yv(o?.sampleRate,"remote config sampleRate"),u=a??l;M(u)&&this.mv();const c=o?.minimumDurationMilliseconds;s.register({[ei]:p(p({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:p({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:E(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(t=this.uv)===null||t===void 0||t.call(this),this.uv=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(r)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;t&&"sessionRecording"in t?t.sessionRecording===!1?(this.bv(t),this.dv()):(this.bv(t),this.startIfEnabledOrStop()):(this.lv==="awaiting_config"&&(this.lv="missing_config",this._instance.register_for_session({[Rr]:!0}),Ue.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.av)===null||i===void 0)&&i.log?this.av.log(e,t):Ue.warn("log called before recorder was ready")}get gv(){var e,t;const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(ei);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}_v(){const e=this._instance.get_property(ei);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return Ue.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!M(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}pv(e){var t,i,s;if(!this.hv&&this.vv&&this._instance.sessionManager){if(!(!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Ue.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Cr]:!0});var r;if(this.av||(this.av=(r=C.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v()){if(this.lv==="missing_config"||this.lv==="awaiting_config")return;this.lv="awaiting_config",Ue.info("persisted remote config is stale, requesting fresh config before starting"),new _l(this._instance).load();return}this.lv=ao,(i=(s=this.av).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Je),this.av.start(e)}else this.lv=Bs}onRRwebEmit(e){var t,i;(t=this.av)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.av)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.av||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.av)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.av||(i=this.Il)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.av)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const s of Nh){var i;const r=(i=this._instance.sessionPersistence)===null||i===void 0?void 0:i.get_property(s);E(r)||(t[s]=r)}return p(p({},t),((e=this.av)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(!((i=this.av)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.av)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},ad={autocapture:class extends Fh{constructor(e){super(new Ah(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.wv=!1,this._instance=e,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Cv();return!!(e.path||e.search||this.$v(e))}startIfEnabled(){this.isEnabled&&(S.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,S.info("History API monitoring stopped")}monitorHistoryChanges(){b&&b.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(e){var t;if(!b||!((t=b.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const i=this;_i(b.history,e,s=>function(r,n,o){var a;i.Rv(o)&&i.Av(),s.call(this,r,n,o),i.Fv(e,!i.wv&&(b==null||(a=b.event)===null||a===void 0?void 0:a.type)!=="popstate")})}xv(){const e=b?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Cv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:N(e)?e:{}}$v(e=this.Cv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Ov(e){const t=this.Cv(),i=this.Sv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.$v(t)&&e.hash!==i.hash))}Fv(e,t=!1){try{t||this.Av();const i=this.xv();if(!i)return;if(this.Ov(i)){const s=()=>this._instance.capture(Ar,{navigation_type:e});t?(this.Dv=s,Promise.resolve().then(()=>this.Av())):s()}this.Sv=i}catch(i){S.error(`Error capturing ${e} pageview`,i)}}Rv(e){var t,i;return!(M(e)||!b)&&((t=Ge(String(e)))===null||t===void 0?void 0:t.href)!==((i=b.location)===null||i===void 0?void 0:i.href)}Av(){const e=this.Dv;if(e){this.Dv=void 0,this.wv=!0;try{e()}catch(t){S.error("Error capturing deferred pageview",t)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const e=()=>{this.Fv("popstate")};V(b,"popstate",e),this.Tv=()=>{b&&b.removeEventListener("popstate",e)}}Pv(){if(this.Iv)return;const e=()=>{this.Fv("hashchange")};V(b,"hashchange",e),this.Iv=()=>{b&&b.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=e,this.Lv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[tr]),this.rageclicks=new Bl(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return N(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return M(this.Ir.capture_heatmaps)?M(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;jh.info("starting..."),this.qv(),this.sn()}else{var e;clearInterval((e=this.Nv)!==null&&e!==void 0?e:void 0),this.jv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tr]:i}),this.Lv=i,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Bv(e){Us(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv=x?.visibilityState==="visible"?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){b&&x&&(this.Hv=this.yl.bind(this),V(b,Ji,this.Hv),this.zv=e=>this.Mr(e||b?.event),V(x,"click",this.zv,{capture:!0}),this.Uv=e=>this.Wv(e||b?.event),V(x,"mousemove",this.Uv,{capture:!0}),this.Vv=new An(this.instance,Nc,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),V(x,di,this.Gv),this.ko=!0)}jv(){var e;b&&x&&(this.Hv&&b.removeEventListener(Ji,this.Hv),this.zv&&x.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&x.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&x.removeEventListener(di,this.Gv),clearTimeout(this.Zv),(e=this.Vv)===null||e===void 0||e.stop(),this.ko=!1)}Qv(e,t){const i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){let u=o;for(;u&&je(u)&&!pe(u,"body");){if(u===l)return!1;let v;try{var c,d,h;v=(c=(d=(h=u.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&d!==void 0?d:b)===null||c===void 0?void 0:c.getComputedStyle(u).position}catch{return!1}if(F(a,v))return!0;u=Za(u)}return!1})(si(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mr(e,t="click"){var i;if(kn(e.target)||!Us(e))return;const s=this.Qv(e,t);(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&tl(si(e),this.instance.config.rageclick)&&this.Zs(p(p({},s),{},{type:"rageclick"})),this.Zs(s)}Wv(e){!kn(e.target)&&Us(e)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(e,"mousemove"))},500))}Zs(e){if(!b)return;const t=this.Ir.disable_capture_url_hashes?ot(b.location.href):b.location.href,i=this.Ir.custom_personal_data_properties,s=this.Ir.mask_personal_data_properties?[...Lt,...i||[]]:[],r=fi(t,s,gi);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}yl(){this.Rt&&!xe(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:An,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",p({$current_url:this.Rt.url},this.Rt.metrics.reduce((i,s)=>p(p({},i),{},{[`$web_vitals_${s.name}_event`]:p({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Xv=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},M(i?.name)||M(i?.value))return void ut.error("Invalid metric received",i);const r=typeof i.navigationURL=="string"?i.navigationURL:void 0,n=this.Yv(r);if(E(n))return;const o=ne(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${n}`;if(this.tf&&i.value>=this.tf)return void ut.error("Ignoring metric with value >= "+this.tf,i);this.Rt.navigationKey!==o&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),E(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=E(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=p(p(p({},i),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,N(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){const u={};for(const c of Dh){const d=c==="url"&&typeof i.attribution[c]=="string"?this.Yv(i.attribution[c]):i.attribution[c];E(d)||(u[c]=d)}l.attribution=u}else delete l.attribution;E(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let i,s,r,n,o=!1;const a=C.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,u=l?.[this.if]||(this.if==="web-vitals"&&E(l)?a?.postHogWebVitalsCallbacks:void 0);if(!E(u)){const h=u.withoutAttribution,v=this.attributionMetrics;o=!E(h),i=v.indexOf("LCP")>-1?u.onLCP:h?.onLCP||u.onLCP,s=v.indexOf("CLS")>-1?u.onCLS:h?.onCLS||u.onCLS,r=v.indexOf("FCP")>-1?u.onFCP:h?.onFCP||u.onFCP,n=v.indexOf("INP")>-1?u.onINP:h?.onINP||u.onINP}if(!(i&&s&&r&&n))return void ut.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},d=o&&this.attributionMetrics.indexOf("INP")>-1?p(p({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&i(this.Xv.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Xv.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Xv.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&n(this.Xv.bind(this),d),this.ko=!0},this.Lv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[rr]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=N(this.nf)?(e=this.nf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return M(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||oo:i}get flushToCaptureTimeoutMs(){return(N(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=N(this.nf)?this.nf.web_vitals_attribution:void 0;return be(e)?e?oo:[]:A(e)?e:Lh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=N(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get tf(){const e=N(this.nf)&&ne(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:no;return e>0&&6e4>=e?no:e}get isEnabled(){const e=te?.protocol;if(e!=="http:"&&e!=="https:")return ut.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=N(this.nf)?this.nf.web_vitals:be(this.nf)?this.nf:void 0;return be(t)?t:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(ut.info("enabled, starting..."),this.Ho(this.ef))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=N(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=N(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[rr]:i}),this._instance.persistence.register({[Ia]:s})),this.Lv=i,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(e){var t;const i=C.__PosthogExtensions__,s=this.if,r=i?.postHogWebVitalsCallbacksByFlavor;r?.[s]||s==="web-vitals"&&E(r)&&i?.postHogWebVitalsCallbacks?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,n=>{n?ut.error("failed to load script",n):e()})}Yv(e){const t=e||b?.location.href;if(!t)return void ut.error("Could not determine current URL");const i=this._instance.config.disable_capture_url_hashes?ot(t):t,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Lt,...s||[]]:[];return fi(i,r,gi)}}},ld={exceptionObserver:class{constructor(e){var t;this.ef=()=>{var i;if(!b||!this.isEnabled||!(!((i=C.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;const s=C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sf&&this.Ir.capture_unhandled_errors&&(this.sf=s(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=r(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=n(this.captureException.bind(this)))}catch(o){Gt.error("failed to start",o),this.lf()}},this._instance=e,this.uf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[ir]),this.wt=new ru(p(p({},(function(i={}){var s,r,n,o;return{refillRate:(s=(r=i.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(n=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Gt})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return N(e)?t=p(p({},t),e):(E(e)?this.uf:e)&&(t=p(p({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Gt.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(e){var t,i,s;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",r=>{if(r)return Gt.error("failed to load script",r);e()})}lf(){var e,t,i;(e=this.sf)===null||e===void 0||e.call(this),this.sf=void 0,(t=this.rf)===null||t===void 0||t.call(this),this.rf=void 0,(i=this.af)===null||i===void 0||i.call(this),this.af=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.uf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ir]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}captureException(e){try{var t,i,s;const r=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(r))return void Gt.info("Skipping exception capture because of client rate limiting.",{exception:r});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this.cf=[],this.df=new gu([new Cu,new Bu,new Fu,new Ru,new Nu,new Du,new Mu,new ju],(function(s,...r){return(n,o=0)=>{const a=[],l=n.split(`
3
3
  `),u=Math.min(l.length,o+1e3),c=[];for(let v=o;u>v;v++){const g=l[v];if(g.length>1024)continue;const m=on.test(g)?g.replace(on,"$1"):g;if(!m.match(/\S*Error: /)){for(const _ of r){const f=_(m,s);if(f){a.push(f);const y=Iu(a);if(y){for(let w=c.length-1;w>=0;w--){const P=c[w];if(y.start>=P.start+P.length)break;c.pop()}c.push(y)}break}}if(Ou(a,c)>=50)break}}const d=[...c].sort((v,g)=>g.start-v.start),h=d[d.length-1];if(h){const v=ua(a,h);a.splice(h.start-v,v);for(const g of d)g.start-=v}for(const v of d)Pu(a,v);return c.some(v=>v.start===0&&a.length===v.length)&&(function(v){const g=v.map(_=>`${_.function}|${_.filename}|${_.lineno}|${_.colno}|${_.module}`);let m=0;for(let _=1;g.length>_;_++)Tu(g,_,m)&&(m=_);v.push(...v.splice(0,m))})(a),(function(v){if(!v.length)return[];const g=Array.from(v);return g.reverse(),g.slice(0,50).map(m=>{return p(p({},m),{},{filename:m.filename||(_=g,_[_.length-1]||{}).filename,function:m.function||"?"});var _})})(a)}})("web:javascript",xu,$u)),this._instance=e,this.cf=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.vf=zi(this.ff()),this.pf=new qu(this.vf)}onConfigChange(){this.vf=zi(this.ff()),this.pf.setConfig(this.vf)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const r=e.config;if(!("errorTracking"in r))return;const n=(t=(i=r.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=r.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this.cf=n,this._instance.persistence&&this._instance.persistence.register({[Sa]:this.cf,[sr]:o})}get gf(){var e;const t=!!this._instance.get_property(sr),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.df.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.vf.enabled)try{if(!L(e)||e.trim().length===0)return void Te.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=(function(r){if(!r)return{sanitizedProperties:{},droppedKeys:[]};const n=[];return{sanitizedProperties:Object.keys(r).reduce((o,a)=>Uu.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}})(this.mf(t));s.length>0&&Te.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.pf.add(p({[Ui]:e,[qi]:new Date().toISOString()},i))}catch(i){Te.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.yf(t)){if(this.bf(t))return this._f("Exception dropped: matched a suppression rule"),void Te.info("Skipping exception capture because a suppression rule matched");if(!this.gf&&this.wf(t))return this._f("Exception dropped: thrown by a browser extension"),void Te.info("Skipping exception capture because it was thrown by an extension");if(!this.gf&&this.kf(t))return this._f("Exception dropped: thrown by an injected browser script"),void Te.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Sf(t))return this._f("Exception dropped: thrown by the PostHog SDK"),void Te.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.vf.enabled&&M(e.$exception_steps)?this.xf(e):e,s=(function(){const r=globalThis._posthogReleaseId;return typeof r=="string"&&r.length>0?r:void 0})();s&&(i.$release_id=s);try{const r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return r&&this.pf.clear(),r}catch(r){yo(r)||Te.error("Failed to capture exception event. Dropping this exception.",r),this.pf.clear();return}}catch(t){yo(t)||Te.error("Failed to process exception event. Ignoring this exception.",t);return}}xf(e){try{const t=this.pf.getAttachable();return t.length===0?e:p(p({},e),{},{$exception_steps:t})}catch(t){return Te.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_f(e){this.vf.enabled&&this.pf.add({[Ui]:e,[qi]:new Date().toISOString()})}mf(e){return N(e)?p({},e):{}}ff(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}bf(e){if(e.length===0)return!1;try{const t=e.reduce((i,{type:s,value:r})=>(L(s)&&s.length>0&&i.$exception_types.push(s),L(r)&&r.length>0&&i.$exception_values.push(r),i),{$exception_types:[],$exception_values:[]});return this.cf.some(i=>{const s=i.values.map(r=>{const n=Ll[r.operator],o=t[r.key];if(!n||!o)return!1;const a=A(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return Te.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}wf(e){const t=e.flatMap(s=>{var r,n;return(r=(n=s.stacktrace)===null||n===void 0?void 0:n.frames)!==null&&r!==void 0?r:[]}),i=t.filter(({filename:s})=>!!s&&Xh.some(r=>s.startsWith(r)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(yr))||e.some(({type:s,value:r})=>s==="NoResponse"||L(r)&&Kh.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:s,filename:r})=>s&&!r?.startsWith(yr)))}kf(e){return e.some(({value:t})=>L(t)&&Qh.some(i=>t.includes(i)))}Sf(e){if(e.length>0){var t,i,s,r;const n=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=n[n.length-1];return(s=o==null||(r=o.filename)===null||r===void 0?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}yf(e){return!M(e)&&A(e)}}},ud=p({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Cf=null,this.$f=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this.Il&&this.Il.register({[Or]:!!t.productTours}),!qs(this._instance))return!this.Cf&&M((i=this.Il)===null||i===void 0?void 0:i.props.ph_product_tours)||Pi.info("product tours disabled; stopping and clearing cached tours"),(s=this.Cf)===null||s===void 0||s.stop(),this.Cf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Cf&&qs(this._instance)&&this.Ho(()=>this.Tf())}Ho(e){var t,i,s;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",r=>{r?Pi.error("Could not load product tours script",r):e()})}Tf(){var e;!this.Cf&&(e=C.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.Cf=C.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(A(this.$f)&&!t)return void e(this.$f,{isLoaded:!0});const i=this.Il;if(i){const s=i.props[or];if(A(s)&&!t)return this.$f=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:s=>{if(!qs(this._instance))return void e([],{isLoaded:!0});const r=s.statusCode;if(r!==200||!s.json){const o=`Product Tours API could not be loaded, status: ${r}`;r===0?s.error||Pi.warn(o):Pi.error(o),e([],{isLoaded:!1,error:o});return}const n=A(s.json.product_tours)?s.json.product_tours:[];this.$f=n,i&&i.register({[or]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){M(this.Cf)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Cf.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Cf)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Cf?this.Cf.previewTour(e):this.Ho(()=>{var t;this.Tf(),(t=this.Cf)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Cf)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Cf)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Cf)===null||e===void 0||e.previousStep()}clearCache(){var e;this.$f=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Cf)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Cf)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Cf)===null||t===void 0||t.cancelPendingTour(e)}}},os),cd={siteApps:class{constructor(e){this._instance=e,this.If=0,this.Mf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ef(e,t){if(!t)return;const i=this.globalsForEvent(t);this.Mf.push(i),this.Mf.length>1e3&&(this.Mf=this.Mf.slice(10))}get siteAppLoaders(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.Ef.bind(this));this.Pf=()=>{e(),this.Mf=[],this.Pf=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[v,g]of Object.entries(c))l[v]={id:u[v],type:v,properties:g};const{$set_once:d,$set:h}=e;return{event:p(p({},va(e,Bh)),{},{properties:p(p(p({},e.properties),h?{$set:p(p({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),h)}:{}),d?{$set_once:p(p({},(s=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&s!==void 0?s:{}),d)}:{}),elements_chain:(n=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Rf(e){var t;const i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Me.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Me.error("prepare_external_dependency_script returned null"),null):e}Af(){var e,t,i,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=x?.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.If++,this.Ff)return this.Of();const c=[],d=this,h=new WeakSet,v=(_,f,y)=>{if(!_?.[f])return;const w=_[f];_[f]=y(w),c.push(()=>{_[f]=w})},g=_=>{if(h.has(_))return _;const f=d.Rf(_);return f&&h.add(f),f},m=_=>_.map(f=>typeof f=="string"?f:g(f)).filter(f=>!ie(f));return v(u,"appendChild",_=>function(f){const y=g(f);return y?_.call(this,y):f}),v(u,"insertBefore",_=>function(f,y){const w=g(f);return w?_.call(this,w,y):f}),v(u,"replaceChild",_=>function(f,y){const w=g(f);return w?_.call(this,w,y):y}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(_=>{v(_,"append",f=>function(...y){return f.apply(this,m(y))}),v(_,"prepend",f=>function(...y){return f.apply(this,m(y))})}),[(r=l.Element)===null||r===void 0?void 0:r.prototype,(n=l.CharacterData)===null||n===void 0?void 0:n.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(_=>{v(_,"before",f=>function(...y){return f.apply(this,m(y))}),v(_,"after",f=>function(...y){return f.apply(this,m(y))}),v(_,"replaceWith",f=>function(...y){const w=m(y);return y.length&&!w.length?void 0:f.apply(this,w)})}),v((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",_=>function(f,y){const w=g(y);return w?_.call(this,f,w):null}),this.Ff=()=>{c.forEach(_=>_()),this.Ff=void 0},this.Of()}Of(){let e=!1;return()=>{var t;e||(e=!0,this.If--,this.If===0&&((t=this.Ff)===null||t===void 0||t.call(this)))}}Df(e,t=!0){const i=this.Af();try{const s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var n;!t.errored&&this.Mf.length&&(Me.info(`Processing ${this.Mf.length} events for site app with id ${e.id}`),this.Mf.forEach(o=>this.Df(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((n=this.Pf)===null||n===void 0||n.call(this))};let s=!1;const r=n=>{t.errored=!n,t.loaded=!0,Me.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:n}=this.Df(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),s=!0}catch(n){Me.error(lo+e.id,n),r(!1)}if(s&&t.loaded)try{i()}catch(n){Me.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}Lf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Nf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this.Df(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){Me.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Lf(),void this._instance.on("eventCaptured",a=>this.Nf(a))):void Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Pf)===null||i===void 0||i.call(this),!e.ok)return;const r=e.config;if(!((s=r.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(const{id:a,url:l}of r.siteApps){var n,o;C[`__$$ph_site_app_${a}`]=this._instance,(n=C.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,u=>{if(u)return Me.error(lo+a,u)})}else Me.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},hd={tracingHeaders:class{constructor(e){this._instance=e,this.qf=void 0,this.jf=void 0,this.Bf=void 0,this.ef=()=>{const t=this.Hf();var i,s;t?(E(this.qf)&&(this.qf=(i=C.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),E(this.jf)&&(this.jf=(s=C.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.lf()}}initialize(){this.startIfEnabledOrStop()}Ho(e){var t,i,s;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=C.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",r=>{if(r)return Mh.error("failed to load script",r);e()})}zf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Hf(){const e=this.zf();return A(e)?(A(this.Bf)?this.Bf.splice(0,this.Bf.length,...e):this.Bf=[...e],e.length>0?this.Bf:void 0):(A(this.Bf)&&this.Bf.splice(0),this.Bf=e||void 0,this.Bf)}lf(){var e,t;(e=this.qf)===null||e===void 0||e.call(this),(t=this.jf)===null||t===void 0||t.call(this),this.qf=void 0,this.jf=void 0}startIfEnabledOrStop(){this.Hf()?this.Ho(this.ef):this.lf()}}},dd=p({surveys:class extends Uh{constructor(e){var t;super(new Wh(e),(t=e,{get projectToken(){return t.config.token},kv:new Vh(t)})),this._instance=e}Vh(e,t){const i=t.query?yi(e,t.query):e;return new Promise(s=>{var r;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},os),vd={toolbar:class{constructor(e){this.instance=e}Uf(e){C.ph_toolbar_state=e}Wf(){var e;return(e=C.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,r;if(lr(this.instance.config)||!b||!x)return!1;e=(s=e)!==null&&s!==void 0?s:b.location,i=(r=i)!==null&&r!==void 0?r:b.history;try{if(!t){try{b.localStorage.setItem("test","test"),b.localStorage.removeItem("test")}catch{return!1}t=b?.localStorage}const n=Gh||Ki(e.hash,"__posthog")||Ki(e.hash,"state");let o;const a=n?tn(()=>JSON.parse(atob(decodeURIComponent(n))))||tn(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(co)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Vf(e){const t=C.ph_load_toolbar||C.ph_load_editor;!M(t)&&ce(t)?t(e,this.instance):ho.warn("No toolbar load function found")}loadToolbar(e){const t=!!x?.getElementById("__POSTHOG_TOOLBAR__");if(!b||t)return!1;const i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=p(p({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(b.localStorage.setItem(co,JSON.stringify(p(p({},s),{},{source:void 0}))),this.Wf()===2)this.Vf(s);else if(this.Wf()===0){var r,n;this.Uf(1),(r=C.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return ho.error("[Toolbar] Failed to load",o),void this.Uf(0);this.Uf(2),this.Vf(s)}),V(b,"turbolinks:load",()=>{this.Uf(0),this.loadToolbar(s)})}return!0}Gf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},pd=p({experiments:class _e{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{_e.Zf("retrieved web experiments from the server"),this.Qf=new Map,s.forEach(r=>{if(r.feature_flag_key){var n;this.Qf&&(_e.Zf("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.Qf)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);L(o)&&r.variants[o]&&this.Jf(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];_e.Kf(a,this._instance)&&this.Jf(r.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())_e.Zf(bo);else if(!this.Ir.disable_web_experiments){if(M(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_e.Zf("applying feature flags",t),t.forEach(i=>{var s;if(this.Qf&&(!((s=this.Qf)===null||s===void 0)&&s.has(i))){var r;const n=this._instance.getFeatureFlag(i),o=(r=this.Qf)===null||r===void 0?void 0:r.get(i);n&&o!=null&&o.variants[n]&&this.Jf(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=_e.getWindowLocation();if(t?.search){const i=Mt(t?.search,"__experiment_id"),s=Mt(t?.search,"__experiment_variant");i&&s&&(_e.Zf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(r=>{this.Xf(parseInt(i),s,r)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Ir.disable_web_experiments&&!s)return t([]);const r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ir.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Xf(t,i,s){const r=s.filter(n=>n.id===t);r&&r.length>0&&(_e.Zf(`Previewing web experiment [${r[0].name}] with variant [${i}]`),this.Jf(r[0].name,i,r[0].variants[i].transforms))}static Kf(t,i){return!M(t.conditions)&&_e.Yf(t,i)&&_e.tp(t)}static Yf(t,i){var s;if(M(t.conditions)||M((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;const r=_e.getWindowLocation();if(r){var n,o,a;const l=Ka(i,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||Zh[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return b?.location}static tp(t){var i;if(M(t.conditions)||M((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;const s=ll();if(s.utm_source){var r,n,o,a,l,u,c,d;const h=!(!((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0)&&r.utm_campaign)||((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_campaign)==s.utm_campaign,v=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,g=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==s.utm_medium,m=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_term)||((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0?void 0:d.utm_term)==s.utm_term;return h&&g&&m&&v}return!1}static Zf(t,...i){S.info(`[WebExperiments] ${t}`,i)}Jf(t,i,s){this._is_bot()?_e.Zf(bo):i!=="control"?s.forEach(r=>{if(r.selector){var n;_e.Zf(`applying transform of variant ${i} for experiment ${t} `,r),((n=document)===null||n===void 0?void 0:n.querySelectorAll(r.selector))?.forEach(o=>{const a=o;r.html&&(a.innerHTML=r.html),r.css&&a.setAttribute("style",r.css)})}}):_e.Zf("Control variants leave the page unmodified.")}_is_bot(){return he&&this._instance?Fl(he,this.Ir.custom_blocked_useragents):void 0}}},os),fd={conversations:class{constructor(e){this._instance=e,this.ep=void 0,this._conversationsManager=null,this.np=!1,this.ne=null,this.sp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.rp=e.ok,!e.ok))return;const t=e.config.conversations;M(t)||(be(t)?this.ep=t:(this.ep=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.ep=void 0,this.ne=null,this.rp=void 0,this.sp=!1}loadIfEnabled(){if(this._conversationsManager||this.np||this._instance.config.disable_conversations||lr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=C?.__PosthogExtensions__;if(e&&!E(this.ep)&&this.ep)if(this.ne&&this.ne.token){this.np=!0;try{const t=e.initConversations;if(t)return this.op(t),void(this.np=!1);const i=e.loadExternalDependency;if(!i)return void this.ap(Fr);i(this._instance,"conversations",s=>{s||!e.initConversations?this.ap("Could not load conversations script",s):this.op(e.initConversations),this.np=!1})}catch(t){this.ap("Error initializing conversations",t),this.np=!1}}else Oe.error("Conversations enabled but missing token in remote config.")}op(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.sp=!1,Oe.info("Conversations loaded successfully")}catch(t){this.ap("Error completing conversations initialization",t)}else Oe.error("Cannot complete initialization: remote config is null")}ap(e,t){Oe.error(e,t),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():Oe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ep===!0&&!ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":lr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.rp===!1?"remote_config_failed":E(this.ep)?this.rp?"disabled_in_project":"remote_config_pending":this.ep?M(this.ne)||!this.ne.token?"missing_token":C?.__PosthogExtensions__?this.np?"initializing":this.sp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Q(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Oe.warn(ht),null)})()}getMessages(e,t){var i=this;return Q(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Oe.warn(ht),null)})()}markAsRead(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Oe.warn(ht),null)})()}getTickets(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Oe.warn(ht),null)})()}requestRestoreLink(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Oe.warn(ht),null)})()}restoreFromToken(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Oe.warn(ht),null)})()}restoreFromUrlToken(){var e=this;return Q(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Oe.warn(ht),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},gd={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=re("[logs]"),this.cp=p(p({},this.A),{},{error:(...i)=>{i.some(xo)||this.A.error(...i)}}),this.ol=[],this.dp=[],this._d=0,this.To=!1,this.vp=[],this.fp=[],this.pp=!1,this.gp=!1,this.mp=()=>{var i,s;this.To||(this._d=0,(i=this.yp)===null||i===void 0||i.onReconnect(),(s=this.bp)===null||s===void 0||s.onReconnect())},this._instance&&(t=this._instance.config.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.lp=!0),b&&V(b,"online",this.mp)}_p(e,t,i,s){var r;const n=wo((r=this._instance)===null||r===void 0||(r=r.config)===null||r===void 0?void 0:r.logs,i);return[new Qu(this.wp(e,t),n,this.cp,()=>this.kp(),o=>o(),void 0,s),n]}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.yp&&this.xp===t||((i=this.yp)===null||i===void 0||i.reset(),this.xp=t,[this.yp,this.Cp]=this._p(()=>this.ol,s=>{this.ol=s})),this.yp}$p(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.bp&&this.Tp===t||((i=this.bp)===null||i===void 0||i.reset(),this.Tp=t,[this.bp,this.Ip]=this._p(()=>this.dp,s=>{this.dp=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Eo)),this.bp}setup(e){var t;if(this.To)return;this.bo=e,(t=this._instance)!==null&&t!==void 0&&(t=t.config)!==null&&t!==void 0&&(t=t.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.lp=!0),(this.lp||this.Mp()&&this.Ep())&&this.Pp();let i=!1;const s=e.onRemoteConfig(r=>{var n;i=r.ok&&((n=r.config.logs)===null||n===void 0?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.To?s.dispose():(this.Eo=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.To||(this.To=!0,this.Rp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.hp=!1,b?.removeEventListener("online",this.mp),(t=this.Ap)===null||t===void 0||t.call(this),this.Ap=void 0,(i=this.yp)===null||i===void 0||i.reset(),(s=this.bp)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this.To)return;const s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;M(s)?this.Fp():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.lp=!0,this.up||this.Pp(),this.loadIfEnabled()):this.Fp())}reset(){var e,t,i,s;this.Rp(),(e=this.yp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.yp)===null||t===void 0||t.reset(),(i=this.bp)===null||i===void 0||i.clearQueue(),this.dp=[],(s=this.bp)===null||s===void 0||s.reset(),this._d=0}captureLog(e){this.To||this.Sp().captureLog(e)}captureConsoleLog(e){this.To||this.$p().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.To||this.$p().captureLog(e,{context:t,occurredAtMs:i})}Ep(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[$a])}Mp(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((i=C._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.config)}$h(){var e;this.Rp(),(e=this.bp)===null||e===void 0||e.clearQueue(),this.dp=[]}Fp(){this.lp||this.Rp()}Pp(){var e;if(this.pp||!C?.console)return;const t=wo((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let i=!0;this.fp.push(()=>{i=!1});for(const s of ed){let r;try{r=td(C.console[s])}catch{continue}r&&this.fp.push(_i(C.console,s,n=>{const o=(...a)=>{try{i&&this.Op(s,a,t)}catch{}return n.apply(C.console,a)};return o.__rrweb_original__=r,o}))}this.pp=!0,this.Dp=setTimeout(()=>{this.Rp()},3e4)}Op(e,t,i){var s;if(this.pp&&!this.gp&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this.vp.length){this.gp=!0;try{this.vp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.kp()})}finally{this.gp=!1}}}else this.Rp()}Rp(){if(this.vp=[],this.pp){this.pp=!1,this.Dp&&(clearTimeout(this.Dp),this.Dp=void 0);for(const e of this.fp)e();this.fp=[]}}Lp(){const e=this.vp;return this.Rp(),e}get logger(){return this.Np||(this.Np={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Np}flushLogs(e){e?this.qp(e):(this.yp&&this.yp.flush().catch(t=>this.jp(t)),this.bp&&this.bp.flush().catch(t=>this.jp(t)))}jp(e){xo(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;const e=C?.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Rp();const t=e.loadExternalDependency;if(!t)return this.A.error(Fr),void this.Rp();this.hp=!0;try{t(this._instance,"logs",i=>{if(this.hp=!1,this.To||!this.lp)return;const s=e.logs;if(i||!s?.initializeLogs)this.A.error("Could not load logs script",i),this.Rp();else{var r;const a=this.Lp();var n,o;this.Ap=s.initializeLogs((r=this.bo)!==null&&r!==void 0?r:this._instance),this.up=!0,a.length>0&&((n=s.replayConsoleBuffer)===null||n===void 0||n.call(s,(o=this.bo)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this.hp=!1,i}}wp(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===De.LogsQueue?e():void 0,setPersistedProperty(s,r){var n;s===De.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},js:s=>this.js(s),getLibraryId:()=>ae.LIB_NAME,getLibraryVersion:()=>ae.LIB_VERSION}}js(e){return new Promise(t=>{if(ol(this._d,3))return void t({kind:"fatal",error:Hs(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=n=>{i||(i=!0,clearTimeout(r),t(n))},r=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Hs(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Bp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{const o=n.statusCode;if(this.Hp(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(n.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Hs(n.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Hp(e){(e!==0||this._instance.__loaded)&&(this._d=al(e,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}qp(e){this.ol.length>0&&this.zp(e,this.ol,this.Cp,ae.LIB_NAME,t=>{this.ol=t}),this.dp.length>0&&this.zp(e,this.dp,this.Ip,Eo,t=>{this.dp=t})}zp(e,t,i,s,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=ya(n,ma(i,ae.LIB_NAME,ae.LIB_VERSION),s,ae.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Bp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}kp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:r,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,M(r)||(t.sessionStartTimestamp=r),M(n)||(t.lastActivityTimestamp=n)}if(C!=null&&(e=C.location)!==null&&e!==void 0&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ot(C.location.href):C.location.href),this._instance.featureFlags){const i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},_d={metrics:class{constructor(e){this._instance=e,this.A=re("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Up?this.Up=(i=>{let s=!0;const r=()=>s?(a=>{var l;const u=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return u===!0?{}:u||void 0})(i):void 0,n=rd(i,r),o=nd(i,r);return()=>{s=!1,n(),o()}})(this._instance):!t&&this.Up&&(this.Up(),this.Up=void 0)}Sp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.yp&&this.xp===t||((i=this.yp)===null||i===void 0||i.reset(),this.xp=t,this.yp=new Zu(this.wp(),(function(s){var r,n,o,a,l;const u=s?.resourceAttributes;return{serviceName:(r=u?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(o=u?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:u,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.A)),this.yp}count(e,t=1,i){this.Sp().count(e,t,i)}gauge(e,t,i){this.Sp().gauge(e,t,i)}histogram(e,t,i){this.Sp().histogram(e,t,i)}flush(e){if(!this.yp)return Promise.resolve();if(e){const t=this.yp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.yp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.yp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Up)===null||e===void 0||e.call(this),this.Up=void 0,(t=this.yp)===null||t===void 0||t.reset()}wp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:i=>t.Ys(i),getLibraryId:()=>ae.LIB_NAME,getLibraryVersion:()=>ae.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1;const r=o=>{s||(s=!0,clearTimeout(n),i(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(p(p({method:"POST",url:this.Wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}Wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};li.__defaultExtensionClasses=p({},p(p(p(p(p(p(p(p(p(p(p(p(p({},os),od),ad),ld),ud),cd),dd),hd),vd),pd),fd),gd),_d));var md=(function(){ae.SDK_DIST_CHANNEL="npm";const e=oi[Kt]=new li;return(function(){function t(){t.done||(t.done=!0,Cl=!1,G(oi,function(i){i._dom_loaded()}))}x?.addEventListener?x.readyState==="complete"?t():V(x,"DOMContentLoaded",t,{capture:!1}):b&&S.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),Id=md;export{Os as _,Ps as a,$e as c,Ed as d,jn as f,yd as g,wd as h,$d as i,bd as l,xd as m,li as n,kd as o,Id as p,Yc as r,Ht as s,vr as t,md as u,Sd as v,Se as y};
4
4
 
5
- //# sourceMappingURL=module-Wq_OenZL.js.map
5
+ //# sourceMappingURL=module-BHBrpZ4U.js.map