tokentracker-cli 0.94.0 → 0.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +9 -7
- package/README.ja.md +8 -6
- package/README.ko.md +8 -6
- package/README.md +23 -10
- package/README.zh-CN.md +8 -6
- package/dashboard/dist/assets/{AchievementBadge-DPqwk2zI.js → AchievementBadge-Pi3Gvbm8.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CELHoMQt.js → AchievementsPage-C4WLT8Rl.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-DdAC0VCb.js → AchievementsSection-ilvR2ssr.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-Dd4I1SpM.js → BadgeDetailModal-CjEeToxa.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-DL2-4mnm.js → BotAnimated-DDf9pBuK.js} +1 -1
- package/dashboard/dist/assets/{Card-B_MpSRse.js → Card-DNous84-.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BLZZ4rG6.js → ClawdAnimated-BLMIRntb.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-B-vfdIbH.js → CommandPalette-vVekhoFO.js} +1 -1
- package/dashboard/dist/assets/CommunityStatsModal-C0Kp_J8B.js +1 -0
- package/dashboard/dist/assets/{ConfirmModal-DLnRwUXC.js → ConfirmModal-DFdpcx12.js} +1 -1
- package/dashboard/dist/assets/{Controls-FZ8wEN5w.js → Controls-RNhqybmE.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-BQjQh1IQ.js +1 -0
- package/dashboard/dist/assets/{DevicePage-D2IzPc5o.js → DevicePage-DIhh-YAk.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-BaqQaUUk.js → DialogClose-ZqxYVIzl.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DDM4aanX.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DrbKjtuS.js → DialogTitle-BiRcejlu.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-GddKDE8i.js → FadeIn-BDBQpeGe.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DUu-Z5mE.js → HeaderGithubStar-CztIwtKT.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-BmDkY35A.js → HoverTooltip-Cfso7LTC.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CGJyqWk2.js → IpCheckPage-CNE7dLs3.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-Bd91ALUj.js → LandingPage-B2a3cweM.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-BGGUwXFd.js → LeaderboardAvatar-CwmZnIji.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BMEqHwif.js → LeaderboardPage-DkTHj3fB.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-BSweJqm2.js → LeaderboardProfileModal-CefTO3Zh.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-CRrI3RFz.js → LeaderboardProfilePage-CnOXlQ3L.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-XIRDv46K.js → LimitsPage-BIZ1-6BB.js} +2 -2
- package/dashboard/dist/assets/{LocalOnlyNotice-CCD-lGWG.js → LocalOnlyNotice-CdHQiPhy.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-lDuqSv4f.js → LoginCard-yXLA9geu.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DStt5VXN.js → LoginModal-BF2Pfkqa.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-dmVPSL72.js → LoginPage-DuOypZap.js} +1 -1
- package/dashboard/dist/assets/{PetPage-ybcZRctF.js → PetPage-BH3xDVV9.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-Dar_UjxF.js → PopoverPopup-CewF_cGz.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-Ct9tILpz.js → ProviderIcon-Dg0K0RPn.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-B4yLh5zx.js → ResetPasswordPage-CYwt85O3.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-BOE1CEzq.js → SegmentedControl-BJkXXomQ.js} +1 -1
- package/dashboard/dist/assets/{Select-D-bSh7Zz.js → Select-B3_WH0Qe.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-DMYjXXq4.js → SelectItemText-BUby_DUu.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-CaleS-6_.js → ServiceStatusPage-BDlVZk4i.js} +1 -1
- package/dashboard/dist/assets/SessionsPage-TaC9nahK.js +2 -0
- package/dashboard/dist/assets/{SettingsPage-iJH0Yyah.js → SettingsPage-CudcQh6m.js} +2 -2
- package/dashboard/dist/assets/SkillsPage-iDLQ8lpZ.js +1 -0
- package/dashboard/dist/assets/{TokenGalaxy-CuXKoMPg.js → TokenGalaxy-DtYzUsXU.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-Dx5GB7F5.js → ToolbarRootContext-PC8Tg1Jz.js} +1 -1
- package/dashboard/dist/assets/TrendMonitor-r8n8YO_9.js +19 -0
- package/dashboard/dist/assets/{WidgetsPage-DUaIyGtu.js → WidgetsPage-vzfGccWb.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-BzqlcAUC.js → WrappedPage-DaKuIkYE.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-BHz2N7Ih.css → __vite-browser-external-CCMdjCX2.css} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-Dnxl50k1.js +45 -0
- package/dashboard/dist/assets/{agent-logos-BdWWxza6.js → agent-logos-B7nzn3n2.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CANSzmm-.js → arrow-up-right-CsxyvCER.js} +1 -1
- package/dashboard/dist/assets/{check-BnJpzXRZ.js → check-hYcC7MdH.js} +1 -1
- package/dashboard/dist/assets/{composite-Ccj6KQmh.js → composite-C79LNbex.js} +1 -1
- package/dashboard/dist/assets/{copy-C2Yc8Evu.js → copy-Cz4qzE62.js} +1 -1
- package/dashboard/dist/assets/{download-B52JTk6Y.js → download-CUaSNE2E.js} +1 -1
- package/dashboard/dist/assets/{external-link-DayTwZx-.js → external-link-vq7kIyKK.js} +1 -1
- package/dashboard/dist/assets/{flame-B8GEX2yT.js → flame-CB6K4eR6.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-mhkbohkb.js → format-tokens-KI-e_JQ-.js} +1 -1
- package/dashboard/dist/assets/{icons-o8bPXqRP.js → icons-3maItkrp.js} +1 -1
- package/dashboard/dist/assets/{index-MBVWUKpA.js → index-BRXoZ7Jj.js} +1 -1
- package/dashboard/dist/assets/{index-CK_CduLm.js → index-C5WrfmLB.js} +1 -1
- package/dashboard/dist/assets/{index-Bp0ZHDtz.js → index-CUbC50Zp.js} +1 -1
- package/dashboard/dist/assets/{info-D94QM_vX.js → info-r0yGihUe.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-BLzMyCiy.js → limits-providers-BN_94oe9.js} +1 -1
- package/dashboard/dist/assets/{link-2-CqBmFaDI.js → link-2-J9t0VXWM.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-SaxUpDR6.js → loader-circle-DCvOsPze.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-BoXqARks.js → maximize-2-CZ9JhGjf.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-Conh_-BD.js → modifiers.esm-DJ0_WKg0.js} +1 -1
- package/dashboard/dist/assets/module-xpSFyNBK.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-D6qLR9qd.js → monitor-smartphone-nqbWjJx_.js} +1 -1
- package/dashboard/dist/assets/{plus-D51mjIc2.js → plus-Cg7wd2jK.js} +1 -1
- package/dashboard/dist/assets/{provider-display-DpHPjd_s.js → provider-display-B9L1nRY9.js} +2 -2
- package/dashboard/dist/assets/{react-D_AcI466.js → react-D2AD6Pk2.js} +1 -1
- package/dashboard/dist/assets/{search-CwLcNdvZ.js → search-uNiWba1h.js} +1 -1
- package/dashboard/dist/assets/{skills-api-Dqi7Mjgo.js → skills-api-BBYuAhiL.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-BPDlUxPb.js → sortable.esm-CzPxc949.js} +1 -1
- package/dashboard/dist/assets/{store-ikeRIRGd.js → store-D4A7EUwE.js} +1 -1
- package/dashboard/dist/assets/{terminal-BfeX3L5T.js → terminal-Crmm_yKF.js} +1 -1
- package/dashboard/dist/assets/{trash-2-5_Qlp1k7.js → trash-2-ia9VjRnU.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-D90Fy2_j.js → use-community-stats-KaGCAxaF.js} +1 -1
- package/dashboard/dist/assets/use-latest-request-guard-Dy8gSDkk.js +1 -0
- package/dashboard/dist/assets/{use-limits-display-prefs-D4BYFaa-.js → use-limits-display-prefs-JSTYlbTD.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-DJxLNdXY.js → use-ordered-list-C4JnHdE0.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-AQE0ummK.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-CAX_GqXc.js → use-session-efficiency-pref-CgyUz5Gc.js} +1 -1
- package/dashboard/dist/assets/{use-transform-CeW6Z5R0.js → use-transform-C7-jSJ9k.js} +1 -1
- package/dashboard/dist/assets/use-usage-limits-B3YYqn-v.js +1 -0
- package/dashboard/dist/assets/{useCurrency-BarGeFyK.js → useCurrency-CK_gcb3J.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-DUJ9iT9H.js → useTokenFormat-C_a-UkCA.js} +1 -1
- package/dashboard/dist/assets/{zap--m0IWoI3.js → zap-BIJNn-Ic.js} +1 -1
- package/dashboard/dist/brand-logos/lmstudio.svg +12 -0
- package/dashboard/dist/brand-logos/unsloth.svg +1 -0
- package/dashboard/dist/index.html +16 -12
- package/dashboard/dist/ip-check.html +2 -2
- package/dashboard/dist/leaderboard.html +2 -2
- package/dashboard/dist/llms.txt +4 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +2 -2
- package/src/commands/device-login.js +5 -10
- package/src/commands/init.js +28 -1
- package/src/commands/serve.js +6 -0
- package/src/commands/status.js +24 -0
- package/src/commands/sync.js +114 -18
- package/src/lib/cloud-account.js +102 -29
- package/src/lib/fs.js +30 -0
- package/src/lib/grok-context-breakdown.js +24 -33
- package/src/lib/grok-usage.js +95 -0
- package/src/lib/local-api.js +101 -13
- package/src/lib/pricing/index.js +15 -0
- package/src/lib/pricing/matcher.js +15 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +1094 -72
- package/src/lib/session-analytics.js +100 -40
- package/src/lib/usage-limits.js +507 -55
- package/src/lib/zcode-limits.js +65 -8
- package/dashboard/dist/assets/CommunityStatsModal-aAico565.js +0 -1
- package/dashboard/dist/assets/DashboardPage-BByRBsbt.js +0 -1
- package/dashboard/dist/assets/DialogDescription-BUrh0Jod.js +0 -1
- package/dashboard/dist/assets/SessionsPage-DOaY6_E9.js +0 -2
- package/dashboard/dist/assets/SkillsPage-BkzJOBLk.js +0 -1
- package/dashboard/dist/assets/TrendMonitor-BuKmsznP.js +0 -19
- package/dashboard/dist/assets/__vite-browser-external-CVIGknXl.js +0 -45
- package/dashboard/dist/assets/chevron-right-DJm0mbG0.js +0 -1
- package/dashboard/dist/assets/module-D2D5r9gC.js +0 -3
- package/dashboard/dist/assets/use-reduced-motion-yE3T3cat.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-5HP8k9a3.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var g=typeof window<"u"?window:void 0,ye=typeof globalThis<"u"?globalThis:g,xe=ye?.navigator,x=ye?.document,se=ye?.location,Lr=ye?.fetch,Ji=ye!=null&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,Qr=ye?.AbortController,cl=ye?.CompressionStream,Ee=xe?.userAgent;function ma(){return!(!g||g.navigator.onLine===!1)}var Jt=typeof globalThis<"u"?globalThis:g;Jt&&typeof self>"u"&&(Jt.self=Jt),Jt&&typeof File>"u"&&(Jt.File=function(){});var O=g??{},Z={DEBUG:!1,LIB_VERSION:"0.7.0",LIB_NAME:"browser-common"};function en(s,e,t,i,r,n,a){try{var o=s[n](a),l=o.value}catch(h){return void t(h)}o.done?e(l):Promise.resolve(l).then(i,r)}function Y(s){return function(){var e=this,t=arguments;return new Promise((function(i,r){var n=s.apply(e,t);function a(l){en(n,i,r,a,o,"next",l)}function o(l){en(n,i,r,a,o,"throw",l)}a(void 0)}))}}function b(){return b=Object.assign?Object.assign.bind():function(s){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},b.apply(null,arguments)}function ya(s,e){if(s==null)return{};var t={};for(var i in s)if({}.hasOwnProperty.call(s,i)){if(e.indexOf(i)!==-1)continue;t[i]=s[i]}return t}var tn=s=>{if(typeof s!="string")return s;try{return JSON.parse(s)}catch{return s}};function sn(s){return typeof s=="string"||s}function rn(s){return typeof s=="string"?s:void 0}var dl=["$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"],Ue=(function(s){return s.AnonymousId="anonymous_id",s.DistinctId="distinct_id",s.Props="props",s.EnablePersonProcessing="enable_person_processing",s.PersonMode="person_mode",s.FeatureFlagDetails="feature_flag_details",s.FeatureFlags="feature_flags",s.FeatureFlagPayloads="feature_flag_payloads",s.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",s.BootstrapFeatureFlags="bootstrap_feature_flags",s.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",s.OverrideFeatureFlags="override_feature_flags",s.Queue="queue",s.AiQueue="ai_queue",s.AiCaptureQueue="ai_capture_queue",s.LogsQueue="logs_queue",s.OptedOut="opted_out",s.SessionId="session_id",s.SessionStartTimestamp="session_start_timestamp",s.SessionLastTimestamp="session_timestamp",s.PersonProperties="person_properties",s.GroupProperties="group_properties",s.InstalledAppBuild="installed_app_build",s.InstalledAppVersion="installed_app_version",s.SessionReplay="session_replay",s.PushRegistered="push_registered",s.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",s.SurveyLastSeenDate="survey_last_seen_date",s.SurveysSeen="surveys_seen",s.Surveys="surveys",s.RemoteConfig="remote_config",s.FlagsEndpointWasHit="flags_endpoint_was_hit",s.DeviceId="device_id",s})({}),Ki=(function(s){return s.GZipJS="gzip-js",s.Base64="base64",s})({}),vl=["$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"],pl=["token"],fl=20,ba=1e3,gl=1e4,_l="[Circular]",Zi="[Truncated]",di="[Unserializable]",ml="[Function]";function Lt(s){for(var e="",t=0;s.length>t;t++){var i=s.charCodeAt(t);if(55296>i||i>56319)e+=56320>i||i>57343?s[t]:"�";else{var r=s.charCodeAt(t+1);56320>r||r>57343?e+="�":(e+=s[t]+s[t+1],t++)}}return e}var yl=["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"],nn=function(s,e){if(e===void 0&&(e=[]),!s)return!1;var t=s.toLowerCase();return yl.concat(e).some((i=>{var r=i.toLowerCase();return t.indexOf(r)!==-1}))};function A(s,e){return s.indexOf(e)!==-1}var vi=function(s){return s.trim()},Yi=function(s){return s.replace(/^\$/,"")};function wa(s){var e,t=[];return(e=JSON.stringify(s,(function(i,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(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(r))return"[Circular]";t.push(r)}return r}})))!==null&&e!==void 0?e:"null"}var xa=Object.prototype,ka=xa.hasOwnProperty,pi=xa.toString,M=Array.isArray||function(s){return pi.call(s)==="[object Array]"},me=s=>typeof s=="function",G=s=>s===Object(s)&&!M(s),Ne=s=>{if(G(s)){for(var e in s)if(ka.call(s,e))return!1;return!0}return!1},w=s=>s===void 0,H=s=>pi.call(s)=="[object String]",Hs=s=>H(s)&&s.trim().length===0,fe=s=>s===null,D=s=>w(s)||fe(s),oe=s=>pi.call(s)=="[object Number]"&&s==s,Ke=s=>oe(s)&&s>0,we=s=>pi.call(s)==="[object Boolean]",bl=s=>s instanceof FormData,wl=s=>A(vl,s),xl=s=>A(pl,s);function Ea(s){return s===null||typeof s!="object"}function Bs(s,e){return{}.toString.call(s)==="[object "+e+"]"}function Sa(s){switch({}.toString.call(s)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Pa(s,Error)}}function Rr(s){return typeof Event<"u"&&Pa(s,Event)}function Pa(s,e){try{return s instanceof e}catch{return!1}}var kl=[!0,"true",1,"1","yes"],_i=s=>A(kl,s),El=[!1,"false",0,"0","no"];function We(s,e,t,i,r){return e>t&&(i.warn("min cannot be greater than max."),e=t),oe(s)?s>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>s?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):s:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),We(r||t,e,t,i))}class Sl{constructor(e){this.k={},this.S=e.S,this.C=We(e.bucketSize,0,100,e.I),this.R=We(e.refillRate,0,this.C,e.I),this.A=We(e.refillInterval,0,864e5,e.I)}O(e,t){var i=Math.floor((t-e.lastAccess)/this.A);i>0&&(e.tokens=Math.min(e.tokens+i*this.R,this.C),e.lastAccess=e.lastAccess+i*this.A)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),n=this.k[r];return n?this.O(n,i):this.k[r]=n={tokens:this.C,lastAccess:i},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.S)==null||t.call(this,e)),n.tokens===0)}stop(){this.k={}}}var $e="Mobile",Us="iOS",et="Android",Nt="Tablet",Ia=et+" "+Nt,Fa="iPad",Ca="Apple",$a=Ca+" Watch",os="Safari",jt="BlackBerry",Oa="Samsung",Ta=Oa+"Browser",La=Oa+" Internet",mt="Chrome",Pl=mt+" OS",Ra=mt+" "+Us,Mr="Internet Explorer",Ma=Mr+" "+$e,Ar="Opera",Il=Ar+" Mini",Dr="Edge",Aa="Microsoft "+Dr,Rt="Firefox",Da=Rt+" "+Us,ds="Nintendo",vs="PlayStation",Mt="Xbox",Na=et+" "+$e,ja=$e+" "+os,is="Windows",Xi=is+" Phone",an="Nokia",Qi="Ouya",qa="Generic",Fl=qa+" "+$e.toLowerCase(),Ha=qa+" "+Nt.toLowerCase(),er="Konqueror",Ba="Oculus Browser",Vs="Vivaldi",Ua="Yandex",zs="Whale",tr="DuckDuckGo",Va="Pale Moon",Ws="Waterfox",ls="Brave",za="Google Search App",ne="(\\d+(\\.\\d+)?)",mi=new RegExp("Version/"+ne),Cl=new RegExp(Mt,"i"),$l=new RegExp(vs+" \\w+","i"),Ol=new RegExp(ds+" \\w+","i"),Nr=new RegExp(jt+"|PlayBook|BB10","i"),Tl={"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"},Wa=function(s,e,t,i){e=e||"";var r=(function(n){return n!=null&&n.brave?ls:null})(t);return r||(i!=null&&i.detectGoogleSearchApp&&A(s,"GSA/")?za:A(s," OPR/")&&A(s,"Mini")?Il:A(s," OPR/")?Ar:Nr.test(s)?jt:A(s,"IE"+$e)||A(s,"WPDesktop")?Ma:A(s,"OculusBrowser")?Ba:A(s,Ta)?La:A(s,Dr)||A(s,"Edg/")?Aa:A(s,Vs+"/")?Vs:A(s,"YaBrowser/")?Ua:A(s,zs+"/")?zs:A(s,tr+"/")||A(s,"Ddg/")?tr:A(s,"FBIOS")?"Facebook "+$e:A(s,"UCWEB")||A(s,"UCBrowser")?"UC Browser":A(s,"CriOS")?Ra:A(s,"CrMo")||A(s,mt)?mt:A(s,et)&&A(s,os)?Na:A(s,"FxiOS")?Da:A(s.toLowerCase(),er.toLowerCase())?er:A(s,ls+"/")?ls:((n,a)=>a&&A(a,Ca)||(function(o){return A(o,os)&&!A(o,mt)&&!A(o,et)})(n))(s,e)?A(s,$e)?ja:os:A(s,"PaleMoon/")?Va:A(s,Ws+"/")?Ws:A(s,Rt)?Rt:A(s,"MSIE")||A(s,"Trident/")?Mr:A(s,"Gecko")?Rt:"")},Ll={[Ma]:[new RegExp("rv:"+ne)],[Aa]:[new RegExp(Dr+"?\\/"+ne)],[mt]:[new RegExp("("+mt+"|CrMo)\\/"+ne)],[Ra]:[new RegExp("CriOS\\/"+ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ne)],[os]:[mi],[ja]:[mi],[Ar]:[new RegExp("(Opera|OPR)\\/"+ne)],[Rt]:[new RegExp(Rt+"\\/"+ne)],[Da]:[new RegExp("FxiOS\\/"+ne)],[er]:[new RegExp("Konqueror[:/]?"+ne,"i")],[jt]:[new RegExp(jt+" "+ne),mi],[Na]:[new RegExp("android\\s"+ne,"i")],[La]:[new RegExp(Ta+"\\/"+ne)],[Ba]:[new RegExp("OculusBrowser\\/"+ne)],[Vs]:[new RegExp(Vs+"\\/"+ne)],[Ua]:[new RegExp("YaBrowser\\/"+ne)],[zs]:[new RegExp(zs+"\\/"+ne)],[ls]:[new RegExp(ls+"\\/"+ne)],[tr]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ne)],[Va]:[new RegExp("PaleMoon\\/"+ne)],[Ws]:[new RegExp(Ws+"\\/"+ne)],[za]:[new RegExp("GSA\\/"+ne)],[Mr]:[new RegExp("(rv:|MSIE )"+ne)],Mozilla:[new RegExp("rv:"+ne)]},Rl=function(s,e,t,i){var r=Wa(s,e,t,i),n=Ll[r];if(w(n))return null;for(var a=0;n.length>a;a++){var o=s.match(n[a]);if(o)return parseFloat(o[o.length-2])}return null},on=[[new RegExp(Mt+"; "+Mt+" (.*?)[);]","i"),s=>[Mt,s&&s[1]||""]],[new RegExp(ds,"i"),[ds,""]],[new RegExp(vs,"i"),[vs,""]],[Nr,[jt,""]],[new RegExp(is,"i"),(s,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Xi,""];if(new RegExp($e).test(e)&&!/IEMobile\b/.test(e))return[is+" "+$e,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=Tl[t[1]]||"";return/arm/i.test(e)&&(i="RT"),[is,i]}return[is,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,s=>s&&s[3]?[Us,[s[3],s[4],s[5]||"0"].join(".")]:[Us,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,s=>{var e="";return s&&s.length>=3&&(e=w(s[2])?s[3]:s[2]),["watchOS",e]}],[new RegExp("("+et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+et+")","i"),s=>s&&s[2]?[et,[s[2],s[3],s[4]||"0"].join(".")]:[et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,s=>{var e=["Mac OS X",""];return s&&s[1]&&(e[1]=[s[1],s[2],s[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Pl,""]],[/Linux|debian/i,["Linux",""]]],ln=function(s){return Ol.test(s)?ds:$l.test(s)?vs:Cl.test(s)?Mt:new RegExp(Qi,"i").test(s)?Qi:new RegExp("("+Xi+"|WPDesktop)","i").test(s)?Xi:/iPad/.test(s)?Fa:/iPod/.test(s)?"iPod Touch":/iPhone/.test(s)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(s)?$a:Nr.test(s)?jt:/(kobo)\s(ereader|touch)/i.test(s)?"Kobo":new RegExp(an,"i").test(s)?an:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(s)||/(kf[a-z]+)( bui|\)).+silk\//i.test(s)?"Kindle Fire":/(Android|ZTE)/i.test(s)?new RegExp($e).test(s)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(s)||/pixel[\daxl ]{1,6}/i.test(s)&&!/pixel c/i.test(s)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(s)||/lmy47v/i.test(s)&&!/QTAQZ3/i.test(s)?et:Ia:new RegExp("(pda|"+$e+")","i").test(s)?Fl:new RegExp(Nt,"i").test(s)&&!new RegExp(Nt+" pc","i").test(s)?Ha:""},Ml=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function un(s,e){return typeof(t=s)=="string"&&Ml.test(t)?s:e();var t}function Ga(s,e){var t=new Error(e);try{Object.defineProperty(t,"name",{value:s,writable:!0,enumerable:!0,configurable:!0})}catch{}return t}function rt(s){return s&&s.split("#")[0]}function jr(s,e){var t=setTimeout(s,e);return t?.unref&&t?.unref(),t}function hn(s,e,t){return Ja.apply(this,arguments)}function Ja(){return(Ja=Y((function*(s,e,t){var i;try{return yield Promise.race([s,new Promise(((r,n)=>{i=jr((()=>{try{t?.(),r()}catch(a){n(a)}}),e)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var Kt,Ka="NativeGzipValidationError",sr=s=>s.length>=2&&s[0]===31&&s[1]===139,cn=(s,e)=>s===Ki.GZipJS||e===Ki.GZipJS||e==="gzip",dn=s=>!(!s||typeof s!="object")&&("name"in s?String(s.name):"")==="NotReadableError",ks=s=>{throw Ga(Ka,"Native gzip produced invalid output: "+s)},Al=(function(){var s=Y((function*(e,t){18>e.size&&ks("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());sr(i)&&i[2]===8||ks("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(Kt)return Kt;Kt=[];for(var u=0;256>u;u++){for(var c=u,d=0;8>d;d++)c=1&c?3988292384^c>>>1:c>>>1;Kt[u]=c>>>0}return Kt})(),l=4294967295,h=0;a.length>h;h++)l=o[255&(l^a[h])]^l>>>8;return(4294967295^l)>>>0})(t)&&ks("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&ks("invalid-size")}));return function(e,t){return s.apply(this,arguments)}})();function ir(){return ir=Y((function*(s,e,t){e===void 0&&(e=!0);try{var i=new TextEncoder().encode(s),r=new globalThis.CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(i).then((()=>n.close())).catch((function(){var h=Y((function*(u){try{yield n.abort(u)}catch{}throw u}));return function(u){return h.apply(this,arguments)}})()),o=new Response(r.readable).blob(),l=(yield Promise.all([o,a]))[0];return yield Al(l,i),l}catch(h){if(t!=null&&t.rethrow)throw h;return e&&console.error("Failed to gzip compress data",h),null}})),ir.apply(this,arguments)}var Za={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}},Dl=Za.info,vn=9223372036854776e3,Nl={}.propertyIsEnumerable;function Gs(s,e){try{return Ya(s,e,{ancestors:new WeakSet,remainingNodes:gl},0)}catch{return[]}}function qr(s,e,t,i){if(0>=t.remainingNodes)return{stringValue:Zi};if(t.remainingNodes--,we(s))return{boolValue:s};if(typeof s=="number"){if(!Number.isFinite(s))return{stringValue:String(s)};if(Number.isInteger(s)){if(Number.isSafeInteger(s))return{intValue:String(s)};if(typeof BigInt>"u")return{stringValue:String(s)};var r=BigInt(s).toString();return s>=vn||-vn>s?(e?.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}return{doubleValue:s}}if(typeof s=="string")return{stringValue:Lt(s)};if(typeof s=="function")return{stringValue:ml};if(typeof s=="symbol")return{stringValue:String(s)};if(typeof s=="object"&&s!==null){if(t.ancestors.has(s))return{stringValue:_l};if(i>=fl)return{stringValue:Zi};if(s instanceof Date){var n=s.getTime(),a=Number.isFinite(n)?s.toISOString():String(s);return{stringValue:typeof a=="string"?Lt(a):String(a)}}t.ancestors.add(s);try{try{var o=s.toJSON;if(typeof o=="function")return qr(o.call(s),e,t,i+1)}catch{}return M(s)?{arrayValue:{values:jl(s,e,t,i+1)}}:{kvlistValue:{values:Ya(s,e,t,i+1)}}}finally{t.ancestors.delete(s)}}return{stringValue:Lt(String(s))}}function jl(s,e,t,i){for(var r=[],n=Math.min(s.length,ba),a=0;n>a&&t.remainingNodes>0;a++)try{var o=a in s?s[a]:void 0;if(D(o))continue;r.push(qr(o,e,t,i))}catch{r.push({stringValue:di})}return s.length>a&&r.push({stringValue:Zi}),r}function Ya(s,e,t,i){var r=[];for(var n in s)if(Nl.call(s,n)){if(r.length>=ba||0>=t.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var a=s[n];if(fe(a)||w(a))continue;r.push({key:Lt(n),value:qr(a,e,t,i)})}catch{r.push({key:Lt(n),value:{stringValue:di}})}}return r}function ql(s){try{return Lt(String(s))}catch{return di}}function Hl(s,e,t,i){var r,n=Za[s.level||"info"]||Dl,a=n.text,o=n.number,l=((r=oe(i)?i:void 0)===void 0&&(r=Date.now()),String(r)+"000000"),h={};e.distinctId&&(h.posthogDistinctId=e.distinctId),e.sessionId&&(h.sessionId=e.sessionId),e.windowId&&(h["window.id"]=e.windowId),D(e.sessionStartTimestamp)||(h.sessionStartTimestamp=String(e.sessionStartTimestamp)),D(e.lastActivityTimestamp)||(h.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(h["url.full"]=e.currentUrl),e.screenName&&(h["screen.name"]=e.screenName),e.appState&&(h["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(h.feature_flags=e.activeFeatureFlags);var u=b({},h),c=s.attributes;if(c){var d=[];try{d=Object.keys(c)}catch{d=[]}for(var p of d){var v=void 0;try{v=c[p]}catch{v=di}Object.defineProperty(u,p,{value:v,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:a,body:{stringValue:ql(s.body)},attributes:Gs(u,t)};return s.trace_id&&(f.traceId=s.trace_id),s.span_id&&(f.spanId=s.span_id),w(s.trace_flags)||(f.flags=s.trace_flags),f}function Xa(s,e,t){return b({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":t})}function Qa(s,e,t,i){return{resourceLogs:[{resource:{attributes:Gs(e)},scopeLogs:[{scope:{name:t,version:i},logRecords:s}]}]}}let Bl=class{constructor(s,e,t,i,r,n,a){var o;n===void 0&&(n=()=>Promise.resolve()),this._instance=s,this.vn=e,this.I=t,this.Pn=i,this.An=r,this.Fn=n,this.On=a,this.Ln=null,this.Dn=0,this.$n=0,this.Nn=0,this.qn=0,this.jn=0,this.Bn=!1,this.Hn=e.maxBufferSize,this.zn=Math.max((o=e.maxQueueSize)!==null&&o!==void 0?o:e.maxBufferSize,e.maxBufferSize),this.Un=e.flushIntervalMs,this.Wn=e.maxBatchRecordsPerPost,this.Vn=e.rateCapWindowMs,this.Gn=e.maxLogsPerInterval}clearQueue(){this.$n++,this._instance.setPersistedProperty(Ue.LogsQueue,[])}reset(){this.Zn(),this.qn=0,this.jn=0,this.Bn=!1,this.Nn=0,this.Wn=this.vn.maxBatchRecordsPerPost}onReconnect(){this.Nn=0,this.Qn()}captureLog(s,e){var t;if(!this._instance.isDisabled&&!this._instance.optedOut&&s!=null&&s.body){var i=this.Jn(s);if(i!==null)if(i.body){if(this.Kn()){var r={record:Hl(i,(t=e?.context)!==null&&t!==void 0?t:this.Pn(),this.I,e?.occurredAtMs)};this.An((()=>this.Yn(r)))}}else this.I.info("Log was rejected in beforeSend function")}}Jn(s){var e=this.vn.beforeSend;if(!e)return s;var t=M(e)?e:[e],i=s;for(var r of t)try{var n=r(i);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;i=n}catch(a){return this.I.error("Error in beforeSend function for log:",a),null}return i}Kn(){if(this.Gn===void 0)return!0;var s=Date.now(),e=s-this.qn;return this.Vn>e&&e>=0||(this.qn=s,this.jn=0,this.Bn=!1),this.Gn>this.jn?(this.jn++,!0):(this.Bn||(this.I.warn("captureLog dropping logs: exceeded "+this.Gn+" logs per "+this.Vn+"ms"),this.Bn=!0),!1)}flush(){var s=this;return Y((function*(){if(!s._instance.isDisabled)return s.Ln||(s.Ln=s.Xn().finally((()=>{s.Ln=null}))),s.Ln}))()}Xn(){var s=this;return Y((function*(){var e;s.Zn();var t=(e=s._instance.getPersistedProperty(Ue.LogsQueue))!==null&&e!==void 0?e:[];if(t.length!==0)for(var i=t.length,r=0;t.length>0&&i>r;){var n,a,o=s.$n;s.Dn=0;var l=Math.min(t.length,s.Wn),h=t.slice(0,l),u=Qa(h.map((d=>d.record)),s.ts(),(n=s.On)!==null&&n!==void 0?n:s._instance.getLibraryId(),s._instance.getLibraryVersion()),c=yield s._instance.es(u);if(s.$n!==o)return;if(c.kind==="too-large"&&h.length>1)s.Wn=Math.max(1,Math.floor(h.length/2)),s.I.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+s.Wn);else if(c.kind==="retry-later"||(c.kind==="too-large"?s.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&s.vn.maxBatchRecordsPerPost>s.Wn&&(s.Wn=Math.min(s.vn.maxBatchRecordsPerPost,s.Wn+1)),yield s.rs(h.length),t=(a=s._instance.getPersistedProperty(Ue.LogsQueue))!==null&&a!==void 0?a:[],r+=h.length,c.kind==="fatal"))throw c.error}}))()}rs(s){var e=this;return Y((function*(){var t,i=Math.max(0,s-e.Dn),r=(t=e._instance.getPersistedProperty(Ue.LogsQueue))!==null&&t!==void 0?t:[];e._instance.setPersistedProperty(Ue.LogsQueue,r.slice(i)),yield e.Fn()}))()}ts(){return Xa(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Yn(s){var e;if(!this._instance.optedOut){var t=(e=this._instance.getPersistedProperty(Ue.LogsQueue))!==null&&e!==void 0?e:[];this.zn>t.length||(t.shift(),this.Dn++,this.I.info("Logs queue is full, dropping oldest record.")),t.push(s),this._instance.setPersistedProperty(Ue.LogsQueue,t),this.Hn>t.length?this.ns():this.Qn()}}ns(s){s===void 0&&(s=this.Un),this.ss||(this.ss=jr((()=>{this.ss=void 0,this.Qn()}),s))}os(){var s=Math.min(Math.max(0,this.Nn-1),6);return this.Un*Math.pow(2,s)}ls(){var s=this._instance.getPersistedProperty(Ue.LogsQueue);return!!s&&s.length>0}shutdown(s){var e=this;return Y((function*(){e.Zn();var t=e.flush().catch((()=>{}));s!==void 0?yield hn(t,s):yield t}))()}flushWithTimeout(s){var e=this;return Y((function*(){var t=e.flush();yield hn(t,s,(()=>{t.catch((()=>{}))}))}))()}Qn(){this.flush().then((()=>{this.Nn=0}),(s=>{this.Nn++,this.I.error("PostHog logs flush failed:",s)})).finally((()=>{!this._instance.isDisabled&&this.ls()&&this.ns(this.os())}))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}};var yi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pn(s){return String(s)+"000000"}function fn(s,e,t,i){var r="";return i&&(r=Object.keys(i).sort().map((n=>JSON.stringify(n)+":"+JSON.stringify(i[n]))).join(",")),s+"\0"+e+"\0"+(t??"")+"\0"+r}let Ul=class{constructor(s,e,t){this._instance=s,this.vn=e,this.I=t,this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set,this.cs=0}count(s,e,t){e===void 0&&(e=1),this.fs({name:s,type:"count",value:e,unit:t?.unit,attributes:t?.attributes})}gauge(s,e,t){this.fs({name:s,type:"gauge",value:e,unit:t?.unit,attributes:t?.attributes})}histogram(s,e,t){this.fs({name:s,type:"histogram",value:e,unit:t?.unit,attributes:t?.attributes})}flush(){var s=this,e=this.Ln,t=(function(){var r=Y((function*(){e&&(yield e.catch((()=>{}))),yield s.ps()}));return function(){return r.apply(this,arguments)}})(),i=t().finally((()=>{this.Ln===i&&(this.Ln=null)}));return this.Ln=i,i}drainWindow(){if(this.us.size===0)return null;var s=this.us;return this.us=new Map,this.hs=!1,this.ds=new Map,this.vs=new Set,this.gs(s)}reset(){this.cs++,this.Zn(),this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set}fs(s){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Jn(s);if(e!==null)if(e.name&&typeof e.name=="string")if(typeof e.value=="number"&&Number.isFinite(e.value))if(e.type==="count"&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var t,i;try{t=e.attributes?b({},e.attributes):void 0,i=fn(e.type,e.name,e.unit,t)}catch(a){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",a)}var r=this.us.get(i);if(!r){if(!this.ys())return;r={name:e.name,type:e.type,unit:e.unit,attributes:t,windowStartMs:Date.now()},this.us.set(i,r)}var n=this.ds.get(e.name);n===void 0?this.ds.set(e.name,e.type):n===e.type||this.vs.has(e.name)||(this.vs.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.bs(r,e.value),this.ns()}else this.I.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}ys(){return this.vn.maxSeriesPerFlush>this.us.size||(this.hs||(this.hs=!0,this.I.warn("Metric series cap reached ("+this.vn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}bs(s,e){var t;switch(s.type){case"count":s.total=((t=s.total)!==null&&t!==void 0?t:0)+e;break;case"gauge":s.last=e;break;case"histogram":s.hist||(s.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(yi.length+1).fill(0)});var i=s.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[(function(r,n){for(var a=0;n.length>a;a++)if(n[a]>=r)return a;return n.length})(e,yi)]+=1}}Jn(s){var e=this.vn.beforeSend;if(!e)return s;var t=M(e)?e:[e],i=s;for(var r of t)try{var n=r(i);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;i=n}catch(a){return this.I.error("Error in beforeSend function for metric:",a),null}return i}ns(){this.ss||(this.ss=jr((()=>{this.ss=void 0,this.flush().catch((s=>{this.I.error("Metrics flush failed:",s)}))}),this.vn.flushIntervalMs))}Zn(){this.ss&&(clearTimeout(this.ss),this.ss=void 0)}ps(){var s=this;return Y((function*(){if(s.us.size!==0){var e=s.us;s.us=new Map,s.hs=!1,s.ds=new Map,s.vs=new Set;var t=s.cs,i=yield s._instance._s(s.gs(e));if(t===s.cs)switch(i.kind){case"ok":return;case"retry-later":return s.ws(e),void s.ns();case"too-large":return void s.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void s.I.error("Failed to send metrics batch:",i.error)}}}))()}gs(s){return e=this.ks(s),t=(function(n,a,o){return b({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o})})(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Gs(t)},scopeMetrics:[{scope:{name:i,version:r},metrics:e}]}]};var e,t,i,r}ks(s){var e=pn(Date.now()),t=new Map;for(var i of s.values()){var r,n=fn(i.type,i.name,i.unit,void 0),a=t.get(n);a||(a=b({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},t.set(n,a));var o=Gs((r=i.attributes)!==null&&r!==void 0?r:{},this.I),l=pn(i.windowStartMs);if(i.type==="count"){var h,u={attributes:o,startTimeUnixNano:l,timeUnixNano:e,asDouble:(h=i.total)!==null&&h!==void 0?h:0};a.sum.dataPoints.push(u)}else if(i.type==="gauge"){var c,d={attributes:o,timeUnixNano:e,asDouble:(c=i.last)!==null&&c!==void 0?c:0};a.gauge.dataPoints.push(d)}else i.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:e,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:yi})}return Array.from(t.values())}ws(s){var e,t;for(var i of s){var r=i[0],n=i[1],a=this.us.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=((e=a.total)!==null&&e!==void 0?e:0)+((t=n.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.ys()&&this.us.set(r,n)}}};var Es,gn,bi;function Vl(s){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return bi&&t.length===gn||(gn=t.length,bi=t.reduce(((i,r)=>{Es||(Es={});var n=Es[r];if(n)i[n[0]]=n[1];else for(var a=s(r),o=a.length-1;o>=0;o--){var l=a[o],h=l?.filename,u=e[r];if(h&&u){i[h]=u,Es[r]=[h,u];break}}return i}),{})),bi}}class zl{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Y((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&M(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?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),b({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Y((function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i}))()}convertToExceptionList(e,t){var i,r,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Vl(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return b({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,i),next:n=>r(n,i+1)})}}var qt="?";function rr(s,e,t,i,r){var n={platform:s,filename:e,function:t==="<anonymous>"?qt:t,in_app:!(e!=null&&e.startsWith("webkit-masked-url://"))&&e!=="<anonymous>"};return w(i)||(n.lineno=i),w(r)||(n.colno=r),n}var eo=(s,e)=>{var t=s.indexOf("safari-extension")!==-1,i=s.indexOf("safari-web-extension")!==-1;return t||i?[s.indexOf("@")!==-1?s.split("@")[0]:qt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[s,e]},Wl=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Gl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jl=/\((\S*)(?::(\d+))(?::(\d+))\)/,Kl=(s,e)=>{var t=Wl.exec(s);if(t)return rr(e,t[1],qt,+t[2],+t[3]);var i=Gl.exec(s);if(i){if(i[2]&&i[2].indexOf("eval")===0){var r=Jl.exec(i[2]);r&&(i[2]=r[1],i[3]=r[2],i[4]=r[3])}var n=eo(i[1]||qt,i[2]);return rr(e,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Zl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Yl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Xl=(s,e)=>{var t=Zl.exec(s);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Yl.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],n=t[1]||qt,a=eo(n,r);return rr(e,r=a[1],n=a[0],t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},_n=/\(error: (.*)\)/;class Ql{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=H(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){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Bs(e,"DOMException")}isDOMError(e){return Bs(e,"DOMError")}}class eu{match(e){return Sa(e)}coerce(e,t){var i,r=this.getStack(e),n=r===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:r??((i=t.syntheticException)==null?void 0:i.stack),cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class tu{constructor(){}match(e){return!!Bs(e,"ErrorEvent")&&(e.error!=null||this.$i(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);var r=t.apply(e.message);return b({},r,{stack:(i=this.Ui(e))!==null&&i!==void 0?i:r.stack,synthetic:!0})}$i(e){return H(e.message)&&e.message.length>0}Ui(e){var t,i,r=e,n=(t=r.lineno)!==null&&t!==void 0?t:0,a=(i=r.colno)!==null&&i!==void 0?i:0;if(H(r.filename)&&r.filename.length!==0&&n!==0)return`Error
|
|
2
|
+
at `+r.filename+":"+n+":"+a}}var su=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class iu{match(e){return typeof e=="string"}coerce(e,t){var i,r=this.getInfos(e),n=r[0],a=r[1];return{type:n??"Error",value:a??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(su);return r&&(t=r[1],i=r[2]),[t,i]}}var ru=["fatal","error","warning","log","info","debug"];function to(s,e){e===void 0&&(e=40);var t=Object.keys(s);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var r=t.slice(0,i).join(", ");if(e>=r.length)return i===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class nu{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,r,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Rr(e))return e.constructor.name;var t="name"in e?e.name:void 0;return H(t)&&!Hs(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+to(e)}isSeverityLevel(e){return H(e)&&!Hs(e)&&ru.indexOf(e)>=0}getStack(e){try{return H(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:H(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(Sa(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class au{match(e){return Rr(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+to(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class ou{match(e){return Ea(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class lu{match(e){return Bs(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Rr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return Ea(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(r)}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}}var Js="$message",Ks="$timestamp",uu=new Set([Js,Ks]),wi={enabled:!0,max_bytes:32768};function Zs(s){var e;return s?{enabled:(e=s.enabled)!==null&&e!==void 0?e:wi.enabled,max_bytes:cu(s.max_bytes,wi.max_bytes)}:b({},wi)}class hu{constructor(e){this.Ss=[],this.xs=0,this.vn=Zs(e)}setConfig(e){this.vn=Zs(e),this.Cs()}add(e){var t=(function(r){var n;try{n=wa(r)}catch{return}try{var a=JSON.parse(n);if(!G(a))return;var o=a,l=o[Js],h=o[Ks];return!H(l)||l.trim().length===0||!H(h)&&!oe(h)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var i=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a})(t.json);i>this.vn.max_bytes||(this.Ss.push({step:t.step,bytes:i}),this.xs+=i,this.Cs())}}getAttachable(){return this.Ss.map((e=>e.step))}clear(){this.Ss=[],this.xs=0}size(){return this.Ss.length}Cs(){for(;this.xs>this.vn.max_bytes&&this.Ss.length>0;){var e=this.Ss.shift();e&&(this.xs-=e.bytes)}}}function cu(s,e){if(!oe(s)||s===1/0||s===-1/0)return e;var t=Math.floor(s);return 0>t?e:t}var so=function(s,e){var t=(e===void 0?{}:e).debugEnabled,i={P(r){if(g&&(Z.DEBUG||g.POSTHOG_DEBUG||t)&&!w(g.console)&&g.console){for(var n=("__rrweb_original__"in g.console[r])?g.console[r].__rrweb_original__:g.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(s,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.P("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.P("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.P("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];i.P("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(s,...n)},uninitializedWarning(r){i.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>so(s+" "+r,n)};return i},S=so("[PostHog.js]"),ee=S.createLogger,du=ee("[ExternalScriptsLoader]"),Ys=s=>{var e=x?.querySelectorAll("script");if(e){for(var t=0;e.length>t;t++)if(e[t].src===s||e[t].getAttribute("src")===s)return e[t]}},ct=(s,e,t)=>{if(s.config.disable_external_dependency_loading)return du.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=Ys(e);if(i){if(i.__posthog_loading_callback_fired)return t();var r=i.__posthog_loading_error;return r?t(r):(i.addEventListener("load",(a=>{i.__posthog_loading_callback_fired=!0,t(void 0,a)})),void i.addEventListener("error",(a=>{i.__posthog_loading_error=a,t(a)})))}var n=()=>{if(!x)return t("document not found");if(Ys(e))return ct(s,e,t);var a=x.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=e,a.onload=h=>{a.__posthog_loading_callback_fired=!0,t(void 0,h)},a.onerror=h=>{a.__posthog_loading_error=h,t(h)},s.config.prepare_external_dependency_script&&(a=s.config.prepare_external_dependency_script(a)),!a)return t("prepare_external_dependency_script returned null");if(s.config.external_scripts_inject_target==="head")x.head.appendChild(a);else{var o,l=x.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)==null||o.insertBefore(a,l[0]):x.body.appendChild(a)}};x!=null&&x.body?n():x?.addEventListener("DOMContentLoaded",n)},xi={},mn=(s,e)=>{var t="/static/"+e+".js?v="+s.version;if(e==="toolbar"){var i=3e5;t=t+"&t="+Math.floor(Date.now()/i)*i}return s.requestRouter.endpointFor("assets",t)};O.__PosthogExtensions__=O.__PosthogExtensions__||{},O.__PosthogExtensions__.loadExternalDependency=(s,e,t)=>{if(e!=="remote-config"){var i=s.config.strict_script_versioning;if(i){var r=s.requestRouter.endpointFor("assets","/static/"+s.version+"/"+e+".js"),n=xi[r];if(i==="fallback"&&n){if(Ys(n))return void ct(s,n,t);delete xi[r]}ct(s,r,i==="fallback"?(o,l)=>{if(o)if(typeof o=="string")t(o);else{var h,u=mn(s,e);xi[r]=u;var c=Ys(r);c==null||(h=c.parentNode)==null||h.removeChild(c),ct(s,u,t)}else t(void 0,l)}:t)}else ct(s,mn(s,e),t)}else{var a=s.requestRouter.endpointFor("assets","/array/"+s.config.token+"/config.js");ct(s,a,t)}},O.__PosthogExtensions__.loadSiteApp=(s,e,t)=>{var i=s.requestRouter.endpointFor("api",e);ct(s,i,t)};Z.DEBUG=!1,Z.LIB_VERSION="1.422.5",Z.LIB_NAME="web";var io="$people_distinct_id",be="distinct_id",ps="$device_id",ki="$device_model",$t="__alias",rs="__timers",nr="$autocapture_disabled_server_side",ar="$heatmaps_enabled_server_side",or="$exception_capture_enabled_server_side",lr="$error_tracking_suppression_rules",ur="$error_tracking_capture_extension_exceptions",hr="$web_vitals_enabled_server_side",Hr="$dead_clicks_enabled_server_side",Br="$product_tours_enabled_server_side",cr="$logs_capture_enabled_server_side",dr="$web_vitals_allowed_metrics",ft="$session_recording_remote_config",ro="$replay_sample_rate",no="$replay_override_sampling",ao="$replay_override_linked_flag",oo="$replay_override_url_trigger",lo="$replay_override_event_trigger",Ot="$sesid",Ur="$session_is_sampled",Ze="$enabled_feature_flags",gt="$active_feature_flags",Ms="$early_access_features",fs="$feature_flag_details",_t="$feature_flag_payloads",At="$feature_flag_request_id",Xs="$minimal_flag_called_events",He="$override_feature_flags",dt="$override_feature_flag_payloads",De="$stored_person_properties",ze="$stored_group_properties",uo="$groups",vr="$surveys",Qs="$surveys_loaded_at",pr="$surveys_activated",As="$surveys_activated_session",Ds="$surveys_activated_timestamps",ns="ph_product_tours",Ye="$flag_call_reported",as="$flag_call_reported_session_id",Dt="$feature_flag_errors",yt="$feature_flag_evaluated_at",j="$user_state",fr="$client_session_props",gr="$capture_rate_limit",_r="$initial_campaign_params",mr="$initial_referrer_info",ei="$initial_person_info",ti="$epp",kt="$posthog_cookieless",ho="$cookieless_mode",co="$sdk_debug_extensions_init_method",vo="$sdk_debug_extensions_init_time_ms",yr="$sdk_debug_recording_script_not_loaded",Vr="PostHog loadExternalDependency extension not found.",vt="on_reject",Xe="always",le="anonymous",pe="identified",br="identified_only",Ht="visibilitychange",si="beforeunload",Ft="$pageview",Ei="$pageleave",Si="$identify",yn="$groupidentify";function Ss(s,e){M(s)&&s.forEach(e)}function z(s,e){if(!D(s))if(M(s))s.forEach(e);else if(bl(s))s.forEach(((i,r)=>e(i,r)));else for(var t in s)ka.call(s,t)&&e(s[t],t)}var J=function(s){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;e>i;i++)t[i-1]=arguments[i];for(var r of t)for(var n in r)r[n]!==void 0&&(s[n]=r[n]);return s};function Ns(s){for(var e=Object.keys(s),t=e.length,i=new Array(t);t--;)i[t]=[e[t],s[e[t]]];return i}var bn=function(s){try{return s()}catch{return}},vu=function(s){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];return s.apply(this,t)}catch(r){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(r)}}},zr=function(s){var e={};return z(s,(function(t,i){(H(t)&&t.length>0||oe(t))&&(e[i]=t)})),e},pu=["herokuapp.com","vercel.app","netlify.app"];function fu(s){var e=s?.hostname;if(!H(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of pu)if(t===i)return!1;return!0}function X(s,e,t,i){var r=i??{},n=r.capture,a=r.passive;s?.addEventListener(e,t,{capture:n!==void 0&&n,passive:a===void 0||a})}function wr(s){return s.name==="ph_toolbar_internal"}var po=s=>{if(x){try{for(var e=s+"=",t=x.cookie.split(";").filter((n=>n.length)),i=0;t.length>i;i++){for(var r=t[i];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(s){return 0>s?Math.ceil(s):Math.floor(s)}),Number.isInteger||(Number.isInteger=function(s){return oe(s)&&isFinite(s)&&Math.floor(s)===s});class ii{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||0>e||0>t||0>i||0>r||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new ii(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ii(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class gu{generate(){var e=this.generateOrAbort();if(!w(e))return e;this.Gr=0;var t=this.generateOrAbort();if(w(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.Gr)this.Gr=e,this.Qr();else{if(this.Gr>=e+1e4)return;this.Jr++,this.Jr>4398046511103&&(this.Gr++,this.Qr())}return ii.fromFieldsV7(this.Gr,Math.trunc(this.Jr/Math.pow(2,30)),this.Jr&Math.pow(2,30)-1,this.Yr.nextUint32())}Qr(){this.Jr=1024*this.Yr.nextUint32()+(1023&this.Yr.nextUint32())}constructor(){this.Gr=0,this.Jr=0,this.Yr=new _u}}var wn,fo=s=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;s.length>e;e++)s[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return s};g&&!w(g.crypto)&&crypto.getRandomValues&&(fo=s=>crypto.getRandomValues(s));class _u{nextUint32(){return this.At.length>this.Kr||(fo(this.At),this.Kr=0),this.At[this.Kr++]}constructor(){this.At=new Uint32Array(8),this.Kr=1/0}}var Ve=()=>mu().toString(),mu=()=>(wn||(wn=new gu)).generate(),Zt="",yu=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ue={Xr:()=>!!x,ii(s){S.error("cookieStore error: "+s)},ti:po,ni(s){var e;try{e=JSON.parse(ue.ti(s))||{}}catch{}return e},ei(s,e,t,i,r){if(!x)return!1;try{var n="",a="",o=(function(u,c){if(c){var d=(function(v,f){if(f===void 0&&(f=x),Zt)return Zt;if(!f||["localhost","127.0.0.1"].includes(v))return"";for(var m=v.split("."),_=Math.min(m.length,8),y="dmn_chk_"+Ve();!Zt&&_--;){var k=m.slice(_).join("."),P=y+"=1;domain=."+k+";path=/";f.cookie=P+";max-age=3",f.cookie.includes(y)&&(f.cookie=P+";max-age=0",Zt=k)}return Zt})(u);if(!d){var p=(v=>{var f=v.match(yu);return f?f[0]:""})(u);p!==d&&S.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(x.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var h=s+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return h.length>3686.4&&S.warn("cookieStore warning: large cookie, len="+h.length),x.cookie=h,!0}catch{return!1}},ri(s,e){if(x!=null&&x.cookie)try{ue.ei(s,"",-1,e)}catch{return}}},Pi=null,W={Xr(){if(!fe(Pi))return Pi;var s=!0;if(w(g))s=!1;else try{var e="__mplssupport__";W.ei(e,"xyz"),W.ti(e)!=='"xyz"'&&(s=!1),W.ri(e)}catch{s=!1}return s||S.error("localStorage unsupported; falling back to cookie store"),Pi=s,s},ii(s){S.error("localStorage error: "+s)},ti(s){try{return g?.localStorage.getItem(s)}catch(e){W.ii(e)}return null},ni(s){try{return JSON.parse(W.ti(s))||{}}catch{}return null},ei(s,e){try{return g?.localStorage.setItem(s,JSON.stringify(e)),!0}catch(t){W.ii(t)}return!1},ri(s){try{g?.localStorage.removeItem(s)}catch(e){W.ii(e)}}},Ii=[De,gt,Ze,fs,_t,At,yt,Dt,Ye],pt=[ps,be,Ot,Ur,ti,ei,j],ri=s=>s+"_cpm",bu=["__proto__","constructor","prototype"],Fi=s=>{if(!G(s))return{};var e={};return Object.keys(s).forEach((t=>{bu.indexOf(t)===-1&&(e[t]=s[t])})),e},Ci=function(s,e){e===void 0&&(e=[]);var t={};return[...pt,...e].forEach((i=>{var r=s[i];w(r)||fe(r)||r===""||(t[i]=r)})),t},go=s=>{for(var e=5381,t=2166136261,i=0;s.length>i;i++){var r=s.charCodeAt(i);e=33*e^r,t=Math.imul(t^r,16777619)}return s.length.toString(36)+"."+(e>>>0).toString(36)+"."+(t>>>0).toString(36)},xn=(s,e)=>({p:e,f:go(JSON.stringify(s))}),kn=(s,e)=>{if(!e)return{properties:[],isValid:!1};try{var t=ue.ni(ri(s)),i=t?.f===go(e)&&M(t.p);return{properties:i?t.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},$i=(s,e)=>e+"|"+(ue.ti(ri(s))||""),Ps={},wu={Xr:()=>!0,ii(s){S.error("memoryStorage error: "+s)},ti:s=>Ps[s]||null,ni:s=>Ps[s]||null,ei:(s,e)=>(Ps[s]=e,!0),ri(s){delete Ps[s]}},ot=null,K={Xr(){if(!fe(ot))return ot;if(ot=!0,w(g))ot=!1;else try{var s="__support__";K.ei(s,"xyz"),K.ti(s)!=='"xyz"'&&(ot=!1),K.ri(s)}catch{ot=!1}return ot},ii(s){S.error("sessionStorage error: ",s)},ti(s){try{return g?.sessionStorage.getItem(s)}catch(e){K.ii(e)}return null},ni(s){try{return JSON.parse(K.ti(s))||null}catch{}return null},ei(s,e){try{return g?.sessionStorage.setItem(s,JSON.stringify(e)),!0}catch(t){K.ii(t)}return!1},ri(s){try{g?.sessionStorage.removeItem(s)}catch(e){K.ii(e)}}};class xu{constructor(e){this._instance=e}get vn(){return this._instance.config}get consent(){return this.Hs()?0:this.zs}isOptedOut(){return this.vn.cookieless_mode===Xe||this.isRejected()||this.consent===-1&&this.vn.cookieless_mode===vt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.vn.opt_out_capturing_by_default}optInOut(e){this.Us.ei(this.Ws,e?1:0,this.vn.cookie_expiration,this.vn.cross_subdomain_cookie,this.vn.secure_cookie)}reset(){this.Us.ri(this.Ws,this.vn.cross_subdomain_cookie)}get Ws(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get zs(){var e=this.Us.ti(this.Ws);return _i(e)?1:A(El,e)?0:-1}get Us(){var e=this.vn.opt_out_capturing_persistence_type,t=e==="localStorage"?W:ue;if(!this.Vs||this.Vs!==t){this.Vs=t;var i=e==="localStorage"?ue:W;i.ti(this.Ws)&&(this.Vs.ti(this.Ws)||this.optInOut(_i(i.ti(this.Ws))),i.ri(this.Ws,this.vn.cross_subdomain_cookie))}return this.Vs}Hs(){return!!this.vn.respect_dnt&&[xe?.doNotTrack,xe?.msDoNotTrack,O.doNotTrack].some((e=>_i(e)))}}function _o(s,e){var t,i=s==null||(t=s.config)==null?void 0:t.get_current_url;if(!me(i))return e;try{var r=i(e);return H(r)&&r?r:e}catch(n){return S.error("Error in get_current_url, falling back to window.location.href",n),e}}var mo="__POSTHOG_TOOLBAR__",ku=1,Eu=3,Su=11;function En(s){return s instanceof Element&&(s.id===mo||!(s.closest==null||!s.closest(".toolbar-global-fade-container")))}function nt(s){return!!s&&s.nodeType===ku}function Ce(s,e){return!!s&&!!s.tagName&&s.tagName.toLowerCase()===e.toLowerCase()}function yo(s){return!!s&&s.nodeType===Eu}function bo(s){return!!s&&s.nodeType===Su&&nt(s.host)}var wo=1e3;function Wr(s){return s?vi(s).split(/\s+/):[]}function Sn(s,e){var t=(function(i){var r,n=g==null||(r=g.location)==null?void 0:r.href;return w(n)?void 0:_o(i,n)})(e);return!!(t&&s&&s.some((i=>t.match(i))))}function ni(s){var e="";switch(typeof s.className){case"string":e=s.className;break;case"object":e=(s.className&&"baseVal"in s.className?s.className.baseVal:null)||s.getAttribute("class")||"";break;default:e=""}return Wr(e)}function xo(s){return D(s)?null:vi(s).split(/(\s+)/).filter((e=>us(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function gs(s){var e="";return Er(s)&&!Io(s)&&s.childNodes&&s.childNodes.length&&z(s.childNodes,(function(t){var i;yo(t)&&t.textContent&&(e+=(i=xo(t.textContent))!==null&&i!==void 0?i:"")})),vi(e)}function xr(s){var e;return w(s.target)?s.srcElement||null:(e=s.target)!=null&&e.shadowRoot?s.composedPath()[0]||null:s.target||null}var Gr=["a","button","form","input","select","textarea","label"];function kr(s,e){if(w(e))return!0;var t,i=function(n){if(e.some((a=>(function(o,l){var h=o.matches||o.matchesSelector||o.msMatchesSelector||o.mozMatchesSelector||o.webkitMatchesSelector||o.oMatchesSelector;try{return!!h&&h.call(o,l)}catch{return!1}})(n,a))))return{v:!0}};for(var r of s)if(t=i(r))return t.v;return!1}function ko(s){var e=s.parentNode;return!(!e||!nt(e))&&e}var Pu=[".ph-no-autocapture","[data-ph-no-autocapture]"],Eo=["next","previous","prev",">","<"],Iu=[...Eo,"+","-","−","–"],Pn=(s,e)=>/[a-z0-9]/i.test(e)?s.includes(e):s===e,In=[".ph-no-rageclick",".ph-no-capture"],Fu=["","text","search","email","password","url","tel","number"];function So(s,e){if(!g||Jr(s))return!1;var t,i,r,n,a;if(we(e)?(t=!!e&&In,i=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:In,i=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!nt(l))&&(!!Ce(l,"textarea")||(Ce(l,"input")?A(Fu,(l.getAttribute("type")||"").toLowerCase()):(function(h){if(h.isContentEditable)return!0;var u=h.getAttribute==null?void 0:h.getAttribute("contenteditable");return u==="true"||u===""})(l)))})(s))return!1;var o=Po(s,!1).targetElementList;return!(function(l,h){if(l===!1||w(l))return!1;var u;if(l===!0)u=Eo;else{if(!M(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;u=l.map((c=>c.toLowerCase()))}return h.some((c=>{var d=c.safeText,p=c.ariaLabel;return u.some((v=>Pn(d,v)||Pn(p,v)))}))})(i,o.map((l=>{var h;return{safeText:gs(l).toLowerCase(),ariaLabel:((h=l.getAttribute("aria-label"))==null?void 0:h.toLowerCase().trim())||""}})))&&!kr(o,t)}var Jr=s=>!s||Ce(s,"html")||!nt(s),Po=(s,e)=>{if(!g||Jr(s))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[s],r=s;r.parentNode&&!Ce(r,"body");)if(bo(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var n=ko(r);if(!n)break;if(e||Gr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else try{var a=g.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}catch{}i.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:i}};function Er(s){for(var e=new Set,t=0,i=s;i.parentNode&&!Ce(i,"body");i=i.parentNode){if(t++>=wo||e.has(i))return!1;e.add(i);var r=ni(i);if(A(r,"ph-sensitive")||A(r,"ph-no-capture"))return!1}if(A(ni(s),"ph-include"))return!0;var n=s.type||"";if(H(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var a=s.name||s.id||"";return!H(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function Io(s){return!!(Ce(s,"input")&&!["button","checkbox","submit","reset"].includes(s.type)||Ce(s,"select")||Ce(s,"textarea")||s.getAttribute("contenteditable")==="true")}var Fn=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}))$"),Cn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Cu=[16,15,14,13],$u=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),$n=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),On=/[0-9A-Za-z_]/;function Ou(s){for(var e=0,t=!1,i=s.length-1;i>=0;i--){var r=s.charCodeAt(i)-48;t&&(r*=2)>9&&(r-=9),e+=r,t=!t}return e%10==0}function us(s,e){if(e===void 0&&(e=!0),D(s))return!1;if(H(s)){s=vi(s);var t=e?Fn.test((s||"").replace(/[- ]/g,"")):(function(r){var n;for(Cn.lastIndex=0;n=Cn.exec(r);){var a=n[2];if(a)for(var o=a.replace(/[- ]/g,""),l=0;o.length>l;l++)for(var h of Cu){var u=l+h;if(o.length>=u){var c=o.slice(l,u);if(Fn.test(c)&&Ou(c))return!0}}}return!1})(s);if(t)return!1;var i=e?$u.test(s):(function(r){var n;for($n.lastIndex=0;n=$n.exec(r);){var a=n[1],o=n[3];if(!(a&&o&&On.test(a)&&On.test(o)))return!0}return!1})(s);if(i)return!1}return!0}function Tn(s){var e=gs(s);return us(e=(e+" "+Fo(s)).trim())?e:""}function Fo(s){var e="";return s&&s.childNodes&&s.childNodes.length&&z(s.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var r=gs(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Fo(t)).trim())}catch(n){S.error("[AutoCapture]",n)}})),e}function Ln(s){return s.replace(/"|\\"/g,'\\"')}function Tu(s){var e=s.attr__class;if(e)return M(e)?e:Wr(e)}var Is=ee("[Dead Clicks]"),Lu=()=>!0,Ru=s=>{var e,t=!((e=s.instance.persistence)==null||!e.get_property(Hr)),i=s.instance.config.capture_dead_clicks;return we(i)?i:!!G(i)||t};class Rn{get lazyLoadedDeadClicksAutocapture(){return this.Gs}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Hr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Zs((()=>{this.Qs()})):this.stop()}Zs(e){var t,i;(t=O.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Is.error("failed to load script",r):e()}))}Qs(){var e;if(x){if(!this.Gs&&(e=O.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=G(this.instance.config.capture_dead_clicks)?b({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Gs=O.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Gs.start(x),Is.info("starting...")}}else Is.error("`document` not found. Cannot start.")}stop(){this.Gs&&(this.Gs.stop(),this.Gs=void 0,Is.info("stopping..."))}}var Oi=ee("[SegmentIntegration]"),Co="posthog-js";function $o(s,e){var t=e===void 0?{}:e,i=t.organization,r=t.projectId,n=t.prefix,a=t.severityAllowList,o=a===void 0?["error"]:a,l=t.sendExceptionsToPostHog,h=l===void 0||l;return u=>{var c,d,p,v,f;if(o!=="*"&&!o.includes(u.level)||!s.__loaded)return u;u.tags||(u.tags={});var m=s.requestRouter.endpointFor("ui","/project/"+s.config.token+"/person/"+s.get_distinct_id());u.tags["PostHog Person URL"]=m,s.sessionRecordingStarted()&&(u.tags["PostHog Recording URL"]=s.get_session_replay_url({withTimestamp:!0}));var _,y=((c=u.exception)==null?void 0:c.values)||[],k=y.map((E=>b({},E,{stacktrace:E.stacktrace?b({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(($=>b({},$,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((d=y[0])==null?void 0:d.value)||u.message,$exception_type:(p=y[0])==null?void 0:p.type,$exception_level:u.level,$exception_list:k,$sentry_event_id:u.event_id,$sentry_exception:u.exception,$sentry_exception_message:((v=y[0])==null?void 0:v.value)||u.message,$sentry_exception_type:(f=y[0])==null?void 0:f.type,$sentry_tags:u.tags};return i&&r&&(P.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+u.event_id),h&&((_=s.exceptions)==null||_.sendExceptionEvent(P)),u}}class Mu{constructor(e,t,i,r,n,a){this.name=Co,this.setupOnce=function(o){o($o(e,{organization:t,projectId:i,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class Mn{constructor(e){this.Js=(t,i,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(S.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.Ks=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ys()}Ys(){var e;this.Xs=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Js)}destroy(){var e;(e=this.Xs)==null||e.call(this),this.Xs=void 0}doPageView(e,t){var i,r=this.ta(e,t);return this.Ks={pathname:(i=g?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ta(e,(t=this.Ks)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ks)==null?void 0:e.pageViewId}}ta(e,t){var i=this.Ks;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var a=n.maxScrollHeight,o=n.lastScrollY,l=n.maxScrollY,h=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(w(a)||w(o)||w(l)||w(h)||w(u)||w(c))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u),c=Math.ceil(c);var d=a>1?We(o/a,0,1,S):1,p=a>1?We(l/a,0,1,S):1,v=h>1?We(u/h,0,1,S):1,f=h>1?We(c/h,0,1,S):1;r=J(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var Ti=["flags","surveys"],Au={[io]:{exposure:"hidden"},[$t]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[rs]:{exposure:"hidden"},[nr]:{exposure:"event"},[ar]:{exposure:"hidden"},[cr]:{exposure:"hidden"},[or]:{exposure:"event"},[lr]:{exposure:"hidden"},[ur]:{exposure:"event"},[hr]:{exposure:"event"},[Hr]:{exposure:"event"},[Br]:{exposure:"hidden"},[dr]:{exposure:"event"},[ft]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[Ur]:{exposure:"event"},[ro]:{exposure:"event",shouldSkipFromEventProperties:s=>fe(s)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Ze]:{exposure:"hidden",storageGroup:"flags"},[gt]:{exposure:"hidden",storageGroup:"flags"},[Ms]:{exposure:"hidden"},[fs]:{exposure:"hidden",storageGroup:"flags"},[_t]:{exposure:"hidden",storageGroup:"flags"},[At]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Xs]:{exposure:"hidden",storageGroup:"flags"},[He]:{exposure:"hidden"},[dt]:{exposure:"hidden"},[De]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[vr]:{exposure:"hidden",storageGroup:"surveys"},[Qs]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[pr]:{exposure:"event"},[As]:{exposure:"hidden"},[Ds]:{exposure:"hidden"},[ns]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ye]:{exposure:"hidden"},[as]:{exposure:"hidden"},[uo]:{exposure:"event"},[Dt]:{exposure:"hidden"},[yt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[j]:{exposure:"hidden"},[fr]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[ei]:{exposure:"hidden"},[ti]:{exposure:"hidden"},[no]:{exposure:"event"},[ao]:{exposure:"event"},[oo]:{exposure:"event"},[lo]:{exposure:"event"},[co]:{exposure:"event"},[vo]:{exposure:"event"},[yr]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Du=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Be=s=>{var e=Au[s];if(e)return e;for(var t of Du){var i=t[1];if(s.indexOf(t[0])===0)return i}},Tt=(s,e)=>{try{return JSON.stringify(s,((t,i)=>typeof i=="bigint"?i.toString():i),e)}catch{return wa(s)}},Bt=s=>{var e=x?.createElement("a");return w(e)?null:(e.href=s,e)},Ut=function(s,e){for(var t,i=((s.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var n=i[r].split("=");if(n[0]===e){t=n;break}}if(!M(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{S.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},_s=function(s,e,t){if(!s||!e||!e.length)return s;for(var i=s.split("#"),r=i[1],n=(i[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),h=[],u=0;l.length>u;u++){var c=l[u].split("=");M(c)&&(e.includes(c[0])?h.push(c[0]+"="+t):h.push(l[u]))}var d=o;return a!=null&&(d+="?"+h.join("&")),r!=null&&(d+="#"+r),d},ai=function(s,e){var t=s.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Oo=(s,e)=>s>=e&&ma(),To=(s,e,t,i)=>{if(s===0){if(ma()){var r=e+1;return r===t&&i(),r}return e}return 0},Fs="https?://(.*)",Vt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Nu=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Vt],ms="<masked>",ju=["li_fat_id"];function Lo(s,e,t){if(!x)return{};var i,r=e?[...Vt,...t||[]]:[],n=Ro(_s(x.URL,r,ms),s),a=(i={},z(ju,(function(o){var l=po(o);i[o]=l||null})),i);return J(a,n)}function Ro(s,e){var t=Nu.concat(e||[]),i={};return z(t,(function(r){var n=Ut(s,r);i[r]=n||null})),i}function Mo(s){var e=(function(n){return n?n.search(Fs+"google.([^/?]*)")===0?"google":n.search(Fs+"bing.com")===0?"bing":n.search(Fs+"yahoo.com")===0?"yahoo":n.search(Fs+"duckduckgo.com")===0?"duckduckgo":null:null})(s),t=e!="yahoo"?"q":"p",i={};if(!fe(e)){i.$search_engine=e;var r=x?Ut(x.referrer,t):"";r.length&&(i.ph_keyword=r)}return i}function An(){return navigator.language||navigator.userLanguage}var oi="$direct";function Ao(){return x?.referrer||oi}function Do(s,e,t){t===void 0&&(t=!1);var i=s?[...Vt,...e||[]]:[],r=t?rt(se?.href):se?.href,n=r?.substring(0,1e3);return{r:Ao().substring(0,1e3),u:n?_s(n,i,ms):void 0}}function No(s,e){var t;e===void 0&&(e=!1);var i=s.r,r=s.u,n=e?rt(r):r,a={$referrer:i,$referring_domain:i==null?void 0:i==oi?oi:(t=Bt(i))==null?void 0:t.host};if(n){a.$current_url=n;var o=Bt(n);a.$host=o?.host,a.$pathname=o?.pathname;var l=Ro(n);J(a,l)}if(i){var h=Mo(i);J(a,h)}return a}function jo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function qu(){try{return new Date().getTimezoneOffset()}catch{return}}var Hu={flags:yt,surveys:Qs},Bu=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Cs=s=>s+"_cookie_identity_change_pending",st="main",Dn=(s,e)=>{z(s,((t,i)=>{var r=Be(i);r&&r.exposure!=="event"||{}.hasOwnProperty.call(e,i)||delete s[i]}))};class Li{constructor(e,t,i){if(i===void 0&&(i=!0),this.ea={},this.ia=!1,this.ra=!1,this.na=!1,this.sa=!1,this.vn=e,this.aa=i,this.props={},this.oa=void 0,this.la=(n=>{var a="";return n.token&&(a=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+a+"_posthog"})(e),this.Us=this.ua(e),this.ra=this.ha(e),this.load(),e.debug&&S.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),g){var r=()=>this.flush();X(g,"beforeunload",r,{capture:!1}),X(g,"pagehide",r,{capture:!1})}}da(){var e,t=(e=this.vn)==null?void 0:e.persistence_save_debounce_ms;return oe(t)&&t>0?t:0}va(e){if(this.vn.cookieWinsOnConflict&&this.vn.persistence.toLowerCase()==="localstorage+cookie")if(e)try{var t=Ci(e,this.vn.cookie_persisted_properties||[]),i=xn(t,this.vn.cookie_persisted_properties||[]),r=JSON.stringify(t)+"|"+JSON.stringify(i),n=ue.ti(this.la)||void 0;n&&$i(this.la,n)===r&&(this.ca=r,this.fa=n)}catch{}else try{var a=ue.ti(this.la)||void 0;this.ca=a?$i(this.la,a):void 0,this.fa=a}catch{}}syncCookieProperties(){return this.pa(this.vn)}pa(e,t){if(t===void 0&&(t=!1),this.ga&&!t||this.sa||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;var i;try{i=ue.ti(this.la)||void 0}catch{}if(!i||i===this.fa)return!1;var r,n=$i(this.la,i);try{r=Fi(JSON.parse(i))}catch{return!1}if((ue.ti(this.la)||void 0)!==i)return!1;this.ca=n,this.fa=i;var a=kn(this.la,i),o=[...pt,...a.properties],l={};if(Object.keys(r).forEach((f=>{var m=r[f];(w(m)||fe(m)||m===""||f===j&&m!==le&&m!==pe)&&(l[f]=!0,delete r[f])})),Ne(r))return!1;var h=be in r||r[j]===le||r[j]===pe,u=this.props[be],c=this.props[j],d=J({},this.props);[...pt,...e.cookie_persisted_properties||[]].forEach((f=>{if(o.indexOf(f)!==-1&&!(f in r)&&!l[f]&&(h||f!==be&&f!==j)){var m=d[f];!a.isValid&&pt.indexOf(f)!==-1&&(m===!1||m===0)||delete d[f]}})),this.props=J(d,r),!h||j in r||j in this.props||this.ma(j,le);var p=this.props[be],v=this.props[j];return!h||p===u&&v===c||(this.na=!0,K.ei(Cs(this.la),!0),this.ya(De),this.ya(gt),this.ya(Ze),this.ya(fs),this.ya(_t),this.ya(At),this.ya(yt),this.ya(Dt),this.ya(Ye),v===le&&(c===pe||r[j]===le||!w(u)&&p!==u)&&(Dn(this.props,r),this.ya(ze)),v===pe?this.props.$user_id=p:delete this.props.$user_id,this.ya($t)),!0}consumeCookieIdentityChange(){var e=Cs(this.la),t=this.na||!!K.ti(e);return this.na=!1,t&&K.ri(e),t}ba(e){return e===void 0&&(e=!1),!(this.sa||this.ga&&!e||!this.vn.cookieWinsOnConflict||this.vn.persistence.toLowerCase()!=="localstorage+cookie"||(this.sa=!0,0))}_a(){this.sa&&(w(this.wa)||(clearTimeout(this.wa),this.wa=void 0),delete this.ea[st],this.ka(!0))}Sa(e){if(e===void 0&&(e=!0),this.sa)try{e?this._a():w(this.wa)||(clearTimeout(this.wa),this.wa=void 0)}finally{this.sa=!1}}isDisabled(){return!!this.ga}ua(e){Bu.indexOf(e.persistence.toLowerCase())===-1&&(S.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...pt,...a];return b({},W,{ni(h){try{var u,c={};try{u=ue.ti(h)||void 0,c=u?Fi(JSON.parse(u)):{}}catch{}var d,p=JSON.parse(W.ti(h)||"{}");if(o){var v=kn(h,u),f=[...pt,...v.properties],m={};Object.keys(c).forEach((E=>{var $=c[E];fe($)||$===""||E===j&&$!==le&&$!==pe||(m[E]=$)}));var _=be in m||m[j]===le||m[j]===pe;if(Object.keys(m).length>0){var y,k=p[be],P=(y=p[j])!==null&&y!==void 0?y:le;l.forEach((E=>{if(f.indexOf(E)!==-1&&!(E in c)&&(_||E!==be&&E!==j)){var $=p[E];!v.isValid&&pt.indexOf(E)!==-1&&($===!1||$===0)||delete p[E]}})),!_||j in c||j in p||(p[j]=le),!_||(be in m?m[be]:p[be])===k&&(j in m?m[j]:p[j])===P||(Ii.forEach((E=>delete p[E])),m[j]===pe&&be in m?p.$user_id=m[be]:delete p.$user_id,m[j]!==pe&&(delete p[uo],delete p[ze]),delete p.__alias)}d=J(p,m)}else d=J(c,p);return W.ei(h,d),d}catch{}return null},ei(h,u,c,d,p,v){var f=W.ei(h,u,void 0,void 0,v);try{var m=Ci(u,a);if(Object.keys(m).length){if(o){var _=ri(h),y=xn(m,a);if(ue.ei(_,y,c,d,p,v),ue.ti(_)!==JSON.stringify(y)){ue.ri(_,d);var k=Ci(u);return ue.ei(h,k,c,d,p,v),f}}ue.ei(h,m,c,d,p,v)}}catch(P){W.ii(P)}return f},ri(h,u){try{g?.localStorage.removeItem(h),ue.ri(h,u),ue.ri(ri(h),u)}catch(c){W.ii(c)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&W.Xr()?(t=W,r=!0):n==="localstorage+cookie"&&i.Xr()?(t=i,r=!0):n==="sessionstorage"&&K.Xr()?t=K:n==="memory"?t=wu:n==="cookie"?t=ue:i.Xr()?(t=i,r=!0):t=ue,this.ia=r,t}xa(e){return this.la+"__"+e}ha(e){return this.ia&&!!e.split_storage}properties(){var e={};return z(this.props,((t,i)=>{var r=Be(i);if(!r||r.exposure==="event"){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t))return;e[i]=t}})),e}load(e){if(e===void 0&&(e=!1),!this.ga||e){var t=this.vn.cookieWinsOnConflict&&this.vn.persistence.toLowerCase()==="localstorage+cookie",i=t?W.ni(this.la):null,r={};if(t)try{z(r=Fi(ue.ni(this.la)),((v,f)=>{(w(v)||fe(v)||v==="")&&delete r[f]}))}catch{}var n=this.Us.ni(this.la);if(n&&(this.props=J({},n)),this.ra&&this.Ca(),t&&n){var a,o,l=i?.[be],h=(a=i?.[j])!==null&&a!==void 0?a:le,u=n[be],c=(o=n[j])!==null&&o!==void 0?o:le;if(u!==l||c!==h){this.na=!0,K.ei(Cs(this.la),!0);var d=J({},this.props);Ii.forEach((v=>delete d[v])),c===le&&(h===pe||r[j]===le||!w(l)&&u!==l)&&(Dn(d,r),delete d[ze]),this.props=d;var p=new Set;Ii.forEach((v=>{var f,m=(f=Be(v))==null?void 0:f.storageGroup;m&&p.add(m)})),p.forEach((v=>{var f={};z(this.props,((m,_)=>{var y;((y=Be(_))==null?void 0:y.storageGroup)===v&&(f[_]=m)})),Ne(f)?(W.ri(this.xa(v)),this.ea[v]={}):W.ei(this.xa(v),f)&&(this.ea[v]={persisted:!0,fingerprint:this.Ta(f,v)})}))}}K.ti(Cs(this.la))&&(this.na=!0)}}Ca(){for(var e of Ti){var t=W.ni(this.xa(e));if(t&&!Ne(t)){var i=this.Ma(e);i.persisted=!0,this.Ea(e)||(i.fingerprint=this.Ta(t,e)),this.Ia(e,t)||J(this.props,t)}}}Ea(e){return Object.keys(this.props).some((t=>{var i;return((i=Be(t))==null?void 0:i.storageGroup)===e}))}Ia(e,t){var i=Hu[e];if(!i)return!1;var r=t[i],n=this.props[i];return oe(r)&&oe(n)&&n>r}refreshKey(e){var t;if(!this.ga){var i=this.ra?(t=Be(e))==null?void 0:t.storageGroup:void 0,r=i?W.ni(this.xa(i)):this.Us.ni(this.la);if(r&&e in r)this.ma(e,r[e]);else{if(i){var n=this.Us.ni(this.la);if(n&&e in n)return void this.ma(e,n[e])}this.ya(e)}}}save(){if(!this.ga){var e=this.da();e>0?w(this.wa)&&(this.wa=setTimeout((()=>{this.wa=void 0,this.ka()}),e)):this.ka()}}flush(){w(this.wa)||(clearTimeout(this.wa),this.wa=void 0,this.ka())}ka(e){e===void 0&&(e=!1),this.ga||this.sa&&!e||(e||this.syncCookieProperties(),this.ra?this.Ra():this.Pa(this.Us,this.la,this.props,st)&&this.va(this.props))}Ra(){var e=this.Aa(),t=e.main,i=e.groups;for(var r of(this.Pa(this.Us,this.la,t,st)&&this.va(t),Ti)){var n,a=i[r];(!Ne(a)||(n=this.ea[r])!=null&&n.persisted)&&this.Pa(W,this.xa(r),a,r)}}Aa(){var e={},t={flags:{},surveys:{}};return z(this.props,((i,r)=>{var n,a=(n=Be(r))==null?void 0:n.storageGroup;a?t[a][r]=i:e[r]=i})),{main:e,groups:t}}Ta(e,t){if(t===st)return JSON.stringify(e)+"|"+this.Fa+"|"+this.Oa+"|"+this.La;var i={};return z(e,((r,n)=>{var a;i[n]=(a=Be(n))!=null&&a.volatile?"__volatile__":r})),JSON.stringify(i)}Pa(e,t,i,r){var n,a=this.Ma(r);if(r!==st&&!a.dirty&&!w(a.fingerprint))return!1;try{if((n=this.Ta(i,r))===a.fingerprint)return a.dirty=!1,!1}catch{n=void 0}return e.ei(t,i,this.Fa,this.Oa,this.La,this.vn.debug)?(a.dirty=!1,r!==st&&(a.persisted=!0),w(n)||(a.fingerprint=n),!0):(this.vn.debug&&S.warn('failed to persist storage entry "'+t+'"; will retry on next save'),!1)}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,i=t!==void 0&&t;if(w(this.wa)||(clearTimeout(this.wa),this.wa=void 0),this.Us.ri(this.la,!1),this.Us.ri(this.la,!0),!i&&this.aa)for(var r of Ti)W.ri(this.xa(r));i?delete this.ea[st]:this.ea={},this.ca=void 0,this.fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(G(e)){this.syncCookieProperties(),w(t)&&(t="None"),this.Fa=w(i)?this.Da:i;var r=!1;if(z(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.ma(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(G(e)){this.syncCookieProperties(),this.Fa=w(t)?this.Da:t;var i=!1;if(z(e,((r,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==r||G(r)||M(r))&&(this.ma(n,r),i=!0)})),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t=typeof e=="string"?[e]:e,i=!1;for(var r of t)r in this.props&&(this.ya(r),i=!0);i&&this.save()}update_campaign_params(){var e=x?.URL;if(e!==this.oa){var t=Lo(this.vn.custom_campaign_params,this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties);Ne(zr(t))||this.register(t),this.oa=e}}update_search_keyword(){var e;this.register((e=x?.referrer)?Mo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ao(),$referring_domain:x!=null&&x.referrer&&((e=Bt(x.referrer))==null?void 0:e.host)||oi},void 0)}set_initial_person_info(){this.props[_r]||this.props[mr]||this.register_once({[ei]:Do(this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties,this.vn.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};z([mr,_r],(r=>{var n=this.props[r];n&&z(n,(function(a,o){e["$initial_"+Yi(o)]=a}))}));var t=this.props[ei];if(t){var i=(function(r,n){n===void 0&&(n=!1);var a=No(r,n),o={};return z(a,(function(l,h){o["$initial_"+Yi(h)]=l})),o})(t,this.vn.disable_capture_url_hashes);J(e,i)}return e}safe_merge(e){return z(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){var r=e.persistence!==t.persistence,n=!((f,m)=>{if(f.length!==m.length)return!1;var _=[...f].sort(),y=[...m].sort();return _.every(((k,P)=>k===y[P]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!i,h=!!this.ga&&!l;l||this.pa(t,h),this.vn=e,!l&&(r||n||o)&&(this.ca=void 0,this.fa=void 0,this.pa(b({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),h));var u=a||o?this.ua(e):this.Us,c=this.ha(e),d=a||c!==this.ra,p=!l&&(d||e.cross_subdomain_cookie!==this.Oa||e.secure_cookie!==this.La)&&this.ba(h);try{if(this.Da=this.Fa=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var v=this.props;this.clear(),this.Us=u,this.ra=c,this.props=v,this.save()}else o&&(this.Us=u,l||(delete this.ea[st],this.ka()))}finally{p&&this.Sa()}}set_disabled(e){this.ga=e,this.ga?this.remove():this.save()}set_cross_subdomain(e){e!==this.Oa&&(this.Oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.La&&(this.La=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[rs]||{};i[e]=t,this.ma(rs,i),this.save()}remove_event_timer(e){var t=this.props[rs]||{},i=t[e];return w(i)||(delete t[e],this.ma(rs,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.ma(e,t),this.save()}ma(e,t){var i;this.props[e]=t,(i=Be(e))!=null&&i.volatile||this.$a(e)}ya(e){delete this.props[e],this.$a(e)}$a(e){var t,i=(t=Be(e))==null?void 0:t.storageGroup;i&&(this.Ma(i).dirty=!0)}Ma(e){return this.ea[e]||(this.ea[e]={})}}function $s(s){var e=!0;return{dispose(){if(e){e=!1;var t=s();t&&me(t.then)&&t.then(void 0,(()=>{}))}}}}var Ie={GZipJS:"gzip-js",Base64:"base64"},Yt={Activation:"events",Cancellation:"cancelEvents"},Ri={Popover:"popover",API:"api",Widget:"widget"},Qe={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Mi={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Sr={Popover:"popover",Inline:"inline"},Uu={SHOWN:"product tour shown"},Nn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},jn=ee("[RateLimiter]");class Vu{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((r=>{jn.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void jn.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,r;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(gr))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var h=1>l.tokens;if(h||e||(l.tokens=Math.max(0,l.tokens-1)),h&&!e){var u=(oe(l.dropped)?l.dropped:0)+1;l.dropped=u,!this.lastEventRateLimited&&this.Na(u)&&(l.dropped=0)}return this.lastEventRateLimited=h,(r=this.instance.persistence)==null||r.set_property(gr,l),{isRateLimited:h,remainingTokens:l.tokens}}qa(e){var t=this.instance.config.property_denylist;return!M(t)||!t.includes(e)}ja(){var e;if(this.qa("$current_url")&&this.qa("$pathname")&&se!=null&&se.pathname)return""+((e=se.origin)!==null&&e!==void 0?e:"")+se.pathname}Na(e){var t,i,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=this.ja(),o=this.qa("$session_id")?(t=(i=this.instance).get_session_id)==null?void 0:t.call(i):void 0,l=[e+" event(s) dropped since the last warning",a?"triggered on "+a: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: "+l+". Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var it=ee("[RemoteConfig]");class qo{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=O._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ba(e){var t,i;(t=O.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ha(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 it.info("Using preloaded remote config",this.remoteConfig),void this.za(this.remoteConfig);if(this._instance.Ua())return void it.warn("Remote config is disabled. Falling back to local config.");this.Ba((e=>{if(!e)return it.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ha((t=>{this.za(t.json,t)}));this.za(e)}))}catch(e){it.error("Error loading remote config",e),this.za()}}za(e,t){!e&&t&&(t.statusCode===0?t.error||it.warn("Failed to fetch remote config from PostHog."):it.error("Failed to fetch remote config from PostHog."));try{this._instance.za(e?{ok:!0,config:e}:{ok:!1})}catch(r){it.error("Error applying remote config",r)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)==null||i.ensureFlagsLoaded()}catch(r){it.error("Error loading feature flags",r)}}}var Re=Uint8Array,Se=Uint16Array,zt=Uint32Array,Kr=new Re([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]),Zr=new Re([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]),qn=new Re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ho=function(s,e){for(var t=new Se(31),i=0;31>i;++i)t[i]=e+=1<<s[i-1];var r=new zt(t[30]);for(i=1;30>i;++i)for(var n=t[i];t[i+1]>n;++n)r[n]=n-t[i]<<5|i;return[t,r]},Bo=Ho(Kr,2),Pr=Bo[1];Bo[0][28]=258,Pr[258]=28;for(var Hn=Ho(Zr,0)[1],Uo=new Se(32768),ie=0;32768>ie;++ie){var Et=(43690&ie)>>>1|(21845&ie)<<1;Uo[ie]=((65280&(Et=(61680&(Et=(52428&Et)>>>2|(13107&Et)<<2))>>>4|(3855&Et)<<4))>>>8|(255&Et)<<8)>>>1}var hs=function(s,e,t){for(var i=s.length,r=0,n=new Se(e);i>r;++r)++n[s[r]-1];var a,o=new Se(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new Se(i),r=0;i>r;++r)a[r]=Uo[o[s[r]-1]++]>>>15-s[r];return a},bt=new Re(288);for(ie=0;144>ie;++ie)bt[ie]=8;for(ie=144;256>ie;++ie)bt[ie]=9;for(ie=256;280>ie;++ie)bt[ie]=7;for(ie=280;288>ie;++ie)bt[ie]=8;var li=new Re(32);for(ie=0;32>ie;++ie)li[ie]=5;var zu=hs(bt,9),Wu=hs(li,5),Vo=function(s){return(s/8>>0)+(7&s&&1)},zo=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var i=new(s instanceof Se?Se:s instanceof zt?zt:Re)(t-e);return i.set(s.subarray(e,t)),i},Ge=function(s,e,t){var i=e/8>>0;s[i]|=t<<=7&e,s[i+1]|=t>>>8},Xt=function(s,e,t){var i=e/8>>0;s[i]|=t<<=7&e,s[i+1]|=t>>>8,s[i+2]|=t>>>16},Ai=function(s,e){for(var t=[],i=0;s.length>i;++i)s[i]&&t.push({s:i,f:s[i]});var r=t.length,n=t.slice();if(!r)return[new Re(0),0];if(r==1){var a=new Re(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(E,$){return E.f-$.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],h=0,u=1,c=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=r-1;)o=t[t[c].f>t[h].f?h++:c++],l=t[h!=u&&t[c].f>t[h].f?h++:c++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(i=1;r>i;++i)n[i].s>d&&(d=n[i].s);var p=new Se(d+1),v=Ir(t[u-1],p,0);if(v>e){i=0;var f=0,m=v-e,_=1<<m;for(n.sort((function(E,$){return p[$.s]-p[E.s]||E.f-$.f}));r>i;++i){var y=n[i].s;if(e>=p[y])break;f+=_-(1<<v-p[y]),p[y]=e}for(f>>>=m;f>0;){var k=n[i].s;e>p[k]?f-=1<<e-p[k]++-1:++i}for(;i>=0&&f;--i){var P=n[i].s;p[P]==e&&(--p[P],++f)}v=e}return[new Re(p),v]},Ir=function(s,e,t){return s.s==-1?Math.max(Ir(s.l,e,t+1),Ir(s.r,e,t+1)):e[s.s]=t},Bn=function(s){for(var e=s.length;e&&!s[--e];);for(var t=new Se(++e),i=0,r=s[0],n=1,a=function(l){t[i++]=l},o=1;e>=o;++o)if(s[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=s[o]}return[t.subarray(0,i),e]},Qt=function(s,e){for(var t=0,i=0;e.length>i;++i)t+=s[i]*e[i];return t},Fr=function(s,e,t){var i=t.length,r=Vo(e+2);s[r]=255&i,s[r+1]=i>>>8,s[r+2]=255^s[r],s[r+3]=255^s[r+1];for(var n=0;i>n;++n)s[r+n+4]=t[n];return 8*(r+4+i)},Un=function(s,e,t,i,r,n,a,o,l,h,u){Ge(e,u++,t),++r[256];for(var c=Ai(r,15),d=c[0],p=c[1],v=Ai(n,15),f=v[0],m=v[1],_=Bn(d),y=_[0],k=_[1],P=Bn(f),E=P[0],$=P[1],N=new Se(19),I=0;y.length>I;++I)N[31&y[I]]++;for(I=0;E.length>I;++I)N[31&E[I]]++;for(var C=Ai(N,7),F=C[0],L=C[1],T=19;T>4&&!F[qn[T-1]];--T);var R,B,V,q,Q=h+5<<3,te=Qt(r,bt)+Qt(n,li)+a,he=Qt(r,d)+Qt(n,f)+a+14+3*T+Qt(N,F)+(2*N[16]+3*N[17]+7*N[18]);if(te>=Q&&he>=Q)return Fr(e,u,s.subarray(l,l+h));if(Ge(e,u,1+(te>he)),u+=2,te>he){R=hs(d,p),B=d,V=hs(f,m),q=f;var de=hs(F,L);for(Ge(e,u,k-257),Ge(e,u+5,$-1),Ge(e,u+10,T-4),u+=14,I=0;T>I;++I)Ge(e,u+3*I,F[qn[I]]);u+=3*T;for(var ge=[y,E],Pe=0;2>Pe;++Pe){var re=ge[Pe];for(I=0;re.length>I;++I)Ge(e,u,de[ve=31&re[I]]),u+=F[ve],ve>15&&(Ge(e,u,re[I]>>>5&127),u+=re[I]>>>12)}}else R=zu,B=bt,V=Wu,q=li;for(I=0;o>I;++I)if(i[I]>255){var ve;Xt(e,u,R[257+(ve=i[I]>>>18&31)]),u+=B[ve+257],ve>7&&(Ge(e,u,i[I]>>>23&31),u+=Kr[ve]);var ce=31&i[I];Xt(e,u,V[ce]),u+=q[ce],ce>3&&(Xt(e,u,i[I]>>>5&8191),u+=Zr[ce])}else Xt(e,u,R[i[I]]),u+=B[i[I]];return Xt(e,u,R[256]),u+B[256]},Gu=new zt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ju=(function(){for(var s=new zt(256),e=0;256>e;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;s[e]=t}return s})(),Di=function(s,e,t){for(;t;++e)s[e]=t,t>>>=8};function Ku(s,e){e===void 0&&(e={});var t=(function(){var c=4294967295;return{p(d){for(var p=c,v=0;d.length>v;++v)p=Ju[255&p^d[v]]^p>>>8;c=p},d(){return 4294967295^c}}})(),i=s.length;t.p(s);var r,n,a,o,l,h=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(c,d,p,v,f,m){var _=c.length,y=new Re(v+_+5*(1+Math.floor(_/7e3))+f),k=y.subarray(v,y.length-f),P=0;if(!d||8>_)for(var E=0;_>=E;E+=65535){var $=E+65535;_>$?P=Fr(k,P,c.subarray(E,$)):(k[E]=!0,P=Fr(k,P,c.subarray(E,_)))}else{for(var N=Gu[d-1],I=N>>>13,C=8191&N,F=(1<<p)-1,L=new Se(32768),T=new Se(F+1),R=Math.ceil(p/3),B=2*R,V=function(gi){return(c[gi]^c[gi+1]<<R^c[gi+2]<<B)&F},q=new zt(25e3),Q=new Se(288),te=new Se(32),he=0,de=0,ge=(E=0,0),Pe=0,re=0;_>E;++E){var ve=V(E),ce=32767&E,je=T[ve];if(L[ce]=je,T[ve]=ce,E>=Pe){var at=_-E;if((he>7e3||ge>24576)&&at>423){P=Un(c,k,0,q,Q,te,de,ge,re,E-re,P),ge=he=de=0,re=E;for(var ae=0;286>ae;++ae)Q[ae]=0;for(ae=0;30>ae;++ae)te[ae]=0}var Me=2,tt=0,Wt=C,Oe=ce-je&32767;if(at>2&&ve==V(E-Oe))for(var ke=Math.min(I,at)-1,bs=Math.min(32767,E),ws=Math.min(258,at);bs>=Oe&&--Wt&&ce!=je;){if(c[E+Me]==c[E+Me-Oe]){for(var Te=0;ws>Te&&c[E+Te]==c[E+Te-Oe];++Te);if(Te>Me){if(Me=Te,tt=Oe,Te>ke)break;var xs=Math.min(Oe,Te-2),wt=0;for(ae=0;xs>ae;++ae){var xt=E-Oe+ae+32768&32767,Gt=xt-L[xt]+32768&32767;Gt>wt&&(wt=Gt,je=xt)}}}Oe+=(ce=je)-(je=L[ce])+32768&32767}if(tt){q[ge++]=268435456|Pr[Me]<<18|Hn[tt];var Yr=31&Pr[Me],Xr=31&Hn[tt];de+=Kr[Yr]+Zr[Xr],++Q[257+Yr],++te[Xr],Pe=E+Me,++he}else q[ge++]=c[E],++Q[c[E]]}}P=Un(c,k,!0,q,Q,te,de,ge,re,E-re,P)}return zo(y,0,v+Vo(P)+f)})(n=s,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),u=h.length;return(function(c,d){var p=d.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>d.level?4:d.level==9?2:0,c[9]=3,d.mtime!=0&&Di(c,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){c[3]=8;for(var v=0;p.length>=v;++v)c[v+10]=p.charCodeAt(v)}})(h,e),Di(h,u-8,t.d()),Di(h,u-4,i),h}var Zu=!!Ji||!!Lr,Wo="text/plain",js=!1,Go=(s,e)=>{var t=s.split("#"),i=t[1],r=t[0].split("?"),n=r[0],a=r[1];if(!a)return s;var o=a.split("&").filter((l=>l.split("=")[0]!==e)).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},ys=function(s,e,t){var i;t===void 0&&(t=!0);var r=s.split("?"),n=r[0],a=r[1],o=b({},e),l=(i=a?.split("&").map((u=>{var c,d=u.split("="),p=d[0],v=t&&(c=o[p])!==null&&c!==void 0?c:d[1];return delete o[p],p+"="+v})))!==null&&i!==void 0?i:[],h=(function(u,c){var d,p;c===void 0&&(c="&");var v=[];return z(u,(function(f,m){w(f)||w(m)||m==="undefined"||(d=encodeURIComponent((_=>_ instanceof File)(f)?f.name:f.toString()),p=encodeURIComponent(m),v[v.length]=p+"="+d)})),v.join(c)})(o);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},Ni=s=>{if(s.Wa)return s.Wa;var e=s.data,t=s.compression;if(e){if(t===Ie.GZipJS){var i=Ku((function(o,l){var h=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var u=new Re(o.length+(o.length>>>1)),c=0,d=function(m){u[c++]=m},p=0;h>p;++p){if(c+5>u.length){var v=new Re(c+8+(h-p<<1));v.set(u),u=v}var f=o.charCodeAt(p);128>f?d(f):2048>f?(d(192|f>>>6),d(128|63&f)):f>55295&&57344>f?(d(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++p))>>>18),d(128|f>>>12&63),d(128|f>>>6&63),d(128|63&f)):(d(224|f>>>12),d(128|f>>>6&63),d(128|63&f))}return zo(u,0,c)})(Tt(e)),{mtime:0});return{contentType:Wo,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(t===Ie.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,h)=>String.fromCharCode(parseInt(h,16)))))})(Tt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Tt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=Tt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Jo=s=>{var e,t,i=()=>s.transport==="sendBeacon"?{url:ys(s.url,{compression:Ie.Base64}),encodedBody:Ni(b({},s,{compression:Ie.Base64,Wa:void 0}))}:{url:Go(s.url,"compression"),encodedBody:Ni(b({},s,{compression:void 0,Wa:void 0}))};try{e=Ni(s)}catch(r){if(cn(s.compression,Ut(s.url,"compression")))return S.error("Failed to gzip request body, sending uncompressed payload",r),i();throw r}return e&&cn(s.compression,Ut(s.url,"compression"))&&!((t=e.body)instanceof ArrayBuffer?sr(new Uint8Array(t)):ArrayBuffer.isView(t)&&sr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?(js=!0,i()):{url:s.url,encodedBody:e}},Ko=s=>{try{return Jo(s)}catch(e){return S.error(e),void(s.callback==null||s.callback({statusCode:0,error:e}))}},Yu=(function(){var s=Y((function*(e){var t=Tt(e.data),i=yield(function(n,a,o){return ir.apply(this,arguments)})(t,Z.DEBUG,{rethrow:!0});if(!i)return e;var r=yield i.arrayBuffer();return b({},e,{Wa:{contentType:Wo,body:r,estimatedSize:r.byteLength}})}));return function(e){return s.apply(this,arguments)}})(),Xu=/Failed to fetch|NetworkError|Load failed/i,Zo=s=>s?.name==="TypeError"&&Xu.test(s?.message||""),Yo=s=>{var e=Ko(s);if(e){var t=e.url,i=e.encodedBody,r=i??{},n=r.contentType,a=r.body,o=r.estimatedSize,l=new Headers;z(s.headers,(function(v,f){l.append(f,v)})),n&&l.append("Content-Type",n);var h=null,u=!1;if(Qr){var c=new Qr;h={signal:c.signal,timeout:setTimeout((()=>{var v;u=!0,c.abort(Ga("AbortError","PostHog request timed out"+((v=s.timeout)?" after "+v+"ms":"")))}),s.timeout)}}var d=v=>{u&&v?.name==="AbortError"||Zo(v)?S.warn(v):S.error(v),s.callback==null||s.callback({statusCode:0,error:v})};try{var p;Lr(t,b({method:s?.method||"GET",headers:l,keepalive:s.method==="POST"&&!s.Va&&52428.8>(o||0),body:a,signal:(p=h)==null?void 0:p.signal},s.fetchOptions)).then((v=>v.text().then((f=>{var m={statusCode:v.status,text:f};if(v.status===200)try{m.json=JSON.parse(f)}catch(_){S.error(_)}s.callback==null||s.callback(m)})))).catch(d).finally((()=>h?clearTimeout(h.timeout):null))}catch(v){h&&clearTimeout(h.timeout),d(v)}}},Cr=s=>{try{var e,t=Jo(s),i=t.url,r=t.encodedBody,n=r??{},a=n.body,o=n.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:n.contentType});if(xe.sendBeacon(i,l))return;var h=M(s.data)?s.data:(e=s.data)==null?void 0:e.batch;if(M(h)&&h.length>1&&(o??0)>16384){var u=Math.ceil(h.length/2),c=d=>M(s.data)?d:b({},s.data,{batch:d});return Cr(b({},s,{data:c(h.slice(0,u))})),void Cr(b({},s,{data:c(h.slice(u))}))}S.warn("Beacon of ~"+(o??0)+" bytes was rejected by the browser, falling back to fetch"),Yo(b({},s,{Va:!0}))}catch(d){S.warn("Beacon send failed",d)}},Vn=(s,e,t,i)=>{var r=i==="query"?e==="POST"?"sent_at":"_":void 0;return ys(t===Ie.GZipJS?Go(s,"compression"):s,b({},r?{[r]:Date.now().toString()}:{},t===Ie.GZipJS?{}:{compression:t}))},qs=[];Lr&&qs.push({transport:"fetch",method:Yo}),Ji&&qs.push({transport:"XHR",method(s){var e=Ko(s);if(e){var t=new Ji,i=e.encodedBody;t.open(s.method||"GET",e.url,!0);var r=i??{},n=r.contentType,a=r.body;z(s.headers,(function(o,l){t.setRequestHeader(l,o)})),n&&t.setRequestHeader("Content-Type",n),s.timeout&&(t.timeout=s.timeout),t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}s.callback==null||s.callback(o)}},t.send(a)}}}),xe!=null&&xe.sendBeacon&&qs.push({transport:"sendBeacon",method:Cr});var $r=3e3;class Qu{constructor(e,t){this.Ga=!0,this.Za=[],this.Qa=We(t?.flush_interval_ms||$r,250,5e3,S.createLogger("flush interval"),$r),this.Ja=e}enqueue(e){this.Za.push(e),this.Ka||this.Ya()}unload(){this.Xa();var e=this.Za.length>0?this.eo():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.io(b({},i,{transport:"sendBeacon"}))}))}enable(){this.Ga=!1,this.Ya()}Ya(){var e=this;this.Ga||(this.Ka=setTimeout((()=>{if(this.Xa(),this.Za.length>0){var t=this.eo(),i=function(){var n=t[r],a=new Date().getTime();n.data&&M(n.data)&&z(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.io(n)};for(var r in t)i()}}),this.Qa))}io(e){try{this.Ja(e)}catch(t){S.error(t)}}Xa(){clearTimeout(this.Ka),this.Ka=void 0}eo(){var e={};return z(this.Za,(t=>{var i,r=t,n=(r?r.batchKey:null)||r.url;w(e[n])&&(e[n]=b({},r,{data:[]})),(i=e[n].data)==null||i.push(r.data)})),this.Za=[],e}}var eh=["retriesPerformedSoFar"];class th{constructor(e){this.ro=!1,this.no=3e3,this.Za=[],this._instance=e,this.Za=[],this.so=!0,!w(g)&&"onLine"in g.navigator&&(this.so=g.navigator.onLine,this.ao=()=>{this.so=!0,this.oo()},this.lo=()=>{this.so=!1},X(g,"online",this.ao),X(g,"offline",this.lo))}get length(){return this.Za.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=ya(e,eh);Ke(t)&&(i.url=ys(i.url,{retry_count:t})),this._instance._send_request(b({},i,{callback:r=>{if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(t??0))return void this.Yn(b({retriesPerformedSoFar:t},i));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 "+(t??0)+" retries.")}i.callback==null||i.callback(r)}}))}Yn(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,h=Math.min(18e5,o),u=Math.random()-.5;return Math.ceil(h+u*(h-l))})(t),r=Date.now()+i;this.Za.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),S.warn(n),this.ro||(this.ro=!0,this.uo())}uo(){if(this.ho&&clearTimeout(this.ho),this.Za.length===0)return this.ro=!1,void(this.ho=void 0);this.ho=setTimeout((()=>{this.so&&this.Za.length>0&&this.oo(),this.uo()}),this.no)}oo(){var e=Date.now(),t=[],i=this.Za.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Za=t,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.ho&&(clearTimeout(this.ho),this.ho=void 0),this.ro=!1,w(g)||(this.ao&&(g.removeEventListener("online",this.ao),this.ao=void 0),this.lo&&(g.removeEventListener("offline",this.lo),this.lo=void 0)),this.Za)){var t=e.requestOptions;try{this._instance._send_request(b({},t,{transport:"sendBeacon"}))}catch(i){S.error(i)}}this.Za=[]}}class sh{constructor(e){this.do=()=>{var t,i,r,n;this.vo||(this.vo={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,h=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.vo.lastScrollY=Math.ceil(o),this.vo.maxScrollY=Math.max(o,(t=this.vo.maxScrollY)!==null&&t!==void 0?t:0),this.vo.maxScrollHeight=Math.max(l,(i=this.vo.maxScrollHeight)!==null&&i!==void 0?i:0),this.vo.lastContentY=h,this.vo.maxContentY=Math.max(h,(r=this.vo.maxContentY)!==null&&r!==void 0?r:0),this.vo.maxContentHeight=Math.max(u,(n=this.vo.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get co(){return this._instance.config.scroll_root_selector}getContext(){return this.vo}resetContext(){var e=this.vo;return setTimeout(this.do,0),e}startMeasuringScrollPosition(){X(g,"scroll",this.do,{capture:!0}),X(g,"scrollend",this.do,{capture:!0}),X(g,"resize",this.do)}scrollElement(){if(!this.co)return g?.document.documentElement;var e=M(this.co)?this.co:[this.co];for(var t of e){var i=g?.document.querySelector(t);if(i)return i}}fo(e){var t=e==="y"?"scrollTop":"scrollLeft";if(this.co){var i=this.scrollElement();return i&&i[t]||0}return g?e==="y"?g.scrollY||g.pageYOffset||g.document.documentElement.scrollTop||0:g.scrollX||g.pageXOffset||g.document.documentElement.scrollLeft||0:0}scrollY(){return this.fo("y")}scrollX(){return this.fo("x")}}var ih=s=>Do(s?.config.mask_personal_data_properties,s?.config.custom_personal_data_properties,s?.config.disable_capture_url_hashes);class zn{constructor(e,t,i,r){this.xt=n=>{var a=this.po();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.mo(this._instance)};this.yo.register({[fr]:o})}},this._instance=e,this.bo=t,this.yo=i,this.mo=r||ih,this.bo.onSessionId(this.xt)}po(){return this.yo.props[fr]}getSetOnceProps(){var e,t=(e=this.po())==null?void 0:e.props;return t?"r"in t?No(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return z(zr(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Yi(i)]=t})),e}}class ui{on(e,t){return this._o[e]||(this._o[e]=[]),this._o[e].push(t),()=>{this._o[e]=this._o[e].filter((i=>i!==t))}}emit(e,t){for(var i of this._o[e]||[])i(t);for(var r of this._o["*"]||[])r(e,t)}constructor(){this._o={}}}var St=ee("[SessionId]"),Wn=864e5;class Gn{on(e,t){return this.wo.on(e,t)}constructor(e,t,i){var r;if(this.ko=null,this.So=null,this.xo=[],this.Co=void 0,this.To=!1,this.wo=new ui,this.Mo=(l,h)=>!(!Ke(l)||!Ke(h))&&Math.abs(l-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Xe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.vn=e.config,this.yo=e.persistence,this.Ct=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this.Eo=void 0,this._sessionActivityTimestamp=null,this.Io=t||Ve,this.Ro=i||Ve;var n=this.vn.persistence_name||this.vn.token;if(this._sessionTimeoutMs=1e3*We(this.vn.session_idle_timeout_seconds||1800,60,36e3,St.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Po(),this.Ao="ph_"+n+"_window_id",this.Fo="ph_"+n+"_primary_window_exists",this.Oo()){var a=K.ni(this.Ao),o=K.ni(this.Fo);a&&!o?this.Ct=a:K.ri(this.Ao),K.ei(this.Fo,!0)}(r=this.vn.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.vn.bootstrap.sessionID),this.Lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return w(this.xo)&&(this.xo=[]),this.xo.push(e),this.Le&&e(this.Le,this.Ct),()=>{this.xo=this.xo.filter((t=>t!==e))}}Oo(){return this.vn.persistence!=="memory"&&!this.yo.ga&&K.Xr()}Do(e){e!==this.Ct&&(this.Ct=e,this.Oo()&&K.ei(this.Ao,e))}$o(){return this.Ct?this.Ct:this.Oo()?K.ni(this.Ao):null}No(e){var t=this.ko;return!fe(t)&&!fe(e)&&5e3>Math.abs(e-t)}qo(e,t,i){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Le||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Le=e,n&&!r||n&&this.No(t)||(this.ko=t,this.yo.register({[Ot]:[t,e,i]}))}jo(){var e,t=(e=this.vn)==null?void 0:e.persistence_save_debounce_ms;return Ke(t)&&t>0}Bo(){this.jo()?this.yo.refreshKey(Ot):(this.yo.flush(),this.yo.load())}Ho(){var e;if(!fe(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ko){this.Bo();var t=this.zo();t[1]===this.Le&&t[2]===this._sessionStartTimestamp&&(this.ko=this._sessionActivityTimestamp,this.yo.register({[Ot]:[this._sessionActivityTimestamp,(e=this.Le)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.yo.flush())}}Uo(){var e=this.zo()[0],t=Ke(e)?e:0,i=Ke(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}Wo(e){return this.Bo(),this.Mo(e,this.Uo())}zo(){var e=this.yo.props[Ot];return M(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.ko=null,this.Eo=void 0,clearTimeout(this.Vo),this.Vo=void 0,this.qo(null,null,null)}setBootstrapSessionId(e,t){t===void 0&&(t=!1);var i=(function(r,n){n===void 0&&(n=new Date().getTime());try{var a=(o=>{var l=o.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(r);return a>n+6e4?void St.error("Bootstrap sessionID cannot be in the future"):a}catch(o){return void St.error("Invalid sessionID in bootstrap",o)}})(e);return!w(i)&&(t?this.Eo={sessionId:e,sessionStartTimestamp:i}:this.qo(e,new Date().getTime(),i),!0)}destroy(){this.To=!0,this.Ho(),clearTimeout(this.Vo),this.Vo=void 0,this.Co&&g&&(g.removeEventListener(si,this.Co,{capture:!1}),this.Co=void 0),this.xo=[]}Lo(){this.Co=()=>{this.Ho(),this.Oo()&&K.ri(this.Fo)},X(g,si,this.Co,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(e===void 0&&(e=!1),t===void 0&&(t=null),i===void 0&&(i=!1),this.vn.cookieless_mode===Xe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),n=this.Le;if(i)this.So=r;else if(fe(this.So)||this.So>r||r-this.So>=1e3){var a,o;(a=(o=this.yo).syncCookieProperties)==null||a.call(o),this.So=r}var l=this.zo(),h=l[1],u=l[2],c=!w(n)&&h!==n,d=this.Uo(),p=this.$o(),v=this.Eo,f=!!v&&(v.sessionStartTimestamp>r+6e4||r-v.sessionStartTimestamp>Wn),m=v?f:Ke(u)&&Math.abs(r-u)>Wn,_=!1,y=c,k=!h||!!v,P=h,E=!k&&!e&&this.Mo(r,d);if(E){(E=this.Wo(r))||St.info("cross-tab refresh kept the session alive",{sessionId:h});var $=this.zo();h=$[1],u=$[2]}if(k||E||m){y=!1;var N=v&&!f;h=N?v.sessionId:this.Io(),p=this.Ro(),St.info("new session ID assigned",{sessionId:h,windowId:p,bootstrapped:!!N,changeReason:{noSessionId:k,activityTimeout:E,sessionPastMaximumLength:m}}),u=N?v.sessionStartTimestamp:r,this.Eo=void 0,_=!0}else p||(p=this.Ro(),_=!0),(y=y||h!==P)&&(St.info("adopted cross-tab session id",{sessionId:h,windowId:p}),_=!0);var I=Ke(d)&&e&&!m?d:r,C=Ke(u)?u:new Date().getTime();this.Do(p),this.qo(h,I,C),e||this.Po();var F={noSessionId:k,activityTimeout:E,sessionPastMaximumLength:m,crossTabAdoption:y};return _&&this.xo.forEach((L=>L(h,p,F))),{sessionId:h,windowId:p,sessionStartTimestamp:C,changeReason:_?F:void 0,lastActivityTimestamp:d}}Po(){this.To||(clearTimeout(this.Vo),this.Vo=setTimeout((()=>{if(!this.To)if(this.Wo(new Date().getTime())){var e=this.Le;this.resetSessionId(),this.wo.emit("forcedIdleReset",{idleSessionId:e})}else this.Po()}),1.1*this.sessionTimeoutMs))}}var Xo=function(s,e){if(!s)return!1;var t=s.userAgent;if(t&&nn(t,e))return!0;try{var i=s?.userAgentData;if(i!=null&&i.brands&&i.brands.some((r=>nn(r?.brand,e))))return!0}catch{}return!!s.webdriver};function Qo(){return(Qo=Y((function*(){var s=xe?.userAgentData;if(s!=null&&s.getHighEntropyValues)try{var e=yield s.getHighEntropyValues(["model"]),t=e?.model;return H(t)&&t.length>0?t:void 0}catch(i){return void S.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}function el(s){var e;return!((e=s.conditions)==null||(e=e.events)==null||(e=e.values)==null||!e.length)}var hi=(s,e)=>{if(!(t=>{try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(s)}catch{return!1}},Os=s=>s.toLowerCase(),tl={exact:(s,e)=>e.some((t=>s.some((i=>t===i)))),is_not:(s,e)=>e.every((t=>s.every((i=>t!==i)))),regex:(s,e)=>e.some((t=>s.some((i=>hi(t,i))))),not_regex:(s,e)=>e.every((t=>s.every((i=>!hi(t,i))))),icontains:(s,e)=>e.map(Os).some((t=>s.map(Os).some((i=>t.includes(i))))),not_icontains:(s,e)=>e.map(Os).every((t=>s.map(Os).every((i=>!t.includes(i))))),gt:(s,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&s.some((r=>i>parseFloat(r)))})),lt:(s,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&s.some((r=>i<parseFloat(r)))}))};function sl(s,e){return!s||Object.entries(s).every((t=>{var i=t[1],r=e?.[t[0]];if(r==null)return!1;var n=tl[i.operator];return!!n&&n(i.values,[String(r)])}))}function ji(s,e,t){return Tt({distinct_id:s,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Or="custom",Jn="i.posthog.com",rh=/^\/static\//,nh=["/s/","/e/","/i/"];class ah{constructor(e){this.Go={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Jn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Go[this.apiHost]||(this.Go[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":Or),this.Go[this.apiHost]}Zo(e){if(rh.test(e)){var t=this.instance.config.asset_host;if(typeof t=="string")return t.trim().replace(/\/$/,"")||void 0}}Qo(e){var t=Bt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}Jo(e,t,i){if(e==="ui")return i;var r=i,n=this.instance.config.rewriteRequestPath;if(n){var a,o=((a=Bt(i))==null?void 0:a.href)||i;r=n(new URL(o)).toString()}if(n&&e==="api"&&nh.some((d=>t.indexOf(d)===0))){var l=this.Qo(r);if(l){var h,u=this.apiHost,c=this.Ko;((h=c)==null?void 0:h.apiHost)===u&&c.rewriteRequestPath===n||(c={apiHost:u,rewriteRequestPath:n,urls:new Set},this.Ko=c),c.urls.add(l)}}return r}isIngestionEndpoint(e){var t=this.Ko,i=this.Qo(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.Jo(e,t,this.uiHost+t);if(e==="flags")return this.Jo(e,t,this.flagsApiHost+t);if(e==="assets"){var i=this.Zo(t);if(i)return this.Jo(e,t,""+i+t)}if(this.region===Or)return this.Jo(e,t,this.apiHost+t);var r=Jn+t;switch(e){case"assets":return this.Jo(e,t,"https://"+this.region+"-assets."+r);case"api":return this.Jo(e,t,"https://"+this.region+"."+r)}}}var U=ee("[Surveys]"),il="seenSurvey_",rl=s=>{try{var e=(t=>((i,r)=>""+il+(function(n){return n.current_iteration&&n.current_iteration>0?n.id+"_"+n.current_iteration:n.id})(r))(0,t))(s);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){U.error("Failed to persist survey seen state",t)}},oh=[Ri.Popover,Ri.Widget,Ri.API],lh={ignoreConditions:!1,ignoreDelay:!1,displayType:Sr.Popover},uh=ee("[PostHog ExternalIntegrations]"),hh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ch{constructor(e){this._instance=e}Zs(e,t){var i;(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return uh.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var n,a,o,l=i[0],h=i[1];!h||(n=O.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[l]||e.Zs(hh[l],(()=>{var u;(u=O.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[l])==null||u.start(e._instance)})),!h&&(a=O.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[l]&&((o=O.__PosthogExtensions__)==null||(o=o.integrations)==null||(o=o[l])==null||o.stop())};for(var i of Object.entries((r=this._instance.config.integrations)!==null&&r!==void 0?r:{})){var r;t()}}}class dh{constructor(e,t){this.I=e,this.Os=t,this.Yo=new Map,this.Rs=!1}add(e){var t=this;return Y((function*(){if(t.Rs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.Yo.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t.Yo.set(e.name,e);try{var i=e.setup(t.Os);i&&(yield i)}catch(n){var r=t.Yo.get(e.name)===e;r&&t.Yo.delete(e.name),t.I.error('Failed to set up browser extension "'+e.name+'"',n),r&&t.Xo(e)}}))()}getExtension(e){return this.Yo.get(e)}dispose(){if(!this.Rs){this.Rs=!0;var e=Array.from(this.Yo.values()).reverse();for(var t of(this.Yo.clear(),e))this.Xo(t)}}Xo(e){try{var t=e.dispose==null?void 0:e.dispose();t&&me(t.then)&&t.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+e.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+e.name+'"',i)}}}class vh{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);var i={};for(var r of e){var n=t?.get_property(r);w(n)||(i[r]=n)}return i}set(e,t){var i;(i=this._instance.persistence)==null||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}}var Kn="extensionsRemoteConfig";class ph{constructor(e){this.Rs=!1,this.instance=e,this.I=S,this.tl=e.el,this.kv=new vh(e),this.onEvent=t=>$s(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(r){this.I.error("Browser extension event listener failed",r)}}))),this.onRemoteConfig=t=>{if(this.Rs)return $s((()=>{}));var i=n=>{try{t(n)}catch(a){this.I.error("Browser extension remote config listener failed",a)}},r=this.instance.il.on(Kn,i);return this.tl&&i(this.tl),$s(r)},this.rl=new dh(S.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(ps))!==null&&e!==void 0?e:this.distinctId}get deviceId(){var e=this.instance.get_property(ps);return typeof e=="string"?e:void 0}get library(){return{name:Z.LIB_NAME,version:Z.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)==null?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,r,n=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(r=n?.sessionStartTimestamp)!==null&&r!==void 0?r: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.rl.add(e)}getExtension(e){return this.rl.getExtension(e)}capture(e,t,i){var r=this;return Y((function*(){i?r.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return $s(this.instance.nl(e))}handleRemoteConfig(e){this.Rs||(this.tl=e,this.instance.il.emit(Kn,e))}sendRequest(e,t){var i=this;return Y((function*(){var r;t===void 0&&(t={});var n=i.instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",e),a={method:t.method,url:t.query?ys(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target==="flags"&&t.compression==="best-available"?Ki.Base64:void 0,timestampMode:t.sentAt};return t.transport==="sendBeacon"?(i.instance._send_request(a),{statusCode:202}):new Promise((o=>{a.callback=o,i.instance._send_request(a)}))}))()}dispose(){this.Rs||(this.Rs=!0,this.rl.dispose())}}var cs={},qi=0,ci=()=>{},Zn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',es="Surveys module not available",Yn="sanitize_properties is deprecated. Use before_send instead",nl="Invalid value for property_denylist config: ",fh=["token","distinct_id",ho],Ct="posthog",al=!Zu&&Ee?.indexOf("MSIE")===-1&&Ee?.indexOf("Mozilla")===-1,gh=s=>{var e={};return s&&s!=="unset"&&("2025-11-30">s||(e.strictMinimumDuration=!0),"2026-05-30">s||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">s||(e.streamNetworkBody=!0),"2026-08-30">s||(e.captureJsonLd=!0)),e},Hi=s=>{var e;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:fu(x?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ci,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:s??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:se&&H(se?.search)&&se.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(g==null||(e=g.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){S.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:br,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:$r},error_tracking:{},_onCapture:ci},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Iu,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:gh(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||t==="unset"||"2026-08-29">t)}))(s))},_h=[["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"]],Xn=s=>{var e={};for(var t of _h){var i=t[0],r=t[1];w(s[i])||(e[r]=s[i])}var n=J({},e,s),a=s.__preview_external_dependency_versioned_paths;return w(a)||(w(s.strict_script_versioning)&&(n.strict_script_versioning=!!a),H(a)&&w(s.asset_host)&&(n.asset_host=a)),M(s.property_blacklist)&&(w(s.property_denylist)?n.property_denylist=s.property_blacklist:M(s.property_denylist)?n.property_denylist=[...s.property_blacklist,...s.property_denylist]:S.error(nl+s.property_denylist)),n};class mh{constructor(){this.__forceAllowLocalhost=!1}get sl(){return this.__forceAllowLocalhost}set sl(e){S.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fe{al(e,t){if(e){var i=this.Yo.indexOf(e);i!==-1&&this.Yo.splice(i,1)}return this.Yo.push(t),t.initialize==null||t.initialize(),t}ol(){return this.config.cookieless_mode===Xe||this.config.cookieless_mode===vt&&this.consent.isRejected()}ll(){if(!this.ol()&&this.get_distinct_id()===kt){var e=this.persistence;if(e){this.ul()||e.load(!0);var t=this.get_distinct_id();if(!t||t===kt){var i=this.config.get_device_id(Ve());this.register({distinct_id:i,$device_id:i}),e.set_property(j,le)}this.hl()}}}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new mh,this.dl=!1,this.version=Z.LIB_VERSION,this.vl=new Set,this.cl="",this.il=new ui,this.Yo=[],this.fl=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Hi(),this.SentryIntegration=Mu,this.sentryIntegration=i=>(function(r,n){var a=$o(r,n);return{name:Co,processEvent:o=>a(o)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.pl=!1,this.gl=null,this.ml=null,this.yl=null,this.scrollManager=new sh(this),this.pageViewManager=new Mn(this),this.rateLimiter=new Vu(this),this.requestRouter=new ah(this),this.consent=new xu(this),this.externalIntegrations=new ch(this);var t=(e=Fe.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(i,r,n)=>{var a=H(i)?{[i]:r}:i;this.setPersonProperties(a),n?.({})},set_once:(i,r,n)=>{var a=H(i)?{[i]:r}:i;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(i=>S.info('send "'+i?.event+'"',i)))}init(e,t,i){if(i&&i!==Ct){var r,n=(r=cs[i])!==null&&r!==void 0?r:new Fe;return n._init(e,t,i),cs[i]=n,cs[Ct][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var r,n;t===void 0&&(t={});var a,o=H(e)?e.trim():"";if(!o)return S.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return o!==((a=this.config)==null?void 0:a.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('"+o+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Hi(t.defaults),t.debug=this.bl(t.debug),this._l=t,this.wl=[],t.person_profiles?this.ml=t.person_profiles:t.process_person&&(this.ml=t.process_person);var l=Hi(t.defaults),h=Xn(t),u=J({},l,h,{name:i,token:o});G(l.rageclick)&&G(h.rageclick)&&(u.rageclick=J({},l.rageclick,h.rageclick)),G(l.session_recording)&&G(h.session_recording)&&(u.session_recording=J({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&S.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Ie.GZipJS;var c=this.ul();if(this.persistence=new Li(this.config,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Li(b({},this.config,{persistence:"sessionStorage"}),c,!1),this.cl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!c&&K.Xr()){var d=K.ni(this.cl);M(d)&&d.forEach(($=>{H($)&&this.vl.add($)}))}else K.ri(this.cl);var p=b({},this.persistence.props),v=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.kl=new Qu(($=>this.Sl($)),this.config.request_queue_config),this.xl=new th(this),this.__request_queue=[];var f=this.ol();if(f||(this.sessionManager=new Gn(this),this.sessionPropsManager=new zn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((($,N,I)=>{(I!=null&&I.activityTimeout||I!=null&&I.sessionPastMaximumLength||I!=null&&I.crossTabAdoption)&&this.Cl()}))),this.Tl(),this.config.__preview_deferred_init_extensions?(S.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ml(f)}),0)):(S.info("Initializing extensions synchronously"),this.Ml(f)),Z.DEBUG=Z.DEBUG||this.config.debug,Z.DEBUG&&S.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p,s:v}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=b({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var m=t.bootstrap.distinctID,_=this.get_distinct_id(),y=this.persistence.get_property(j);if(t.bootstrap.isIdentifiedID&&_!=null&&_!==m&&y===le)this.identify(m);else if(t.bootstrap.isIdentifiedID&&_!=null&&_!==m&&y===pe)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{var k=this.config.get_device_id(Ve()),P=t.bootstrap.isIdentifiedID?k:m;this.persistence.set_property(j,t.bootstrap.isIdentifiedID?pe:le),this.register({distinct_id:m,$device_id:P})}}if(f)this.register_once({distinct_id:kt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Ve());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(j,le)}return X(g,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function($,N){var I=$.config.segment;if(!I)return N();(function(C,F){var L=C.config.segment;if(!L)return F();var T=B=>{var V=()=>B.anonymousId()||Ve();C.config.get_device_id=V,B.id()&&(C.register({distinct_id:B.id(),$device_id:V()}),C.persistence.set_property(j,pe)),F()},R=L.user();"then"in R&&me(R.then)?R.then(T):T(R)})($,(()=>{I.register((C=>{typeof Promise<"u"&&Promise.resolve||Oi.warn("This browser does not have Promise support, and can not use the segment integration");var F=(L,T)=>{if(!T)return L;L.event.userId||L.event.anonymousId===C.get_distinct_id()||(Oi.info("No userId set, resetting PostHog"),C.reset()),L.event.userId&&L.event.userId!==C.get_distinct_id()&&(Oi.info("UserId set, identifying with PostHog"),C.identify(L.event.userId));var R=C.calculateEventProperties(T,L.event.properties);return L.event.properties=Object.assign({},R,L.event.properties),L};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:L=>F(L,L.event.event),page:L=>F(L,Ft),identify:L=>F(L,Si),screen:L=>F(L,"$screen")}})($)).then((()=>{N()}))}))})(this,(()=>this.El())):this.El(),me(this.config._onCapture)&&this.config._onCapture!==ci&&(S.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",($=>this.config._onCapture($.event,$)))),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 Qo.apply(this,arguments)})().then(($=>{$&&this.register({[ki]:$})})).catch(ci),this}Il(e){var t=e;return H(t.name)&&me(t.setup)}Rl(e,t){this.Il(e)?t.push((()=>{this.Pl().add(e).catch((()=>e.dispose==null?void 0:e.dispose())).catch((i=>{S.error('Failed to dispose browser extension "'+e.name+'"',i)}))})):this.Yo.push(e)}Tl(){var e,t,i,r,n,a,o=(e=(t=this.config.__extensionClasses)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:(i=Fe.__defaultExtensionClasses)==null?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||((r=this.Al)==null||r.call(this),this.Al=void 0,this.featureFlags=new o(this)),me(this.featureFlags.onReloading)&&me(this.featureFlags.setup)?this.Al||(this.Al=this.featureFlags.onReloading((()=>{this.il.emit("featureFlagsReloading",!0)})),this.Pl().add(this.featureFlags)):(n=(a=this.featureFlags).initialize)==null||n.call(a))}Ml(e){var t,i,r,n,a,o,l,h=performance.now(),u=b({},Fe.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.exceptions&&this.Yo.push(this.exceptions=(t=this.exceptions)!==null&&t!==void 0?t:new u.exceptions(this)),u.historyAutocapture&&this.Yo.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Yo.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Yo.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Yo.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Rl(this.autocapture=new u.autocapture(this),c),u.surveys&&this.Rl(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new u.surveys(this),c),u.logs&&this.Rl(this.logs=(r=this.logs)!==null&&r!==void 0?r:new u.logs(this),c),u.metrics&&this.Yo.push(this.metrics=(n=this.metrics)!==null&&n!==void 0?n:new u.metrics(this)),u.conversations&&this.Yo.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.Yo.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Yo.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Yo.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Yo.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Yo.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ru)),u.toolbar&&this.Yo.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.Yo.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.Yo.forEach((d=>{d.initialize&&c.push((()=>{d.initialize==null||d.initialize()}))})),c.push((()=>{if(this.Fl){var d=this.Fl;this.Fl=void 0,this.Yo.forEach((p=>p.onRemoteConfig==null?void 0:p.onRemoteConfig(d)))}})),this.Ol(c,h)}Ol(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Ol(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){S.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({[co]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[vo]:r}),this.config.__preview_deferred_init_extensions&&S.info("PostHog extensions initialized ("+r+"ms)")}za(e){var t;if(!x||!x.body)return S.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.za(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Fl=e),this.el=e,this.compression=void 0,e.ok){var i,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=A(r.supportedCompression,Ie.GZipJS)?Ie.GZipJS:A(r.supportedCompression,Ie.Base64)?Ie.Base64:void 0),(i=r.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.ml?this.ml:br}),(t=this.Ll)==null||t.handleRemoteConfig(e),this.Yo.forEach((n=>n.onRemoteConfig==null?void 0:n.onRemoteConfig(e)))}El(){try{this.config.loaded(this)}catch(i){S.critical("`loaded` function failed",i)}if(this.Dl(),this.config.internal_or_test_user_hostname&&se!=null&&se.hostname){var e=se.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ol())&&this.$l()}),1),this.Nl=new qo(this),this.Nl.load()}Dl(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.kl)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ss(this.__request_queue,(e=>this.Sl(e))),this.__request_queue=[],this.Dl()}_handle_unload(){var e,t,i,r,n;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush("sendBeacon"),this.config.request_batching?(this.ql()&&this.capture(Ei),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.kl)==null||r.unload(),(n=this.xl)==null||n.unload()):this.ql()&&this.capture(Ei,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?al?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=b({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?(t=this.compression)!==null&&t!==void 0?t:e.compressionFallback:e.compression,(w(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(i=>{var r,n,a,o=b({},i);o.timeout=o.timeout||6e4;var l,h,u,c,d,p=(r=o.transport)!==null&&r!==void 0?r:"fetch";p==="sendBeacon"&&w(o.compression)&&o.data&&(o.compression=Ie.Base64),o.method==="POST"&&o.data&&(o.timestampMode==="capture-body"?o.data={api_key:(h=(d=(c=(M(l=o.data)?l:[l]).map((_=>b({},_,_.timestamp instanceof Date&&!isNaN(_.timestamp.getTime())?{timestamp:_.timestamp.toISOString()}:{}))))[0])==null||(u=d.properties)==null?void 0:u.token)!==null&&h!==void 0?h:d?.token,batch:c,sent_at:new Date().toISOString()}:o.timestampMode==="body"&&(o.data=(function(_,y){return y===void 0&&(y=new Date().toISOString()),M(_)?_.map((k=>b({},k,{sent_at:y}))):b({},_,{sent_at:y})})(o.data))),o.url=Vn(o.url,o.method,o.compression,o.timestampMode);var v=qs.filter((_=>!o.disableTransport||!_.transport||!o.disableTransport.includes(_.transport))),f=(n=(a=(function(_,y){for(var k=0;_.length>k;k++)if(_[k].transport===p)return _[k]})(v))==null?void 0:a.method)!==null&&n!==void 0?n:v[0].method;if(!f)throw new Error("No available transport method");var m=_=>{try{f(_)}catch(y){Zo(y)?S.warn(y):S.error(y),o.callback==null||o.callback({statusCode:0,error:y})}};p!=="sendBeacon"&&o.data&&o.compression===Ie.GZipJS&&cl&&typeof Promise<"u"&&!js?Yu(o).then((_=>{m(_)})).catch((_=>{if(dn(_))return js=!0,void m(b({},o,{compression:void 0,url:Vn(i.url,i.method,void 0,i.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;var k="name"in y?String(y.name):"";return dn(y)||k===Ka})(_)&&(js=!0),m(o)})):f(o)})(b({},e,{callback:i=>{var r,n;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(n=this.config).on_request_error)==null||r.call(n,i),e.callback==null||e.callback(i)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Sl(e){this.xl?this.xl.retriableRequest(e):this._send_request(e)}_execute_array(e){qi++;try{var t,i=[],r=[],n=[];Ss(e,(o=>{if(o)if(M(t=o[0]))n.push(o);else if(me(o))try{o.call(this)}catch(l){S.error("Error executing queued PostHog call",o,l)}else M(o)&&t==="alias"?i.push(o):M(o)&&t.indexOf("capture")!==-1&&me(this[t])?n.push(o):r.push(o)}));var a=function(o,l){Ss(o,(function(h){try{if(M(h[0])){var u=l;z(h,(function(c){u=u[c[0]].apply(u,c.slice(1))}))}else l[h[0]].apply(l,h.slice(1))}catch(c){S.error("Error executing queued PostHog call",h,c)}}))};a(i,this),a(r,this),a(n,this)}finally{qi--}}push(e){if(qi>0&&M(e)&&H(e[0])){var t=Fe.prototype[e[0]];me(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.kl){if(this.is_capturing())if(!w(e)&&H(e)){this.ll();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){t!=null&&t.$current_url&&!H(t?.$current_url)&&(S.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||i!=null&&i.jl||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&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,d=i?.timestamp||c,p=un(i?.uuid,Ve),v={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},d,p)};e===Ft&&this.config.__preview_capture_bot_pageviews&&h&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),u&&(v.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var f=e==="$feature_flag_called"&&v.properties.$feature_flag_has_experiment===!1&&this.get_property(Xs)===!0;i?.$set&&!f&&(v.$set=i?.$set);var m=i?.$unset;m&&(v.$unset=m);var _,y,k,P=f?void 0:this.Bl(i?.$set_once,e!==yn,e===Si);if(P&&(v.$set_once=P),i!=null&&i._noTruncate||(n=this.config.properties_string_max_length,a=v,o=T=>H(T)?T.slice(0,n):T,l=new Set,v=(function T(R,B){if(R!==Object(R))return o?o(R):R;if(!l.has(R)){var V;if(l.add(R),M(R))V=[],Ss(R,(Q=>{V.push(T(Q))}));else{var q={};z(R,((Q,te)=>{l.has(Q)||(q[te]=T(Q))})),V=q}return V}})(a)),v.timestamp=d,w(i?.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=c),f&&(v.properties=(function(T,R){R===void 0&&(R=[]);var B={},V=q=>{T[q]!==void 0&&(B[q]=T[q])};return dl.forEach(V),R.forEach(V),B})(v.properties,fh)),e===Qe.DISMISSED||e===Qe.SENT){var E=t?.[Mi.SURVEY_ID],$=t?.[Mi.SURVEY_ITERATION];rl({id:E,current_iteration:$}),v.$set=b({},v.$set,{[(_={id:E,current_iteration:$},y=e===Qe.SENT?"responded":"dismissed",k="$survey_"+y+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(k="$survey_"+y+"/"+_.id+"/"+_.current_iteration),k)]:!0})}else e===Qe.SHOWN&&(v.$set=b({},v.$set,{[Mi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Uu.SHOWN){var N=t?.[Nn.TOUR_TYPE];N&&(v.$set=b({},v.$set,{[Nn.TOUR_LAST_SEEN_DATE+"/"+N]:new Date().toISOString()}))}var I=b({},v.properties.$set,v.$set);if(Ne(I)||this.setPersonPropertiesForFlags(I),!D(this.config.before_send)){var C=this.Jn(v);if(!C)return;(v=C).uuid=un(v.uuid,Ve)}this.il.emit("eventCaptured",v);var F=(r=i?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),L={method:"POST",url:F,data:v,compression:"best-available",timestampMode:i?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(F)?"body":"capture-body",batchKey:i?._batchKey,transport:i?.transport};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Sl(L):this.kl.enqueue(L),v}S.critical("This capture call is ignored due to client rate limiting.")}}else S.error("No event name provided to posthog.capture")}else S.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}getExtension(e){var t;return(t=this.Ll)==null?void 0:t.getExtension(e)}Pl(){var e;return(e=this.Ll)!==null&&e!==void 0?e:this.Ll=new ph(this)}nl(e){this.fl.push(e);var t=!0;return()=>{if(t){t=!1;var i=this.fl.indexOf(e);i!==-1&&this.fl.splice(i,1)}}}Hl(e){var t,i,r;return e===void 0&&(e=!0),!((t=this.persistence)==null||!t.consumeCookieIdentityChange())&&(this.yl=null,this.persistence.get_property(j)===le&&((r=this.sessionPersistence)==null||r.clear(),this.vl.clear(),this.zl()),(i=this.featureFlags)==null||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.Hl();var a=n?void 0:this.persistence.remove_event_timer(e),o=b({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.ol()&&(o[ho]=!0),e==="$snapshot"){var l=b({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!H(o.distinct_id)&&!oe(o.distinct_id)||Hs(o.distinct_id))&&S.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var h,u=(function(E,$,N,I){var C,F,L,T;if(I===void 0&&(I=!1),!Ee)return{};var R,B=E?[...Vt,...$||[]]:[],V=(function(ws){for(var Te=0;on.length>Te;Te++){var xs=on[Te],wt=xs[1],xt=xs[0].exec(ws),Gt=xt&&(me(wt)?wt(xt,ws):wt);if(Gt)return Gt}return["",""]})(Ee),q=V[0],Q=V[1],te=(R=typeof navigator<"u"?navigator:void 0)!=null&&R.brave?{brave:!0}:{},he={};w(N)||(he.detectGoogleSearchApp=N);var de={},ge=(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,Pe=(F=navigator)==null?void 0:F.maxTouchPoints,re=g==null||(L=g.screen)==null?void 0:L.width,ve=g==null||(T=g.screen)==null?void 0:T.height,ce=g?.devicePixelRatio;w(ge)||(de.userAgentDataPlatform=ge),w(Pe)||(de.maxTouchPoints=Pe),w(re)||(de.screenWidth=re),w(ve)||(de.screenHeight=ve),w(ce)||(de.devicePixelRatio=ce);var je,at,ae,Me,tt,Wt,Oe,ke,bs=J(zr({$os:q,$os_version:Q,$browser:Wa(Ee,navigator.vendor,te,he),$device:ln(Ee),$device_type:(at=Ee,ae=de,ke=ln(at),ke===Fa||ke===Ia||ke==="Kobo"||ke==="Kindle Fire"||ke===Ha?Nt:ke===ds||ke===Mt||ke===vs||ke===Qi?"Console":ke===$a?"Wearable":ke?$e:ae?.userAgentDataPlatform==="Android"&&((Me=ae?.maxTouchPoints)!==null&&Me!==void 0?Me:0)>0?600>Math.min((tt=ae?.screenWidth)!==null&&tt!==void 0?tt:0,(Wt=ae?.screenHeight)!==null&&Wt!==void 0?Wt:0)/((Oe=ae?.devicePixelRatio)!==null&&Oe!==void 0?Oe:1)?$e:Nt:"Desktop"),$timezone:jo(),$timezone_offset:qu()}),{$current_url:_s(I?rt(se?.href):se?.href,B,ms),$host:se?.host,$pathname:se?.pathname,$raw_user_agent:Ee.length>1e3?Ee.substring(0,997)+"...":Ee,$browser_version:Rl(Ee,navigator.vendor,te,he),$browser_language:An(),$browser_language_prefix:(je=An(),typeof je=="string"?je.split("-")[0]:void 0),$screen_height:g?.screen.height,$screen_width:g?.screen.width,$viewport_height:g?.innerHeight,$viewport_width:g?.innerWidth,$lib:Z.LIB_NAME,$lib_version:Z.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Z.SDK_DIST_CHANNEL&&(bs.$sdk_dist_channel=Z.SDK_DIST_CHANNEL),bs})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0),d=c.windowId;o.$session_id=c.sessionId,o.$window_id=d}this.sessionPropsManager&&J(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&J(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.xl)==null?void 0:p.length}catch(E){o.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===Or&&(o.$lib_custom_api_host=this.config.api_host),h=e!==Ft||n?e!==Ei||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=J(o,h),e===Ft&&x&&(o.title=x.title),!w(a)){var v=i.getTime()-a;o.$duration=parseFloat((v/1e3).toFixed(3))}Ee&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var f=this.persistence.properties(),m=this.sessionPersistence.properties();z(["$referrer","$referring_domain"],(E=>{E in f&&delete m[E]}));var _={};if(this.fl.length>0)for(var y of this.fl.slice())try{J(_,y())}catch(E){S.error("Failed to produce browser extension event properties",E)}(o=J({},u,f,m,b({},_,o))).$is_identified=this._isIdentified(),M(this.config.property_denylist)?z(this.config.property_denylist,(function(E){delete o[E]})):S.error(nl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(S.error(Yn),o=k(o,e));var P=this.Ul();return o.$process_person_profile=P,P&&!n&&this.Wl("_calculate_event_properties"),o}Bl(e,t,i){var r;if(t===void 0&&(t=!0),i===void 0&&(i=!1),!this.persistence||!this.Ul()||this.dl&&!i)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=J({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(S.error(Yn),o=l(o,"$set_once")),t&&(this.dl=!0),Ne(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var r;(r=this.persistence)==null||r.register_once(e,t,i)}register_for_session(e){var t,i;(t=this.persistence)==null||t.syncCookieProperties(),this.Hl(),(i=this.sessionPersistence)==null||i.register(e),Object.keys(e).forEach((r=>this.vl.add(r))),this.zl()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.vl.delete(e),this.zl()}Vl(e,t){this.register({[e]:t})}Cl(){this.vl.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.vl.clear(),this.zl()}zl(){var e;if(this.cl)if(this.config.persistence==="memory"||(e=this.sessionPersistence)!=null&&e.ga||!K.Xr())K.ri(this.cl);else{var t=[];this.vl.forEach((i=>t.push(i))),t.length>0?K.ei(this.cl,t):K.ri(this.cl)}}getFeatureFlag(e,t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,t){var i,r;return(i=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))!==null&&i!==void 0?i:t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,i){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.il.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:es}),()=>{})}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:es})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:es})}renderSurvey(e,t){var i;(i=this.surveys)==null||i.renderSurvey(e,t)}displaySurvey(e,t){var i;t===void 0&&(t=lh),(i=this.surveys)==null||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return(t=(i=this.surveys)==null?void 0:i.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:es}}canRenderSurveyAsync(e,t){var i,r;return t===void 0&&(t=!1),(i=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:es})}Gl(e){return!e||Hs(e)?(S.critical("Unique user id has not been set in posthog.identify"),!1):e===kt?(S.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(S.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return S.uninitializedWarning("posthog.identify");if(oe(e)&&(e=e.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.Gl(e)&&this.Wl("posthog.identify")){this.ll();var r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.Hl(!1),o=this.persistence.ba(),l=!1;try{var h=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ps)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),e!==h&&e!==this.get_property($t)&&(this.unregister($t),this.register({distinct_id:e}));var u,c=(this.persistence.get_property(j)||le)===le,d=e!==h,p=!d&&c;if(d&&c)this.persistence.set_property(j,pe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture(Si,{distinct_id:e,$anon_distinct_id:h},{$set:t||{},$set_once:i||{}}),this.yl=ji(e,t,i),(u=this.featureFlags)==null||u.setAnonymousDistinctId(h);else if(p){this.persistence.set_property(j,pe);var v=t||{},f=i||{};this.setPersonPropertiesForFlags({$set:v,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture("$set",{$set:v,$set_once:f}),this.yl=ji(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);d||n||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ye)):p&&(t||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Sa(l)}}}setPersonProperties(e,t){if((e||t)&&this.Wl("posthog.setPersonProperties")){var i=ji(this.get_distinct_id(),e,t);this.yl!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.yl=i):S.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(M(e)?e:[e]).filter((r=>H(r)&&r.length>0));i.length!==0&&this.Wl("posthog.unsetPersonProperties")&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.yl=null)}group(e,t,i){var r;if(e&&t){(r=this.persistence)==null||r.syncCookieProperties(),this.Hl();var n=this.getGroups(),a=n[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},n,{[e]:t})}),a||i){var o={$group_type:e,$group_key:t};i&&(o.$group_set=i),this.capture(yn,o)}i&&this.setGroupPropertiesForFlags({[e]:i}),a&&!i&&this.reloadFeatureFlags()}else S.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;t===void 0&&(t=!0),(i=this.featureFlags)==null||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;t===void 0&&(t=!0),this.Wl("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)==null||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t=we(e)?e:e?.resetDeviceID,i=we(e)||e==null?void 0:e.bootstrap;this.Zl(t,!1,i)}Zl(e,t,i){var r,n,a;if(t===void 0&&(t=!1),S.info("reset"),!this.__loaded)return S.uninitializedWarning("posthog.reset");var o=i?.sessionID;this.config.bootstrap=i||((r=this._l)==null?void 0:r.bootstrap)||{},(n=this.featureFlags)==null||n.updateConfig==null||n.updateConfig(this.config,this.Ua());var l=this.get_property(ps),h=this.get_property(ki),u=this.get_property(ft),c=this.is_capturing();this.consent.reset(),t||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=(a=this.persistence)==null||a.ba==null?void 0:a.ba(),p=!1;try{var v,f,m,_,y,k,P,E,$,N,I,C,F;if((v=this.persistence)==null||v.clear(),(f=this.sessionPersistence)==null||f.clear(),this.vl.clear(),this.zl(),w(u)||(N=this.persistence)==null||N.register({[ft]:u}),(m=this.surveys)==null||m.reset(),(_=this.featureFlags)==null||_.reset(),(y=this.conversations)==null||y.reset(),(k=this.logs)==null||k.reset(),(P=this.metrics)==null||P.reset(),(E=this.persistence)==null||E.set_property(j,le),($=this.sessionManager)==null||$.resetSessionId(),this.yl=null,this.config.cookieless_mode===Xe)this.register_once({distinct_id:kt,$device_id:null},"");else{var L=this.config.get_device_id(Ve());this.register_once({distinct_id:L,$device_id:e?L:l},""),e||w(h)||this.register({[ki]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID===void 0||this.ol()||((F=this.persistence)==null||F.set_property(j,i.isIdentifiedID?pe:le),this.register({distinct_id:i.distinctID})),(I=this.featureFlags)==null||I.initialize(),!(w(o)||(C=this.sessionManager)!=null&&C.setBootstrapSessionId(o,!0)))){var T=b({},i);delete T.sessionID,this.config.bootstrap=T}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var R;d&&((R=this.persistence)==null||R.Sa==null||R.Sa(p))}this.reloadFeatureFlags()}shutdown(e){var t=this;return Y((function*(){var i,r,n,a,o;if(t.__loaded){t.Pl().dispose(),(i=t.sessionRecording)==null||i.dispose(),(r=t.logs)==null||r.flushLogs("sendBeacon"),(n=t.metrics)==null||n.flush("sendBeacon"),(a=t.kl)==null||a.unload(),(o=t.xl)==null||o.unload();try{var l;(l=t.featureFlags)==null||l.destroy()}catch(h){S.error("Error while destroying feature flags",h)}}else S.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(i=this.conversations)==null||i.Ql()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Jl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(io)?(S.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wl("posthog.alias")?(w(t)&&(t=this.get_distinct_id()),e!==t?(this.Vl($t,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(S.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(G(e)){var i,r,n,a,o,l,h,u,c,d,p,v;J(this.config,Xn(e));var f=this.ul();(i=this.persistence)==null||i.update_config(this.config,t,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Li(b({},this.config,{persistence:"sessionStorage"}),f,!1);var m,_=this.bl(this.config.debug);we(_)&&(this.config.debug=_),we(this.config.debug)&&(this.config.debug?(Z.DEBUG=!0,W.Xr()&&W.ei("ph_debug",!0),S.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(Z.DEBUG=!1,W.Xr()&&W.ri("ph_debug"))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.Ua()),(n=this.exceptionObserver)==null||n.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(l=this.tracingHeaders)==null||l.startIfEnabledOrStop(),(h=this.autocapture)==null||h.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((m=this.historyAutocapture)==null||m.startIfEnabledOrStop()),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(p=this.surveys)==null||p.loadIfEnabled(),this.hl(),(v=this.externalIntegrations)==null||v.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){Z.LIB_NAME=e,Z.LIB_VERSION=t}startSessionRecording(e){var t,i,r,n,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(b({},r,t))}}addExceptionStep(e,t){var i;(i=this.exceptions)==null||i.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:Fe.Kl}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return(t=(i=this.toolbar)==null?void 0:i.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Ct;return t!==Ct&&(t=Ct+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(j))===pe||((t=this.sessionPersistence)==null?void 0:t.get_property(j))===pe}Ul(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===br&&!this._isIdentified()&&Ne(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[$t])&&((t=this.persistence)==null||(t=t.props)==null||!t[ti]))}ql(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.Ul()||this.Wl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wl(e){return this.config.person_profiles==="never"?(S.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Vl(ti,!0),!0)}ul(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==vt)}hl(){var e,t,i,r,n,a=this.ul();return this.is_capturing()||(i=this.logs)==null||i.Yl(),((e=this.persistence)==null?void 0:e.ga)!==a&&((r=this.persistence)==null||r.set_disabled(a)),((t=this.sessionPersistence)==null?void 0:t.ga)!==a&&((n=this.sessionPersistence)==null||n.set_disabled(a)),a&&(this.vl.clear(),this.zl()),a}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Xe){if(this.ol()){var i,r,n,a,o;this.Zl(!0,!0),(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new Gn(this),this.pageViewManager=new Mn(this),this.persistence&&(this.sessionPropsManager=new zn(this,this.sessionManager,this.persistence));var l,h=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=Fe.__defaultExtensionClasses)==null?void 0:o.sessionRecording;h&&(this.sessionRecording=this.al(this.sessionRecording,new h(this)),this.el&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.el)))}var u,c;this.consent.optInOut(!0),this.hl(),this.Dl(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==vt&&((u=this.surveys)==null||u.loadIfEnabled()),(w(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$l()}else S.warn(Zn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==Xe?(this.config.cookieless_mode===vt&&this.consent.isOptedIn()&&this.Zl(!0,!0),this.consent.optInOut(!1),this.hl(),this.config.cookieless_mode===vt&&(this.register({distinct_id:kt,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.$l(),this.Dl())):S.warn(Zn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Xe||(this.config.cookieless_mode===vt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hl()}_is_bot(){return xe?Xo(xe,this.config.custom_blocked_useragents):void 0}$l(){x&&(x.visibilityState==="visible"?this.pl||(this.pl=!0,this.capture(Ft,{title:x.title},{send_instantly:!0}),this.gl&&(x.removeEventListener(Ht,this.gl),this.gl=null)):this.gl||(this.gl=this.$l.bind(this),X(x,Ht,this.gl)))}debug(e){e===!1?(g?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(g?.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}))}Ua(){var e=this._l||{};return"advanced_disable_flags"in e?!!e.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(t,i,r,n,a){var o=i in t&&!D(t[i]),l=r in t&&!D(t[r]);return o?t[i]:!!l&&(a&&a.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[r])})(e,"advanced_disable_flags","advanced_disable_decide",0,S)}Jn(e){var t;if(D(this.config.before_send))return e;var i=Object.keys((t=e.properties)!==null&&t!==void 0?t:{}).filter(xl),r=M(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var a of r)try{if(n=a(n),D(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return wl(e.event)?S.warn(o+". This can cause unexpected behavior."):S.info(o),null}n.properties&&!Ne(n.properties)||S.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(h){return S.error("Error in beforeSend function for event '"+e.event+"':",h),null}for(var l of i)if(n.properties&&D(n.properties[l]))return S.warn("Event '"+e.event+"' had its '"+l+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return(e=this.pageViewManager.Ks)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}bl(e){var t=we(e)&&!e,i=W.Xr()&&W.ti("ph_debug")==="true";return!t&&(!!i||e)}}Fe.__defaultExtensionClasses={},Fe.Kl=(()=>{var s=()=>{};return{trace:s,debug:s,info:s,warn:s,error:s,fatal:s}})(),(function(s,e){for(var t=0;e.length>t;t++)s.prototype[e[t]]=vu(s.prototype[e[t]])})(Fe,["identify"]);class ol{constructor(e){this.disabled=e===!1;var t=G(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;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>i-r.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}}var Bi="$copy_autocapture",Ts=ee("[AutoCapture]");function Ui(s,e){return e.length>s?e.slice(0,s)+"...":e}function yh(s){if(s.previousElementSibling)return s.previousElementSibling;var e=s;do e=e.previousSibling;while(e&&!nt(e));return e}function bh(s,e){var t,i,r=e.e,n=e.maskAllElementAttributes,a=e.maskAllText,o=e.elementAttributeIgnoreList,l=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!nt(s))return{props:{}};for(var u=[s],c=new Set([s]),d=s;d.parentNode&&!Ce(d,"body")&&wo>u.length;)if(bo(d.parentNode)){var p=d.parentNode.host;if(c.has(p))break;c.add(p),u.push(p),d=p}else{if(!nt(d.parentNode)||c.has(d.parentNode))break;c.add(d.parentNode),u.push(d.parentNode),d=d.parentNode}var v,f,m=[],_={},y=!1,k=!1;if(z(u,(I=>{var C=Er(I);if(Ce(I,"a")){var F=I.getAttribute("href");y=!!(C&&F&&us(F))&&(h?rt(F):F)}A(ni(I),"ph-no-capture")&&(k=!0),m.push((function(T,R,B,V,q){q===void 0&&(q=!1);var Q=T.tagName.toLowerCase(),te={tag_name:Q};Gr.indexOf(Q)>-1&&!B&&(te.$el_text=Q.toLowerCase()==="a"||Q.toLowerCase()==="button"?Ui(1024,Tn(T)):Ui(1024,gs(T)));var he=ni(T);he.length>0&&(te.classes=he.filter((function(re){return re!==""}))),z(T.attributes,(function(re){var ve;if((!Io(T)||["name","id","class","aria-label"].indexOf(re.name)!==-1)&&(V==null||!V.includes(re.name))&&!R&&us(re.value)&&(!H(ve=re.name)||ve.substring(0,10)!=="_ngcontent"&&ve.substring(0,7)!=="_nghost")){var ce=re.value;re.name==="class"&&(ce=Wr(ce).join(" ")),te["attr__"+re.name]=Ui(1024,re.name==="href"&&q?rt(ce):ce)}}));for(var de=1,ge=1,Pe=T;Pe=yh(Pe);)de++,Pe.tagName===T.tagName&&ge++;return te.nth_child=de,te.nth_of_type=ge,te})(I,n,a,o,h));var L=(function(T){if(!Er(T))return{};var R={};return z(T.attributes,(function(B){if(B.name&&B.name.indexOf("data-ph-capture-attribute")===0){var V=B.name.replace("data-ph-capture-attribute-",""),q=B.value;V&&q&&us(q)&&(R[V]=q)}})),R})(I);J(_,L)})),k)return{props:{},explicitNoCapture:k};if(a||(m[0].$el_text=Ce(s,"a")||Ce(s,"button")?Tn(s):gs(s)),y){var P,E;m[0].attr__href=y;var $=(P=Bt(y))==null?void 0:P.host,N=g==null||(E=g.location)==null?void 0:E.host;$&&N&&$!==N&&(v=y)}return{props:J({$event_type:r.type,$ce_version:1},l?{}:{$elements:m},{$elements_chain:(f=m,(function(I){return I.map((C=>{var F,L,T="";if(C.tag_name&&(T+=C.tag_name),C.attr_class)for(var R of(C.attr_class.sort(),C.attr_class))T+="."+R.replace(/"/g,"");var B=b({},C.text?{text:C.text}:{},{"nth-child":(F=C.nth_child)!==null&&F!==void 0?F:0,"nth-of-type":(L=C.nth_of_type)!==null&&L!==void 0?L:0},C.href?{href:C.href}:{},C.attr_id?{attr_id:C.attr_id}:{},C.attributes),V={};return Ns(B).sort(((q,Q)=>{return(he=Q[0])>(te=q[0])?-1:te>he?1:0;var te,he})).forEach((q=>{var Q=q[1];return V[Ln(q[0].toString())]=Ln(Q.toString())})),(T+=":")+Ns(V).map((q=>q[0]+'="'+q[1]+'"')).join("")})).join(";")})((function(I){return I.map((C=>{var F,L,T={text:(F=C.$el_text)==null?void 0:F.slice(0,400),tag_name:C.tag_name,href:(L=C.attr__href)==null?void 0:L.slice(0,2048),attr_class:Tu(C),attr_id:C.attr__id,nth_child:C.nth_child,nth_of_type:C.nth_of_type,attributes:{}};return Ns(C).filter((R=>R[0].indexOf("attr__")===0)).forEach((R=>T.attributes[R[0]]=R[1])),T}))})(f)))},(t=m[0])!=null&&t.$el_text?{$el_text:(i=m[0])==null?void 0:i.$el_text}:{},v&&r.type==="click"?{$external_click_url:v}:{},_)}}class wh{constructor(e){this.name="autocapture",this.Ts=!1,this.Ms=null,this.Es=!1,this.Is=!1,this.vn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Rs=!1,this.Ps=e,this.Ps.refresh(this.vn),this.rageclicks=new ol(this.vn.rageclick),this.As=null}setup(e){this.Fs(),this.Os=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Rs?t.dispose():(this.Ls=t,this.startIfEnabled())}dispose(){var e;this.Rs||(this.Rs=!0,this.Os=void 0,(e=this.Ls)==null||e.dispose(),this.Ls=void 0,this.Ds())}$s(){return this.Ps.refresh(this.vn),this.vn}Fs(){var e,t;return this.$s(),this.vn.url_allowlist=(e=this.vn.url_allowlist)==null?void 0:e.map((i=>new RegExp(i))),this.vn.url_ignorelist=(t=this.vn.url_ignorelist)==null?void 0:t.map((i=>new RegExp(i))),this.vn}Ns(){if(this.isBrowserSupported()){if(g&&x){var e=this.qs=i=>{i=i||g?.event;try{this.js(i)}catch(r){Ts.error("Failed to capture event",r)}};if(X(x,"submit",e,{capture:!0}),X(x,"change",e,{capture:!0}),X(x,"click",e,{capture:!0}),this.$s().capture_copied_text){var t=this.Bs=i=>{i=i||g?.event;try{this.js(i,Bi)}catch(r){Ts.error("Failed to capture clipboard event",r)}};X(x,"copy",t,{capture:!0}),X(x,"cut",t,{capture:!0}),X(x,"paste",t,{capture:!0})}}}else Ts.info("Disabling Automatic Event Collection because this browser is not supported")}Ds(){this.qs&&(x?.removeEventListener("submit",this.qs,!0),x?.removeEventListener("change",this.qs,!0),x?.removeEventListener("click",this.qs,!0),this.qs=void 0),this.Bs&&(x?.removeEventListener("copy",this.Bs,!0),x?.removeEventListener("cut",this.Bs,!0),x?.removeEventListener("paste",this.Bs,!0),this.Bs=void 0),this.Ts=!1}startIfEnabled(){!this.Rs&&this.Os&&this.isEnabled&&!this.Ts&&(this.Ns(),this.Ts=!0)}onRemoteConfig(e){if(!this.Rs)if(this.Es=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Is=t.elementsChainAsString);var i,r=t.autocapture_opt_out;we(r)&&((i=this.Os)==null||i.kv.set(nr,r),this.Ms=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.As=e}getElementSelectors(e){var t,i=[];return(t=this.As)==null||t.forEach((r=>{var n=x?.querySelectorAll(r);n?.forEach((a=>{e===a&&i.push(r)}))})),i}get isEnabled(){var e,t;if(this.Rs)return!1;var i=(e=this.Os)==null?void 0:e.kv.get(nr),r=this.Ms,n=this.$s(),a=n.remoteRequestsDisabled&&!this.Es;if(fe(r)&&!we(i)&&!a)return!1;var o=(t=this.Ms)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}js(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i=xr(e);yo(i)&&(i=i.parentNode||null);var r,n=this.Fs();t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&So(i,n.rageclick)&&this.js(e,"$rageclick");var a=t===Bi,o=a?b({},n,{dom_event_allowlist:void 0}):n;if(i&&(function(_,y,k,P,E,$){var N;if(!g||Jr(_)||k!=null&&k.url_allowlist&&!Sn(k.url_allowlist,$)||k!=null&&k.url_ignorelist&&Sn(k.url_ignorelist,$))return!1;if(k!=null&&k.dom_event_allowlist){var I=k.dom_event_allowlist;if(I&&!I.some((B=>y.type===B)))return!1}var C=Po(_,P),F=C.parentIsUsefulElement,L=C.targetElementList;if(!(function(B,V){var q=V?.element_allowlist;if(w(q))return!0;var Q,te=function(de){if(q.some((ge=>de.tagName.toLowerCase()===ge)))return{v:!0}};for(var he of B)if(Q=te(he))return Q.v;return!1})(L,k)||!kr(L,k?.css_selector_allowlist)||kr(L,(N=k?.css_selector_ignorelist)!==null&&N!==void 0?N:Pu))return!1;try{var T=g.getComputedStyle(_);if(T&&T.getPropertyValue("cursor")==="pointer"&&y.type==="click")return!0}catch{}var R=_.tagName.toLowerCase();switch(R){case"html":return!1;case"form":return(E||["submit"]).indexOf(y.type)>=0;case"input":case"select":case"textarea":return(E||["change","click"]).indexOf(y.type)>=0;default:return F?(E||["click"]).indexOf(y.type)>=0:(E||["click"]).indexOf(y.type)>=0&&(Gr.indexOf(R)>-1||_.getAttribute("contenteditable")==="true")}})(i,e,o,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=bh(i,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Is,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(u.$element_selectors=c),t===Bi){var d=e.type||"clipboard";if(d!=="paste"){var p,v,f=g==null||(p=g.getSelection())==null?void 0:p.toString(),m=xo(f);if(!m)return!1;u.$selected_content=m,u.$clipboard_text_length=(v=f?.length)!==null&&v!==void 0?v:0}u.$copy_type=d}return(l=this.Os)==null||l.capture(t,u).catch((_=>Ts.error("Failed to capture event",_))),!0}}}isBrowserSupported(){return me(x?.querySelectorAll)}}class xh{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,i=G(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.Ua(),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}}var ts=ee("[ExceptionAutocapture]"),Qn=()=>{},ea=s=>{var e;if(me(s))return(e=s.__posthog_layer__)!==null&&e!==void 0?e:s.__rrweb_layer__};function ll(s,e,t){try{if(!(e in s))return Qn;var i={next:s[e]},r=t((function(){for(var n=arguments.length,a=new Array(n),o=0;n>o;o++)a[o]=arguments[o];return i.next.apply(this,a)}));return me(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),s[e]=r,()=>{if(s[e]!==r)for(var n=s[e],a=ea(n);a;){if(a.next===r)return void(a.next=i.next);a=ea(n=a.next)}else s[e]=i.next}}catch{return Qn}}var kh=ee("[TracingHeaders]"),lt=ee("[Web Vitals]"),ta=9e5,sa=["CLS","FCP","INP","LCP"],Eh=["INP","LCP"],Sh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],ia="disabled",ra="lazy_loading",ss="awaiting_config",Ls="missing_config";ee("[SessionRecording]"),ee("[SessionRecording]");var Tr="[SessionRecording]",Je=ee(Tr),Ph=ee("[Heatmaps]");function Vi(s){return G(s)&&"clientX"in s&&"clientY"in s&&oe(s.clientX)&&oe(s.clientY)}var Rs=ee("[Product Tours]"),zi=s=>{var e;return!s.config.disable_product_tours&&!((e=s.persistence)==null||!e.get_property(Br))},Ih=["$set_once","$set"],qe=ee("[SiteApps]"),na="Error while initializing PostHog app with config id ",ul=(s,e)=>s!=null&&s.then?s.then(e):e(s),Pt="SDK is not enabled or survey functionality is not yet loaded",aa="Disabled. Not loading surveys.";class Fh{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Xl=!1,this.tu=[],this.eu=null,this.iu=null,this.Rs=!1,this.ru=new Set,this.onRemoteConfig=i=>{if(!this.Rs&&!this.vn.disableSurveys){if(!i.ok)return U.warn("Remote config unavailable. Not loading surveys.");var r=i.config.surveys;if(D(r))return U.warn("Flags not loaded yet. Not loading surveys.");this.nu=we(r)?r:r.length>0,U.info("flags response received, isSurveysEnabled: "+this.nu),this.loadIfEnabled()}},this.Ps=e,this.su=t}setup(e){if(!this.Rs)return this.au=e,ul(e.kv.initialize(),(()=>{if(this.au===e&&!this.Rs){this.au=void 0,this.Os=e;var t=e.onRemoteConfig(this.onRemoteConfig);this.Rs?t.dispose():(this.Ls=t,this.loadIfEnabled())}}))}dispose(){var e,t,i;this.Rs||(this.Rs=!0,this.au=void 0,this.Os=void 0,(e=this.Ls)==null||e.dispose(),this.Ls=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)==null||i.dispose==null||i.dispose(),this._surveyManager=null,this.tu=[],this.eu=null,this.ru.forEach((r=>clearTimeout(r))),this.ru.clear())}get vn(){return this.Ps.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(r!=null&&r.startsWith(il)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach((n=>localStorage.removeItem(n)))}catch{}}loadIfEnabled(){if(!this.Rs&&this.Os){var e=this.vn;if(!this._surveyManager)if(this.Xl)U.info("Already initializing surveys, skipping...");else if(e.disableSurveys)U.info(aa);else if(e.cookielessMode&&this.Ps.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var t=this.Ps.getExtensions();if(t){if(!w(this.nu)||e.advancedEnableSurveys){var i=this.nu||e.advancedEnableSurveys;this.Xl=!0;try{var r=t.generateSurveys;if(r)return this.ou(r,i),void(this.Xl=!1);var n=t.loadExternalDependency;if(!n)return this.lu(Vr),void(this.Xl=!1);n((a=>{try{if(this.Rs)return;var o=this.Ps.getExtensions();a||o==null||!o.generateSurveys?this.lu("Could not load surveys script",a):this.ou(o.generateSurveys,i)}finally{this.Xl=!1}}))}catch(a){throw this.Xl=!1,this.lu("Error initializing surveys",a),a}}}else U.error("PostHog Extensions not found.")}}}ou(e,t){this.Rs||(this._surveyManager=e(t),this._surveyEventReceiver=this.Ps.createEventReceiver(),U.info("Surveys loaded successfully"),this.uu({isLoaded:!0}))}lu(e,t){U.error(e,t),this.uu({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.tu.push(e),this._surveyManager&&this.uu({isLoaded:!0}),()=>{this.tu=this.tu.filter((t=>t!==e))}}getSurveys(e,t){var i;t===void 0&&(t=!1);var r=(i=this.Os)!==null&&i!==void 0?i:this.su;if(r&&!this.Rs){if(this.vn.disableSurveys)return U.info(aa),e([]);var n=r.kv.get(vr);if(n&&!t)return e(n,{isLoaded:!0}),void(this.hu()&&this.getSurveys((()=>{}),!0));if(this.eu)this.eu.then((l=>{this.Rs||e(l.surveys,l.context)})).catch((l=>U.error("Error in survey callback",l)));else{var a=this.du("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.vn.requestTimeoutMs}).then((l=>{try{return this.vu(r,l)}catch(h){return U.error("Error processing surveys response",h),this.vu(r,{statusCode:0,error:h})}}),(l=>this.vu(r,{statusCode:0,error:l})));this.eu=a;var o=()=>{this.eu===a&&(this.eu=null)};a.then((l=>{o(),this.Rs||e(l.surveys,l.context)}),o).catch((l=>U.error("Error in survey callback",l)))}}}du(e,t){var i=this.Os;return i?i.sendRequest(e,t):new Promise((r=>r({statusCode:0,error:new Error(Pt)})))}vu(e,t){if(this.Rs)return{surveys:[],context:{isLoaded:!1,error:Pt}};var i=t.statusCode;if(i!==200||!t.json){var r="Surveys API could not be loaded, status: "+i;return i!==0?U.error(r):t.error||U.warn(r),this.iu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.iu=null;var n,a=t.json.surveys||[],o=a.filter((l=>(function(h){return!(!h.start_date||h.end_date)})(l)&&(el(l)||(function(h){var u;return!((u=h.conditions)==null||(u=u.actions)==null||(u=u.values)==null||!u.length)})(l))));return o.length>0&&((n=this._surveyEventReceiver)==null||n.register(o)),e.kv.set({[vr]:a,[Qs]:Date.now()}),{surveys:a,context:{isLoaded:!0}}}hu(){return this.cu()&&!this.eu&&!this.fu()}cu(){var e,t,i=(e=(t=this.Os)!==null&&t!==void 0?t:this.su)==null?void 0:e.kv.get(Qs);return oe(i)&&Date.now()-i>3e5}fu(){return oe(this.iu)&&3e5>Date.now()-this.iu}markSurveyAsSeen(e,t){var i,r={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};rl(r);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}uu(e){for(var t of this.tu)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){U.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);U.warn("init was not called")}pu(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((n=>n.id===e)))!==null&&r!==void 0?r:null})),t}gu(e){if(D(this._surveyManager))return{eligible:!1,reason:Pt};var t=typeof e=="string"?this.pu(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}mu(e){if(D(this._surveyManager))return{eligible:!1,reason:Pt};var t=typeof e=="string"?this.pu(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(D(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:Pt};var t=this.mu(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return D(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Pt})):new Promise((i=>{this.getSurveys((r=>{var n,a=(n=r.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(a){var o=this.mu(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(D(this._surveyManager))U.warn("init was not called");else{var n=typeof e=="string"?this.pu(e):e;if(n!=null&&n.id)if(oh.includes(n.type)){var a=x?.querySelector(t);if(a)if((r=n.appearance)!=null&&r.surveyPopupDelaySeconds){U.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var l,h;this.ru.delete(o),this.Rs||(U.info("Rendering survey "+n.id+" with delay of "+((l=n.appearance)==null?void 0:l.surveyPopupDelaySeconds)+" seconds"),(h=this._surveyManager)==null||h.renderSurvey(n,a,i),U.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.ru.add(o)}else this._surveyManager.renderSurvey(n,a,i);else U.warn("Survey element not found")}else U.warn("Surveys of type "+n.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(e,t){var i;if(D(this._surveyManager))U.warn("init was not called");else{var r=this.pu(e);if(r){var n=r;if((i=r.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=b({},r,{appearance:b({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Sr.Popover&&t.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var a=this.gu(r);if(!a.eligible)return void U.warn("Survey is not eligible to be displayed: ",a.reason)}t.displayType!==Sr.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(e){D(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}function It(s,e,t){if(D(s))return!1;switch(t){case"exact":return s===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(s);case"regex":try{return new RegExp(e).test(s)}catch{return!1}default:return!1}}class Ch{constructor(e){this.yu=new Set,this.bu=new Set,this._u=new ui,this.wu=(t,i)=>this.ku(t,i)&&this.Su(t,i)&&this.xu(t,i)&&this.Cu(t,i),this.ku=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e}init(){var e,t;w((e=this._instance)==null?void 0:e._addCaptureHook)||(this.Tu=(t=this._instance)==null?void 0:t._addCaptureHook(((i,r)=>{this.on(i,r)})))}dispose(){var e;(e=this.Tu)==null||e.call(this),this.Tu=void 0,this._u=new ui}register(e){var t,i;if(!w((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((n=>{var a;this.yu.add(n),(a=n.steps)==null||a.forEach((o=>{this.bu.add(o?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r=new Set;this.yu.forEach((n=>{var a;(a=n.steps)==null||a.forEach((o=>{o!=null&&o.selector&&r.add(o.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(e){this.yu.clear(),this.bu.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.bu.has(e)||this.bu.has(t.event))&&this.yu.forEach((i=>{this.Mu(t,i)&&this._u.emit("actionCaptured",i.name)}))}Eu(e){this.onAction("actionCaptured",(t=>e(t)))}Mu(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.wu(e,i))return!0;return!1}onAction(e,t){return this._u.on(e,t)}Su(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!It(r,t.url,t.url_matching||"contains"))return!1}return!0}xu(e,t){return!!this.Iu(e,t)&&!!this.Ru(e,t)&&!!this.Pu(e,t)}Iu(e,t){var i;if(t==null||!t.href)return!0;var r=this.Au(e);if(r.length>0)return r.some((o=>It(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!a&&It((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Ru(e,t){var i;if(t==null||!t.text)return!0;var r=this.Au(e);if(r.length>0)return r.some((h=>It(h.text,t.text,t.text_matching||"exact")||It(h.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(h){for(var u,c=[],d=/(?::|")text="(.*?)"/g;!D(u=d.exec(h));)c.includes(u[1])||c.push(u[1]);return c})(l),a=t.text,o=t.text_matching||"exact",n.some((h=>It(h,a,o))))}Pu(e,t){var i,r;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Au(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Cu(e,t){return t==null||!t.properties||t.properties.length===0||sl(t.properties.reduce(((i,r)=>{var n=M(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return i[r.key]={values:n,operator:r.operator||"exact"},i}),{}),e?.properties)}}class $h{constructor(e){var t;this.Fu=[],this._instance=e,this.Ou=new Map,this.Lu=new Map,this.Du=new Map,this.$u=(t=this._instance)==null||t.onSessionId==null?void 0:t.onSessionId((i=>this.Nu(i)))}qu(e){return!1}ju(){return null}Bu(e){}Hu(){}zu(e,t){return!!e&&sl(e.propertyFilters,t?.properties)}Uu(e,t){var i=new Map;return e.forEach((r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=i.get(a.name)||[];o.push(r.id),i.set(a.name,o)}}))})),i}Wu(e,t,i){var r=(i===Yt.Activation?this.Ou:this.Lu).get(e),n=[];return this.Vu((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[i])==null||(o=o.values)==null?void 0:o.find((h=>h.name===e));return this.zu(l,t)}))}register(e){this.Gu(e,!1)}replace(e){this.Gu(e,!0)}Gu(e,t){var i;w((i=this._instance)==null?void 0:i._addCaptureHook)||(this.Zu(e,t),this.Qu(e,t))}Qu(e,t){var i=e.filter((a=>{var o;return(o=a.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length}));if(t&&this.Du.clear(),i.length!==0){this.Ju||(this.Ju=new Ch(this._instance),this.Ju.init(),this.Ju.Eu((a=>this.onAction(a))));var r=[];i.forEach((a=>{var o;(o=a.conditions)==null||(o=o.actions)==null||o.values.forEach((l=>{if(r.push(l),l.name){var h,u=(h=this.Du.get(l.name))!==null&&h!==void 0?h:[];u.includes(a.id)||u.push(a.id),this.Du.set(l.name,u)}}))})),t?this.Ju.replace(r):this.Ju.register(r)}else{var n;t&&((n=this.Ju)==null||n.replace([]))}}Ku(e,t){t.forEach(((i,r)=>{var n,a=(n=e.get(r))!==null&&n!==void 0?n:[];i.forEach((o=>{a.includes(o)||a.push(o)})),e.set(r,a)}))}Zu(e,t){var i,r,n=e.filter((h=>{var u,c;return((u=h.conditions)==null?void 0:u.events)&&((c=h.conditions)==null||(c=c.events)==null||(c=c.values)==null?void 0:c.length)>0})),a=e.filter((h=>{var u,c;return((u=h.conditions)==null?void 0:u.cancelEvents)&&((c=h.conditions)==null||(c=c.cancelEvents)==null||(c=c.values)==null?void 0:c.length)>0})),o=this.Uu(e,Yt.Activation),l=this.Uu(e,Yt.Cancellation);t?(this.Ou=o,this.Lu=l):(this.Ku(this.Ou,o),this.Ku(this.Lu,l)),(n.length!==0||a.length!==0)&&((i=this.Tu)!==null&&i!==void 0||(this.Tu=(r=this._instance)==null?void 0:r._addCaptureHook(((h,u)=>{this.onEvent(h,u)}))))}onEvent(e,t){var i,r,n=this.Yu(),a=(t==null||(i=t.properties)==null?void 0:i.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Xu(e,a);if(o==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:a}),void this.th([a]);if(o==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:a}),this.eh(a),void this.ih([a])}if(this.Lu.has(e)){var l=this.Wu(e,t,Yt.Cancellation);l.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:l.map((u=>u.id))}),this.th(l.map((u=>u.id))),l.forEach((u=>this.rh(u.id))))}if(this.Ou.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.Ou.get(e)});var h=this.Wu(e,t,Yt.Activation);this.nh(h.map((u=>u.id)))}}onAction(e){this.Du.has(e)&&this.nh(this.Du.get(e)||[])}nh(e){var t;if(e.length!==0){var i=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),r=[];for(var n of e)i&&this.qu(n)?this.eh(n)&&this.sh(n):r.push(n);r.length>0&&(this.Fu=[...new Set([...this.Fu,...r])]),this.Yu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}eh(e){this.Fu=this.Fu.filter((i=>i!==e));var t=this.ah();return!t.includes(e)&&(this.oh([...t,e]),this.lh(),!0)}th(e){var t=new Set(e);this.Fu=this.Fu.filter((n=>!t.has(n)));var i=this.uh(),r=i.filter((n=>!t.has(n)));r.length!==i.length&&(this.oh(r),r.length===0&&this.hh()),this.ih(e)}dh(){var e,t=this.ju();if(!t)return{};var i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i&&typeof i=="object"?i:{}}sh(e){if(this.ju()){var t=this.dh();this.Bu(b({},t,{[e]:Date.now()}))}}ih(e){if(this.ju()){var t=this.dh(),i={},r=!1;for(var n of Object.entries(t)){var a=n[0],o=n[1];e.includes(a)?r=!0:i[a]=o}r&&(Ne(i)?this.Hu():this.Bu(i))}}fh(){this.ju()&&this.Hu()}getActivationTimestamp(e){if(this.ah().includes(e)){var t=this.dh()[e];return oe(t)?t:void 0}}uh(){var e,t=this.ph();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}ah(){var e,t,i=this.uh();if(i.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.gh()],n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return n&&r===n?i:[]}lh(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.mh(t)}hh(){this.yh()}Nu(e){var t,i=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.gh()];if(i&&i!==e){var r=this.uh(),n=this.dh();r.length>0&&(this.oh([]),r.filter((a=>oe(n[a]))).forEach((a=>this.rh(a)))),this.hh(),this.fh()}}getActivatedIds(){return[...new Set([...this.ah(),...this.Fu])].filter((e=>!this.bh(e)))}dispose(){var e,t,i;(e=this.$u)==null||e.call(this),this.$u=void 0,(t=this.Tu)==null||t.call(this),this.Tu=void 0,(i=this.Ju)==null||i.dispose(),this.Ju=void 0}reset(){this.Fu=[],this.uh().length>0&&this.oh([]),this.hh(),this.fh()}getEventToItemsMap(){return this.Ou}_h(){return this.Ju}}class Oh extends $h{constructor(e){super(e)}ph(){return pr}gh(){return As}ju(){return Ds}Bu(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Ds]:e})}Hu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Ds)}qu(e){var t,i;this.Vu((n=>{i=n.find((a=>a.id===e))}));var r=(t=i)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return oe(r)&&r>0}wh(){return Qe.SHOWN}Vu(e){var t;(t=this._instance)==null||t.getSurveys(e)}rh(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Yu(){return U}oh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[pr]:e})}mh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[As]:e})}yh(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(As)}bh(){return!1}Xu(e,t){var i;this.Vu((n=>{i=n.find((a=>a.id===t))}));var r=!i||(function(n){var a;return el(n)&&!((a=n.conditions)==null||(a=a.events)==null||!a.repeatedActivation)||n.schedule==="always"})(i);return r?e===Qe.SHOWN?"consume":"ignore":e===Qe.SHOWN?"persist":e===Qe.DISMISSED||e===Qe.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Th{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);var t={};for(var i of e){var r=this._instance.get_property(i);w(r)||(t[i]=r)}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)}}class Lh{constructor(e){this._instance=e}get(){var 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()}getExtensions(){var e=O?.__PosthogExtensions__;if(e){var t=e.generateSurveys,i=e.loadExternalDependency;return{generateSurveys:t?r=>t(this._instance,r):void 0,loadExternalDependency:i?r=>i(this._instance,"surveys",r):void 0}}}createEventReceiver(){return new Oh(this._instance)}}var Rh=g!=null&&g.location?ai(g.location.hash,"__posthog")||ai(location.hash,"state"):null,oa="_postHogToolbarParams",la=ee("[Toolbar]"),ua=ee("[FeatureFlags]");class Mh{constructor(e,t){t===void 0&&(t=!1),this.kh=!1,this.update(e,t)}update(e,t){this.Sh=((i,r)=>{var n,a,o,l,h;return{bootstrap:{featureFlags:(n=i.bootstrap)==null?void 0:n.featureFlags,featureFlagPayloads:(a=i.bootstrap)==null?void 0:a.featureFlagPayloads},remoteRequestsDisabled:r,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:(o=i.remote_config_refresh_interval_ms)!==null&&o!==void 0?o:3e5,requestTimeoutMs:i.feature_flag_request_timeout_ms,compression:i.disable_compression?void 0:"best-available",evaluationContexts:(l=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&l!==void 0?l:[],flagKeys:M(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.kh||(ua.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.kh=!0),w(e.flag_keys)||M(e.flag_keys)||ua.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Sh}}var ha=ee("[FeatureFlags]"),ut=ee("[FeatureFlags]",{debugEnabled:!0}),Wi=`" failed. Feature flags didn't load in time.`,ca="connection_error",da=s=>{for(var e={},t=0;s.length>t;t++)e[s[t]]=!0;return e},va=s=>{var e={};for(var t of Ns(s||{})){var i=t[1];i&&(e[t[0]]=i)}return e},Ae=ee("[Error tracking]"),Ah=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],Dh=["__firefox__","__gCrWeb"],pa="Refusing to render web experiment since the viewer is a likely bot",Nh={icontains:(s,e)=>e.toLowerCase().indexOf(s.toLowerCase())>-1,not_icontains:(s,e)=>e.toLowerCase().indexOf(s.toLowerCase())===-1,regex:(s,e)=>hi(e,s),not_regex:(s,e)=>!hi(e,s),exact:(s,e)=>e===s,is_not:(s,e)=>e!==s};class _e{get vn(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((r=>{_e.xh("retrieved web experiments from the server"),t.Ch=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.Ch&&(_e.xh("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Ch)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);H(o)&&n.variants[o]&&t.Th(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var h=n.variants[l];_e.Mh(h,t._instance)&&t.Th(n.name,l,h.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())_e.xh(pa);else if(!this.vn.disable_web_experiments){if(D(this.Ch))return this.Ch=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_e.xh("applying feature flags",e),e.forEach((t=>{var i;if(this.Ch&&(i=this.Ch)!=null&&i.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.Ch)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.Th(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=_e.getWindowLocation();if(e!=null&&e.search){var t=Ut(e?.search,"__experiment_id"),i=Ut(e?.search,"__experiment_variant");t&&i&&(_e.xh("previewing web experiments "+t+" && "+i),this.getWebExperiments((r=>{this.Eh(parseInt(t),i,r)}),!1,!0))}}loadIfEnabled(){this.vn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.vn.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.vn.token),method:"GET",timestampMode:"query",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Eh(e,t,i){var r=i.filter((n=>n.id===e));r&&r.length>0&&(_e.xh("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Th(r[0].name,t,r[0].variants[t].transforms))}static Mh(e,t){return!D(e.conditions)&&_e.Ih(e,t)&&_e.Rh(e)}static Ih(e,t){var i;if(D(e.conditions)||D((i=e.conditions)==null?void 0:i.url))return!0;var r=_e.getWindowLocation();if(r){var n,a,o,l=_o(t,r.href);return(n=e.conditions)==null||!n.url||Nh[(a=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&a!==void 0?a:"icontains"](e.conditions.url,l)}return!1}static getWindowLocation(){return g?.location}static Rh(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.utm))return!0;var i=Lo();if(i.utm_source){var r,n,a,o,l,h,u,c,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_medium)==i.utm_medium,f=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_term)==i.utm_term;return d&&v&&f&&p}return!1}static xh(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];S.info("[WebExperiments] "+e,i)}Th(e,t,i){this._is_bot()?_e.xh(pa):t!=="control"?i.forEach((r=>{if(r.selector){var n;_e.xh("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a?.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):_e.xh("Control variants leave the page unmodified.")}_is_bot(){return xe&&this._instance?Xo(xe,this.vn.custom_blocked_useragents):void 0}}var Le=ee("[Conversations]"),ht="Conversations not available yet.";function fa(s,e){var t,i,r,n,a,o,l,h=(t=s?.flushIntervalMs)!==null&&t!==void 0?t:3e3,u=(i=s?.maxBufferSize)!==null&&i!==void 0?i:100,c=e!=null&&e.consoleCapture?void 0:(r=s?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,d=w(c)?Math.max(u,2048):Math.max(u,c),p=s?.resourceAttributes;return{serviceName:(n=(a=p?.["service.name"])!==null&&a!==void 0?a:s?.serviceName)!==null&&n!==void 0?n:e?.serviceNameDefault,serviceVersion:(o=p?.["service.version"])!==null&&o!==void 0?o:s?.serviceVersion,environment:(l=p?.["deployment.environment"])!==null&&l!==void 0?l:s?.environment,resourceAttributes:p,beforeSend:s?.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var jh=["debug","log","warn","error","info"],ga="console",hl="__posthogHandledLogsRequestError",Gi=(s,e)=>{var t=s instanceof Error?s:new Error(e);return t[hl]=!0,t},_a=s=>!!s&&typeof s=="object"&&s[hl]===!0,fi={featureFlags:class{constructor(s){this.name="featureFlags",this.Ph=!1,this.featureFlagEventHandlers=[],this.I=ha,this.Ah={},this.Fh={},this.Oh=[],this.Lh=!1,this.Dh=!1,this.$h=0,this.Nh=!1,this.qh=!1,this.jh=!1,this.Bh=!1,this.Hh=0,this.Ht=()=>{var e=this.zh();this.Hh=0,e&&this.reloadFeatureFlags()},this.Uh=()=>{var e,t=this.Wh;w(t)||this.vn.remoteRequestsDisabled||!x||x.visibilityState==="hidden"||Date.now()-((e=this.Vh)!==null&&e!==void 0?e:0)<t||(this.reloadFeatureFlags(),this.Gh())},this.$t=()=>{x?.visibilityState==="visible"&&this.Uh()},"get"in s?this.Ps=s:(this.Zh=new Mh(s.config,s.Ua()),this.Ps=this.Zh)}updateConfig(s,e){var t;(t=this.Zh)==null||t.update(s,e),this.Os&&this.Qh()}setup(s){return this.au=s,this.I=s.logger.createLogger("[FeatureFlags]"),ul(s.kv.initialize(),(()=>{this.au===s&&(this.au=void 0,this.Os=s,this.Jh(s))}))}Jh(s){if(this.Os===s)return g&&X(g,"online",this.Ht),this.Qh(),this.Kh=s.registerDynamicEventProperties((()=>this.Yh()?this.Ah:this.Fh)),this.Xh(),this.initialize()}Qh(){var s=this.vn.refreshIntervalMs,e=!this.vn.remoteRequestsDisabled&&x&&!w(s)&&s>0?s:void 0;e!==this.Wh&&(this.td(),w(e)||(this.Wh=e,this.Gh(),x!=null&&x.addEventListener&&X(x,Ht,this.$t)))}Gh(){w(this.Wh)||(w(this.ed)||clearInterval(this.ed),this.Vh=Date.now(),this.ed=setInterval(this.Uh,this.Wh))}td(){w(this.ed)||(clearInterval(this.ed),this.ed=void 0,x==null||x.removeEventListener==null||x.removeEventListener(Ht,this.$t)),this.Wh=void 0,this.Vh=void 0}destroy(){this.rd()}dispose(){this.rd()}rd(){var s;this.td(),this.$h++,this.qh=!1,this.au=void 0,this.Os&&(this.nd(),(s=this.Kh)==null||s.dispose(),this.Kh=void 0,this.Oh=[],g?.removeEventListener("online",this.Ht),this.Os=void 0)}get vn(){return this.Ps.get()}sd(s){var e;return(e=this.Os)==null?void 0:e.kv.get(s)}ei(s){this.ad((()=>{var e;return(e=this.Os)==null?void 0:e.kv.set(s)}))}ri(s){this.ad((()=>{var e;return(e=this.Os)==null?void 0:e.kv.remove(s)}))}ad(s){try{s()}catch(e){this.I.error("Failed to update feature flag persistence",e)}}Xh(){var s={};for(var e of[gt,_t,At,He]){var t=this.sd(e);w(t)||(s[e]=t)}this.Ah=s;var i=b({},s),r=this.sd(Ze);if(r)for(var n of Object.entries(r))i["$feature/"+n[0]]=n[1];this.Fh=i}Yh(){var s=this.vn.cacheTtlMs;if(!s||0>=s)return!1;var e=this.sd(yt);return typeof e!="number"||Date.now()-e>s}od(){return!!this.Yh()&&(this.Bh||this.Dh||(this.Bh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ld(){var s=this.vn.evaluationContexts;return s!=null&&s.length?s.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.I.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}ud(){var s=this.vn.flagKeys;if(!w(s))return s.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||this.I.error("Invalid flag key found:",e,"Expected non-empty string"),t}))}initialize(){var s,e,t=this.vn,i=(s=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&s!==void 0?s:{};if(Object.keys(i).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(i).filter((h=>!!i[h])).reduce(((h,u)=>(h[u]=i[u]||!1,h)),{}),l=Object.keys(a).filter((h=>o[h])).reduce(((h,u)=>(h[u]=a[u],h)),{});return this.hd({featureFlags:o,featureFlagPayloads:l})}}updateFlags(s,e,t){var i,r,n=t!=null&&t.merge&&(i=this.sd(Ze))!==null&&i!==void 0?i:{},a=t!=null&&t.merge&&(r=this.sd(_t))!==null&&r!==void 0?r:{},o=b({},n,s),l=b({},a,e),h={};for(var u of Object.entries(o)){var c=u[0],d=u[1];h[c]={key:c,enabled:sn(d),variant:rn(d),reason:void 0,metadata:w(l?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.hd({flags:h})}get hasLoadedFlags(){return this.Lh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var s=this.sd(fs),e=this.sd(He),t=this.sd(dt);if(!t&&!e)return s||{};var i=J({},s||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=i[n],h=e?.[n],u=w(h)?(a=l?.enabled)!==null&&a!==void 0&&a:!!h,c=w(h)?l?.variant:typeof h=="string"?h:void 0,d=t?.[n],p=b({},l,{enabled:u,variant:u?c??l?.variant:void 0});u!==l?.enabled&&(p.original_enabled=l?.enabled),c!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=b({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),i[n]=p}return this.Ph||(this.I.warn(" Overriding feature flag details!",{flagDetails:s,overriddenPayloads:t,finalDetails:i}),this.Ph=!0),i}getAllFeatureFlags(){var s=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(s).map((t=>{var i=s[t];return{key:t,enabled:sn(i),variant:rn(i),payload:tn(e[t])}}))}getFlagVariants(){var s=this.sd(Ze),e=this.sd(He);if(!e)return s||{};for(var t=J({},s||{}),i=Object.keys(e),r=0;i.length>r;r++)t[i[r]]=e[i[r]];return this.Ph||(this.I.warn(" Overriding feature flags!",{enabledFlags:s,overriddenFlags:e,finalFlags:t}),this.Ph=!0),t}getFlagPayloads(){var s=this.sd(_t),e=this.sd(dt);if(!e)return s||{};for(var t=J({},s||{}),i=Object.keys(e),r=0;i.length>r;r++)t[i[r]]=e[i[r]];return this.Ph||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:s,overriddenPayloads:e,finalPayloads:t}),this.Ph=!0),t}reloadFeatureFlags(){this.Nh||this.vn.featureFlagsDisabled||this.zh()||this.dd||(this.Oh.slice().forEach((s=>{try{s()}catch(e){this.I.error("Error while running feature flags reloading callback",e)}})),this.dd=setTimeout((()=>{this.vd()}),5))}nd(){clearTimeout(this.dd),this.dd=void 0}onReloading(s){return this.Oh.push(s),()=>{this.Oh=this.Oh.filter((e=>e!==s))}}ensureFlagsLoaded(){this.Lh||this.Dh||this.dd||this.reloadFeatureFlags()}setAnonymousDistinctId(s){this.$anon_distinct_id=s}setReloadingPaused(s){this.Nh=s}resetFlagCallReported(){this.ri(Ye)}vd(s){this.nd();var e=this.Os;if(e&&!this.vn.remoteRequestsDisabled&&!this.zh())if(this.Dh)this.qh=!0;else{var t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},e.initialPersonProperties,this.sd(De)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sd(ze),timezone:jo()};w(e.deviceId)||(t.$device_id=e.deviceId),(s!=null&&s.disableFlags||this.vn.featureFlagsDisabled)&&(t.disable_flags=!0);var i=this.ld();i.length&&(t.evaluation_contexts=i);var r=this.ud();w(r)||(t.flag_keys=r);var n=this.vn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),o=this.$h;this.Dh=!0;var l=()=>{this.qh&&(this.qh=!1,this.vd())},h=u=>{this.Dh=!1,o===this.$h&&(this.ei({[Dt]:[ca]}),this.I.error("Feature flag request failed",u)),l()};try{e.sendRequest(a,{target:"flags",method:"POST",body:t,compression:this.vn.compression,sentAt:"body",timeoutMs:this.vn.requestTimeoutMs}).then((u=>{var c,d,p=(c=u.json)!==null&&c!==void 0?c:{},v=u.statusCode!==200;if(this.Dh=!1,o===this.$h){if(this.fd(u.statusCode),v||this.qh||(this.$anon_distinct_id=void 0),!t.disable_flags||this.qh){this.jh=!v;var f=[];u.error?f.push(u.error instanceof Error&&u.error.name==="AbortError"?"timeout":u.error instanceof Error?ca:"unknown_error"):u.statusCode!==200&&f.push("api_error_"+u.statusCode),p.errorsWhileComputingFlags&&f.push("errors_while_computing_flags");var m=!((d=p.quotaLimited)==null||!d.includes("feature_flags"));m&&f.push("quota_limited"),this.ei({[Dt]:f}),m?this.I.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."):t.disable_flags||this.hd(p,v,{partialResponse:n}),l()}}else l()})).catch(h)}catch(u){h(u)}}}zh(){return Oo(this.Hh,3)}fd(s){this.Hh=To(s,this.Hh,3,(()=>this.I.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(s,e){var t;if(e===void 0&&(e={}),!e.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var i=this.getFeatureFlagResult(s,e);return(t=i?.variant)!==null&&t!==void 0?t:i?.enabled}}else this.I.warn('getFeatureFlag for key "'+s+Wi)}getFeatureFlagDetails(s){return this.getFlagsWithDetails()[s]}getFeatureFlagPayload(s){var e=this.getFeatureFlagResult(s,{send_event:!1});return e?.payload}getFeatureFlagResult(s,e){if(e===void 0&&(e={}),!e.fresh||this.jh)if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var t,i=this.getFlagVariants(),r=s in i,n=i[s],a=this.getFlagPayloads()[s],o=String(n),l=this.sd(At)||void 0,h=this.sd(yt)||void 0,u=this.sd(Ye)||{};if(this.vn.deduplicateCallsPerSession){var c,d=(c=this.Os)==null?void 0:c.session.sessionId,p=this.sd(as);d&&d!==p&&(u={},t=d)}if(e.send_event||!("send_event"in e))if(s in u&&u[s].includes(o))t&&this.ei({[Ye]:u,[as]:t});else{var v,f,m,_,y,k,P,E,$,N,I,C;M(u[s])?u[s].push(o):u[s]=[o],this.ei(b({[Ye]:u},t?{[as]:t}:{}));var F=this.getFeatureFlagDetails(s),L=[...(v=this.sd(Dt))!==null&&v!==void 0?v:[]];w(n)&&L.push("flag_missing");var T={$feature_flag:s,$feature_flag_response:n,$feature_flag_payload:a??null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:(f=(m=this.vn.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[s])!==null&&f!==void 0?f:null,$feature_flag_bootstrapped_payload:(_=(y=this.vn.bootstrap)==null||(y=y.featureFlagPayloads)==null?void 0:y[s])!==null&&_!==void 0?_:null,$used_bootstrap_value:!this.jh};w(F==null||(k=F.metadata)==null?void 0:k.has_experiment)||(T.$feature_flag_has_experiment=F.metadata.has_experiment),w(F==null||(P=F.metadata)==null?void 0:P.version)||(T.$feature_flag_version=F.metadata.version);var R,B=(E=F==null||($=F.reason)==null?void 0:$.description)!==null&&E!==void 0?E:F==null||(N=F.reason)==null?void 0:N.code;B&&(T.$feature_flag_reason=B),F!=null&&(I=F.metadata)!=null&&I.id&&(T.$feature_flag_id=F.metadata.id),w(F?.original_variant)&&w(F?.original_enabled)||(T.$feature_flag_original_response=w(F.original_variant)?F.original_enabled:F.original_variant),F!=null&&(C=F.metadata)!=null&&C.original_payload&&(T.$feature_flag_original_payload=F==null||(R=F.metadata)==null?void 0:R.original_payload),L.length&&(T.$feature_flag_error=L.join(",")),this.pd(T)}else t&&this.ei({[Ye]:u,[as]:t});if(r)return{key:s,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:tn(a)}}}else this.I.warn('getFeatureFlagResult for key "'+s+Wi)}pd(s){try{var e;(e=this.Os)==null||e.capture("$feature_flag_called",s).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(s,e){this.gd(s,e)}gd(s,e){var t=this;return Y((function*(){var i=t.Os;if(i){var r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=t.ld();n.length&&(r.evaluation_contexts=n);var a,o=t.ud();w(o)||(r.flag_keys=o);try{var l,h=(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:t.vn.compression,sentAt:"body",timeoutMs:t.vn.requestTimeoutMs})).json)==null?void 0:l.featureFlagPayloads;a=h?.[s]||void 0}catch(u){return void t.I.error("Remote config feature flag request failed",u)}try{e(a)}catch(u){t.I.error("Remote config feature flag callback failed",u)}}}))()}isFeatureEnabled(s,e){if(e===void 0&&(e={}),e.fresh&&!this.jh)return e.defaultValue;if(!(this.Lh||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+s+Wi),e.defaultValue;var t=this.getFeatureFlag(s,e);return w(t)?e.defaultValue:!!t}addFeatureFlagsHandler(s){this.featureFlagEventHandlers.push(s)}removeFeatureFlagsHandler(s){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==s))}receivedFeatureFlags(s,e,t){this.hd(s,e,t)}hd(s,e,t){if(this.Os){this.Lh=!0;var i=(function(r,n,a,o,l,h){n===void 0&&(n={}),a===void 0&&(a={}),o===void 0&&(o={}),h===void 0&&(h=ha);var u=(($,N)=>{var I=$.flags;return I?b({},$,{featureFlags:Object.fromEntries(Object.keys(I).map((C=>{var F;return[C,(F=I[C].variant)!==null&&F!==void 0?F:I[C].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(I).filter((C=>I[C].enabled)).filter((C=>{var F;return(F=I[C].metadata)==null?void 0:F.payload})).map((C=>{var F;return[C,(F=I[C].metadata)==null?void 0:F.payload]})))}):($.featureFlags&&N.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$)})(r,h),c=u.flags,d=u.featureFlags,p=u.featureFlagPayloads;if(d){var v=r.requestId,f=r.evaluatedAt;if(M(d)){h.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var m={};if(d)for(var _=0;d.length>_;_++)m[d[_]]=!0;return{[gt]:d,[Ze]:m,[Xs]:!1}}var y=d,k=p,P=c;if(l!=null&&l.partialResponse)y=b({},n,y),k=b({},a,k),P=b({},o,P);else if(r.errorsWhileComputingFlags)if(c){var E=new Set(Object.keys(c).filter(($=>{var N;return!((N=c[$])!=null&&N.failed)})));y=b({},n,Object.fromEntries(Object.entries(y).filter(($=>E.has($[0]))))),k=b({},a,Object.fromEntries(Object.entries(k||{}).filter(($=>E.has($[0]))))),P=b({},o,Object.fromEntries(Object.entries(P||{}).filter(($=>E.has($[0])))))}else y=b({},n,y),k=b({},a,k),P=b({},o,P);return b({[gt]:Object.keys(va(y)),[Ze]:y||{},[_t]:k||{},[fs]:P||{},[Xs]:r.minimalFlagCalledEvents===!0},v?{[At]:v}:{},f?{[yt]:f}:{})}})(s,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),t,this.I);i&&this.ei(i),e||(this.Bh=!1),this.md(e)}}override(s,e){e===void 0&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:s,suppressWarning:e})}overrideFeatureFlags(s){this.yd(s)}yd(s){if(this.Os){if(s===!1)return this.ri([He,dt]),this.md(),void ut.info("All overrides cleared");if(M(s))return this.ei({[He]:da(s)}),this.md(),void ut.info("Flag overrides set",{flags:s});if(s&&typeof s=="object"&&("flags"in s||"payloads"in s)){var e,t=s;this.Ph=!!((e=t.suppressWarning)!==null&&e!==void 0&&e);var i={},r=t.flags,n=t.payloads;return r&&(i[He]=M(r)?da(r):r),n&&(i[dt]=n),Object.keys(i).length&&this.ei(i),r===!1&&n===!1?this.ri([He,dt]):r===!1?this.ri(He):n===!1&&this.ri(dt),this.md(),r===!1?ut.info("Flag overrides cleared"):r&&ut.info("Flag overrides set",{flags:r}),void(n===!1?ut.info("Payload overrides cleared"):n&&ut.info("Payload overrides set",{payloads:n}))}if(s&&typeof s=="object")return this.ei({[He]:s}),this.md(),void ut.info("Flag overrides set",{flags:s});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:s})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(s){if(this.addFeatureFlagsHandler(s),this.Lh){var e=this.bd(),t=e.flags,i=e.flagVariants;try{s(t,i)}catch(r){this.I.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(s)}updateEarlyAccessFeatureEnrollment(s,e,t){var i=(this.sd(Ms)||[]).find((l=>l.flagKey===s)),r={["$feature_enrollment/"+s]:e},n={$feature_flag:s,$feature_enrollment:e,$set:r};i&&(n.$early_access_feature_name=i.name),t&&(n.$feature_enrollment_stage=t);var a=b({},this.getFlagVariants(),{[s]:e});this.ei({[gt]:Object.keys(va(a)),[Ze]:a,[De]:b({},this.sd(De)||{},r)}),this.md();try{var o;(o=this.Os)==null||o.capture("$feature_enrollment_update",n).catch((l=>{this.I.error("Failed to capture early access feature enrollment",l)}))}catch(l){this.I.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(s,e,t){e===void 0&&(e=!1);var i=this.sd(Ms);!i||e?this._d(s,t):s(i)}_d(s,e){var t=this;return Y((function*(){var i=t.Os;if(i){var r,n=e?"&"+e.map((o=>"stage="+o)).join("&"):"";try{var a=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;t.ei({[Ms]:r=a.json.earlyAccessFeatures})}catch(o){return void t.I.error("Early access feature request failed",o)}try{s(r)}catch(o){t.I.error("Early access feature callback failed",o)}}}))()}bd(){var s=this.getFlags(),e=this.getFlagVariants();return{flags:s.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}md(s){this.Xh();var e=this.bd(),t=e.flags,i=e.flagVariants;this.featureFlagEventHandlers.forEach((r=>{try{r(t,i,{errorsLoading:s})}catch(n){this.I.error("Error while running feature flags callback",n)}}))}setPersonPropertiesForFlags(s,e){e===void 0&&(e=!0),this.wd(s,e)}wd(s,e){e===void 0&&(e=!0);var t=this.sd(De)||{},i=s?.$set||(s!=null&&s.$set_once?{}:s),r=s?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this.ei({[De]:b({},t,n,i)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(s,e){e===void 0&&(e=!0);var t=b({},this.sd(De)||{});s.forEach((i=>{delete t[i]})),this.ei({[De]:t}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(s){s===void 0&&(s=!0),this.ri(De),s&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(s,e){e===void 0&&(e=!0);var t=this.sd(ze)||{},i=b({},t);for(var r of Object.keys(s))i[r]=b({},t[r],s[r]);this.ei({[ze]:i}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(s){if(s){var e=this.sd(ze)||{};this.ei({[ze]:b({},e,{[s]:{}})})}else this.ri(ze)}reset(){this.$h++,this.qh=!1,this.Ah={},this.Fh={},this.Lh=!1,this.Nh=!1,this.jh=!1,this.$anon_distinct_id=void 0,this.nd(),this.Ph=!1,this.Hh=0}}},qh={sessionRecording:class{get vn(){return this._instance.config}get yo(){return this._instance.persistence}get started(){var s;return!((s=this.kd)==null||!s.isStarted)}get status(){var s,e;return this.Sd===ss||this.Sd===Ls?this.Sd:(s=(e=this.kd)==null?void 0:e.status)!==null&&s!==void 0?s:this.Sd}constructor(s){if(this._forceAllowLocalhostNetworkCapture=!1,this.Sd=ia,this.xd=void 0,this.Cd=!1,this.Dt=(()=>{var e;if(x==null||!x.visibilityState||x.visibilityState==="visible")return!0;var t=g==null||(e=g.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType("visibility-state");return!(t!=null&&t.length)||t.some((i=>i.name==="visible"))})(),this.$t=()=>{var e;x?.visibilityState==="visible"&&(this.Dt=!0,(e=this.kd)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=s,!this._instance.sessionManager)throw Je.error("started without valid sessionManager"),new Error(Tr+" started without valid sessionManager. This is a bug.");if(this.vn.cookieless_mode===Xe)throw new Error(Tr+' cannot be used with cookieless_mode="always"');x!=null&&x.addEventListener&&X(x,"visibilitychange",this.$t)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Cd=!0,x==null||x.removeEventListener==null||x.removeEventListener("visibilitychange",this.$t),this.stopRecording()}get Td(){var s,e=!((s=this._instance.get_property(ft))==null||!s.enabled),t=!this.vn.disable_session_recording,i=this.vn.disable_session_recording||this._instance.consent.isOptedOut();return g&&e&&t&&!i}startIfEnabledOrStop(s){var e;if(!(this.Cd||this.Td&&(e=this.kd)!=null&&e.isStarted)){var t=!w(Object.assign)&&!w(Array.from);this.Td&&t?(this.Md(s),Je.info("starting")):(this.Sd=ia,this.stopRecording())}}Md(s){var e,t,i;this.Td&&(this.Sd!==ss&&this.Sd!==Ls&&(this.Sd=ra),O!=null&&(e=O.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=O.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Ed(s):(i=O.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Id,(r=>{if(r)return this._instance.register_for_session({[yr]:!0}),Je.error("could not load recorder",r);this.Ed(s)})))}stopRecording(){var s,e;(s=this.xd)==null||s.call(this),this.xd=void 0,(e=this.kd)==null||e.stop()}Rd(){var s,e;(s=this.xd)==null||s.call(this),this.xd=void 0,(e=this.kd)==null||e.discard()}Pd(){var s,e;(s=this.yo)==null||s.unregister(Ur),(e=this.yo)==null||e.unregister(ro)}Ad(s,e){if(D(s))return null;var t,i=oe(s)?s:parseFloat(s);return typeof(t=i)!="number"||!Number.isFinite(t)||0>t||t>1?(Je.warn(e+" must be between 0 and 1. Ignoring invalid value:",s),null):i}Fd(s){if(this.yo){var e,t,i=this.yo,r=()=>{var n,a=s.sessionRecording===!1?void 0:s.sessionRecording,o=this.Ad((n=this.vn.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ad(a?.sampleRate,"remote config sampleRate"),h=o??l;D(h)&&this.Pd();var u=a?.minimumDurationMilliseconds;i.register({[ft]:b({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:b({capturePerformance:s.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:h,minimumDurationMilliseconds:w(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.xd)==null||e.call(this),this.xd=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(s){var e=s.ok?s.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Fd(e),void this.Rd()):(this.Fd(e),void this.startIfEnabledOrStop()):(this.Sd===ss&&(this.Sd=Ls,Je.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(s,e){var t;e===void 0&&(e="log"),(t=this.kd)!=null&&t.log?this.kd.log(s,e):Je.warn("log called before recorder was ready")}get Id(){var s,e,t=(s=this._instance)==null||(s=s.persistence)==null?void 0:s.get_property(ft);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Od(){var s,e=this._instance.get_property(ft);if(!e)return!1;try{s=typeof e=="object"?e:JSON.parse(e)}catch(t){return Je.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!D(s.cache_timestamp)&&36e5>=Date.now()-s.cache_timestamp}Ed(s){var e,t,i;if(!this.Cd){if((e=O.__PosthogExtensions__)==null||!e.initSessionRecording)return Je.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[yr]:!0});var r;if(this.kd||(this.kd=(r=O.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance,this.Dt),this.kd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Od())return this.Sd===Ls||this.Sd===ss?void 0:(this.Sd=ss,Je.info("persisted remote config is stale, requesting fresh config before starting"),void new qo(this._instance).load());this.Sd=ra,(t=(i=this.kd).setDocumentWasEverVisible)==null||t.call(i,this.Dt),this.kd.start(s)}}onRRwebEmit(s){var e;(e=this.kd)==null||e.onRRwebEmit==null||e.onRRwebEmit(s)}overrideLinkedFlag(){var s,e;this.kd||(e=this.yo)==null||e.register({[ao]:!0}),(s=this.kd)==null||s.overrideLinkedFlag()}overrideSampling(){var s,e;this.kd||(e=this.yo)==null||e.register({[no]:!0}),(s=this.kd)==null||s.overrideSampling()}overrideTrigger(s){var e,t;this.kd||(t=this.yo)==null||t.register({[s==="url"?oo:lo]:!0}),(e=this.kd)==null||e.overrideTrigger(s)}get sdkDebugProperties(){var s;return((s=this.kd)==null?void 0:s.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(s,e){var t;return!((t=this.kd)==null||!t.tryAddCustomEvent(s,e))}}},Hh={autocapture:class extends wh{constructor(s){super(new xh(s)),this.instance=s}},historyAutocapture:class{constructor(s){this._instance=s,this.Ld=this.Dd()}initialize(){this.startIfEnabled()}get isEnabled(){var s=this.$d();return!!(s.path||s.search||this.Nd(s))}startIfEnabled(){this.isEnabled&&(S.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Ld=this.Dd(),this.startIfEnabled()}stop(){this.qd&&this.qd(),this.qd=void 0,this.jd&&this.jd(),this.jd=void 0,S.info("History API monitoring stopped")}monitorHistoryChanges(){g&&g.history&&(this.Bd("pushState"),this.Bd("replaceState"),this.Hd(),this.Nd()&&this.zd())}Bd(s){var e;if(g&&((e=g.history[s])==null||!e.__posthog_wrapped__)){var t=this;ll(g.history,s,(i=>function(r,n,a){i.call(this,r,n,a),t.Ud(s)}))}}Dd(){var s=g?.location;if(s!=null&&s.pathname)return{pathname:s.pathname,search:s.search,hash:s.hash}}$d(){var s=this._instance.config.capture_pageview;return s==="history_change"?{path:!0}:G(s)?s:{}}Nd(s){return s===void 0&&(s=this.$d()),!!s.hash&&!this._instance.config.disable_capture_url_hashes}Wd(s){var e=this.$d(),t=this.Ld;return!(!t||!(e.path&&s.pathname!==t.pathname||e.search&&s.search!==t.search||this.Nd(e)&&s.hash!==t.hash))}Ud(s){try{var e=this.Dd();if(!e)return;this.Wd(e)&&this._instance.capture(Ft,{navigation_type:s}),this.Ld=e}catch(t){S.error("Error capturing "+s+" pageview",t)}}Hd(){if(!this.qd){var s=()=>{this.Ud("popstate")};X(g,"popstate",s),this.qd=()=>{g&&g.removeEventListener("popstate",s)}}}zd(){if(!this.jd){var s=()=>{this.Ud("hashchange")};X(g,"hashchange",s),this.jd=()=>{g&&g.removeEventListener("hashchange",s)}}}},heatmaps:class{get vn(){return this.instance.config}constructor(s){var e;this.Vd=!1,this.Ts=!1,this.Gd=null,this.instance=s,this.Vd=!((e=this.instance.persistence)==null||!e.props[ar]),this.rageclicks=new ol(s.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var s=5e3;return G(this.vn.capture_heatmaps)&&this.vn.capture_heatmaps.flush_interval_milliseconds&&(s=this.vn.capture_heatmaps.flush_interval_milliseconds),s}get isEnabled(){return D(this.vn.capture_heatmaps)?D(this.vn.enable_heatmaps)?this.Vd:this.vn.enable_heatmaps:this.vn.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ts)return;Ph.info("starting..."),this.Zd(),this.$t()}else{var s;clearInterval((s=this.Gd)!==null&&s!==void 0?s:void 0),this.Qd(),this.getAndClearBuffer()}}onRemoteConfig(s){if(s.ok){var e=s.config;if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ar]:t}),this.Vd=t,this.startIfEnabled()}}}getAndClearBuffer(){var s=this.At;return this.At=void 0,s}Jd(s){Vi(s.originalEvent)&&this.Qi(s.originalEvent,"deadclick")}$t(){this.Gd&&clearInterval(this.Gd),this.Gd=x?.visibilityState==="visible"?setInterval(this.oo.bind(this),this.flushIntervalMilliseconds):null}Zd(){g&&x&&(this.Kd=this.oo.bind(this),X(g,si,this.Kd),this.Yd=s=>this.Qi(s||g?.event),X(x,"click",this.Yd,{capture:!0}),this.Xd=s=>this.tv(s||g?.event),X(x,"mousemove",this.Xd,{capture:!0}),this.ev=new Rn(this.instance,Lu,this.Jd.bind(this)),this.ev.startIfEnabledOrStop(),this.iv=this.$t.bind(this),X(x,Ht,this.iv),this.Ts=!0)}Qd(){var s;g&&x&&(this.Kd&&g.removeEventListener(si,this.Kd),this.Yd&&x.removeEventListener("click",this.Yd,{capture:!0}),this.Xd&&x.removeEventListener("mousemove",this.Xd,{capture:!0}),this.iv&&x.removeEventListener(Ht,this.iv),clearTimeout(this.rv),(s=this.ev)==null||s.stop(),this.Ts=!1)}nv(s,e){var t=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var h=a;h&&nt(h)&&!Ce(h,"body");){if(h===l)return!1;var u=void 0;try{var c,d,p;u=(c=(d=(p=h.ownerDocument)==null?void 0:p.defaultView)!==null&&d!==void 0?d:g)==null?void 0:c.getComputedStyle(h).position}catch{return!1}if(A(o,u))return!0;h=ko(h)}return!1})(xr(s),["fixed","sticky"],r);return{x:s.clientX+(n?0:i),y:s.clientY+(n?0:t),target_fixed:n,type:e}}Qi(s,e){var t;if(e===void 0&&(e="click"),!En(s.target)&&Vi(s)){var i=this.nv(s,e);(t=this.rageclicks)!=null&&t.isRageClick(s.clientX,s.clientY,new Date().getTime())&&So(xr(s),this.instance.config.rageclick)&&this.fs(b({},i,{type:"rageclick"})),this.fs(i)}}tv(s){!En(s.target)&&Vi(s)&&(clearTimeout(this.rv),this.rv=setTimeout((()=>{this.fs(this.nv(s,"mousemove"))}),500))}fs(s){if(g){var e=this.vn.disable_capture_url_hashes?rt(g.location.href):g.location.href,t=this.vn.custom_personal_data_properties,i=this.vn.mask_personal_data_properties?[...Vt,...t||[]]:[],r=_s(e,i,ms);this.At=this.At||{},this.At[r]||(this.At[r]=[]),this.At[r].push(s)}}oo(){this.At&&!Ne(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Rn,webVitalsAutocapture:class{constructor(s){var e;this.Vd=!1,this.Ts=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.sv=()=>{clearTimeout(this.av),this.av=void 0,this.At.metrics.length!==0&&(this._instance.capture("$web_vitals",b({$current_url:this.At.url},this.At.metrics.reduce(((t,i)=>b({},t,{["$web_vitals_"+i.name+"_event"]:b({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ov=t=>{var i;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},D(t?.name)||D(t?.value))lt.error("Invalid metric received",t);else{var r=typeof t.navigationURL=="string"?t.navigationURL:void 0,n=this.lv(r);if(!w(n)){var a=oe(t.navigationId)||typeof t.navigationId=="string"?"navigation:"+t.navigationId:"url:"+n;if(!this.uv||this.uv>t.value){this.At.navigationKey!==a&&(this.sv(),this.av=setTimeout(this.sv,this.flushToCaptureTimeoutMs)),w(this.At.navigationKey)&&(this.At.navigationKey=a,this.At.url=n),this.At.firstMetricTimestamp=w(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;var o=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),l=b({},t,r?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,G(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var h={};for(var u of Sh){var c=u==="url"&&typeof t.attribution[u]=="string"?this.lv(t.attribution[u]):t.attribution[u];w(c)||(h[u]=c)}l.attribution=h}else delete l.attribution;w(o)||(l.$session_id=o.sessionId,l.$window_id=o.windowId),this.At.metrics.push(l),this.At.metrics.length===this.allowedMetrics.length&&this.sv()}else lt.error("Ignoring metric with value >= "+this.uv,t)}}},this.hv=()=>{if(!this.Ts){var t,i,r,n,a=!1,o=O.__PosthogExtensions__,l=o?.postHogWebVitalsCallbacksByFlavor,h=l?.[this.dv]||(this.dv==="web-vitals"&&w(l)?o?.postHogWebVitalsCallbacks:void 0);if(!w(h)){var u=h.withoutAttribution,c=this.attributionMetrics;a=!w(u),t=c.indexOf("LCP")>-1?h.onLCP:u?.onLCP||h.onLCP,i=c.indexOf("CLS")>-1?h.onCLS:u?.onCLS||h.onCLS,r=c.indexOf("FCP")>-1?h.onFCP:u?.onFCP||h.onFCP,n=c.indexOf("INP")>-1?h.onINP:u?.onINP||h.onINP}if(t&&i&&r&&n){var d={reportSoftNavs:this.useSoftNavs},p=a&&this.attributionMetrics.indexOf("INP")>-1?b({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.ov.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ov.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.ov.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&n(this.ov.bind(this),p),this.Ts=!0}else lt.error("web vitals callbacks not loaded - not starting")}},this._instance=s,this.Vd=!((e=this._instance.persistence)==null||!e.props[hr]),this.startIfEnabled()}get vv(){return this._instance.config.capture_performance}get allowedMetrics(){var s,e,t=G(this.vv)?(s=this.vv)==null?void 0:s.web_vitals_allowed_metrics:void 0;return D(t)?((e=this._instance.persistence)==null?void 0:e.props[dr])||sa:t}get flushToCaptureTimeoutMs(){return(G(this.vv)?this.vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var s=G(this.vv)?this.vv.web_vitals_attribution:void 0;return we(s)?s?sa:[]:M(s)?s:Eh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var s=G(this.vv)?this.vv.__preview_web_vitals_soft_navs:void 0;return s!=null&&s}get uv(){var s=G(this.vv)&&oe(this.vv.__web_vitals_max_value)?this.vv.__web_vitals_max_value:ta;return s>0&&6e4>=s?ta:s}get isEnabled(){var s=se?.protocol;if(s!=="http:"&&s!=="https:")return lt.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=G(this.vv)?this.vv.web_vitals:we(this.vv)?this.vv:void 0;return we(e)?e:this.Vd}startIfEnabled(){this.isEnabled&&!this.Ts&&(lt.info("enabled, starting..."),this.Zs(this.hv))}onRemoteConfig(s){if(s.ok){var e=s.config;if("capturePerformance"in e){var t=G(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=G(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[hr]:t}),this._instance.persistence.register({[dr]:i})),this.Vd=t,this.startIfEnabled()}}}get dv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Zs(s){var e=O.__PosthogExtensions__,t=this.dv,i=e?.postHogWebVitalsCallbacksByFlavor;i!=null&&i[t]||t==="web-vitals"&&w(i)&&e!=null&&e.postHogWebVitalsCallbacks?s():e==null||e.loadExternalDependency==null||e.loadExternalDependency(this._instance,t,(r=>{r?lt.error("failed to load script",r):s()}))}lv(s){var e=s||g?.location.href;if(e){var t=this._instance.config.disable_capture_url_hashes?rt(e):e,i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Vt,...i||[]]:[];return _s(t,r,ms)}lt.error("Could not determine current URL")}}},Bh={exceptionObserver:class{constructor(s){var e;this.hv=()=>{var t;if(g&&this.isEnabled&&(t=O.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var i=O.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=O.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=O.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fv&&this.vn.capture_unhandled_errors&&(this.fv=i(this.captureException.bind(this))),!this.pv&&this.vn.capture_unhandled_rejections&&(this.pv=r(this.captureException.bind(this))),!this.gv&&this.vn.capture_console_errors&&(this.gv=n(this.captureException.bind(this)))}catch(a){ts.error("failed to start",a),this.mv()}}},this._instance=s,this.yv=!((e=this._instance.persistence)==null||!e.props[or]),this.de=new Sl(b({},(function(t){var i,r,n,a;return t===void 0&&(t={}),{refillRate:(i=(r=t.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:t.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(n=(a=t.exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:t.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking),{refillInterval:1e4,I:ts})),this.vn=this.bv(),this.startIfEnabledOrStop()}bv(){var s=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return G(s)?e=b({},e,s):(w(s)?this.yv:s)&&(e=b({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.vn.capture_console_errors||this.vn.capture_unhandled_errors||this.vn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ts.info("enabled"),this.mv(),this.Zs(this.hv)):this.mv()}Zs(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.errorWrappingFunctions?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return ts.error("failed to load script",i);s()}))}mv(){var s,e,t;(s=this.fv)==null||s.call(this),this.fv=void 0,(e=this.pv)==null||e.call(this),this.pv=void 0,(t=this.gv)==null||t.call(this),this.gv=void 0}onRemoteConfig(s){if(s.ok){var e=s.config;"autocaptureExceptions"in e&&(this.yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[or]:this.yv}),this.vn=this.bv(),this.startIfEnabledOrStop())}}onConfigChange(){this.vn=this.bv()}captureException(s){var e,t,i,r=(e=s==null||(t=s.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.de.consumeRateLimit(r)?ts.info("Skipping exception capture because of client rate limiting.",{exception:r}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(s)}},exceptions:class{constructor(s){var e,t;this._v=[],this.wv=new zl([new Ql,new lu,new tu,new eu,new au,new nu,new iu,new ou],(function(i){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var h=[],u=o.split(`
|
|
3
|
+
`),c=l;u.length>c;c++){var d=u[c];if(1024>=d.length){var p=_n.test(d)?d.replace(_n,"$1"):d;if(!p.match(/\S*Error: /)){for(var v of n){var f=v(p,i);if(f){h.push(f);break}}if(h.length>=50)break}}}return(function(m){if(!m.length)return[];var _=Array.from(m);return _.reverse(),_.slice(0,50).map((y=>{return b({},y,{filename:y.filename||(k=_,k[k.length-1]||{}).filename,function:y.function||qt});var k}))})(h)}})("web:javascript",Kl,Xl)),this._instance=s,this._v=(e=(t=this._instance.persistence)==null?void 0:t.get_property(lr))!==null&&e!==void 0?e:[],this.Sv=Zs(this.xv()),this.Cv=new hu(this.Sv)}onConfigChange(){this.Sv=Zs(this.xv()),this.Cv.setConfig(this.Sv)}onRemoteConfig(s){var e,t,i;if(s.ok){var r=s.config;if("errorTracking"in r){var n=(e=(t=r.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],a=(i=r.errorTracking)==null?void 0:i.captureExtensionExceptions;this._v=n,this._instance.persistence&&this._instance.persistence.register({[lr]:this._v,[ur]:a})}}}get Tv(){var s,e=!!this._instance.get_property(ur),t=this._instance.config.error_tracking.captureExtensionExceptions;return(s=t??e)!==null&&s!==void 0&&s}buildProperties(s,e){return this.wv.buildFromUnknown(s,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(s,e){if(this.Sv.enabled)try{if(!H(s)||s.trim().length===0)return void Ae.warn("Ignoring exception step because message must be a non-empty string");var t=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce(((o,l)=>uu.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(this.Mv(e)),i=t.sanitizedProperties,r=t.droppedKeys;r.length>0&&Ae.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Cv.add(b({[Js]:s,[Ks]:new Date().toISOString()},i))}catch(n){Ae.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(s){try{var e=s.$exception_list;if(this.Ev(e)){if(this.Iv(e))return this.Rv("Exception dropped: matched a suppression rule"),void Ae.info("Skipping exception capture because a suppression rule matched");if(!this.Tv&&this.Pv(e))return this.Rv("Exception dropped: thrown by a browser extension"),void Ae.info("Skipping exception capture because it was thrown by an extension");if(!this.Tv&&this.Av(e))return this.Rv("Exception dropped: thrown by an injected browser script"),void Ae.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Fv(e))return this.Rv("Exception dropped: thrown by the PostHog SDK"),void Ae.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.Sv.enabled&&D(s.$exception_steps)?this.Ov(s):s,i=typeof(n=globalThis._posthogReleaseId)=="string"&&n.length>0?n:void 0;i&&(t.$release_id=i);try{var r=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",jl:!0});return r&&this.Cv.clear(),r}catch(a){return Ae.error("Failed to capture exception event. Dropping this exception.",a),void this.Cv.clear()}}catch(a){return void Ae.error("Failed to process exception event. Ignoring this exception.",a)}var n}Ov(s){try{var e=this.Cv.getAttachable();return e.length===0?s:b({},s,{$exception_steps:e})}catch(t){return Ae.error("Failed to read buffered exception steps. Capturing exception without steps.",t),s}}Rv(s){this.Sv.enabled&&this.Cv.add({[Js]:s,[Ks]:new Date().toISOString()})}Mv(s){return G(s)?b({},s):{}}xv(){var s,e;return(s=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&s!==void 0?s:{}}Iv(s){if(s.length===0)return!1;try{var e=s.reduce(((t,i)=>{var r=i.type,n=i.value;return H(r)&&r.length>0&&t.$exception_types.push(r),H(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this._v.some((t=>{var i=t.values.map((r=>{var n=tl[r.operator],a=e[r.key];if(!n||!a)return!1;var o=M(r.value)?r.value:[r.value];return o.length>0&&n(o,a)}));return t.type==="OR"?i.some(Boolean):i.every(Boolean)}))}catch(t){return Ae.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Pv(s){return s.flatMap((e=>{var t,i;return(t=(i=e.stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[]})).some((e=>{var t=e.filename;return!!t&&Ah.some((i=>t.startsWith(i)))}))}Av(s){return s.some((e=>{var t=e.value;return H(t)&&Dh.some((i=>t.includes(i)))}))}Fv(s){if(s.length>0){var e,t,i,r,n=(e=(t=s[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(i=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Ev(s){return!D(s)&&M(s)}}},Uh=b({productTours:class{get yo(){return this._instance.persistence}constructor(s){this.Lv=null,this.Dv=null,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(s.ok){var e=s.config;if("productTours"in e){var t,i;if(this.yo&&this.yo.register({[Br]:!!e.productTours}),!zi(this._instance))return!this.Lv&&D((t=this.yo)==null?void 0:t.props[ns])||Rs.info("product tours disabled; stopping and clearing cached tours"),(i=this.Lv)==null||i.stop(),this.Lv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Lv&&zi(this._instance)&&this.Zs((()=>this.$v()))}Zs(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.generateProductTours?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(i=>{i?Rs.error("Could not load product tours script",i):s()}))}$v(){var s;!this.Lv&&(s=O.__PosthogExtensions__)!=null&&s.generateProductTours&&(this.Lv=O.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(s,e){if(e===void 0&&(e=!1),!M(this.Dv)||e){var t=this.yo;if(t){var i=t.props[ns];if(M(i)&&!e)return this.Dv=i,void s(i,{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:r=>{if(zi(this._instance)){var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return n===0?r.error||Rs.warn(a):Rs.error(a),void s([],{isLoaded:!1,error:a})}var o=M(r.json.product_tours)?r.json.product_tours:[];this.Dv=o,t&&t.register({[ns]:o}),s(o,{isLoaded:!0})}else s([],{isLoaded:!0})}})}else s(this.Dv,{isLoaded:!0})}getActiveProductTours(s){D(this.Lv)?s([],{isLoaded:!1,error:"Product tours not loaded"}):this.Lv.getActiveProductTours(s)}showProductTour(s){var e;(e=this.Lv)==null||e.showTourById(s)}previewTour(s){this.Lv?this.Lv.previewTour(s):this.Zs((()=>{var e;this.$v(),(e=this.Lv)==null||e.previewTour(s)}))}dismissProductTour(){var s;(s=this.Lv)==null||s.dismissTour("user_clicked_skip")}nextStep(){var s;(s=this.Lv)==null||s.nextStep()}previousStep(){var s;(s=this.Lv)==null||s.previousStep()}clearCache(){var s;this.Dv=null,(s=this.yo)==null||s.unregister(ns)}resetTour(s){var e;(e=this.Lv)==null||e.resetTour(s)}resetAllTours(){var s;(s=this.Lv)==null||s.resetAllTours()}cancelPendingTour(s){var e;(e=this.Lv)==null||e.cancelPendingTour(s)}}},fi),Vh={siteApps:class{constructor(s){this.Nv=0,this._instance=s,this.qv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}jv(s,e){if(e){var t=this.globalsForEvent(e);this.qv.push(t),this.qv.length>1e3&&(this.qv=this.qv.slice(10))}}get siteAppLoaders(){var s;return(s=O._POSTHOG_REMOTE_CONFIG)==null||(s=s[this._instance.config.token])==null?void 0:s.siteApps}initialize(){if(this.isEnabled){var s=this._instance._addCaptureHook(this.jv.bind(this));this.Bv=()=>{s(),this.qv=[],this.Bv=void 0}}}globalsForEvent(s){var e,t,i,r,n,a,o;if(!s)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(u)){var d=c[0];l[d]={id:h[d],type:d,properties:c[1]}}var p=s.$set_once,v=s.$set;return{event:b({},ya(s,Ih),{properties:b({},s.properties,v?{$set:b({},(e=(t=s.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},v)}:{},p?{$set_once:b({},(i=(r=s.properties)==null?void 0:r.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(n=(a=s.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=s.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Hv(s){var e,t=(e=s.tagName)==null?void 0:e.toLowerCase();return t==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(s)||(qe.error("prepare_external_dependency_stylesheet returned null"),null):t==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(s)||(qe.error("prepare_external_dependency_script returned null"),null):s}zv(){var s,e,t,i,r,n,a,o;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=x?.defaultView,h=l==null||(s=l.Node)==null?void 0:s.prototype;if(!l||!h)return()=>{};if(this.Nv++,this.Uv)return this.Wv();var u=[],c=this,d=new WeakSet,p=(m,_,y)=>{if(m!=null&&m[_]){var k=m[_];m[_]=y(k),u.push((()=>{m[_]=k}))}},v=m=>{if(d.has(m))return m;var _=c.Hv(m);return _&&d.add(_),_},f=m=>m.map((_=>typeof _=="string"?_:v(_))).filter((_=>!fe(_)));return p(h,"appendChild",(m=>function(_){var y=v(_);return y?m.call(this,y):_})),p(h,"insertBefore",(m=>function(_,y){var k=v(_);return k?m.call(this,k,y):_})),p(h,"replaceChild",(m=>function(_,y){var k=v(_);return k?m.call(this,k,y):y})),[(e=l.Element)==null?void 0:e.prototype,(t=l.Document)==null?void 0:t.prototype,(i=l.DocumentFragment)==null?void 0:i.prototype].forEach((m=>{p(m,"append",(_=>function(){for(var y=arguments.length,k=new Array(y),P=0;y>P;P++)k[P]=arguments[P];return _.apply(this,f(k))})),p(m,"prepend",(_=>function(){for(var y=arguments.length,k=new Array(y),P=0;y>P;P++)k[P]=arguments[P];return _.apply(this,f(k))}))})),[(r=l.Element)==null?void 0:r.prototype,(n=l.CharacterData)==null?void 0:n.prototype,(a=l.DocumentType)==null?void 0:a.prototype].forEach((m=>{p(m,"before",(_=>function(){for(var y=arguments.length,k=new Array(y),P=0;y>P;P++)k[P]=arguments[P];return _.apply(this,f(k))})),p(m,"after",(_=>function(){for(var y=arguments.length,k=new Array(y),P=0;y>P;P++)k[P]=arguments[P];return _.apply(this,f(k))})),p(m,"replaceWith",(_=>function(){for(var y=arguments.length,k=new Array(y),P=0;y>P;P++)k[P]=arguments[P];var E=f(k);return k.length&&!E.length?void 0:_.apply(this,E)}))})),p((o=l.Element)==null?void 0:o.prototype,"insertAdjacentElement",(m=>function(_,y){var k=v(y);return k?m.call(this,_,k):null})),this.Uv=()=>{u.forEach((m=>m())),this.Uv=void 0},this.Wv()}Wv(){var s=!1;return()=>{var e;s||(s=!0,this.Nv--,this.Nv===0&&((e=this.Uv)==null||e.call(this)))}}Vv(s,e){e===void 0&&(e=!0);var t=this.zv();try{var i=s(t);return e&&t(),i}catch(r){throw t(),r}}setupSiteApp(s){var e=this.apps[s.id],t=()=>{var a;!e.errored&&this.qv.length&&(qe.info("Processing "+this.qv.length+" events for site app with id "+s.id),this.qv.forEach((o=>this.Vv((()=>e.processEvent==null?void 0:e.processEvent(o))))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Bv)==null||a.call(this))},i=!1,r=a=>{e.errored=!a,e.loaded=!0,qe.info("Site app with id "+s.id+" "+(a?"loaded":"errored")),i&&t()};try{var n=this.Vv((a=>s.init({posthog:this._instance,callback(o){a(),r(o)}})),!1).processEvent;n&&(e.processEvent=n),i=!0}catch(a){qe.error(na+s.id,a),r(!1)}if(i&&e.loaded)try{t()}catch(a){qe.error("Error while processing buffered events PostHog app with config id "+s.id,a),e.errored=!0}}Gv(){var s=this.siteAppLoaders||[];for(var e of s)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of s)this.setupSiteApp(t)}Zv(s){var e=this;if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(s),i=function(n){try{e.Vv((()=>n.processEvent==null?void 0:n.processEvent(t)))}catch(a){qe.error("Error while processing event "+s.event+" for site app "+n.id,a)}};for(var r of Object.values(this.apps))i(r)}}onRemoteConfig(s){var e,t,i,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Gv(),void this._instance.on("eventCaptured",(l=>this.Zv(l)))):void qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.Bv)==null||t.call(this),s.ok){var n=s.config;if((i=n.siteApps)!=null&&i.length)if(this.isEnabled){var a=function(){var l,h=o.id,u=o.url;O["__$$ph_site_app_"+h]=r._instance,(l=O.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(r._instance,u,(c=>{if(c)return qe.error(na+h,c)}))};for(var o of n.siteApps)a()}else qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},zh={tracingHeaders:class{constructor(s){this.Qv=void 0,this.Jv=void 0,this.Kv=void 0,this.hv=()=>{var e,t,i=this.Yv();i?(w(this.Qv)&&(this.Qv=(e=O.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),w(this.Jv)&&(this.Jv=(t=O.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mv()},this._instance=s}initialize(){this.startIfEnabledOrStop()}Zs(s){var e,t;(e=O.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?s():(t=O.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return kh.error("failed to load script",i);s()}))}Xv(){var s,e;return(s=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&s!==void 0?s:this._instance.config.__add_tracing_headers}Yv(){var s=this.Xv();return M(s)?(M(this.Kv)?this.Kv.splice(0,this.Kv.length,...s):this.Kv=[...s],s.length>0?this.Kv:void 0):(M(this.Kv)&&this.Kv.splice(0),this.Kv=s||void 0,this.Kv)}mv(){var s,e;(s=this.Qv)==null||s.call(this),(e=this.Jv)==null||e.call(this),this.Qv=void 0,this.Jv=void 0}startIfEnabledOrStop(){this.Yv()?this.Zs(this.hv):this.mv()}}},Wh=b({surveys:class extends Fh{constructor(s){var e;super(new Lh(s),{get projectToken(){return e.config.token},kv:new Th(e=s)}),this._instance=s}du(s,e){var t=e.query?ys(s,e.query):s;return new Promise((i=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((r=e.target)!==null&&r!==void 0?r:"api",t),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:i})}))}}},fi),Gh={toolbar:class{constructor(s){this.instance=s}tc(s){O.ph_toolbar_state=s}ec(){var s;return(s=O.ph_toolbar_state)!==null&&s!==void 0?s:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(s,e,t){if(s===void 0&&(s=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),wr(this.instance.config)||!g||!x)return!1;s=s??g.location,t=t??g.history;try{if(!e){try{g.localStorage.setItem("test","test"),g.localStorage.removeItem("test")}catch{return!1}e=g?.localStorage}var i,r=Rh||ai(s.hash,"__posthog")||ai(s.hash,"state"),n=r?bn((()=>JSON.parse(atob(decodeURIComponent(r)))))||bn((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((i=n).source="url",i&&Object.keys(i).length>0&&(n.desiredHash?s.hash=n.desiredHash:t?t.replaceState(t.state,"",s.pathname+s.search):s.hash="")):((i=JSON.parse(e.getItem(oa)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}ic(s){var e=O.ph_load_toolbar||O.ph_load_editor;!D(e)&&me(e)?e(s,this.instance):la.warn("No toolbar load function found")}loadToolbar(s){var e=!(x==null||!x.getElementById(mo));if(!g||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=b({token:this.instance.config.token},s,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(g.localStorage.setItem(oa,JSON.stringify(b({},i,{source:void 0}))),this.ec()===2)this.ic(i);else if(this.ec()===0){var r;this.tc(1),(r=O.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return la.error("[Toolbar] Failed to load",n),void this.tc(0);this.tc(2),this.ic(i)})),X(g,"turbolinks:load",(()=>{this.tc(0),this.loadToolbar(i)}))}return!0}rc(s){return this.loadToolbar(s)}maybeLoadEditor(s,e,t){return s===void 0&&(s=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(s,e,t)}}},Jh=b({experiments:_e},fi),Kh={conversations:class{constructor(s){this.nc=void 0,this._conversationsManager=null,this.sc=!1,this.Fe=null,this.ac=!1,this._instance=s}initialize(){this.loadIfEnabled()}onRemoteConfig(s){if(!this._instance.config.disable_conversations&&(this.oc=s.ok,s.ok)){var e=s.config.conversations;D(e)||(we(e)?this.nc=e:(this.nc=e.enabled,this.Fe=e),this.loadIfEnabled())}}reset(){var s;(s=this._conversationsManager)==null||s.reset(),this._conversationsManager=null,this.nc=void 0,this.Fe=null,this.oc=void 0,this.ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.sc||this._instance.config.disable_conversations||wr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var s=O?.__PosthogExtensions__;if(s&&!w(this.nc)&&this.nc)if(this.Fe&&this.Fe.token){this.sc=!0;try{var e=s.initConversations;if(e)return this.lc(e),void(this.sc=!1);var t=s.loadExternalDependency;if(!t)return void this.uc(Vr);t(this._instance,"conversations",(i=>{i||!s.initConversations?this.uc("Could not load conversations script",i):this.lc(s.initConversations),this.sc=!1}))}catch(i){this.uc("Error initializing conversations",i),this.sc=!1}}else Le.error("Conversations enabled but missing token in remote config.")}}lc(s){if(this.Fe)try{this._conversationsManager=s(this.Fe,this._instance),this.ac=!1,Le.info("Conversations loaded successfully")}catch(e){this.uc("Error completing conversations initialization",e)}else Le.error("Cannot complete initialization: remote config is null")}uc(s,e){Le.error(s,e),this._conversationsManager=null,this.sc=!1,this.ac=!0}show(){this._conversationsManager?this._conversationsManager.show():Le.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.nc===!0&&!fe(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":wr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.oc===!1?"remote_config_failed":w(this.nc)?this.oc?"disabled_in_project":"remote_config_pending":this.nc?D(this.Fe)||!this.Fe.token?"missing_token":O!=null&&O.__PosthogExtensions__?this.sc?"initializing":this.ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&s!==void 0&&s}sendMessage(s,e,t){var i=this;return Y((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(s,e,t):(Le.warn(ht),null)}))()}getMessages(s,e){var t=this;return Y((function*(){return t._conversationsManager?t._conversationsManager.getMessages(s,e):(Le.warn(ht),null)}))()}markAsRead(s){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(s):(Le.warn(ht),null)}))()}getTickets(s){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.getTickets(s):(Le.warn(ht),null)}))()}requestRestoreLink(s){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(s):(Le.warn(ht),null)}))()}restoreFromToken(s){var e=this;return Y((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(s):(Le.warn(ht),null)}))()}restoreFromUrlToken(){var s=this;return Y((function*(){return s._conversationsManager?s._conversationsManager.restoreFromUrlToken():(Le.warn(ht),null)}))()}getCurrentTicketId(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&s!==void 0?s:null}getWidgetSessionId(){var s,e;return(s=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&s!==void 0?s:null}Ql(){var s;(s=this._conversationsManager)==null||s.setIdentity()}Jl(){var s;(s=this._conversationsManager)==null||s.clearIdentity()}}},Zh={logs:class{constructor(s){var e,t=this;this.name="logs",this.hc=!1,this.dc=!1,this.vc=!1,this.I=ee("[logs]"),this.cc=b({},this.I,{error(){for(var i=arguments.length,r=new Array(i),n=0;i>n;n++)r[n]=arguments[n];r.some(_a)||t.I.error(...r)}}),this.Za=[],this.fc=[],this.Hh=0,this.Rs=!1,this.gc=[],this.mc=[],this.yc=!1,this.bc=!1,this._c=()=>{var i,r;this.Rs||(this.Hh=0,(i=this.wc)==null||i.onReconnect(),(r=this.kc)==null||r.onReconnect())},this._instance=s,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.hc=!0),g&&X(g,"online",this._c)}Sc(s,e,t,i){var r,n=fa((r=this._instance)==null||(r=r.config)==null?void 0:r.logs,t);return[new Bl(this.xc(s,e),n,this.cc,(()=>this.Cc()),(a=>a()),void 0,i),n]}Tc(){var s,e=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.wc||this.Mc!==e){var t;(t=this.wc)==null||t.reset(),this.Mc=e;var i=this.Sc((()=>this.Za),(r=>{this.Za=r}));this.wc=i[0],this.Ec=i[1]}return this.wc}Ic(){var s,e=(s=this._instance)==null||(s=s.config)==null?void 0:s.logs;if(!this.kc||this.Rc!==e){var t;(t=this.kc)==null||t.reset(),this.Rc=e;var i=this.Sc((()=>this.fc),(r=>{this.fc=r}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ga);this.kc=i[0],this.Pc=i[1]}return this.kc}setup(s){var e;if(!this.Rs){this.Os=s,(e=this._instance)!=null&&(e=e.config)!=null&&(e=e.logs)!=null&&e.captureConsoleLogs&&(this.hc=!0),(this.hc||this.Ac()&&this.Fc())&&this.Oc();var t=!1,i=s.onRemoteConfig((r=>{var n;t=r.ok&&((n=r.config.logs)==null?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)}));this.Rs?i.dispose():(this.Ls=i,t||this.loadIfEnabled())}}dispose(){var s,e,t,i;this.Rs||(this.Rs=!0,this.Lc(),(s=this.Ls)==null||s.dispose(),this.Ls=void 0,this.Os=void 0,this.vc=!1,g?.removeEventListener("online",this._c),(e=this.Dc)==null||e.call(this),this.Dc=void 0,(t=this.wc)==null||t.reset(),(i=this.kc)==null||i.reset())}onRemoteConfig(s){var e,t;if(!this.Rs){var i=s.ok?(e=s.config.logs)==null?void 0:e.captureConsoleLogs:void 0;D(i)?this.$c():((t=this._instance)==null||(t=t.persistence)==null||t.register({[cr]:!!i}),i?(this.hc=!0,this.dc||this.Oc(),this.loadIfEnabled()):this.$c())}}reset(){var s,e,t,i;this.Lc(),(s=this.wc)==null||s.clearQueue(),this.Za=[],(e=this.wc)==null||e.reset(),(t=this.kc)==null||t.clearQueue(),this.fc=[],(i=this.kc)==null||i.reset(),this.Hh=0}captureLog(s){this.Rs||this.Tc().captureLog(s)}captureConsoleLog(s){this.Rs||this.Ic().captureLog(s)}captureBufferedConsoleLog(s,e,t){this.Rs||this.Ic().captureLog(s,{context:e,occurredAtMs:t})}Fc(){var s;return!((s=this._instance)==null||(s=s.persistence)==null||(s=s.props)==null||!s[cr])}Ac(){var s,e;return(s=this._instance)==null||s.Ua==null||!s.Ua()||!((e=O._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null||!e.config)}Yl(){var s;this.Lc(),(s=this.kc)==null||s.clearQueue(),this.fc=[]}$c(){this.hc||this.Lc()}Oc(){var s,e=this;if(!this.yc&&O!=null&&O.console){var t=fa((s=this._instance)==null||(s=s.config)==null?void 0:s.logs).maxBufferSize,i=function(n){var a;try{a=(o=>{for(;(l=o)!=null&&l.__rrweb_original__;){var l;o=o.__rrweb_original__}return o})(O.console[n])}catch{return 0}if(!a)return 0;e.mc.push(ll(O.console,n,(o=>{var l=function(){for(var h=arguments.length,u=new Array(h),c=0;h>c;c++)u[c]=arguments[c];try{e.Nc(n,u,t)}catch{}return o.apply(O.console,u)};return l.__rrweb_original__=a,l})))};for(var r of jh)i(r);this.yc=!0,this.qc=setTimeout((()=>{this.Lc()}),3e4)}}Nc(s,e,t){var i;if(this.yc&&!this.bc&&e.length!==0)if((i=this._instance)!=null&&i.is_capturing()){if(t>this.gc.length){this.bc=!0;try{this.gc.push({level:s,args:e,occurredAtMs:Date.now(),context:this.Cc()})}finally{this.bc=!1}}}else this.Lc()}Lc(){if(this.gc=[],this.yc){for(var s of(this.yc=!1,this.qc&&(clearTimeout(this.qc),this.qc=void 0),this.mc))s();this.mc=[]}}jc(){var s=this.gc;return this.Lc(),s}get logger(){return this.Bc||(this.Bc={trace:(s,e)=>this.captureLog({body:s,level:"trace",attributes:e}),debug:(s,e)=>this.captureLog({body:s,level:"debug",attributes:e}),info:(s,e)=>this.captureLog({body:s,level:"info",attributes:e}),warn:(s,e)=>this.captureLog({body:s,level:"warn",attributes:e}),error:(s,e)=>this.captureLog({body:s,level:"error",attributes:e}),fatal:(s,e)=>this.captureLog({body:s,level:"fatal",attributes:e})}),this.Bc}flushLogs(s){s?this.Hc(s):(this.wc&&this.wc.flush().catch((e=>this.zc(e))),this.kc&&this.kc.flush().catch((e=>this.zc(e))))}zc(s){_a(s)||this.I.error("PostHog logs flush failed:",s)}loadIfEnabled(){if(!this.Rs&&this.hc&&!this.dc&&!this.vc){var s=O?.__PosthogExtensions__;if(!s)return this.I.error("PostHog Extensions not found."),void this.Lc();var e=s.loadExternalDependency;if(!e)return this.I.error(Vr),void this.Lc();this.vc=!0;try{e(this._instance,"logs",(t=>{if(this.vc=!1,!this.Rs&&this.hc){var i=s.logs;if(t||i==null||!i.initializeLogs)this.I.error("Could not load logs script",t),this.Lc();else{var r,n,a=this.jc();this.Dc=i.initializeLogs((r=this.Os)!==null&&r!==void 0?r:this._instance),this.dc=!0,a.length>0&&(i.replayConsoleBuffer==null||i.replayConsoleBuffer((n=this.Os)!==null&&n!==void 0?n:this._instance,a))}}}))}catch(t){throw this.vc=!1,t}}}xc(s,e){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:i=>i===Ue.LogsQueue?s():void 0,setPersistedProperty(i,r){var n;i===Ue.LogsQueue&&e((n=r)!==null&&n!==void 0?n:[])},es:i=>this.es(i),getLibraryId:()=>Z.LIB_NAME,getLibraryVersion:()=>Z.LIB_VERSION}}es(s){return new Promise((e=>{if(Oo(this.Hh,3))e({kind:"fatal",error:Gi(void 0,"logs endpoint is unreachable, dropping batch")});else{var t=!1,i=n=>{t||(t=!0,clearTimeout(r),e(n))},r=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Gi(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Uc(),data:s,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{var a=n.statusCode;if(this.Wc(a),a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error("logs request failed with status "+a)});else{var o;a===0?(n.error||this.I.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Gi(n.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(o=n.error)!==null&&o!==void 0?o:new Error("logs request failed with status "+a)})}}})}}))}Wc(s){(s!==0||this._instance.__loaded)&&(this.Hh=To(s,this.Hh,3,(()=>this.I.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."))))}Hc(s){this.Za.length>0&&this.Vc(s,this.Za,this.Ec,Z.LIB_NAME,(e=>{this.Za=e})),this.fc.length>0&&this.Vc(s,this.fc,this.Pc,ga,(e=>{this.fc=e}))}Vc(s,e,t,i,r){if(e.length!==0){var n=e.map((o=>o.record));r([]);var a=Qa(n,Xa(t,Z.LIB_NAME,Z.LIB_VERSION),i,Z.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Uc(),data:a,compression:"best-available",batchKey:"logs",transport:s})}}Uc(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Cc(){var s,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var t=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.windowId,r=t.sessionStartTimestamp,n=t.lastActivityTimestamp;e.sessionId=t.sessionId,e.windowId=i,D(r)||(e.sessionStartTimestamp=r),D(n)||(e.lastActivityTimestamp=n)}if(O!=null&&(s=O.location)!=null&&s.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?rt(O.location.href):O.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(e.activeFeatureFlags=a)}return e}}},Yh={metrics:class{constructor(s){this.I=ee("[metrics]"),this._instance=s}initialize(){}Tc(){var s,e,t=(s=this._instance)==null||(s=s.config)==null?void 0:s.metrics;return this.wc&&this.Mc===t||((e=this.wc)==null||e.reset(),this.Mc=t,this.wc=new Ul(this.xc(),(function(i){var r,n,a,o,l,h=i?.resourceAttributes;return{serviceName:(r=h?.["service.name"])!==null&&r!==void 0?r:i?.serviceName,serviceVersion:(n=h?.["service.version"])!==null&&n!==void 0?n:i?.serviceVersion,environment:(a=h?.["deployment.environment"])!==null&&a!==void 0?a:i?.environment,resourceAttributes:h,beforeSend:i?.beforeSend,flushIntervalMs:(o=i?.flushIntervalMs)!==null&&o!==void 0?o:1e4,maxSeriesPerFlush:(l=i?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.I)),this.wc}count(s,e,t){e===void 0&&(e=1),this.Tc().count(s,e,t)}gauge(s,e,t){this.Tc().gauge(s,e,t)}histogram(s,e,t){this.Tc().histogram(s,e,t)}flush(s){if(!this.wc)return Promise.resolve();if(s){var e=this.wc.drainWindow();return e&&this._s(e,s),Promise.resolve()}return this.wc.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var s;(s=this.wc)==null||s.reset()}xc(){var s=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},_s:t=>e._s(t),getLibraryId:()=>Z.LIB_NAME,getLibraryVersion:()=>Z.LIB_VERSION}}_s(s,e){return new Promise((t=>{var i=!1,r=a=>{i||(i=!0,clearTimeout(n),t(a))},n=setTimeout((()=>r({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(b({method:"POST",url:this.Gc(),data:s,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(a){var o=a.statusCode;if(o>=200&&300>o)r({kind:"ok"});else if(o===413)r({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)r({kind:"fatal",error:new Error("metrics request failed with status "+o)});else{var l;r({kind:"retry-later",error:(l=a.error)!==null&&l!==void 0?l:new Error("metrics request failed with status "+o)})}}}))}))}Gc(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Xh=b({},fi,qh,Hh,Bh,Uh,Vh,Wh,zh,Gh,Jh,Kh,Zh,Yh);Fe.__defaultExtensionClasses=b({},Xh);var Qh=(function(){Z.SDK_DIST_CHANNEL="npm";var s=cs[Ct]=new Fe;return(function(){function e(){e.done||(e.done=!0,al=!1,z(cs,(function(t){t._dom_loaded()})))}x!=null&&x.addEventListener?x.readyState==="complete"?e():X(x,"DOMContentLoaded",e,{capture:!1}):g&&S.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),s})();export{Ie as Compression,Sr as DisplaySurveyType,Fe as PostHog,Uu as ProductTourEventName,Nn as ProductTourEventProperties,Qe as SurveyEventName,Mi as SurveyEventProperties,Yt as SurveyEventType,Ri as SurveyType,Qh as default,Qh as posthog};
|